--New Hud
cfunction("register2DOverlay", "hud_position", "always/hud/position", 150)
cfunction("register2DOverlay", "hud_time", "always/hud/time", 150)
cfunction("register2DOverlay", "hud_statemorph", "always/hud/statemorph", 150)
cfunction("register2DOverlay", "hud_statemorph2", "always/hud/statemorph", 150)
cfunction("register2DOverlay", "hud_speed", "always/hud/kmh", 150)
cfunction("register2DOverlay", "hud_speed2", "always/hud/kmh", 150)

cfunction("register2DOverlay", "hud_sm_dragster_normal", "always/hud/dragster_neutral", 150)
cfunction("register2DOverlay", "hud_sm_dragster_active", "always/hud/dragster_active", 150)
cfunction("register2DOverlay", "hud_sm_dragster_select", "always/hud/dragster_select", 150)
cfunction("register2DOverlay", "hud_sm_glide_normal", "always/hud/glide_neutral", 150)
cfunction("register2DOverlay", "hud_sm_glide_active", "always/hud/glide_active", 150)
cfunction("register2DOverlay", "hud_sm_glide_select", "always/hud/glide_select", 150)
cfunction("register2DOverlay", "hud_sm_mammoth_normal", "always/hud/mammoth_neutral", 150)
cfunction("register2DOverlay", "hud_sm_mammoth_active", "always/hud/mammoth_active", 150)
cfunction("register2DOverlay", "hud_sm_mammoth_select", "always/hud/mammoth_select", 150)
cfunction("register2DOverlay", "hud_sm_scorch_normal", "always/hud/scorch_neutral", 150)
cfunction("register2DOverlay", "hud_sm_scorch_active", "always/hud/scorch_active", 150)
cfunction("register2DOverlay", "hud_sm_scorch_select", "always/hud/scorch_select", 150)

cfunction("register2DOverlay", "hud_weapons_emp1", "always/hud/emp", 150)
cfunction("register2DOverlay", "hud_weapons_emp2", "always/hud/emp", 150)
cfunction("register2DOverlay", "hud_weapons_emp_blink", "always/hud/emp_blink", 150)
cfunction("register2DOverlay", "hud_weapons_flashbomb1", "always/hud/flashbomb", 150)
cfunction("register2DOverlay", "hud_weapons_flashbomb2", "always/hud/flashbomb", 150)
cfunction("register2DOverlay", "hud_weapons_flashbomb_blink", "always/hud/flashbomb_blink", 150)

cfunction("register2DOverlay", "hud_weapons_foammissile1", "always/hud/foammissile", 150)
cfunction("register2DOverlay", "hud_weapons_foammissile2", "always/hud/foammissile", 150)
cfunction("register2DOverlay", "hud_weapons_foammissile_blink", "always/hud/foammissile_blink", 150)
cfunction("register2DOverlay", "hud_weapons_grenade1", "always/hud/grenade", 150)
cfunction("register2DOverlay", "hud_weapons_grenade2", "always/hud/grenade", 150)
cfunction("register2DOverlay", "hud_weapons_grenade_blink", "always/hud/grenade_blink", 150)

cfunction("registerFontOverlay", "font_hud_pos_enemy", "pos_enemy", 580)
cfunction("registerFontOverlay", "font_hud_pos_player", "pos_player", 580)
cfunction("registerFontOverlay", "font_hud_speed2", "speed", 580)
cfunction("registerFontOverlay", "font_hud_time", "time", 580)

cfunction("createState", "pauseState", "pauseState_ia")
cfunction("createState", "alwaysOn", "alwaysOn")

cfunction("createState", "endingAndCredits", "endingAndCredits")
cfunction("createState", "tournamentResult", "tournament/result")
cfunction("createState", "tournamentNotEnoughPoints", "tournament/notEnoughPoints")
cfunction("createState", "tournamentVictory", "tournament/victory")
cfunction("createState", "tournamentUpgrade", "tournament/upgrade")


cfunction("createState", "arcadeResult", "arcade/result")
cfunction("createState", "arcadeAgainQuestion", "arcade/againQuestion")

cfunction("register2DOverlay", "blackScreen", "blackScreen", 800)

cfunction("register2DOverlay", "sm_all", "always/SM_Select_all", 110)
cfunction("register2DOverlay", "sm_left", "always/SM_Select_left", 110)
cfunction("register2DOverlay", "sm_right", "always/SM_Select_right", 110)

