--------------------------------------------------------------------
-- s_first.lua
-- シーン開始時の処理
--
-- author IZUMI STUDIO
-- date 2009-08-20 新規作成
--------------------------------------------------------------------
require(".\\scripts\\title\\s_common")

yCount      = 4
unitHeight  = PROJ_WIDTH / yCount
plateHeight = PROJ_WIDTH / yCount * 0.97

aspectRatio = Scene.GetEnvParameterFloat( "AspectRatio" )
unitWidth   = unitHeight
a = ( PROJ_WIDTH*aspectRatio*0.5 - unitWidth*0.5 ) / unitWidth
a = math.ceil( a )
xCount      = 1 + a*2
plateWidth  = plateHeight

-- BGM 再生
Scene.ControlStreamSound( 0, SCONTROL_STOP, 0, "" )
Scene.ControlStreamSound( 0, SCONTROL_CLEAR, 0, "" )
Scene.ControlStreamSound( 0, SCONTROL_PUSH_SOUND, 0, "sounds\\mb00007390.ogg" )
Scene.ControlStreamSound( 0, SCONTROL_PLAY, SCONTROL_LOOP_ONE, "" )

-- パネル初期化
for y= 0, (yCount-1) do
	for x=0, (xCount-1) do
		Scene.CreatePlate( 0,
			unitWidth * ( x + 0.5 ) - unitWidth * xCount / 2.0,
			unitHeight * ( y + 0.5 ) - unitHeight * yCount / 2.0,
			0.0,
			plateWidth, plateHeight, 1.0 )
	end
end

-- ロゴ初期化
Scene.CreateLogo( 30,
	80,
	(35.0-400.0)/400.0*1.333*PROJ_HALF_WIDTH, 
	(300.0-300.0)/300.0*PROJ_HALF_WIDTH, 
	0.0,
	1.0 /800.0*PROJ_WIDTH*1.333,
	1.0 /600.0*PROJ_WIDTH,
	1.0 ) ;

-- @todo
Scene.ExecEffectScript( 0, ".\\scripts\\game\\e_demo_play.lua" )

-- ハイビスカス
Scene.ExecEffectScript( 0, ".\\scripts\\title\\e_flower.lua" )

-- 著作権表示
Scene.ExecEffectScript( 0, ".\\scripts\\title\\e_copyright.lua" )

-- 次のシーンへ
Scene.SetEnvParameterInt( 0, "IsDemoMode", 1 )
Scene.SetEnvParameterInt( 0, "PlayerCodeRed", PLAYER_COM )
Scene.SetEnvParameterInt( 0, "PlayerCodeYellow", PLAYER_COM )
Scene.SetEnvParameterInt( 0, "UseAIRed", 1 )
Scene.SetEnvParameterInt( 0, "UseAIYellow", 1 )
Scene.SetEnvParameterInt( 0, "AIModeRed", 1 )
Scene.SetEnvParameterInt( 0, "AIModeYellow", 1 )
Scene.SetEnvParameterString( 0, "AIScriptRed", AI_SCRIPT_1 )
Scene.SetEnvParameterInt( 0, "AILevelRed", AI_LEVEL_1 )
Scene.SetEnvParameterString( 0, "PlayerNameRed", AI_NAME_1 )
Scene.SetEnvParameterString( 0, "AIScriptYellow", AI_SCRIPT_1 )
Scene.SetEnvParameterInt( 0, "AILevelYellow", AI_LEVEL_1 )
Scene.SetEnvParameterString( 0, "PlayerNameYellow", AI_NAME_1 )
Scene.SetEnvParameterInt( 0, "TempPlayCount", 0 )
Scene.ChangeScene( 30*30, SCENE_GAME, TRANSITION_BLACK_OUT, 20, TRANSITION_BLACK_IN, 20 )

-- BGM（フェードアウト）
Scene.ControlStreamSound( 30*30, SCONTROL_FADE_OUT, 2, "" )


