457 lines
19 KiB
Plaintext
457 lines
19 KiB
Plaintext
#東方弾幕風[Package]
|
|
#Title["EXルーミアパッケージ"]
|
|
#Text["EXルーミアトパッケージ"]
|
|
|
|
|
|
@Initialize
|
|
{
|
|
TTitleScene();
|
|
}
|
|
|
|
|
|
@MainLoop
|
|
{
|
|
yield;
|
|
}
|
|
|
|
@Finalize
|
|
{
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// タイトルシーン
|
|
//----------------------------------------------------
|
|
task TTitleScene
|
|
{
|
|
//タイトルシーン終了フラグ
|
|
let bEndTitleScene = false;
|
|
|
|
//タイトルパス設定
|
|
let dir = GetCurrentScriptDirectory();
|
|
let pathTitle = dir ~ "Title.png";
|
|
|
|
let objTitleImage = ObjPrim_Create(OBJ_SPRITE_2D); //2Dスプライトオブジェクト生成
|
|
Obj_SetRenderPriorityI(objTitleImage, 20); //描画優先度を設定
|
|
ObjPrim_SetTexture(objTitleImage, pathTitle); //テクスチャを設定
|
|
ObjSprite2D_SetSourceRect(objTitleImage, 0, 0, 640, 480);
|
|
ObjSprite2D_SetDestRect(objTitleImage, 0, 0, 640, 480);
|
|
|
|
//タイトル文字列
|
|
let objTitleText = ObjText_Create();
|
|
ObjText_SetText(objTitleText, "パッケージサンプル");
|
|
ObjText_SetFontSize(objTitleText, 40);
|
|
ObjText_SetFontBold(objTitleText, true);
|
|
ObjText_SetFontColorTop(objTitleText, 128, 128, 255);
|
|
ObjText_SetFontColorBottom(objTitleText, 64, 64, 255);
|
|
ObjText_SetFontBorderType(objTitleText, BORDER_FULL);
|
|
ObjText_SetFontBorderColor(objTitleText,255, 255, 255);
|
|
ObjText_SetFontBorderWidth(objTitleText, 2);
|
|
Obj_SetRenderPriorityI(objTitleText, 30);
|
|
ObjRender_SetX(objTitleText, 48);
|
|
ObjRender_SetY(objTitleText, 48);
|
|
|
|
|
|
//メニュー
|
|
let INDEX_START = 0;
|
|
let INDEX_REPLAY = 1;
|
|
let INDEX_QUIT = 2;
|
|
let selectIndex = 0;//選択位置
|
|
task TMenuItem(let index, let mx, let my, let text)
|
|
{
|
|
function CreateTextObject(let mx, let my, let text)
|
|
{
|
|
let obj = ObjText_Create();
|
|
ObjText_SetText(obj, text);
|
|
ObjText_SetFontSize(obj, 20);
|
|
ObjText_SetFontBold(obj, true);
|
|
ObjText_SetFontColorTop(obj, 128, 128, 255);
|
|
ObjText_SetFontColorBottom(obj, 64, 64, 255);
|
|
ObjText_SetFontBorderType(obj, BORDER_FULL);
|
|
ObjText_SetFontBorderColor(obj,255, 255, 255);
|
|
ObjText_SetFontBorderWidth(obj, 2);
|
|
Obj_SetRenderPriorityI(obj, 30);
|
|
ObjRender_SetX(obj, mx);
|
|
ObjRender_SetY(obj, my);
|
|
return obj;
|
|
}
|
|
|
|
let objText = CreateTextObject(mx, my, text);
|
|
let objSelect = CreateTextObject(mx, my, text);
|
|
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
|
|
while(!bEndTitleScene)
|
|
{
|
|
Obj_SetVisible(objSelect, index == selectIndex);
|
|
yield;
|
|
}
|
|
Obj_Delete(objText);
|
|
Obj_Delete(objSelect);
|
|
}
|
|
|
|
//メニュー配置
|
|
let mx = 48;
|
|
let my = 360;
|
|
let texts = ["Start", "Replay", "Quit"];
|
|
var countMenu = length(texts);
|
|
ascent(var iText in 0 .. countMenu)
|
|
{
|
|
TMenuItem(iText, mx, my, texts[iText]);
|
|
my += 32;
|
|
}
|
|
|
|
//キー状態がリセットされるまで待機
|
|
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
|
|
|
|
//メニュー選択処理
|
|
let frameKeyHold = 0;//キー押しっぱなしフレーム数
|
|
loop
|
|
{
|
|
//決定
|
|
if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
|
|
{
|
|
if(selectIndex == INDEX_START)
|
|
{
|
|
TStageScene("");
|
|
}
|
|
else if(selectIndex == INDEX_REPLAY)
|
|
{
|
|
TReplaySelectScene();
|
|
}
|
|
else if(selectIndex == INDEX_QUIT)
|
|
{
|
|
ClosePackage();
|
|
}
|
|
break;
|
|
}
|
|
|
|
//カーソル移動
|
|
if(GetVirtualKeyState(VK_UP) == KEY_PUSH)
|
|
{
|
|
selectIndex--;
|
|
}
|
|
else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH)
|
|
{
|
|
selectIndex++;
|
|
}
|
|
else if(GetVirtualKeyState(VK_UP) == KEY_HOLD)
|
|
{
|
|
frameKeyHold++;
|
|
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
|
|
{
|
|
selectIndex--;
|
|
}
|
|
}
|
|
else if(GetVirtualKeyState(VK_DOWN) == KEY_HOLD)
|
|
{
|
|
frameKeyHold++;
|
|
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
|
|
{
|
|
selectIndex++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
frameKeyHold = 0;
|
|
}
|
|
|
|
if(selectIndex < 0)
|
|
{
|
|
selectIndex = countMenu - 1;
|
|
}
|
|
else
|
|
{
|
|
selectIndex %= countMenu;
|
|
}
|
|
|
|
yield;
|
|
}
|
|
|
|
bEndTitleScene = true;
|
|
Obj_Delete(objTitleImage);
|
|
Obj_Delete(objTitleText);
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// ステージシーン
|
|
//----------------------------------------------------
|
|
task TStageScene(let pathReplay)
|
|
{
|
|
let dirCurrent = GetCurrentScriptDirectory();
|
|
let dirModule = GetModuleDirectory();
|
|
let pathMainScript = dirCurrent ~ "ExRumia_Stage.txt";
|
|
let pathPlayer = dirModule ~ "script/player/default_player/Default_Player_Rumia.txt";
|
|
|
|
//--------------------------------
|
|
//画面遷移
|
|
RenderSceneToTransitionTexture();
|
|
TTransition();
|
|
|
|
//--------------------------------
|
|
//ステージ初期化
|
|
InitializeStageScene();
|
|
if(length(pathReplay) > 0)
|
|
{
|
|
SetStageReplayFile(pathReplay);
|
|
}
|
|
|
|
//--------------------------------
|
|
//初期ステージ設定
|
|
let indexStage = 1; //ステージインデックス
|
|
SetStageIndex(indexStage);
|
|
SetStageMainScript(pathMainScript);
|
|
SetStagePlayerScript(pathPlayer);
|
|
StartStageScene();
|
|
|
|
//--------------------------------
|
|
//ステージ操作
|
|
loop
|
|
{
|
|
//--------------------------------
|
|
//一時停止チェック
|
|
if(GetVirtualKeyState(VK_PAUSE) == KEY_PUSH)
|
|
{
|
|
let resPause = RunPauseScene();
|
|
alternative(resPause)
|
|
case(RESULT_RETRY)
|
|
{
|
|
//最初からやり直す
|
|
if(!IsReplay())
|
|
{
|
|
//リトライ
|
|
TerminateStageScene();
|
|
TStageScene("");
|
|
return;
|
|
}
|
|
}
|
|
case(RESULT_END)
|
|
{
|
|
//一時停止中の終了
|
|
TerminateStageScene();
|
|
}
|
|
}
|
|
|
|
if(!IsReplay() && GetKeyState(KEY_BACK) == KEY_PUSH)
|
|
{
|
|
//リトライ
|
|
TerminateStageScene();
|
|
TStageScene("");
|
|
return;
|
|
}
|
|
|
|
//--------------------------------
|
|
//ステージ完了待ち
|
|
let stgSceneState = GetStageSceneState();
|
|
if(stgSceneState == STAGE_STATE_FINISHED)
|
|
{
|
|
//ステージ終了結果を取得
|
|
let stageResult = GetStageSceneResult();
|
|
alternative(stageResult)
|
|
case(STAGE_RESULT_CLEARED)
|
|
{
|
|
//ステージクリア
|
|
if(indexStage == 2)
|
|
{
|
|
//ステージ2をクリアした場合は終了
|
|
TEndScene();
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
//次のステージへ遷移
|
|
indexStage++;
|
|
SetStageIndex(indexStage);
|
|
SetStageMainScript(pathMainScript); //ひとまず同じステージ...
|
|
SetStagePlayerScript(pathPlayer);
|
|
StartStageScene();
|
|
TTransition();
|
|
}
|
|
}
|
|
case(STAGE_RESULT_PLAYER_DOWN)
|
|
{
|
|
//自機残機0
|
|
TEndScene();
|
|
break;
|
|
}
|
|
case(STAGE_RESULT_BREAK_OFF)
|
|
{
|
|
//ステージ途中終了
|
|
//一時停止中の終了
|
|
TTitleScene();
|
|
break;
|
|
}
|
|
}
|
|
yield;
|
|
}
|
|
|
|
TTransition();
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// 終了シーン
|
|
//----------------------------------------------------
|
|
task TEndScene()
|
|
{
|
|
if(IsReplay())
|
|
{
|
|
TTitleScene();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------
|
|
//ステージ終了処理
|
|
FinalizeStageScene();
|
|
|
|
//--------------------------------
|
|
//終了シーンスクリプト起動
|
|
let dirModule = GetModuleDirectory();
|
|
let pathScript = dirModule ~ "script/default_system/Default_EndScene.txt";
|
|
let idScript = LoadScript(pathScript);
|
|
StartScript(idScript);
|
|
|
|
while(!IsCloseScript(idScript))
|
|
{
|
|
yield;
|
|
}
|
|
|
|
//--------------------------------
|
|
//終了シーン結果処理
|
|
let result = GetScriptResult(idScript);
|
|
alternative(result)
|
|
case(RESULT_SAVE_REPLAY)
|
|
{
|
|
//リプレイ保存
|
|
TReplaySaveScene();
|
|
}
|
|
case(RESULT_END)
|
|
{
|
|
//再生終了
|
|
TTitleScene();
|
|
}
|
|
case(RESULT_RETRY)
|
|
{
|
|
//リトライ
|
|
TStageScene("");
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------------
|
|
// 一時停止シーン
|
|
//----------------------------------------------------
|
|
function RunPauseScene()
|
|
{
|
|
RenderSceneToTransitionTexture();
|
|
PauseStageScene(true);
|
|
|
|
let dirModule = GetModuleDirectory();
|
|
let pathScript = dirModule ~ "script/default_system/Default_Pause.txt";
|
|
|
|
//--------------------------------
|
|
//一時停止シーンンスクリプト起動
|
|
let idScript = LoadScript(pathScript);
|
|
StartScript(idScript);
|
|
|
|
while(!IsCloseScript(idScript))
|
|
{
|
|
yield;
|
|
}
|
|
|
|
PauseStageScene(false);
|
|
|
|
let res = GetScriptResult(idScript);
|
|
return res;
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// リプレイ選択シーン
|
|
//----------------------------------------------------
|
|
task TReplaySelectScene()
|
|
{
|
|
let dirCurrent = GetCurrentScriptDirectory();
|
|
let pathScript = dirCurrent ~ "ExRumia_Package_ReplaySelectScene.txt";
|
|
|
|
//--------------------------------
|
|
//リプレイ選択シーンスクリプト起動
|
|
let idScript = LoadScript(pathScript);
|
|
StartScript(idScript);
|
|
|
|
while(!IsCloseScript(idScript))
|
|
{
|
|
yield;
|
|
}
|
|
|
|
//--------------------------------
|
|
//リプレイ選択シーン結果処理
|
|
let result = GetScriptResult(idScript);
|
|
if(length(result) == 0)
|
|
{
|
|
//タイトルシーンへ戻る
|
|
TTitleScene();
|
|
}
|
|
else
|
|
{
|
|
//リプレイ再生開始
|
|
TStageScene(result);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// リプレイ保存シーン
|
|
//----------------------------------------------------
|
|
task TReplaySaveScene()
|
|
{
|
|
let dirModule = GetModuleDirectory();
|
|
let pathScript = dirModule ~ "script/default_system/Default_ReplaySaveScene.txt";
|
|
|
|
//--------------------------------
|
|
//リプレイ保存シーンスクリプト起動
|
|
let idScript = LoadScript(pathScript);
|
|
StartScript(idScript);
|
|
|
|
while(!IsCloseScript(idScript))
|
|
{
|
|
yield;
|
|
}
|
|
|
|
|
|
//--------------------------------
|
|
//タイトルシーンへ遷移
|
|
TTitleScene();
|
|
}
|
|
|
|
|
|
//----------------------------------------------------
|
|
// 画面遷移エフェクト
|
|
//----------------------------------------------------
|
|
function RenderSceneToTransitionTexture()
|
|
{
|
|
//現在のシーン内容を画面遷移用テクスチャに描画
|
|
let textureName = GetTransitionRenderTargetName();
|
|
RenderToTextureA1(textureName, 0, 100, true);
|
|
}
|
|
|
|
task TTransition
|
|
{
|
|
let textureName = GetTransitionRenderTargetName();
|
|
|
|
let objImage = ObjPrim_Create(OBJ_SPRITE_2D); //2Dスプライトオブジェクト生成
|
|
Obj_SetRenderPriorityI(objImage, 100); //描画優先度を設定
|
|
ObjPrim_SetTexture(objImage, textureName); //テクスチャを設定
|
|
ObjSprite2D_SetSourceRect(objImage, 0, 0, 640, 480);
|
|
ObjSprite2D_SetDestRect(objImage, 0, 0, 640, 480);
|
|
|
|
let alpha = 255;
|
|
while(alpha > 0)
|
|
{
|
|
ObjRender_SetAlpha(objImage, alpha);
|
|
alpha -= 16;
|
|
yield;
|
|
}
|
|
Obj_Delete(objImage);
|
|
}
|
|
|