cfunction("register2DOverlay", "sm_glide", "always/SM_Select_glide", 110)
cfunction("register2DOverlay", "sm_mammoth", "always/SM_Select_mammoth", 110)
cfunction("register2DOverlay", "sm_dragster", "always/SM_Select_dragster", 110)
cfunction("register2DOverlay", "sm_scorch", "always/SM_Select_scorch", 110)

cfunction("register2DOverlay", "pause", "pause/Pause", 610)
cfunction("register2DOverlay", "leftcursor", "pause/cursor", 620)
cfunction("register2DOverlay", "rightcursor", "pause/cursor", 620)

cfunction("register2DOverlay", "resultBG", "finish/Resultscreen", 600)
cfunction("registerFontOverlay", "option_restart", "Results_font", 680)
cfunction("registerFontOverlay", "resultFont", "Results_font", 680)
cfunction("register2DOverlay", "eogBG", "eog/RestartExit", 600)

--[[
cfunction("register2DOverlay", "SMOverlayDragster", "always/drag", 1500)
cfunction("register2DOverlay", "SMOverlayGlide", "always/glide", 1500)
cfunction("register2DOverlay", "SMOverlayMammoth", "always/mam", 1500)
cfunction("register2DOverlay", "SMOverlayScorch", "always/scorch", 1500)
--]]

cfunction("register2DOverlay", "SMComboKeyWindow", "always/hud/combo_key_window", 1010)
cfunction("register2DOverlay", "SMComboRButton1", "always/hud/combo_r_default", 1015)
cfunction("register2DOverlay", "SMComboRButton2", "always/hud/combo_r_default", 1015)
cfunction("register2DOverlay", "SMComboRButton3", "always/hud/combo_r_default", 1015)
cfunction("register2DOverlay", "SMComboRButton4", "always/hud/combo_r_default", 1015)
cfunction("register2DOverlay", "SMComboLButton1", "always/hud/combo_l_default", 1015)
cfunction("register2DOverlay", "SMComboLButton2", "always/hud/combo_l_default", 1015)
cfunction("register2DOverlay", "SMComboLButton3", "always/hud/combo_l_default", 1015)
cfunction("register2DOverlay", "SMComboLButton4", "always/hud/combo_l_default", 1015)

cfunction("register2DOverlay", "SMComboRButton1On", "always/hud/combo_r_on", 1015)
cfunction("register2DOverlay", "SMComboRButton2On", "always/hud/combo_r_on", 1015)
cfunction("register2DOverlay", "SMComboRButton3On", "always/hud/combo_r_on", 1015)
cfunction("register2DOverlay", "SMComboRButton4On", "always/hud/combo_r_on", 1015)
cfunction("register2DOverlay", "SMComboLButton1On", "always/hud/combo_l_on", 1015)
cfunction("register2DOverlay", "SMComboLButton2On", "always/hud/combo_l_on", 1015)
cfunction("register2DOverlay", "SMComboLButton3On", "always/hud/combo_l_on", 1015)
cfunction("register2DOverlay", "SMComboLButton4On", "always/hud/combo_l_on", 1015)

cfunction("register2DOverlay", "SMComboLink", "always/hud/combo_link_default", 1015)
cfunction("register2DOverlay", "SMComboLinkOn", "always/hud/combo_link_on", 1015)

cfunction("register2DOverlay", "SMComboWrong", "always/hud/combo_error", 1015)

cfunction("register2DOverlay", "SMComboDragster", "always/hud/dragster_neutral", 1020)
cfunction("register2DOverlay", "SMComboScorch", "always/hud/scorch_neutral", 1020)
cfunction("register2DOverlay", "SMComboMammoth", "always/hud/mammoth_neutral", 1020)
cfunction("register2DOverlay", "SMComboGlide", "always/hud/glide_neutral", 1020)

cfunction("register2DOverlay", "SMComboDragsterOn", "always/hud/dragster_active", 1020)
cfunction("register2DOverlay", "SMComboScorchOn", "always/hud/scorch_active", 1020)
cfunction("register2DOverlay", "SMComboMammothOn", "always/hud/mammoth_active", 1020)
cfunction("register2DOverlay", "SMComboGlideOn", "always/hud/glide_active", 1020)



firstState = "alwaysOn"

--vars:
--reg_7 = 10*music vol + sfx vol
--reg_6 = character
--reg_5 = level
--reg_8 = playerName

--exitCodes:
--1 = startLevel
--

