NarumiSTG_HyperSnowDrifter/script/GayGunner_Package.dnh

656 lines
30 KiB
Plaintext

#東方弾幕風[Package]
#Title["be gay do crimes"]
#Text["A NEW PACKAGE!"]
// Logic control bools
#include "./Package_FuncLib.dnh"
#include "./Package_MenuLib.dnh"
bool IsGameStart = false; // Set to true during StageScene
// Font installation: Anke Calligraph, Connecting Chain Handserif, Unispace, etc.
string pathPlayer = "";
string pathStage = "";
string[] PlayerArray =
["script/player/Narumi/Player_Main.dnh",
"script/player/Kouryuu/Player_Main.dnh"];
string[] PlayerReplayName = ["Narumi", "Kouryuu"];
string[] DifficultyName = ["Novice", "Standard", "Extra"];
float BGMRate = GetAreaCommonData("Config", "BGMVol", 100) * 0.01;
int objTitleBGM = ObjSound_Create();
@Initialize
{
StartScript("script/KevinSystem/Init.dnh");
//AddArchiveFile("script/Jam10.dat");
//AddArchiveFile("script/KevinSystem.dat");
ObjSound_Load(objTitleBGM, "script/Jam10/PackageLib/AAAAA.mp3");
ObjSound_SetSoundDivision(objTitleBGM, SOUND_BGM);
//ObjSound_SetResumeEnable(objTitleBGM, true);
ObjSound_SetLoopEnable(objTitleBGM, true);
//ObjSound_SetLoopTime(objBGM, 0.00, 89.618);
ObjSound_SetVolumeRate(objTitleBGM, 0);
if(IsCommonDataAreaExists("PIV") == false){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{
SetAreaCommonData("PIV", "currentvalue", 10000);
}
if(IsCommonDataAreaExists("ScriptID") == false){
CreateCommonDataArea("ScriptID");
SetAreaCommonData("ScriptID", "SystemID", 0);
SetAreaCommonData("ScriptID", "ItemID", 0);
}
ImgLoad();
_RenderTitleBackground();
TInstallFont();
TTitleScene();
let diffIndex = 0;
let playerIndex = 0;
}
let dirSystem = "script/KevinSystem/";
let dirLib = "script/Jam10/PackageLib/";
int lang = GetCommonData("Language", 0);
// Initialize common data: Configurations, high scores for difficulties and players
/* CONFIG
BGM Volume
Sound Volume
Starting Lives Setting (0 to 999) (but why would you want to set your starting lives to 0??????)
Background Opacity (255 to 0, disables background rendering if at 0)
Dialogue Skip Setting (ON/OFF)
*/
// Load/create common data for config
if(LoadCommonDataAreaA2("Config", "script/Jam10/config.dat") == false){
CreateCommonDataArea("Config");
SetAreaCommonData("Config", "BGMVol", 100);
SetAreaCommonData("Config", "SEVol", 100);
SetAreaCommonData("Config", "StartingLife", 3);
SetAreaCommonData("Config", "BGOpacity", 100); // By percentage
SetAreaCommonData("Config", "DialogueSkip", 0); // 0: no, 1: yes
SetAreaCommonData("Config", "PlayerShotOpacity", 60);
SetAreaCommonData("Config", "BGMSelect", 0); // O: Yal, 1: Wareya
SetAreaCommonData("Config", "ItemOpacity", 60);
// 1.01a
SetAreaCommonData("Config", "EffectCut", 0);
SaveCommonDataAreaA2("Config", "script/Jam10/config.dat");
}
else{
LoadCommonDataAreaA2("Config", "script/Jam10/config.dat");
}
// High Score
if(
LoadCommonDataAreaA2("Data_" ~ PlayerReplayName[0], "script/Jam10/data_Pl0.dat") == false &&
LoadCommonDataAreaA2("Data_" ~ PlayerReplayName[1], "script/Jam10/data_Pl1.dat") == false
){
CreateCommonDataArea("Data_" ~ PlayerReplayName[0]);
CreateCommonDataArea("Data_" ~ PlayerReplayName[1]);
for each(diff in DifficultyName){
SetAreaCommonData("Data_" ~ PlayerReplayName[0], "HighScore_" ~ diff, 0);
SetAreaCommonData("Data_" ~ PlayerReplayName[1], "HighScore_" ~ diff, 0);
}
SaveCommonDataAreaA2("Data_" ~ PlayerReplayName[0], "script/Jam10/data_Pl0.dat");
SaveCommonDataAreaA2("Data_" ~ PlayerReplayName[1], "script/Jam10/data_Pl1.dat");
}
else{
LoadCommonDataAreaA2("Data_" ~ PlayerReplayName[0], "script/Jam10/data_Pl0.dat");
LoadCommonDataAreaA2("Data_" ~ PlayerReplayName[1], "script/Jam10/data_Pl1.dat");
}
@MainLoop
{
lang = GetCommonData("Language", 0);
yield;
}
@Finalize
{
}
//----------------------------------------------------
// タイトルシーン
//----------------------------------------------------
task TTitleScene
{
if(!ObjSound_IsPlaying(objTitleBGM)){
ObjSound_Play(objTitleBGM);
ObjSound_SetVolumeRate(objTitleBGM, 75*GetAreaCommonData("Config", "BGMVol", 100)*0.01);
}
else{}
IsGameStart = false;
/*ObjText_SetText(objText,
"[font sz=150 oc=(78, 102, 255)]東方氷湖暴[r][font sz=90 oc=(0, 26, 190)]RAMPAGE OF THE STRONGEST!"
);*/
let bEndTitleScene = false;
int text = CreateTextObject(
GetScreenWidth()/2, 4.5*GetScreenHeight()/5, 36,
"", "Unispace",
0xFFFFFF, 0xFFFFFF,
0x000000, 4,
4
);
ObjText_SetHorizontalAlignment(text, ALIGNMENT_CENTER);
ObjText_SetAutoTransCenter(text, true);
let textArray = [
"Begin the game.",
"View the instructions for the game.",
"View your magnificent replays!",
"Configure the game's settings to your liking.",
"See you soon...?"
];
int img = _Create2DImage("script/Jam10/PackageLib/title.png", [0, 0, 1280, 360]);
Obj_SetRenderPriorityI(img, 5);
ObjRender_SetScaleXYZ(img, 0.8);
ObjSprite2D_SetDestCenter(img);
ObjRender_SetPosition(img, GetScreenWidth()/2, GetScreenHeight()*1/4, 1);
let INDEX_START = 0;
let INDEX_MANUAL = 1;
let INDEX_REPLAY = 2;
let INDEX_CONFIG = 3;
let INDEX_QUIT = 4;
let selectIndex = 0;//選択位置
task MenuItem(string text, int index, float posX, posY){
float size = 32;
int[] item = TMenuItem(
1, "GravityBold8",
posX, posY, size,
0x5EFFD7, 0xFFFFFF, 0x30008D,
text
);
while(!bEndTitleScene)
{
ObjRender_SetPosition(item[1], ObjRender_GetX(item[0]), ObjRender_GetY(item[0]), 1);
if(index == selectIndex){
ObjText_SetFontBorderWidth(item[0], size/6);
ObjText_SetFontSize(item[0], size*1.15);
ObjText_SetFontBorderColor(item[0], 0xA87CFF);
}
else{
ObjText_SetFontBorderWidth(item[0], size/10);
ObjText_SetFontSize(item[0], size);
ObjText_SetFontBorderColor(item[0], 0x30008D);
}
yield;
}
Obj_Delete(item[0]);
Obj_Delete(item[1]);
}
//メニュー配置
let mx = 1*GetScreenWidth()/2;
let my = 2.3*GetScreenHeight()/5;
let texts = ["START GAME", "MANUAL", "VIEW REPLAY", "OPTIONS", "END GAME"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
MenuItem(texts[iText], iText, mx, my);
my += 50;
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
//決定
ObjText_SetText(text, textArray[selectIndex]);
//ObjRender_SetPosition(img, mx, 1.5*GetScreenHeight()/5, 1);
if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_START)
{
pathPlayer = PlayerArray[0];
SetCommonData("Difficulty", "Standard");
TStageScene("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), false);
}
if(selectIndex == INDEX_MANUAL)
{
TManualScene();
}
else if(selectIndex == INDEX_REPLAY)
{
TReplaySelectScene();
}
else if(selectIndex == INDEX_CONFIG)
{
TConfigScene();
}
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;
}
Obj_Delete(text);
Obj_Delete(img);
bEndTitleScene = true;
}
//----------------------------------------------------
// ステージシーン
//----------------------------------------------------
task TStageScene(let pathReplay, let pathPlayer, let pathLives, let modeDialog, bool isRetry)
{
IsGameStart = true;
if(ObjSound_IsPlaying(objTitleBGM)){
ObjSound_Stop(objTitleBGM);
}
else{}
let dirCurrent = GetCurrentScriptDirectory();
let dirModule = GetModuleDirectory();
if(IsCommonDataAreaExists("PIV") == false){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{
SetAreaCommonData("PIV", "currentvalue", 10000);
}
//--------------------------------
//画面遷移
RenderSceneToTransitionTexture();
TTransition();
//--------------------------------
//ステージ初期化
InitializeStageScene();
if(length(pathReplay) > 0)
{
SetStageReplayFile(pathReplay);
}
//--------------------------------
//初期ステージ設定
let indexStage = 0; //ステージインデックス
SetStageIndex(indexStage);
SetStageMainScript("script/Jam10/Game_Plural.dnh");
SetStagePlayerScript(pathPlayer);
SetCommonData("Starting Lives", pathLives);
if(!isRetry){SetCommonData("Dialogue Skip Mode", modeDialog);}
else{}
StartStageScene();
//--------------------------------
//ステージ操作
loop
{
//--------------------------------
//一時停止チェック
if(GetVirtualKeyState(VK_PAUSE) == KEY_PUSH)
{
let resPause = RunPauseScene();
alternative(resPause)
case(RESULT_RETRY)
{
//最初からやり直す
if(!IsReplay())
{
//リトライ
TerminateStageScene();
TStageScene("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), true);
return;
}
}
case(RESULT_END)
{
//一時停止中の終了
TerminateStageScene();
}
}
if(!IsReplay() && GetKeyState(KEY_BACK) == KEY_PUSH)
{
//リトライ
TerminateStageScene();
TStageScene("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), true);
return;
}
//--------------------------------
//ステージ完了待ち
let stgSceneState = GetStageSceneState();
if(stgSceneState == STAGE_STATE_FINISHED)
{
//ステージ終了結果を取得
let stageResult = GetStageSceneResult();
alternative(stageResult)
case(STAGE_RESULT_CLEARED)
{
TEndScene();
break;
}
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 = "script/KevinSystem/kevin_system/Kevin_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("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), true);
}
}
//----------------------------------------------------
// 一時停止シーン
//----------------------------------------------------
function RunPauseScene()
{
RenderSceneToTransitionTexture();
PauseStageScene(true);
let dirModule = GetModuleDirectory();
let pathScript = "script/KevinSystem/kevin_system/Kevin_Pause.txt";
//--------------------------------
//一時停止シーンンスクリプト起動
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
PauseStageScene(false);
let res = GetScriptResult(idScript);
return res;
}
//----------------------------------------------------
// リプレイ選択シーン
//----------------------------------------------------
task TReplaySelectScene()
{
LoadReplayList();
let dirCurrent = GetCurrentScriptDirectory();
let pathScript = "script/ExRumia/ExRumia_Package_ReplaySelectScene.txt";
//--------------------------------
//リプレイ選択シーンスクリプト起動
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
//--------------------------------
//リプレイ選択シーン結果処理
LoadReplayList();
let result = GetScriptResult(idScript);
let pathPlayerReplay = "";
let resultStage, resultTeam;
if(result == 99999999*69420)
{
//タイトルシーンへ戻る
TTitleScene();
//ObjSound_Stop(objTitleBGM);
}
else
{
let resultPath = GetReplayInfo(result, REPLAY_FILE_PATH);
if (GetReplayInfo(result, REPLAY_PLAYER_NAME) == "Narumi") {pathPlayerReplay = PlayerArray[0];}
else if (GetReplayInfo(result, REPLAY_PLAYER_NAME) == "Kouryuu") {pathPlayerReplay = PlayerArray[1];}
if(GetReplayUserData(result, "Difficulty") == "Novice"){SetCommonData("Difficulty", "Novice");}
else if(GetReplayUserData(result, "Difficulty") == "Standard"){SetCommonData("Difficulty", "Standard");}
else if(GetReplayUserData(result, "Difficulty") == "Extra"){SetCommonData("Difficulty", "Extra");}
//リプレイ再生開始
WriteLog(pathPlayerReplay);
TStageScene(
resultPath,
pathPlayerReplay,
GetReplayUserData(result, "Starting Lives"),
GetReplayUserData(result, "Dialogue Skip"),
false
);
ObjSound_Stop(objTitleBGM);
}
}
//----------------------------------------------------
// リプレイ保存シーン
//----------------------------------------------------
task TReplaySaveScene()
{
LoadReplayList();
let dirModule = GetModuleDirectory();
let pathScript = dirModule ~ "script/KevinSystem/kevin_system/Kevin_ReplaySave.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, 1920, 1080);
ObjSprite2D_SetDestRect(objImage, 0, 0, 1920, 1080);
let alpha = 255;
while(alpha > 0)
{
ObjRender_SetAlpha(objImage, alpha);
alpha -= 16;
yield;
}
Obj_Delete(objImage);
}