include("DATAINCLUDE")

cfunction("createState", "pauseState", "pauseState")
cfunction("createState", "alwaysOn", "alwaysOn")
cfunction("createState", "controlScreen", "controlScreen")
cfunction("createState", "soundAndMusicScreen", "soundAndMusicScreen")

if flow_gameMode == gameTypesIds["ARCADE"] then
	cfunction("createState", "arcadeResult", "arcade/result")
	cfunction("createState", "arcadeAgainQuestion", "arcade/againQuestion")
elseif flow_gameMode == gameTypesIds["TOURNAMENT"] then
	cfunction("createState", "tournamentResult", "tournament/result")
	cfunction("createState", "tournamentSumResult", "tournament/sum_result")
	cfunction("createState", "tournamentProceedQuestion", "tournament/proceedQuestion")
	cfunction("createState", "tournamentNotEnoughPoints", "tournament/notEnoughPoints")
	cfunction("createState", "tournamentVictory", "tournament/victory")	
elseif flow_gameMode == gameTypesIds["CHALLENGE"] then
	cfunction("createState", "challengeObjectives", "challenge/objectives")
	cfunction("createState", "challengeResult", "challenge/result")
	cfunction("createState", "challengeInformationScreen", "challenge/informationScreen")
elseif flow_gameMode == gameTypesIds["TIMETRIAL"] then
	cfunction("createState", "timetrialResult", "timetrial/result")	
elseif flow_gameMode == gameTypesIds["MULTIPLAYER"] then
	cfunction("createState", "multiplayerResult", "mp/result")
elseif flow_gameMode == gameTypesIds["TUTORIAL"] then
	cfunction("createState", "tutorialRequirementScreen", "tutorial/requirementScreen")
	cfunction("createState", "tutorialInformationScreen", "tutorial/informationScreen")
	cfunction("createState", "tutorialResult", "tutorial/result")
	cfunction("createState", "tutorialFinishQuestion", "tutorial/finishQuestion")
end

cfunction("registerBitmapOverlay", "hud_position", "always/hud/topleft", 150)
cfunction("registerBitmapOverlay", "hud_time", "always/hud/bottomright", 150)
cfunction("registerBitmapOverlay", "hud_statemorph", "always/hud/topright", 150)
cfunction("registerBitmapOverlay", "hud_statemorph2", "always/hud/topright", 150)
cfunction("registerBitmapOverlay", "hud_speed", "always/hud/bottomleft", 150)
cfunction("registerBitmapOverlay", "hud_speed2", "always/hud/bottomleft", 150)
cfunction("registerBitmapOverlay", "hud_weapons_emp1", "always/hud/emp", 150)
cfunction("registerBitmapOverlay", "hud_weapons_flashbomb1", "always/hud/flashbomb", 150)
cfunction("registerBitmapOverlay", "hud_weapons_foammissile1", "always/hud/foammissile", 150)
cfunction("registerBitmapOverlay", "hud_weapons_grenade1", "always/hud/grenade", 150)
cfunction("registerBitmapOverlay", "hud_weapons_emp2", "always/hud/emp", 150)
cfunction("registerBitmapOverlay", "hud_weapons_flashbomb2", "always/hud/flashbomb", 150)
cfunction("registerBitmapOverlay", "hud_weapons_foammissile2", "always/hud/foammissile", 150)
cfunction("registerBitmapOverlay", "hud_weapons_grenade2", "always/hud/grenade", 150)

cfunction("registerBitmapOverlay", "blackPix1", "blackPix", 2100)
cfunction("registerBitmapOverlay", "blackPix2", "blackPix", 2100)

cfunction("registerBitmapOverlay", "hud_weaponLock_frame", "always/hud/WeaponLockBar", 200)
cfunction("registerBitmapOverlay", "hud_weaponLock_blockL", "always/hud/WeaponLockSquare", 210)
cfunction("registerBitmapOverlay", "hud_weaponLock_blockR", "always/hud/WeaponLockSquare", 210)
cfunction("registerBitmapOverlay", "hud_weaponLock_hit", "always/hud/WeaponLock_Hit", 210)

