NarumiSTG_HyperSnowDrifter/script/Jam10/Game_Plural.dnh

208 lines
4.9 KiB
Plaintext
Raw Permalink Normal View History

2023-01-26 11:34:56 +00:00
#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Game Plural"]
#Text["pilk"]
#System["script/KevinSystem/Kevin_System.txt"]
//#Player["script/KevinPackage/KevinScript_Players/PankevKouda/KevKou_Main.dnh", "script/KevinPackage/KevinScript_Players/MariHousui/MariHousui_Main.dnh"]
let csd = GetCurrentScriptDirectory();
let obj = ObjEnemyBossScene_Create();
int objBGM = ObjSound_Create();
int objBGMBoss = ObjSound_Create();
#include "script/KevinSystem/Universal_Lib.txt"
#include "script/KevinSystem/kevin_system/Lib_Const.dnh"
#include "script/Jam10/Stage_Background.dnh"
int LifeStart = GetCommonData("Starting Lives", 3);
bool stageStart = false;
bool bossStart = false;
float BGMRate = GetAreaCommonData("Config", "BGMVol", 100) * 0.01;
let POINTER_CHAIN = LoadAreaCommonDataValuePointer("PIV", "ChainAmount", 1);
let POINTER_CHAINGAUGE = LoadAreaCommonDataValuePointer("PIV", "ChainGauge", 0);
let POINTER_SPECIALAMMO = LoadAreaCommonDataValuePointer("PIV", "SpecialAmmo", 100);
let POINTER_SPECIALCHECK = LoadAreaCommonDataValuePointer("PIV", "IsUsingSpecial", false);
let POINTER_CHAINCHECK = LoadAreaCommonDataValuePointer("PIV", "IsChaining", false);
string DATA_PLAYER = "";
string DATA_DIFFICULTY = "";
@Event{
alternative (GetEventType())
case(EV_START_MUSIC){
stageStart = true;
ObjSound_Play(objBGM);
}
case(EV_BOSS_MUSIC){
bossStart = true;
ObjSound_Stop(objBGM);
ObjSound_Play(objBGMBoss);
}
case(EV_PAUSE_ENTER){
if (stageStart) {
if(bossStart){
ObjSound_Stop(objBGMBoss);
}
else{
ObjSound_Stop(objBGM);
}
}
}
case(EV_PAUSE_LEAVE){
if (stageStart) {
if(bossStart){
ObjSound_Play(objBGMBoss);
}
else{
ObjSound_Play(objBGM);
}
}
}
}
@Initialize{
SetCommonDataPtr(POINTER_CHAIN, 1);
SetCommonDataPtr(POINTER_CHAINGAUGE, 0);
SetCommonDataPtr(POINTER_SPECIALAMMO, 100);
SetCommonDataPtr(POINTER_SPECIALCHECK, false);
SetCommonDataPtr(POINTER_CHAINCHECK, false);
SetCommonData("Flying Defeated", 0);
SetCommonData("Ground Defeated", 0);
//SetCommonData("IsBomb", false);
SetCommonData("Rank", 1);
if(!IsCommonDataAreaExists("PIV")){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 1000);
SetAreaCommonData("PIV", "ChainAmount", 1);
}
else{
SetAreaCommonData("PIV", "ChainAmount", 1);
SetAreaCommonData("PIV", "currentvalue", 1000);
}
SetPlayerLife(GetAreaCommonData("Config", "StartingLife", 3));
SetAutoDeleteObject(true);
// 0: Yal, 1: Wareya
//SetAreaCommonData("Config", "BGMSelect", "Wareya");
/*
if(GetAreaCommonData("Config", "BGMSelect", 0) == 1){
ObjSound_Load(objBGM, "script/game/resourceLib/BossTheme_Wareya1.ogg");
ObjSound_SetLoopTime(objBGM, 1.644, 51.110);
}
else{
ObjSound_Load(objBGM, "script/game/resourceLib/BossTheme_Yal.ogg");
ObjSound_SetLoopTime(objBGM, 0.001, 92.81);
}
*/
InitiateData();
ObjSound_Load(objBGM, "script/Jam10/resourceLib/StageTheme.ogg");
2023-01-26 11:34:56 +00:00
ObjSound_SetSoundDivision(objBGM, SOUND_BGM);
ObjSound_SetResumeEnable(objBGM, true);
ObjSound_SetLoopEnable(objBGM, true);
ObjSound_SetLoopTime(objBGM, 22.72, 79.52);
ObjSound_Load(objBGMBoss, "script/Jam10/resourceLib/BossTheme.ogg");
2023-01-26 11:34:56 +00:00
ObjSound_SetSoundDivision(objBGMBoss, SOUND_BGM);
ObjSound_SetResumeEnable(objBGMBoss, true);
ObjSound_SetLoopEnable(objBGMBoss, false);
ObjSound_SetVolumeRate(objBGMBoss, 100*BGMRate);
ObjSound_SetVolumeRate(objBGM, 100*BGMRate);
PluralTask();
}
@MainLoop{
yield;
}
@Finalize
{
}
task InitiateData(){
DATA_PLAYER = GetPlayerReplayName();
DATA_DIFFICULTY = GetCommonData("Difficulty", "Standard");
}
/* TO DO:
+ Single *syncing* - ensure that the boss stays at the same position
*/
// Task to handle the plural's boss scene
task PluralTask(){
// Registering individual singles
ObjEnemyBossScene_Add(obj, 0, csd ~ "NarumiSTG.dnh");
ObjEnemyBossScene_LoadInThread(obj);
_ScrollBackground();
// Loading and registering the boss scene
ObjEnemyBossScene_Regist(obj);
async{
while(GetPlayerState() != STATE_END){yield;}
ObjSound_Stop(objBGM);
ObjSound_Stop(objBGMBoss);
}
while(!Obj_IsDeleted(obj)){
yield;
}
ObjSound_Stop(objBGM);
ObjSound_Stop(objBGMBoss);
stageStart = false;
bossStart = false;
//_ExplosionEffect(GetCommonData("Boss Position X", STG_WIDTH/2), GetCommonData("Boss Position Y", STG_WIDTH/2), PetalEffect);
if(!IsReplay() & LifeStart <= 3){
int highScore = GetAreaCommonData("Data_" ~ DATA_PLAYER, "HighScore_" ~ DATA_DIFFICULTY, 0);
int curScore = trunc(GetCommonData("Run Score", 0)/10)*10;
if(curScore > highScore){SetAreaCommonData("Data_" ~ DATA_PLAYER, "HighScore_" ~ DATA_DIFFICULTY, curScore);}
else{}
}
string savefile = "";
if (DATA_PLAYER == "Narumi") {savefile = "data_Pl0.dat";}
else if (DATA_PLAYER == "Kouryuu") {savefile = "data_Pl1.dat";}
else {savefile = "data_ERROR.dat";}
SaveCommonDataAreaA2("Data_" ~ DATA_PLAYER, "script/Jam10/" ~ savefile);
SetAutoDeleteObject(true);
CloseScript(GetOwnScriptID());
}