#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["yukari plural"]
#Text["by fuchsia"]
#Background["./bg.txt"]
#include"./function/index.txt"

//----------------------------------------------------
//global variables
//----------------------------------------------------
let GCSD = GetCurrentScriptDirectory;
//----------------------------------------------------

@Initialize {
	TMainTask();
	TLoad();
}

@MainLoop {
	yield;
}

task TMainTask () {
	let objScenes = ObjEnemyBossScene_Create();
	ObjEnemyBossScene_Add(objScenes, 0, GCSD ~ "ns1.txt");
	ObjEnemyBossScene_Add(objScenes, 0, GCSD ~ "s1.txt");
	ObjEnemyBossScene_Add(objScenes, 1, GCSD ~ "ns2.txt");
	ObjEnemyBossScene_Add(objScenes, 1, GCSD ~ "s2.txt");
	ObjEnemyBossScene_Add(objScenes, 2, GCSD ~ "ns3.txt");
	ObjEnemyBossScene_Add(objScenes, 2, GCSD ~ "s3.txt");
	ObjEnemyBossScene_LoadInThread(objScenes);
	
	SetPlayerLife(15);
	FWait(60);
	FPlaySoundNR("script/yukari_yakumo_fuchsia/se/boundary.wav");
	let boundary = TDrawBoundary(50, GetStgFrameHeight() / 3, 1.5, 1.5, 5);
	FWait(35);
	let objBoss = TDrawStageBoss();
	ObjMove_SetPosition(objBoss, 50, GetStgFrameHeight() / 3);
	ObjMove_SetDestAtWeight(objBoss, halfStageFrameWidth, GetStgFrameHeight() / 3, 5, 3);
	
	while (ObjMove_GetSpeed(objBoss) > 0) { yield; }
	
	FWait(30);
	TCloseBoundary(boundary, 5);
	FWait(60);
	Obj_Delete(boundary);
	SetCommonData("bossAtkAnim", true);
	let snowflake = TMakeSnowflake(true, 60, 1);
	
	let bgm = ObjSound_Create;
	ObjSound_Load(bgm, "script/yukari_yakumo_fuchsia/bgm.ogg");
	ObjSound_SetSoundDivision(bgm, SOUND_BGM);
	ObjSound_SetLoopEnable(bgm, true);
	ObjSound_SetLoopSampleCount(bgm, 996141, 6723953);
	ObjSound_Play(bgm);
	
	ObjRender_SetPosition(snowflake, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 0);
	FWait(60);
	Obj_Delete(objBoss);
	Obj_Delete(snowflake);
	
	ObjEnemyBossScene_Regist(objScenes);
	
	while (!Obj_IsDeleted(objScenes)) { yield; }
	
	CloseScript(GetOwnScriptID());
}

task TLoad () {
	let img = [];
	let snd = [];
	
	snd = snd ~ [GCSD ~ "se/byoro07.wav"];
	snd = snd ~ [GCSD ~ "se/cardcall.wav"];
	snd = snd ~ [GCSD ~ "se/charge00.wav"];
	snd = snd ~ [GCSD ~ "se/don20.wav"];
	snd = snd ~ [GCSD ~ "se/enep01.wav"];
	snd = snd ~ [GCSD ~ "se/lazer00.wav"];
	snd = snd ~ [GCSD ~ "se/lazer01.wav"];
	snd = snd ~ [GCSD ~ "se/se_bonus3.wav"];
	snd = snd ~ [GCSD ~ "se/se_boon00.wav"];
	snd = snd ~ [GCSD ~ "se/se_cardget.wav"];
	snd = snd ~ [GCSD ~ "se/se_fault.wav"];
	snd = snd ~ [GCSD ~ "se/shot02.wav"];
	snd = snd ~ [GCSD ~ "se/tan00.wav"];
	snd = snd ~ [GCSD ~ "se/tan01.wav"];
	snd = snd ~ [GCSD ~ "se/tan02.wav"];
	snd = snd ~ [GCSD ~ "se/kira00.wav"];
	snd = snd ~ [GCSD ~ "se/kira01.wav"];
	snd = snd ~ [GCSD ~ "se/kira03.wav"];
	snd = snd ~ [GCSD ~ "se/timerWarn.wav"];
	snd = snd ~ [GCSD ~ "se/timerWarn2.wav"];
	
//	ascent(i in 0..length(img)){
//		LoadTextureInLoadThread(img[i]);
//	}
	
	ascent(i in 0..length(snd)){
		LoadSound(snd[i]);
	}
	
}