cfunction("registerBitmapOverlay", "soundBlock1", "pause/pause_volumebar01", 820)
cfunction("registerBitmapOverlay", "soundBlock2", "pause/pause_volumebar02", 820)
cfunction("registerBitmapOverlay", "soundBlock3", "pause/pause_volumebar03", 820)
cfunction("registerBitmapOverlay", "soundBlock4", "pause/pause_volumebar04", 820)
cfunction("registerBitmapOverlay", "soundBlock5", "pause/pause_volumebar05", 820)
cfunction("registerBitmapOverlay", "soundBlock6", "pause/pause_volumebar06", 820)
cfunction("registerBitmapOverlay", "soundBlock7", "pause/pause_volumebar07", 820)
cfunction("registerBitmapOverlay", "soundBlock8", "pause/pause_volumebar08", 820)
cfunction("registerBitmapOverlay", "soundBlock9", "pause/pause_volumebar09", 820)

cfunction("registerBitmapOverlay", "musicBlock1", "pause/pause_volumebar01", 820)
cfunction("registerBitmapOverlay", "musicBlock2", "pause/pause_volumebar02", 820)
cfunction("registerBitmapOverlay", "musicBlock3", "pause/pause_volumebar03", 820)
cfunction("registerBitmapOverlay", "musicBlock4", "pause/pause_volumebar04", 820)
cfunction("registerBitmapOverlay", "musicBlock5", "pause/pause_volumebar05", 820)
cfunction("registerBitmapOverlay", "musicBlock6", "pause/pause_volumebar06", 820)
cfunction("registerBitmapOverlay", "musicBlock7", "pause/pause_volumebar07", 820)
cfunction("registerBitmapOverlay", "musicBlock8", "pause/pause_volumebar08", 820)
cfunction("registerBitmapOverlay", "musicBlock9", "pause/pause_volumebar09", 820)

cfunction("registerBitmapOverlay", "keys_dragster", "pause/Combo_Dragster", 820)
cfunction("registerBitmapOverlay", "keys_glide", "pause/Combo_Glide", 820)
cfunction("registerBitmapOverlay", "keys_mammoth", "pause/Combo_Mammoth", 820)
cfunction("registerBitmapOverlay", "keys_scorch", "pause/Combo_Scorch", 820)

cfunction("registerSoundEffect", "soundVolumeTest", "UI_Move_5", 0)
cfunction("registerSoundEffect", "select_sfx", "UI_Select", 0)
cfunction("registerSoundEffect", "back_sfx", "UI_Misc_1", 0)
cfunction("registerSoundEffect", "move_sfx", "UI_Move_3", 0)

cfunction("registerBitmapOverlay", "hud_wrongway", "always/hud/wrongway", 800)
cfunction("registerBitmapOverlay", "hud_dodgeWeapon", "always/hud/dodgeWeapon", 500)
cfunction("registerBitmapOverlay", "hud_smInputLeft_top", "always/hud/ButtonTopLeft", 510)
cfunction("registerBitmapOverlay", "hud_smInputRight_top", "always/hud/ButtonTopRight", 510)
cfunction("registerBitmapOverlay", "hud_smInputLeft_bottom", "always/hud/ButtonDownLeft", 510)
cfunction("registerBitmapOverlay", "hud_smInputRight_bottom", "always/hud/ButtonDownRight", 510)

--cfunction("registerBitmapOverlay", "generalLoading", "generalLoading", 2200)

cfunction("registerFontOverlay", "font_hud_pos_enemy", "Font_AI_Cars", 580)
cfunction("registerFontOverlay", "font_hud_pos_player", "Font_PLAYER_POS", 580)
cfunction("registerFontOverlay", "font_hud_speed", "Font_Speed", 580)
cfunction("registerFontOverlay", "font_hud_speed2", "Font_Speed", 580)
cfunction("registerFontOverlay", "font_hud_time", "Font_Time", 580)
cfunction("registerFontOverlay", "option_restart", "Results_font", 680)
cfunction("registerFontOverlay", "resultFont", "Results_font", 680)

