local luaCutscenesUtils = require("#Celeste.Mod.MaxHelpingHand.Module.LuaCutscenesUtils")

function onTalk()
	playSound("event:/ui/main/bside_intro_text")
	setFlag("playingMusic", true)
	wait(0.25)
	coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("ANDYB", "CC_KoseiDiamond_musicbox_start"))
	::song_selection::
	selectsong1 = choice ("CC_KoseiDiamond_musicbox_boss","CC_KoseiDiamond_musicbox_crimson","CC_KoseiDiamond_musicbox_desert",
						  "CC_KoseiDiamond_musicbox_dungeon","CC_KoseiDiamond_musicbox_jungle","CC_KoseiDiamond_musicbox_more")
	if selectsong1 == 1 then
		playMusic("event:/CC/CC_KoseiDiamond_Boss")
	elseif selectsong1 == 2 then
		playMusic("event:/CC/CC_KoseiDiamond_Corruption")
	elseif selectsong1 == 3 then
		playMusic("event:/CC/CC_KoseiDiamond_Desert")
	elseif selectsong1 == 4 then
		playMusic("event:/CC/CC_KoseiDiamond_Dungeon")
	elseif selectsong1 == 5 then
		playMusic("event:/CC/CC_KoseiDiamond_Jungle")
	else
		selectsong2 = choice ("CC_KoseiDiamond_musicbox_ocean","CC_KoseiDiamond_musicbox_sunkensea","CC_KoseiDiamond_musicbox_overworld",
						      "CC_KoseiDiamond_musicbox_sky","CC_KoseiDiamond_musicbox_snow","CC_KoseiDiamond_musicbox_more")
		if selectsong2 == 1 then
			playMusic("event:/CC/CC_KoseiDiamond_Ocean")
		elseif selectsong2 == 2 then
			playMusic("event:/CC/CC_KoseiDiamond_Sunkensea")
		elseif selectsong2 == 3 then
			playMusic("event:/CC/CC_KoseiDiamond_Overworld")
		elseif selectsong2 == 4 then
			playMusic("event:/CC/CC_KoseiDiamond_Sky")
		elseif selectsong2 == 5 then
			playMusic("event:/CC/CC_KoseiDiamond_Snow")
		else
			selectsong3 = choice("CC_KoseiDiamond_musicbox_space","CC_KoseiDiamond_musicbox_underground","CC_KoseiDiamond_musicbox_underworld",
								 "CC_KoseiDiamond_musicbox_rain","CC_KoseiDiamond_musicbox_goback","CC_KoseiDiamond_musicbox_dontplay")
			if selectsong3 == 1 then
				playMusic("event:/CC/CC_KoseiDiamond_Space")
			elseif selectsong3 == 2 then
				playMusic("event:/CC/CC_KoseiDiamond_Underground")
			elseif selectsong3 == 3 then
				playMusic("event:/CC/CC_KoseiDiamond_Underworld")
			elseif selectsong3 == 4 then
				playMusic("event:/CC/CC_KoseiDiamond_Rain")
			elseif selectsong3 == 5 then
				goto song_selection
			else
			onEnd()
			end
		end
	end
end


function onEnd() -- finishes the cutscene
	setFlag("playingMusic", false)
end