cfunction("registerFontOverlay", "resultLevelName", "result_font_14pt", 900)
cfunction("registerFontOverlay", "resultLevelRecord", "result_font_11pt", 900)

cfunction("registerFontOverlay", "font_hud_behind", "Results_font", 580)


cfunction("registerFontOverlay", "track_resultListHeader", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem1", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem2", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem3", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem4", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem5", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem6", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem7", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem8", "result_font_11pt", 930)
cfunction("registerFontOverlay", "track_resultListItem9", "result_font_11pt", 930)

--popupWindow
cfunction("registerBitmapOverlay", "menuBgBlack", "blackPix", 780)
cfunction("registerBitmapOverlay", "frameTop", "frame/Pause_frame_top", 802)
cfunction("registerBitmapOverlay", "frameBottom", "frame/Pause_frame_bottom", 802)
cfunction("registerBitmapOverlay", "frameContent", "frame/Pause_window", 800)
cfunction("registerFontOverlay", "menu_content", "result_font_14pt", 810)
cfunction("registerFontOverlay", "ss_content", "result_font_14pt", 810)

if flow_gameMode == gameTypesIds["ARCADE"] then
	--no exclusive assets	
elseif flow_gameMode == gameTypesIds["TOURNAMENT"] then
	cfunction("registerFontOverlay", "tournamentStatus", "result_font_11pt", 900)
	
	if tournamentData[flow_tournamentId]["numTracks"] == flow_tournamentTrackInTournament then
		cfunction("registerSoundEffect", "unlockImpact", "menu_clang_new", -1)	
		cfunction("registerBitmapOverlay", tournamentData[flow_tournamentId]["finishedImg"], "unlocks/"..tournamentData[flow_tournamentId]["finishedImg"], 1000)	
		
		for indx = 1, tournamentData[flow_tournamentId]["numberOfUnlocks"] do
			xType = tournamentData[flow_tournamentId]["unlocks"][indx]["type"]
			xId = tournamentData[flow_tournamentId]["unlocks"][indx]["id"]
			if xType == unlockableTypes ["ARCADETRACK"] then
				cfunction("registerBitmapOverlay", "unlock_A_"..trackData[xId][1], "unlocks/Unlock_A_"..trackData[xId][1], 1000)
			elseif xType == unlockableTypes ["CHARACTER"] then
				cfunction("registerBitmapOverlay", characterData[xId][2], "unlocks/"..characterData[xId][2], 1000)	
			elseif xType == unlockableTypes ["TOURNAMENT"] then
				xText = tournamentData[xId]["unlockImg"]
				cfunction("registerBitmapOverlay", xText, "unlocks/"..xText, 1000)			
			elseif xType == unlockableTypes ["CHALLENGE"] then
				cfunction("registerBitmapOverlay", challengeData[xId][2], "unlocks/"..challengeData[xId][2], 1000)
			elseif xType == unlockableTypes ["STATEMORPH"] then
				cfunction("registerBitmapOverlay", "unlock_S_"..statemorphData[xId], "unlocks/Unlock_S_"..statemorphData[xId], 1000)
			elseif xType == unlockableTypes ["VEHICLELEVEL"] then
				cfunction("registerBitmapOverlay", "Unlock_U_Upgrade01", "unlocks/Unlock_U_Upgrade01", 1000)
				cfunction("registerBitmapOverlay", "Unlock_U_Upgrade02", "unlocks/Unlock_U_Upgrade02", 1000)
			end			
		end
	end
elseif flow_gameMode == gameTypesIds["CHALLENGE"] then
	cfunction("registerBitmapOverlay", "LE_lowenergy", "lowenergy", 800)
	cfunction("registerBitmapOverlay", "CD_lifes", "lifes", 800)
	cfunction("registerBitmapOverlay", "CD_cross1", "cross", 810)
	cfunction("registerBitmapOverlay", "CD_cross2", "cross", 810)
	cfunction("registerBitmapOverlay", "CD_cross3", "cross", 810)
	
	cfunction("registerFontOverlay", "tutorial_title", "result_font_14pt", 930)
	cfunction("registerFontOverlay", "tutorial_undertitle", "result_font_14pt", 930)
	cfunction("registerFontOverlay", "tutorial_desc", "result_font_11pt", 930)
	
elseif flow_gameMode == gameTypesIds["TIMETRIAL"] then
	
elseif flow_gameMode == gameTypesIds["MULTIPLAYER"] then
	
elseif flow_gameMode == gameTypesIds["TUTORIAL"] then
	cfunction("registerFontOverlay", "tutorial_title", "result_font_14pt", 930)
	cfunction("registerFontOverlay", "tutorial_undertitle", "result_font_14pt", 930)
	cfunction("registerFontOverlay", "tutorial_desc", "result_font_11pt", 930)
	cfunction("registerFontOverlay", "tutorial_requirementCol1", "result_font_11pt", 930)
	cfunction("registerFontOverlay", "tutorial_requirementCol2", "result_font_11pt", 930)
	cfunction("registerFontOverlay", "tutorial_requirementCol3", "result_font_11pt", 930)
	cfunction("registerFontOverlay", "tutorial_requirementCol4", "result_font_11pt", 930)
	
	cfunction("registerBitmapOverlay", "tutorial_drift", "tutorial/Tutorial_Drift", 920)
	cfunction("registerBitmapOverlay", "tutorial_do", "tutorial/Tutorial_DO", 920)
	cfunction("registerBitmapOverlay", "tutorial_sme", "tutorial/Tutorial_SME", 920)
	cfunction("registerBitmapOverlay", "tutorial_wp", "tutorial/Tutorial_WP", 920)
	
	cfunction("registerBitmapOverlay", "tutorial_combo_dragster1", "tutorial/Tutorial_combo_dragster01", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_dragster2", "tutorial/Tutorial_combo_dragster02", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_dragster3", "tutorial/Tutorial_combo_dragster03", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_dragster4", "tutorial/Tutorial_combo_dragster04", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_dragster5", "tutorial/Tutorial_combo_dragster05", 920)
	
	cfunction("registerBitmapOverlay", "tutorial_combo_scorch1", "tutorial/Tutorial_combo_scorch01", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_scorch2", "tutorial/Tutorial_combo_scorch02", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_scorch3", "tutorial/Tutorial_combo_scorch03", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_scorch4", "tutorial/Tutorial_combo_scorch04", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_scorch5", "tutorial/Tutorial_combo_scorch05", 920)
	
	cfunction("registerBitmapOverlay", "tutorial_combo_mammoth1", "tutorial/Tutorial_combo_mammoth01", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_mammoth2", "tutorial/Tutorial_combo_mammoth02", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_mammoth3", "tutorial/Tutorial_combo_mammoth03", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_mammoth4", "tutorial/Tutorial_combo_mammoth04", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_mammoth5", "tutorial/Tutorial_combo_mammoth05", 920)
	
	cfunction("registerBitmapOverlay", "tutorial_combo_glide1", "tutorial/Tutorial_combo_glide01", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_glide2", "tutorial/Tutorial_combo_glide02", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_glide3", "tutorial/Tutorial_combo_glide03", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_glide4", "tutorial/Tutorial_combo_glide04", 920)
	cfunction("registerBitmapOverlay", "tutorial_combo_glide5", "tutorial/Tutorial_combo_glide05", 920)
	
	cfunction("registerBitmapOverlay", "tutorial_dragster_buttons", "SM_dragster_buttons", 930)
	cfunction("registerBitmapOverlay", "tutorial_scorch_buttons", "SM_scorch_buttons", 930)
	cfunction("registerBitmapOverlay", "tutorial_mammoth_buttons", "SM_mammoth_buttons", 930)
	cfunction("registerBitmapOverlay", "tutorial_glide_buttons", "SM_glide_buttons", 930)
end

firstState = "alwaysOn"
