2352 lines
119 KiB
Scheme
Executable File
2352 lines
119 KiB
Scheme
Executable File
//////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// SCRIPT NAME : generic_launcher.sch //
|
|
// AUTHOR : Ryan Paradis //
|
|
// DESCRIPTION : default functions and primary loop for minigame launchers //
|
|
// //
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
USING "mission_control_public.sch"
|
|
USING "flow_public_core.sch"
|
|
USING "context_control_public.sch"
|
|
USING "replay_public.sch"
|
|
USING "ambience_run_checks.sch"
|
|
USING "stripclub_public.sch"
|
|
USING "website_public.sch"
|
|
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_SCRIPT_INIT)
|
|
PROC LAUNCHER_CUSTOM_SCRIPT_INIT()
|
|
PRINTLN("LAUNCHER_CUSTOM_SCRIPT_INIT()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_REQUEST_ASSETS)
|
|
PROC LAUNCHER_CUSTOM_REQUEST_ASSETS()
|
|
PRINTLN("LAUNCHER_CUSTOM_REQUEST_ASSETS()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_ASSETS_LOADED)
|
|
FUNC BOOL LAUNCHER_CUSTOM_ASSETS_LOADED()
|
|
RETURN TRUE
|
|
ENDFUNC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_SPAWN_SCENE)
|
|
PROC LAUNCHER_CUSTOM_SPAWN_SCENE()
|
|
PRINTLN("LAUNCHER_CUSTOM_SPAWN_SCENE()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_CLEAR_SCENE)
|
|
PROC LAUNCHER_CUSTOM_CLEAR_SCENE()
|
|
PRINTLN("LAUNCHER_CUSTOM_CLEAR_SCENE()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_APPROACH_WAIT)
|
|
PROC LAUNCHER_CUSTOM_APPROACH_WAIT()
|
|
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_LOAD_SCRIPT_WAIT)
|
|
PROC LAUNCHER_CUSTOM_LOAD_SCRIPT_WAIT()
|
|
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_RUN_WAIT)
|
|
PROC LAUNCHER_CUSTOM_RUN_WAIT()
|
|
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_SCRIPT_END)
|
|
PROC LAUNCHER_CUSTOM_SCRIPT_END()
|
|
PRINTLN("LAUNCHER_CUSTOM_SCRIPT_END()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_RELEASE_ASSETS)
|
|
PROC LAUNCHER_CUSTOM_RELEASE_ASSETS()
|
|
PRINTLN("LAUNCHER_CUSTOM_RELEASE_ASSETS()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_CLEANUP)
|
|
PROC LAUNCHER_CUSTOM_CLEANUP()
|
|
PRINTLN("LAUNCHER_CUSTOM_CLEANUP()")
|
|
ENDPROC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CAN_RUN_FRIEND_ACTIVITY)
|
|
FUNC BOOL LAUNCHER_CAN_RUN_FRIEND_ACTIVITY()
|
|
RETURN TRUE
|
|
ENDFUNC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(PERFORM_ONE_TIME_TASK)
|
|
FUNC BOOL PERFORM_ONE_TIME_TASK()
|
|
RETURN TRUE
|
|
ENDFUNC
|
|
#ENDIF
|
|
|
|
#IF NOT DEFINED(LAUNCHER_CUSTOM_RUN_SCRIPT)
|
|
FUNC THREADID LAUNCHER_CUSTOM_RUN_SCRIPT()
|
|
DEBUG_MESSAGE("You're trying to use LAUNCHER_CUSTOM_SCRIPT_LAUNCH, without overriding LAUNCHER_CUSTOM_RUN_SCRIPT(). See Ryan P for why you're doing it wrong.")
|
|
|
|
// Nothing custom has been done, just run default.
|
|
THREADID threadTemp = START_NEW_SCRIPT(scriptName, iStackSize)
|
|
SET_SCRIPT_AS_NO_LONGER_NEEDED(scriptName)
|
|
|
|
RETURN threadTemp
|
|
ENDFUNC
|
|
#ENDIF
|
|
|
|
|
|
PROC MG_LAUNCHER_UNUSED_STUFF()
|
|
#IF LAUNCHER_VEHICLE_ENTER
|
|
UNUSED_PARAMETER(fHelpTextScriptDist)
|
|
#ENDIF
|
|
ENDPROC
|
|
|
|
#IF IS_DEBUG_BUILD
|
|
|
|
FUNC STRING GET_LAUNCHER_STATE_DEBUG_STRING(LAUNCHER_STATE state)
|
|
SWITCH state
|
|
CASE STREAM_ASSETS RETURN "STREAM_ASSETS" BREAK
|
|
CASE STREAMING_WAIT RETURN "STREAMING_WAIT" BREAK
|
|
CASE SCENE_SETUP RETURN "SCENE_SETUP" BREAK
|
|
CASE APPROACH_WAIT RETURN "APPROACH_WAIT" BREAK
|
|
CASE IDLE_WAIT RETURN "IDLE_WAIT" BREAK
|
|
CASE RUN_SCRIPT RETURN "RUN_SCRIPT" BREAK
|
|
CASE RUN_WAIT RETURN "RUN_WAIT" BREAK
|
|
CASE UNLOAD_ASSETS RETURN "UNLOAD_ASSETS" BREAK
|
|
CASE WAIT_FOR_FAILSCREEN_REPLAY RETURN "WAIT_FOR_FAILSCREEN_REPLAY" BREAK
|
|
CASE WAIT_FOR_TERMINATE RETURN "WAIT_FOR_TERMINATE" BREAK
|
|
CASE CLEANUP_LAUNCHER RETURN "CLEANUP_LAUNCHER" BREAK
|
|
ENDSWITCH
|
|
|
|
CASSERTLN(DEBUG_MG_LAUNCHER, "GET_LAUNCHER_STATE_DEBUG_STRING: Debug string for launcher state ", ENUM_TO_INT(state), " is missing.")
|
|
RETURN "MISSING!"
|
|
ENDFUNC
|
|
|
|
|
|
FUNC STRING GET_LAUNCHER_FLAG_DEBUG_STRING(LAUNCHER_STATUS_FLAGS flag)
|
|
SWITCH flag
|
|
CASE LAUNCHER_FRIEND_ACTIVITY RETURN "FRIEND_ACTIVITY" BREAK
|
|
CASE LAUNCHER_MISSION_CANDIDATE_STARTED RETURN "MISSION_CANDIDATE_STARTED" BREAK
|
|
CASE LAUNCHER_SPAWNED_SCENE_CUSTOM RETURN "SPAWNED_SCENE_CUSTOM" BREAK
|
|
CASE LAUNCHER_RUN_DESPITE_MISSION RETURN "RUN_DESPITE_MISSION" BREAK
|
|
CASE LAUNCHER_NEED_SETUP_ON_MISSION RETURN "NEED_SETUP_ON_MISSION" BREAK
|
|
CASE LAUNCHER_SHOULD_UNLOCK_CARS RETURN "SHOULD_UNLOCK_CARS" BREAK
|
|
CASE LAUNCHER_SCRIPT_NOT_ALLOWING_RUN RETURN "SCRIPT_NOT_ALLOWING_RUN" BREAK
|
|
CASE LAUNCHER_BLIP_INACTIVE RETURN "BLIP_INACTIVE" BREAK
|
|
CASE LAUNCHER_FINISHED_INIT_FADE_DOWN RETURN "FINISHED_INIT_FADE_DOWN" BREAK
|
|
CASE LAUNCHER_OUTFIT_NOTIFIED RETURN "OUTFIT_NOTIFIED" BREAK
|
|
CASE LAUNCHER_ON_FOOT_NOTIFIED RETURN "ON_FOOT_NOTIFIED" BREAK
|
|
CASE LAUNCHER_HELP_TEXT_DISPLAYED RETURN "HELP_TEXT_DISPLAYED" BREAK
|
|
CASE LAUNCHER_JUSTDONE_WAIT_FOR_LEAVE RETURN "JUSTDONE_WAIT_FOR_LEAVE" BREAK
|
|
CASE LAUNCHER_PERFORM_ONE_TIME_TASK RETURN "PERFORM_ONE_TIME_TASK" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_FOR_MISSION_LEADIN RETURN "SHUTDOWN_FOR_MISSION_LEADIN" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_ON_PLAYER_DEATH RETURN "SHUTDOWN_ON_PLAYER_DEATH" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_IF_MISSION_RUNNING RETURN "SHUTDOWN_IF_MISSION_RUNNING" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_ALLOW_MULTIPLE_COPIES RETURN "SHUTDOWN_ALLOW_MULTIPLE_COPIES" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_FORCED_ON_INIT RETURN "SHUTDOWN_FORCED_ON_INIT" BREAK
|
|
CASE LAUNCHER_SHUTDOWN_FORCED_ON_FINISH RETURN "SHUTDOWN_FORCED_ON_FINISH" BREAK
|
|
CASE LAUNCHER_PRICE_NOTIFIED RETURN "PRICE_NOTIFIED" BREAK
|
|
CASE LAUNCHER_PRINTED_VEHICLE_FIRE RETURN "PRINTED_VEHICLE_FIRE" BREAK
|
|
CASE LAUNCHER_TOD_NOTIFIED RETURN "TOD_NOTIFIED" BREAK
|
|
CASE LAUNCHER_ALREADY_SNAPPED_CP RETURN "ALREADY_SNAPPED_CP" BREAK
|
|
CASE LAUNCHER_WRONG_VEHICLE_PRINTED RETURN "WRONG_VEHICLE_PRINTED" BREAK
|
|
CASE LAUNCHER_PRINTED_VEHICLE_DMG RETURN "PRINTED_VEHICLE_DMG" BREAK
|
|
ENDSWITCH
|
|
|
|
CASSERTLN(DEBUG_MG_LAUNCHER, "GET_LAUNCHER_FLAG_DEBUG_STRING: Debug string for launcher flag ", ENUM_TO_INT(flag), " is missing.")
|
|
RETURN "MISSING!"
|
|
ENDFUNC
|
|
|
|
|
|
// Limits per-frame spamming of block reasons and formats print string.
|
|
PROC PRINT_LAUNCHER_UPDATE_BLOCK_REASON(STRING reason)
|
|
IF (GET_FRAME_COUNT() % 120) = 0
|
|
CDEBUG2LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher update currently blocked. Reason: ", reason, ".")
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
|
|
PROC PRINT_LAUNCHER_INIT_DATA()
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> ----------------------------------------------------------")
|
|
|
|
//Core info.
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Script Name: ", scriptName)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Stack Size: " , iStackSize)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Mission Type: ", GET_MISSION_TYPE_DEBUG_STRING(eMinigameMissionType))
|
|
IF eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Static Blip: NONE")
|
|
ELSE
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Static Blip: " , DEBUG_GET_STRING_NAME_OF_STATIC_BLIP(ENUM_TO_INT(eLauncherStaticBlip)))
|
|
ENDIF
|
|
#IF LAUNCHER_CHAR_REQUIRED
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Required Character: ", GET_CHARSHEET_DISPLAY_STRING_FROM_CHARSHEET(characterRequired))
|
|
#ENDIF
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Price To Launch: $", iPriceToLaunch)
|
|
#ENDIF
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
|
|
//Config flags.
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Config Flags:")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VEHICLE_SPAWN ", PICK_STRING(LAUNCHER_VEHICLE_SPAWN = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> HAS_TRIGGER_SCENE ", PICK_STRING(LAUNCHER_HAS_TRIGGER_SCENE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VARIED_VEHICLE_ENTER ", PICK_STRING(LAUNCHER_VARIED_VEHICLE_ENTER = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VEHICLE_ENTER ", PICK_STRING(LAUNCHER_VEHICLE_ENTER = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VEHICLE_GETTING_IN ", PICK_STRING(LAUNCHER_VEHICLE_GETTING_IN = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VEHICLE_ENTER_ANY_SEAT ", PICK_STRING(LAUNCHER_VEHICLE_ENTER_ANY_SEAT = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VEHICLE_IGNORE_PROXIMITY ", PICK_STRING(LAUNCHER_VEHICLE_IGNORE_PROXIMITY = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> POINT_ENTER_IN_VEHICLE ", PICK_STRING(LAUNCHER_POINT_ENTER_IN_VEHICLE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> POINT_AUTO_TRIGGER_IN_VEHICLE ", PICK_STRING(LAUNCHER_POINT_AUTO_TRIGGER_IN_VEHICLE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> POINT_TRIGGER_WITH_FRIEND_IN_VEHICLE ", PICK_STRING(LAUNCHER_POINT_TRIGGER_WITH_FRIEND_IN_VEHICLE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> IGNORE_VEHICLE_HEALTH ", PICK_STRING(LAUNCHER_IGNORE_VEHICLE_HEALTH = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> IGNORE_PLAYER_CONTROL ", PICK_STRING(LAUNCHER_IGNORE_PLAYER_CONTROL = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> DISABLE_FOR_MAGDEMO ", PICK_STRING(LAUNCHER_DISABLE_FOR_MAGDEMO = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CHECK_SPAWN_DIST ", PICK_STRING(LAUNCHER_CHECK_SPAWN_DIST = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> COLLECTORS_AND_SPECIAL_EDITION_ONLY ", PICK_STRING(LAUNCHER_COLLECTORS_AND_SPECIAL_EDITION_ONLY = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> VOL_BUTTON_PRESS ", PICK_STRING(LAUNCHER_VOL_BUTTON_PRESS = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CUSTOM_SCRIPT_LAUNCH ", PICK_STRING(LAUNCHER_CUSTOM_SCRIPT_LAUNCH = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CLEAR_SCENE_ON_START ", PICK_STRING(LAUNCHER_CLEAR_SCENE_ON_START = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CHAR_REQUIRED ", PICK_STRING(LAUNCHER_CHAR_REQUIRED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> SNAP_CHECKPOINT_TO_GROUND ", PICK_STRING(LAUNCHER_SNAP_CHECKPOINT_TO_GROUND = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> HAS_SCENE ", PICK_STRING(LAUNCHER_HAS_SCENE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> NO_BUTTONPRESS ", PICK_STRING(LAUNCHER_NO_BUTTONPRESS = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> DONT_FADE_DOWN ", PICK_STRING(LAUNCHER_DONT_FADE_DOWN = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> DONT_CHECK_RELOAD_RANGE ", PICK_STRING(LAUNCHER_DONT_CHECK_RELOAD_RANGE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> OBJECT_ATTACHED ", PICK_STRING(LAUNCHER_OBJECT_ATTACHED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CHECK_INTERIOR ", PICK_STRING(LAUNCHER_CHECK_INTERIOR = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> REPLAYS_ENABLED ", PICK_STRING(LAUNCHER_REPLAYS_ENABLED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> TIME_RESTRICTED ", PICK_STRING(LAUNCHER_TIME_RESTRICTED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> MONEY_RESTRICTED ", PICK_STRING(LAUNCHER_MONEY_RESTRICTED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> PED_VARIATIONS ", PICK_STRING(LAUNCHER_PED_VARIATIONS = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> ON_FOOT_RESTRICTED ", PICK_STRING(LAUNCHER_ON_FOOT_RESTRICTED = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> CHECK_FOR_FIRE ", PICK_STRING(LAUNCHER_CHECK_FOR_FIRE = 1, "Yes", "No"))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
|
|
//Trigger dist info.
|
|
#IF LAUNCHER_POINT_ENTER
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Point enter trigger dist: ", fLaunchScriptDist)
|
|
#ENDIF
|
|
#IF LAUNCHER_VEHICLE_ENTER
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Vehicle enter trigger dist: ", fHelpTextScriptDist)
|
|
#ENDIF
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Shutdown Distance: " , fLauncherShutdownDist)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Trigger help text: ", helpButtonPress)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> --- LAUNCHER_VEHICLE_SPAWN Config ---")
|
|
IF vehicleModel = DUMMY_MODEL_FOR_SCRIPT
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Vehicle Model: NONE")
|
|
ELSE
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Vehicle Model: ", ENUM_TO_INT(vehicleModel))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Vehicle Heading: " , vehicleHeading)
|
|
ENDIF
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_OBJECT_ATTACHED
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> --- LAUNCHER_OBJECT_ATTACHED Config ---")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Associated Prop: ", ENUM_TO_INT(eAssociatedProp))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Object LOS Offset: ", vObjectLOSOffset)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Object LOS Coords: ", vObjectLOSCoords)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_VOL_BUTTON_PRESS
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> --- LAUNCHER_VOL_BUTTON_PRESS Config ---")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Volume Point 1: ", vVolPt1)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Volume Point 2: ", vVolPt2)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Volume Width: ", fVolWidth)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Volume Height: ", fVolHeight)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Max Trigger Distance: ", fMaxTriggerDist)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_TIME_RESTRICTED
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> --- LAUNCHER_TIME_RESTRICTED Config ---")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Available After Hour: ", iAvailableAfterHour)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Available Before Hour: ", iAvailableBeforeHour)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_PED_VARIATIONS
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> --- LAUNCHER_TIME_RESTRICTED Config ---")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Outfit Help Text: ", outfitHelpLabel)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> [Drw|Txt]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Michael Torso: [", michaelVariations.pedCompTorsoDrw, "|", michaelVariations.pedCompTorsoTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Michael Legs: [", michaelVariations.pedCompLegDrw, "|", michaelVariations.pedCompLegTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Michael Feet: [", michaelVariations.pedCompFeetDrw, "|", michaelVariations.pedCompFeetTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Franklin Torso: [", franklinVariations.pedCompTorsoDrw, "|", franklinVariations.pedCompTorsoTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Franklin Legs: [", franklinVariations.pedCompLegDrw, "|", franklinVariations.pedCompLegTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Franklin Feet: [", franklinVariations.pedCompFeetDrw, "|", franklinVariations.pedCompFeetTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Trevor Torso: [", trevorVariations.pedCompTorsoDrw, "|", trevorVariations.pedCompTorsoTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Trevor Legs: [", trevorVariations.pedCompLegDrw, "|", trevorVariations.pedCompLegTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Trevor Feet: [", trevorVariations.pedCompFeetDrw, "|", trevorVariations.pedCompFeetTxt, "]")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), ">")
|
|
#ENDIF
|
|
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> ----------------------------------------------------------")
|
|
ENDPROC
|
|
|
|
#ENDIF
|
|
|
|
|
|
PROC SWITCH_LAUNCHER_STATE(LAUNCHER_STATE newState)
|
|
CDEBUG2LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Switching state from ", GET_LAUNCHER_STATE_DEBUG_STRING(launcherState), " to ", GET_LAUNCHER_STATE_DEBUG_STRING(newState), ".")
|
|
launcherState = newState
|
|
ENDPROC
|
|
|
|
|
|
/// PURPOSE:
|
|
/// See if we are looking for a button press
|
|
/// PARAMS:
|
|
/// thePlayer -
|
|
/// theVehicle -
|
|
/// vVehPos -
|
|
/// bNeedPositionCheck -
|
|
/// RETURNS:
|
|
///
|
|
FUNC BOOL GENERIC_LAUNCHER_Reqires_Button_Press(VEHICLE_INDEX thisVehicle)
|
|
|
|
UNUSED_PARAMETER(thisVehicle)
|
|
#IF LAUNCHER_VARIED_VEHICLE_ENTER
|
|
IF DOES_ENTITY_EXIST(thisVehicle) AND IS_PED_IN_VEHICLE(PLAYER_PED_ID(), thisVehicle)
|
|
RETURN FALSE
|
|
ELSE
|
|
RETURN TRUE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_NO_BUTTONPRESS
|
|
RETURN FALSE
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_POINT_TRIGGER_WITH_FRIEND_IN_VEHICLE
|
|
IF IS_CURRENTLY_ON_MISSION_OF_TYPE(MISSION_TYPE_FRIEND_ACTIVITY)
|
|
OR IS_CURRENTLY_ON_MISSION_OF_TYPE(MISSION_TYPE_FRIEND_ACTIVITY_WITH_MG)
|
|
IF IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
VEHICLE_INDEX tempveh = GET_VEHICLE_PED_IS_USING(PLAYER_PED_ID())
|
|
IF IS_PED_IN_VEHICLE(FRIEND_A_PED_ID(), tempveh)
|
|
RETURN FALSE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_POINT_AUTO_TRIGGER_IN_VEHICLE
|
|
IF IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
thisVehicle = GET_VEHICLE_PED_IS_IN(PLAYER_PED_ID())
|
|
IF NOT IS_ENTITY_IN_AIR(thisVehicle) AND IS_VEHICLE_ON_ALL_WHEELS(thisVehicle)
|
|
RETURN FALSE
|
|
ELSE
|
|
PRINTLN("ENTITY IS IN AIR OR VEHICLE IS NOT ON ALL WHEELS")
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
//IF DOES_ENTITY_EXIST(thisVehicle)
|
|
// IF IS_PED_IN_VEHICLE(PLAYER_PED_ID(), thisVehicle)
|
|
// VECTOR vTemp = GET_ENTITY_COORDS(thisVehicle)
|
|
// FLOAT fGroundZ
|
|
// IF GET_GROUND_Z_FOR_3D_COORD(vTemp, fGroundZ)
|
|
// IF vTemp.z > (fGroundZ - 2.0) AND vTemp.z < (fGroundZ + 2.0)
|
|
// PRINTLN("vTemp is... ", vTemp, " and fGroundZ is... ", fGroundZ)
|
|
// IF NOT IS_ENTITY_IN_AIR(thisVehicle) AND IS_VEHICLE_ON_ALL_WHEELS(thisVehicle)
|
|
// RETURN FALSE
|
|
// ELSE
|
|
// PRINTLN("ENTITY IS IN AIR OR VEHICLE IS NOT ON ALL WHEELS")
|
|
// ENDIF
|
|
// ENDIF
|
|
// ENDIF
|
|
// ENDIF
|
|
//ENDIF
|
|
|
|
RETURN TRUE
|
|
|
|
ENDFUNC
|
|
|
|
|
|
FUNC BOOL GENERIC_LAUNCHER_IsVehicleAliveWithPlayerInIt(PED_INDEX thePlayer, VEHICLE_INDEX theVehicle, VECTOR vVehPos, BOOL bNeedPositionCheck = TRUE)
|
|
IF DOES_ENTITY_EXIST(theVehicle)
|
|
IF NOT IS_ENTITY_DEAD(theVehicle)
|
|
IF IS_PED_IN_VEHICLE(thePlayer, theVehicle)
|
|
IF (bNeedPositionCheck)
|
|
VECTOR vPlayerPos = GET_ENTITY_COORDS(thePlayer)
|
|
FLOAT fDist2 = VDIST2(vPlayerPos, vVehPos)
|
|
IF (fDist2 < LOCATE_SIZE_ANY_MEANS*LOCATE_SIZE_ANY_MEANS)
|
|
RETURN TRUE
|
|
ENDIF
|
|
ELSE
|
|
RETURN TRUE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
RETURN FALSE
|
|
ENDFUNC
|
|
|
|
FUNC BOOL GENERIC_LAUNCHER_IsPlayerUsingWeapon()
|
|
WEAPON_TYPE playerWeapon
|
|
BOOL bHasWeapon
|
|
IF IS_PED_INJURED(PLAYER_PED_ID())
|
|
RETURN FALSE
|
|
ENDIF
|
|
GET_CURRENT_PED_WEAPON(PLAYER_PED_ID(), playerWeapon)
|
|
IF playerWeapon = WEAPONTYPE_INVALID
|
|
OR playerWeapon = WEAPONTYPE_UNARMED
|
|
OR playerWeapon = WEAPONTYPE_ELECTRIC_FENCE
|
|
OR playerWeapon = GADGETTYPE_PARACHUTE
|
|
bHasWeapon = FALSE
|
|
ELSE
|
|
bHasWeapon = TRUE
|
|
ENDIF
|
|
|
|
IF bHasWeapon
|
|
#IF IS_DEBUG_BUILD
|
|
IF (GET_FRAME_COUNT() % 120) = 0
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "Player has valid weapon equipped for minigame, ENUM ID: ", playerWeapon)
|
|
ENDIF
|
|
#ENDIF
|
|
ENDIF
|
|
|
|
IF IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
RETURN (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_VEH_ATTACK))
|
|
OR (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_VEH_ATTACK2))
|
|
OR (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_VEH_AIM))
|
|
OR IS_PLAYER_TARGETTING_ANYTHING(PLAYER_ID())
|
|
ELSE
|
|
RETURN (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_ATTACK))
|
|
OR (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_AIM))
|
|
OR (bHasWeapon AND IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_DETONATE))
|
|
OR IS_PED_PERFORMING_MELEE_ACTION(PLAYER_PED_ID())
|
|
OR IS_PLAYER_TARGETTING_ANYTHING(PLAYER_ID())
|
|
ENDIF
|
|
|
|
ENDFUNC
|
|
|
|
FUNC BOOL GENERIC_LAUNCHER_IsPlayerInTargetVehicleTypeNearby(PED_INDEX thePlayer, MODEL_NAMES modelChk, VECTOR posChk)
|
|
// There's the possibility that we didn't clear the vehicle (player was maybe in it?)... Just search the area for vehicles
|
|
// and go from there.
|
|
VEHICLE_INDEX vehTemp
|
|
vehTemp = GET_VEHICLE_PED_IS_USING(thePlayer)
|
|
IF NOT IS_ENTITY_DEAD(vehTemp)
|
|
IF IS_PED_IN_VEHICLE(thePlayer, vehTemp)
|
|
IF (GET_ENTITY_MODEL(vehTemp) = modelChk) AND GET_PLAYER_DISTANCE_FROM_LOCATION(posChk) < 30.0
|
|
// Bollocks.
|
|
RETURN TRUE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
RETURN FALSE
|
|
ENDFUNC
|
|
|
|
/// PURPOSE:
|
|
/// This function determines if the car model name is of the needed type.
|
|
/// RETURNS:
|
|
/// TRUE if the car is the correct type.
|
|
FUNC BOOL GENERIC_LAUNCHER_CheckAgainstCarType(VEHICLE_TRIGGER_TYPE againstType)
|
|
SWITCH(againstType)
|
|
CASE LAUNCHER_VEHTYPE_ANY_VEH
|
|
IF IS_PED_IN_ANY_BOAT(PLAYER_PED_ID())
|
|
OR IS_PED_IN_ANY_HELI(PLAYER_PED_ID())
|
|
OR IS_PED_IN_ANY_PLANE(PLAYER_PED_ID())
|
|
RETURN FALSE
|
|
ELSE
|
|
RETURN IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
ENDIF
|
|
BREAK
|
|
|
|
DEFAULT
|
|
SCRIPT_ASSERT("Entered an unhandled vehicle type into GENERIC_LAUNCHER_CheckAgainstCarType. Please define your vehicle type, or put it in this switch.")
|
|
RETURN FALSE
|
|
BREAK
|
|
ENDSWITCH
|
|
|
|
RETURN TRUE
|
|
ENDFUNC
|
|
|
|
|
|
/// PURPOSE:
|
|
/// Checks to see if we are too close
|
|
/// RETURNS:
|
|
///
|
|
FUNC BOOL GENERIC_LAUNCHER_IS_PLAYER_TOO_CLOSE_TO_SPAWN_VEH()
|
|
IF IS_PED_INJURED(PLAYER_PED_ID())
|
|
RETURN FALSE
|
|
ENDIF
|
|
|
|
VECTOR vPlayerPos = GET_ENTITY_COORDS(PLAYER_PED_ID())
|
|
FLOAT fPlayerDist2 = VDIST2(vPlayerPos, vLaunchLocation)
|
|
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Checking if the player is too close to spawn launcher vehicle...")
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player distance:", fPlayerDist2, ". On-screen threshold:", LAUNCHER_VEHICLE_SPAWN_DISTANCE, ". Proximity threshold: ", LAUNCHER_TOO_CLOSE_DIST, ".")
|
|
|
|
IF fPlayerDist2 < LAUNCHER_TOO_CLOSE_DIST*LAUNCHER_TOO_CLOSE_DIST
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is very close. Blocking vehicle spawn.")
|
|
RETURN TRUE //should never get here, but in case we do
|
|
ELIF fPlayerDist2 < LAUNCHER_VEHICLE_SPAWN_DISTANCE*LAUNCHER_VEHICLE_SPAWN_DISTANCE
|
|
IF IS_SPHERE_VISIBLE(vLaunchLocation, 5.0)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is close and looking at the spawn location. Blocking vehicle spawn.")
|
|
RETURN TRUE
|
|
ELSE
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is close but not looking at the spawn location. Safe.")
|
|
RETURN FALSE
|
|
ENDIF
|
|
ENDIF
|
|
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is not close to the spawn location. Safe.")
|
|
RETURN FALSE
|
|
|
|
ENDFUNC
|
|
|
|
/// PURPOSE:
|
|
/// If we're in a vehicle trigger launcher, print notification that the player needs the right car to trigger it.
|
|
/// Turned into a function as I had to use this in a few places.
|
|
PROC GENERIC_LAUNCHER_PrintCarNotification()
|
|
#IF LAUNCHER_POINT_ENTER_IN_VEHICLE
|
|
// He wasn't in a correct vehicle type...
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_WRONG_VEHICLE_PRINTED)
|
|
IF NOT IS_HELP_MESSAGE_ON_SCREEN()
|
|
SET_BITMASK_ENUM_AS_ENUM(launcherFlags, LAUNCHER_WRONG_VEHICLE_PRINTED)
|
|
PRINT_HELP("RACE_AnyVeh")
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
ENDPROC
|
|
|
|
/// PURPOSE:
|
|
/// If we're in a vehicle trigger launcher, print notification that the player needs the right car to trigger it.
|
|
/// Turned into a function as I had to use this in a few places.
|
|
PROC GENERIC_LAUNCHER_PrintCarDmgNotification()
|
|
// Print the help once.
|
|
#IF LAUNCHER_POINT_ENTER_IN_VEHICLE
|
|
// Is the car too dmg'd to enter?
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_PRINTED_VEHICLE_DMG)
|
|
IF NOT IS_HELP_MESSAGE_ON_SCREEN()
|
|
PRINT_HELP("RACE_VehDmg")
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_PRINTED_VEHICLE_DMG)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
ENDPROC
|
|
|
|
/// PURPOSE:
|
|
/// If we're in a vehicle trigger launcher, print notification that the player needs to put out the fire on their car.
|
|
PROC GENERIC_LAUNCHER_PrintCarFireNotification()
|
|
// Print the help once.
|
|
#IF LAUNCHER_POINT_ENTER_IN_VEHICLE
|
|
// Is the car too dmg'd to enter?
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_PRINTED_VEHICLE_FIRE)
|
|
IF NOT IS_HELP_MESSAGE_ON_SCREEN()
|
|
PRINT_HELP("RACE_VehFire")
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_PRINTED_VEHICLE_FIRE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
ENDPROC
|
|
|
|
PROC CLEANUP_SCRIPT_ASSETS()
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher cleaning up assets in memory.")
|
|
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
IF DOES_ENTITY_EXIST(vehicleLaunch)
|
|
IF NOT IS_ENTITY_DEAD(vehicleLaunch)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up launcher vehicle.")
|
|
SET_ENTITY_AS_MISSION_ENTITY(vehicleLaunch, DEFAULT, TRUE)
|
|
SET_VEHICLE_AS_NO_LONGER_NEEDED(vehicleLaunch)
|
|
DELETE_VEHICLE(vehicleLaunch)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_SPAWNED_SCENE_CUSTOM)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Running launcher custom cleanup.")
|
|
LAUNCHER_CUSTOM_CLEANUP()
|
|
|
|
IF IS_THREAD_ACTIVE(threadInstance)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up active minigame thread.")
|
|
FORCE_CLEANUP_FOR_THREAD_WITH_THIS_ID(threadInstance, DEFAULT_FORCE_CLEANUP_FLAGS)
|
|
ENDIF
|
|
|
|
IF NOT IS_STRING_NULL(scriptToRun)
|
|
IF GET_LENGTH_OF_LITERAL_STRING(scriptToRun) <> 0
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Setting associated minigame script as no longer needed.")
|
|
SET_SCRIPT_AS_NO_LONGER_NEEDED(scriptToRun)
|
|
ENDIF
|
|
ENDIF
|
|
ENDPROC
|
|
|
|
|
|
PROC SCRIPT_CLEANUP(BOOL bTurnBlipOff = TRUE)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher cleaning up.")
|
|
|
|
IF bTurnBlipOff
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> bTurnBlipOff is true, so setting static blip inactive before terminating.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_THIS_HELP_MESSAGE_WITH_NUMBER_BEING_DISPLAYED(helpButtonPress, iPriceToLaunch)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Running custom associated script cleanup.")
|
|
LAUNCHER_CUSTOM_SCRIPT_END()
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
Mission_Over(iMissionCandInd)
|
|
ENDIF
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
|
|
CLEANUP_SCRIPT_ASSETS()
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Terminating launcher. Script: ", GET_THIS_SCRIPT_NAME(), ".")
|
|
TERMINATE_THIS_THREAD()
|
|
ENDPROC
|
|
|
|
|
|
|
|
#IF NOT LAUNCHER_OBJECT_ATTACHED
|
|
SCRIPT(COORDS_STRUCT inCoords)
|
|
vLaunchLocation = inCoords.vec_coord[0]
|
|
vLaunchLocation = vLaunchLocation
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Script ", GET_THIS_SCRIPT_NAME(), " starting as proximity based launcher.")
|
|
#ENDIF
|
|
#IF LAUNCHER_OBJECT_ATTACHED
|
|
SCRIPT(OBJECT_INDEX oObject)
|
|
COORDS_STRUCT inCoords
|
|
IF DOES_ENTITY_EXIST(oObject)
|
|
vLaunchLocation = GET_ENTITY_COORDS(oObject)
|
|
oScriptObject = oObject
|
|
inCoords.vec_coord[0] = vLaunchLocation
|
|
eAssociatedProp = GET_ENTITY_MODEL(oScriptObject)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Script ", GET_THIS_SCRIPT_NAME(), " starting as object-attached launcher. Object found.")
|
|
ELSE
|
|
oScriptObject = oObject
|
|
inCoords.vec_coord[0] = vLaunchLocation
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Script ", GET_THIS_SCRIPT_NAME(), " starting as object-attached launcher. Object not found!")
|
|
ENDIF
|
|
|
|
#ENDIF
|
|
vehicleLaunch = vehicleLaunch
|
|
scriptToRun = scriptToRun
|
|
BOOL bLaunchedAsFriend = FALSE
|
|
|
|
|
|
#IF LAUNCHER_DISABLE_FOR_MAGDEMO
|
|
IF (HAS_FORCE_CLEANUP_OCCURRED(FORCE_CLEANUP_FLAG_REPEAT_PLAY|FORCE_CLEANUP_FLAG_SP_TO_MP|FORCE_CLEANUP_FLAG_DEBUG_MENU|FORCE_CLEANUP_FLAG_MAGDEMO))
|
|
#IF IS_DEBUG_BUILD
|
|
STRING sForceCleanupReason
|
|
SWITCH GET_CAUSE_OF_MOST_RECENT_FORCE_CLEANUP()
|
|
CASE FORCE_CLEANUP_FLAG_REPEAT_PLAY sForceCleanupReason = "Repeat Play" BREAK
|
|
CASE FORCE_CLEANUP_FLAG_SP_TO_MP sForceCleanupReason = "SP to MP" BREAK
|
|
CASE FORCE_CLEANUP_FLAG_DEBUG_MENU sForceCleanupReason = "Debug Menu" BREAK
|
|
CASE FORCE_CLEANUP_FLAG_MAGDEMO sForceCleanupReason = "Mag Demo" BREAK
|
|
ENDSWITCH
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher forced to cleanup. Reason: ", sForceCleanupReason, " Script: ", GET_THIS_SCRIPT_NAME(), ".")
|
|
#ENDIF
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF NOT LAUNCHER_DISABLE_FOR_MAGDEMO
|
|
IF (HAS_FORCE_CLEANUP_OCCURRED(FORCE_CLEANUP_FLAG_REPEAT_PLAY|FORCE_CLEANUP_FLAG_SP_TO_MP|FORCE_CLEANUP_FLAG_DEBUG_MENU))
|
|
#IF IS_DEBUG_BUILD
|
|
STRING sForceCleanupReason
|
|
SWITCH GET_CAUSE_OF_MOST_RECENT_FORCE_CLEANUP()
|
|
CASE FORCE_CLEANUP_FLAG_REPEAT_PLAY sForceCleanupReason = "Repeat Play" BREAK
|
|
CASE FORCE_CLEANUP_FLAG_SP_TO_MP sForceCleanupReason = "SP to MP" BREAK
|
|
CASE FORCE_CLEANUP_FLAG_DEBUG_MENU sForceCleanupReason = "Debug Menu" BREAK
|
|
ENDSWITCH
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher forced to cleanup. Reason: ", sForceCleanupReason, " Script: ", GET_THIS_SCRIPT_NAME(), ".")
|
|
#ENDIF
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
|
|
#IF IS_DEBUG_BUILD
|
|
bDebugLaunched = bDebugLaunched
|
|
#ENDIF
|
|
|
|
|
|
pedPlayer = GET_PLAYER_PED(PLAYER_ID())
|
|
launcherState = STREAM_ASSETS
|
|
CLEAR_BITMASK_AS_ENUM(sLauncherData.iLauncherFlags, LAUNCHED_SCRIPT_MinigameFailed)
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Running launcher custom initialisation.")
|
|
LAUNCHER_CUSTOM_SCRIPT_INIT()
|
|
|
|
#IF LAUNCHER_HAS_TRIGGER_SCENE
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Flagging launcher as having trigger script streaming priority.")
|
|
SET_THIS_IS_A_TRIGGER_SCRIPT(TRUE)
|
|
#ENDIF
|
|
|
|
//Define this minigame's mission launch type based on whether it can be played on friend activities.
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_FRIEND_ACTIVITY)
|
|
CDEBUG2LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Setting launcher minigame type as MISSION_TYPE_MINIGAME_FRIENDS.")
|
|
eMinigameMissionType = MISSION_TYPE_MINIGAME_FRIENDS
|
|
ELSE
|
|
CDEBUG2LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Setting launcher minigame type as MISSION_TYPE_MINIGAME.")
|
|
eMinigameMissionType = MISSION_TYPE_MINIGAME
|
|
ENDIF
|
|
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_INIT_DATA()
|
|
#ENDIF
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Starting to wait for minigame blip states to be restored...")
|
|
WHILE NOT g_bMinigameBlipsRestored
|
|
WAIT(0)
|
|
ENDWHILE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> ...Finished waiting for minigame blip states to be restored.")
|
|
|
|
// If any other mission is running. Only if we don't have a very special flag to run despite a mission.
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_RUN_DESPITE_MISSION)
|
|
|
|
// Check if a mission type is running that minigames are not allowed to launch over
|
|
// the top of. If so we need to back out of the approach and clean up. All mission
|
|
// launch relationships defined in candidate_public.sch.
|
|
// Note: The minigame blips will automatically turn on and off to match this result.
|
|
IF NOT CAN_MISSION_TYPE_START_AGAINST_CURRENT_TYPE(eMinigameMissionType)
|
|
#if USE_CLF_DLC
|
|
IF GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_CLF_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#if USE_NRM_DLC
|
|
IF GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_NRM_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#if not USE_CLF_DLC
|
|
#if not USE_NRM_DLC
|
|
IF GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#endif
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher needs to cleanup due to another mission launching.")
|
|
#IF IS_DEBUG_BUILD
|
|
PRINTLN(GET_THIS_SCRIPT_NAME(), " going to cleanup since its not allowed to run when another mission is running... g_OnMissionState = ", GET_MISSION_TYPE_DEBUG_STRING(g_OnMissionState))
|
|
#ENDIF
|
|
SCRIPT_CLEANUP(FALSE)//cleanup script, but let the blip_controller handle the blip.
|
|
ELSE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher cleaning up as the minigame isn't active in the flow yet.")
|
|
PRINTLN(GET_THIS_SCRIPT_NAME(), " **** Bitset bit not active for this launcher ****")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// Does this launcher have a scene that might still run even if the player can't play?
|
|
IF (eMinigame != MINIGAME_NONE)
|
|
#if USE_CLF_DLC
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_CLF_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
#endif
|
|
#if USE_NRM_DLC
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_NRM_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
#endif
|
|
#if not USE_CLF_DLC
|
|
#if not USE_NRM_DLC
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
#endif
|
|
#endif
|
|
#IF LAUNCHER_HAS_SCENE
|
|
bPlayerCanPlay = FALSE
|
|
#ENDIF
|
|
|
|
#IF NOT LAUNCHER_HAS_SCENE
|
|
PRINTLN(GET_THIS_SCRIPT_NAME(), " **** Bitset bit not active for this launcher ****")
|
|
SCRIPT_CLEANUP()
|
|
#ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_FORCED_ON_INIT)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Shutting down as flagged to clean up on init.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_FOR_MISSION_LEADIN)
|
|
AND (IS_MISSION_LEADIN_WITH_HIGH_MEMORY_ACTIVE() AND NOT IS_HIGH_MEMORY_PC())
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Shutting down as flagged to clean up when a high memory lead-in is active nearby.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Starting ", scriptName, " launcher at ", vLaunchLocation, ".")
|
|
IF GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(GET_HASH_OF_THIS_SCRIPT_NAME()) > 1 AND NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_ALLOW_MULTIPLE_COPIES)
|
|
// If there is already a golf launcher up, kill this version. This could happen because of the launch/kill hysteresis
|
|
PRINTLN("This launcher script already has another instance running. Killing this one.")
|
|
//prevent the blip from being destroyed.
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
ENDIF
|
|
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
|
|
//perform check once
|
|
#IF LAUNCHER_CHECK_SPAWN_DIST
|
|
IF NOT DOES_ENTITY_EXIST(vehicleLaunch) #IF IS_DEBUG_BUILD AND NOT bDebugLaunched #ENDIF
|
|
IF GENERIC_LAUNCHER_IS_PLAYER_TOO_CLOSE_TO_SPAWN_VEH() AND NOT g_bPlayerIsInTaxi
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Sending launcher to sleep as the player is too near the spawn vehicle.")
|
|
LAUNCHER_GOTO_SLEEP(ASLEEP_WAITING_FOR_PLAYER_TO_SPAWN_VEH)
|
|
ELIF g_bPlayerIsInTaxi
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Noted player is in a taxi.")
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Wipe all misc player characters in the world but us. - #352650 RyanP
|
|
// This breaks a lot of things.
|
|
//SET_AMBIENT_PLAYER_CHARS_AS_NO_LONGER_NEEDED()
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Starting launcher main loop...")
|
|
WHILE (TRUE)
|
|
|
|
#IF LAUNCHER_DISABLE_FOR_MAGDEMO
|
|
IF g_bMagDemoActive
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up due to magdemo running.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_COLLECTORS_AND_SPECIAL_EDITION_ONLY
|
|
IF NOT IS_COLLECTORS_EDITION_GAME()
|
|
AND NOT IS_SPECIAL_EDITION_GAME()
|
|
AND NOT IS_JAPANESE_SPECIAL_EDITION_GAME()
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher is CE/SE only and this game isn't SE, CE or JSE. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Snap the inCoords to the ground if we need to.
|
|
#IF LAUNCHER_SNAP_CHECKPOINT_TO_GROUND
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_ALREADY_SNAPPED_CP)
|
|
FLOAT gndZ = 0.0
|
|
IF GET_GROUND_Z_FOR_3D_COORD(inCoords.VEC_COORD[0], gndZ)
|
|
IF (gndZ <> 0.0)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher checkpoint was found to be floating. Snapped to ground.")
|
|
inCoords.VEC_COORD[0].z = gndZ
|
|
SET_BITMASK_ENUM_AS_ENUM(launcherFlags, LAUNCHER_ALREADY_SNAPPED_CP)
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Getting the player ped only ONCE up above was okay, but that didn't account for swapping the
|
|
// player ped close to the event. We need to handle that.
|
|
pedPlayer = GET_PLAYER_PED(PLAYER_ID())
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_ON_PLAYER_DEATH)
|
|
IF IS_ENTITY_DEAD(pedPlayer)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> The player is dead. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF DOES_ENTITY_EXIST(pedPlayer)
|
|
AND NOT IS_ENTITY_DEAD(pedPlayer)
|
|
vPlayerLocation = GET_ENTITY_COORDS(pedPlayer)
|
|
fPlayerDistToLauncher = VDIST2(vPlayerLocation, inCoords.VEC_COORD[0])
|
|
fPlayerDistToLauncher = fPlayerDistToLauncher
|
|
|
|
vFlattenedPlayerLocation = vPlayerLocation
|
|
vFlattenedLauncherLocation = inCoords.VEC_COORD[0]
|
|
vFlattenedPlayerLocation.z = 0
|
|
vFlattenedLauncherLocation.z = 0
|
|
fFlatSquaredPlayerDistanceToLauncher = VDIST2(vFlattenedPlayerLocation, vFlattenedLauncherLocation)
|
|
|
|
SWITCH launcherState
|
|
CASE STREAM_ASSETS
|
|
|
|
// Check if a mission type is running that minigames are not allowed to launch over
|
|
// the top of. If so we need to back out and clean up unless explicitly flagged to
|
|
// continue.
|
|
IF CAN_MISSION_TYPE_START_AGAINST_CURRENT_TYPE(eMinigameMissionType)
|
|
OR (IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_NEED_SETUP_ON_MISSION) AND NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_FOR_MISSION_LEADIN)) //if we need a setup during mission and we're NOT flagged as a high memory launcher then
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Checking distance from launcher before loading assets...")
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player-location:(", vFlattenedPlayerLocation.x, ",", vFlattenedPlayerLocation.y, ") Launcher-pos:(", vFlattenedLauncherLocation.x, ",", vFlattenedLauncherLocation.y, ")")
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> PlayerDistSqrToLauncher:", fFlatSquaredPlayerDistanceToLauncher, " ThresholdDistSqr:", DEFAULT_CUTSCENE_LOAD_DIST*DEFAULT_CUTSCENE_LOAD_DIST, ".")
|
|
|
|
#IF LAUNCHER_HAS_CUT_SCENE
|
|
IF fFlatSquaredPlayerDistanceToLauncher < DEFAULT_CUTSCENE_LOAD_DIST*DEFAULT_CUTSCENE_LOAD_DIST
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Requesting launcher vehicle model.")
|
|
REQUEST_MODEL(vehicleModel)
|
|
#ENDIF
|
|
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Running launcher custom request assets.")
|
|
LAUNCHER_CUSTOM_REQUEST_ASSETS()
|
|
|
|
SWITCH_LAUNCHER_STATE(STREAMING_WAIT)
|
|
|
|
#IF LAUNCHER_HAS_CUT_SCENE
|
|
ELSE
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is too far from the launcher. Waiting to load assets.")
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
ELSE
|
|
// If we've moved too far away, just exit.
|
|
IF fFlatSquaredPlayerDistanceToLauncher > fLauncherShutdownDist*fLauncherShutdownDist
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player past shut down distance for launcher. Cleaning up.")
|
|
|
|
//Prevent the blip from being destroyed.
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Keeping launcher blip alive as launcher shuts down.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
|
|
IF vPlayerLocation.z - inCoords.VEC_COORD[0].z > 500
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher is too far below player.")
|
|
ENDIF
|
|
ENDIF
|
|
BREAK
|
|
|
|
CASE STREAMING_WAIT
|
|
|
|
#IF IS_DEBUG_BUILD
|
|
IF (GET_FRAME_COUNT() % 120) = 0
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Waiting for assets to stream in.")
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
IF LAUNCHER_CUSTOM_ASSETS_LOADED()
|
|
#IF LAUNCHER_POINT_ENTER
|
|
#IF NOT LAUNCHER_DONT_CHECK_RELOAD_RANGE
|
|
AND fPlayerDistToLauncher > ((fLaunchScriptDist*1.5)*(fLaunchScriptDist*1.5))
|
|
#ENDIF
|
|
#ENDIF
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
AND HAS_MODEL_LOADED(vehicleModel)
|
|
#IF NOT LAUNCHER_DONT_CHECK_RELOAD_RANGE
|
|
AND fPlayerDistToLauncher > ((LOCATE_SIZE_ON_FOOT_ONLY+2.0)*(LOCATE_SIZE_ON_FOOT_ONLY+2.0))
|
|
#ENDIF
|
|
#ENDIF
|
|
eTransMode = eTransMode
|
|
SWITCH_LAUNCHER_STATE(APPROACH_WAIT)
|
|
ELSE
|
|
LAUNCHER_CUSTOM_REQUEST_ASSETS()
|
|
ENDIF
|
|
BREAK
|
|
|
|
CASE APPROACH_WAIT
|
|
|
|
IF NETWORK_IS_IN_SESSION()
|
|
PRINTLN("NETWORK_IS_IN_SESSION() returning true. Cleaning up launcher")
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Network session started. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
EXIT
|
|
ENDIF
|
|
|
|
// Check if a mission type is running that minigames are not allowed to launch over
|
|
// the top of. If so we need to back out and clean up.
|
|
IF NOT CAN_MISSION_TYPE_START_AGAINST_CURRENT_TYPE(eMinigameMissionType)
|
|
|
|
//PRINTLN("Mission is flagged as running...")
|
|
// This would send us back to the top but leave us running. Instead, we're going to terminate.
|
|
//CLEANUP_SCRIPT_ASSETS
|
|
//SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
//EXIT
|
|
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_RUN_DESPITE_MISSION)
|
|
BOOL bForceCleanMission
|
|
bForceCleanMission = TRUE
|
|
|
|
// If a mission is forcing us to clean... make sure it's not us...
|
|
IF ARE_STRINGS_EQUAL(g_replay.replayScriptName, scriptToRun)
|
|
scriptToRun = scriptName
|
|
bForceCleanMission = FALSE
|
|
ENDIF
|
|
|
|
IF bForceCleanMission
|
|
PRINTLN(GET_THIS_SCRIPT_NAME(), " is cleaning up due to mission running in approach wait.")
|
|
SCRIPT_CLEANUP(FALSE)//cleanup script, but let the blip_controller handle the blip.
|
|
BREAK
|
|
ENDIF
|
|
ENDIF
|
|
|
|
ENDIF
|
|
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
IF NOT DOES_ENTITY_EXIST(vehicleLaunch)
|
|
AND (((fPlayerDistToLauncher > LAUNCHER_TOO_CLOSE_DIST*LAUNCHER_TOO_CLOSE_DIST AND NOT IS_SPHERE_VISIBLE(inCoords.VEC_COORD[0], 5))
|
|
OR (fPlayerDistToLauncher > LAUNCHER_VEHICLE_SPAWN_DISTANCE*LAUNCHER_VEHICLE_SPAWN_DISTANCE)) //if we're close, check the visibility. If we're far, dont check.
|
|
OR (NOT DOES_ENTITY_EXIST(vehicleLaunch) AND IS_SCREEN_FADED_OUT())
|
|
#IF IS_DEBUG_BUILD OR bDebugLaunched #ENDIF )
|
|
|
|
CLEAR_AREA_OF_VEHICLES(inCoords.VEC_COORD[0], 8.0)
|
|
vehicleLaunch = CREATE_VEHICLE(vehicleModel, inCoords.VEC_COORD[0], vehicleHeading)
|
|
|
|
INCREMENT_MINIGAMES_LOADED_COUNT()
|
|
|
|
SET_VEHICLE_HAS_STRONG_AXLES(vehicleLaunch, TRUE)
|
|
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Created launcher vehicle at position ", inCoords.VEC_COORD[0], " with heading ", vehicleHeading, ".")
|
|
|
|
#IF LAUNCHER_REPLAYS_ENABLED
|
|
IF bIsReplayLaunch
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Automatically warping the player into launcher vehicle for replay restart.")
|
|
SET_PED_INTO_VEHICLE(pedPlayer, vehicleLaunch)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
//If we're a replay, we actually don't lock.
|
|
BOOL bIgnoreLock
|
|
bIgnoreLock = FALSE
|
|
#IF LAUNCHER_REPLAYS_ENABLED
|
|
bIgnoreLock = bIsReplayLaunch
|
|
#ENDIF
|
|
|
|
// Lock the doors while on a mission.
|
|
IF IS_CURRENTLY_ON_MISSION_OF_ANY_TYPE() AND NOT bIgnoreLock
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Locking launcher vehicle doors as we go on-mission.")
|
|
SET_VEHICLE_DOORS_LOCKED(vehicleLaunch, VEHICLELOCK_LOCKED)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_SHOULD_UNLOCK_CARS)
|
|
ENDIF
|
|
|
|
ELSE
|
|
// Unlock the doors when the mission is over.
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHOULD_UNLOCK_CARS)
|
|
IF NOT IS_CURRENTLY_ON_MISSION_OF_ANY_TYPE()
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Unlocking launcher vehicle doors as we come off-mission.")
|
|
IF NOT IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_VEHICLE_DOORS_LOCKED(vehicleLaunch, VEHICLELOCK_UNLOCKED)
|
|
ENDIF
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_SHOULD_UNLOCK_CARS)
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Scene spawning.
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SPAWNED_SCENE_CUSTOM)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Spawning custom scene.")
|
|
LAUNCHER_CUSTOM_SPAWN_SCENE()
|
|
SET_BITMASK_ENUM_AS_ENUM(launcherFlags, LAUNCHER_SPAWNED_SCENE_CUSTOM)
|
|
ENDIF
|
|
|
|
// Check to see if we need to quit first...
|
|
IF fFlatSquaredPlayerDistanceToLauncher > (fLauncherShutdownDist*fLauncherShutdownDist) AND NOT g_bLaunchMinigameReplay
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is too far from launcher. Starting cleanup.")
|
|
|
|
//Prevent the blip from being destroyed on cleanup.
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
|
|
//B* 2054078, 2039255: Only check visiblity if on friend activity
|
|
IF IS_CURRENTLY_ON_MISSION_OF_TYPE(MISSION_TYPE_FRIEND_ACTIVITY)
|
|
AND NOT IS_STATIC_BLIP_CURRENTLY_VISIBLE(eLauncherStaticBlip)
|
|
//Do nothing as we don't want this reappearing when in a friend activity
|
|
ELSE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Setting static blip active as cleanup starts.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE) //Not needed, already active
|
|
eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
ENDIF
|
|
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ELSE
|
|
scriptToRun = scriptName
|
|
|
|
// Don't do any launch checks if we're on a refused friend activity. But first, see if the launcher is refusing us.
|
|
BOOL bUpdateLaunch
|
|
bUpdateLaunch = NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SCRIPT_NOT_ALLOWING_RUN)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
|
|
// Make sure we can run in general
|
|
IF NOT IS_AMBIENT_SCRIPT_ALLOWED_TO_RUN(RUN_ON_MISSION_NEVER) AND NOT g_bLaunchMinigameReplay
|
|
|
|
// This may be a terminate condition...
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_IF_MISSION_RUNNING)
|
|
|
|
// We may be being ordered to shutdown.
|
|
// Shutdown if we're not a friend activity, or the friend doesn't exist. Also, make sure we're not a replay.
|
|
IF (NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_FRIEND_ACTIVITY) OR
|
|
NOT DOES_ENTITY_EXIST(FRIEND_A_PED_ID())) AND NOT g_bLaunchMinigameReplay
|
|
PRINTLN("APPROACH_WAIT: minigame not allowed to start, killing myself!")
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
BREAK
|
|
ENDIF
|
|
|
|
ENDIF
|
|
|
|
ENDIF
|
|
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_FOR_MISSION_LEADIN)
|
|
AND (IS_MISSION_LEADIN_WITH_HIGH_MEMORY_ACTIVE() AND NOT IS_HIGH_MEMORY_PC())
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up due to high memory lead-in being active.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
|
|
IF IS_PLAYER_ON_BOOTY_CALL()
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player is on a booty call. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
|
|
IF NOT IS_IT_SAFE_TO_TRIGGER_SCRIPT_TYPE(ST_MINIGAME) OR g_bPlayerIsInTaxi OR GENERIC_LAUNCHER_IsPlayerUsingWeapon()
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "IS_IT_SAFE_TO_TRIGGER_SCRIPT_TYPE(ST_MINIGAME) is... (1 for true)", IS_IT_SAFE_TO_TRIGGER_SCRIPT_TYPE(ST_MINIGAME))
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "GENERIC_LAUNCHER_IsPlayerUsingWeapon() is... (1 for true)", GENERIC_LAUNCHER_IsPlayerUsingWeapon())
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "Can't update since its not safe to trigger a MG, or the player is using a weapon!")
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_ATTACK) (1 for yes) ", IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_ATTACK))
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_AIM) (1 for yes) ", IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_AIM))
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_DETONATE) (1 for yes) ", IS_CONTROL_PRESSED(PLAYER_CONTROL, INPUT_DETONATE))
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "IS_PLAYER_TARGETTING_ANYTHING(PLAYER_ID()) (1 for yes) ", IS_PLAYER_TARGETTING_ANYTHING(PLAYER_ID()))
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "g_bPlayerIsInTaxi is... (1 for true)", g_bPlayerIsInTaxi)
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
// We were refused by a flow flag, but still want to update the scene.
|
|
#IF LAUNCHER_HAS_SCENE
|
|
IF NOT bPlayerCanPlay
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("bPlayerCanPlay is FALSE")
|
|
#ENDIF
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Can't run a friend activity, but we're a friend activity.
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_FRIEND_ACTIVITY)
|
|
IF NOT LAUNCHER_CAN_RUN_FRIEND_ACTIVITY()
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Can't run a friend activity")
|
|
#ENDIF
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// Can't launch with a selector onscreen.
|
|
IF IS_SELECTOR_ONSCREEN()
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Selector on screen")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
IF g_bInMultiplayer
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("In multiplayer")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
IF Is_Player_Timetable_Scene_In_Progress()
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Timetable scene in progress")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
IF IS_PLAYER_SWITCH_IN_PROGRESS()
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player switch in progress")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
// Buncha checks...
|
|
IF (IS_CUSTOM_MENU_ON_SCREEN())
|
|
OR (IS_SCRIPT_HUD_DISPLAYING(HUDPART_TRANSITIONHUD))
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Script HUD or custom menu on screen")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
// Can't launch if we don't have control!
|
|
IF NOT CAN_PLAYER_START_MISSION(PLAYER_ID())
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player not in a safe state to start mission")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
#IF NOT LAUNCHER_IGNORE_PLAYER_CONTROL
|
|
IF NOT IS_PLAYER_SCRIPT_CONTROL_ON(PLAYER_ID())
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player control off")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Can't launch minigame with the phone up. - #260195
|
|
// Really the bug was for being in a phonecall, but this should cover everything
|
|
IF IS_PHONE_ONSCREEN() OR IS_BROWSER_OPEN()
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Phone on screen")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
|
|
// If we're still allowed to launch, do it.
|
|
IF bUpdateLaunch
|
|
// See if we're the right char.
|
|
#IF LAUNCHER_CHAR_REQUIRED
|
|
IF NOT IS_PED_THE_CURRENT_PLAYER_PED(characterRequired)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player incorrect character")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// We're in a volume check.
|
|
#IF LAUNCHER_VOL_BUTTON_PRESS
|
|
IF (NOT IS_ENTITY_IN_ANGLED_AREA(PLAYER_PED_ID(), vVolPt1, vVolPt2, fVolWidth, TRUE, FALSE, eTransMode))
|
|
OR (fMaxTriggerDist > 0.0 AND GET_DISTANCE_BETWEEN_COORDS(GET_ENTITY_COORDS(PLAYER_PED_ID()), LERP_VECTOR(vVolPt1, vVolPt2, 0.5), FALSE) > fMaxTriggerDist)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player not in trigger area")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELIF fVolHeight > 0
|
|
IF ABSF(vPlayerLocation.z - vVolPt1.z) > fVolHeight
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player not in trigger area after height check")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// We may be a point enter.
|
|
#IF LAUNCHER_POINT_ENTER
|
|
#IF LAUNCHER_POINT_AUTO_TRIGGER_IN_VEHICLE
|
|
IF IS_PED_IN_ANY_VEHICLE(pedPlayer)
|
|
IF NOT IS_ENTITY_AT_COORD( GET_VEHICLE_PED_IS_IN(pedPlayer), inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, 20.0>>,
|
|
FALSE, FALSE, eTransMode)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't close enough to trigger point (in veh)")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ELSE
|
|
IF NOT IS_ENTITY_AT_COORD( pedPlayer, inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, LOCATE_SIZE_HEIGHT>>,
|
|
FALSE, TRUE, eTransMode)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't close enough to trigger point")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_POINT_TRIGGER_WITH_FRIEND_IN_VEHICLE
|
|
IF IS_PED_IN_ANY_VEHICLE(pedPlayer)
|
|
IF NOT IS_ENTITY_AT_COORD( GET_VEHICLE_PED_IS_IN(pedPlayer), inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, 20.0>>,
|
|
FALSE, FALSE, eTransMode)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't close enough to trigger point (with friend in veh)")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ELSE
|
|
IF NOT IS_ENTITY_AT_COORD( pedPlayer, inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, LOCATE_SIZE_HEIGHT>>,
|
|
FALSE, TRUE, eTransMode)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't close enough to trigger point (with friend)")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF NOT LAUNCHER_POINT_AUTO_TRIGGER_IN_VEHICLE
|
|
#IF NOT LAUNCHER_POINT_TRIGGER_WITH_FRIEND_IN_VEHICLE
|
|
IF NOT IS_ENTITY_AT_COORD( pedPlayer, inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, LOCATE_SIZE_HEIGHT>>,
|
|
FALSE, TRUE, eTransMode)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't close enough to trigger point (autotrigger in veh)")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
#ENDIF
|
|
|
|
#ENDIF
|
|
|
|
// Try to see if we can see the prop.
|
|
#IF LAUNCHER_OBJECT_ATTACHED
|
|
IF IS_ENTITY_DEAD(oScriptObject)
|
|
// We don't have the prop? Can we find it? Anyway, return FALSE this update.
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Launcher object not found")
|
|
#ENDIF
|
|
oScriptObject = GET_CLOSEST_OBJECT_OF_TYPE(vLaunchLocation, 2.0, eAssociatedProp)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
bUpdateLaunch = FALSE
|
|
ELSE
|
|
vObjectLOSCoords = GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(oScriptObject, vObjectLOSOffset)
|
|
IF COMPUTE_LOS_BETWEEN_COORDS(ObjAttachedArgs, vPlayerLocation, vObjectLOSCoords, oScriptObject)
|
|
bFailedLOSCheck = FALSE
|
|
ELSE
|
|
//we dont know if we can see shit
|
|
IF ObjAttachedArgs.bFailedLosCheck = TRUE
|
|
//now we know we cant see shit
|
|
bFailedLOSCheck = TRUE
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF bFailedLOSCheck
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Launcher object not in line of sight")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF NOT bStreamsCheck
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// See if we're in the correct interior
|
|
#IF LAUNCHER_CHECK_INTERIOR
|
|
IF (GET_INTERIOR_FROM_ENTITY(PLAYER_PED_ID()) <> eInterior)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player not in launcher interior")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_CHECK_FOR_FIRE
|
|
IF GET_NUMBER_OF_FIRES_IN_RANGE(vLaunchLocation, fLaunchScriptDist) > 0
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Fire in launch area")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_POINT_ENTER_IN_VEHICLE
|
|
// If he's not in a vehicle, or he's in a plane, boat, or heli, don't launch.
|
|
IF (IS_PED_IN_ANY_BOAT(PLAYER_PED_ID()) OR IS_PED_IN_ANY_HELI(PLAYER_PED_ID()) OR IS_PED_IN_ANY_PLANE(PLAYER_PED_ID()))
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_THIS_HELP_MESSAGE_WITH_NUMBER_BEING_DISPLAYED(helpButtonPress, iPriceToLaunch)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
GENERIC_LAUNCHER_PrintCarNotification()
|
|
ELSE
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_WRONG_VEHICLE_PRINTED)
|
|
ENDIF
|
|
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player in plane, boat or heli")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELSE
|
|
IF IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
VEHICLE_INDEX tempVeh
|
|
tempVeh = GET_VEHICLE_PED_IS_USING(PLAYER_PED_ID())
|
|
|
|
IF NOT (GET_PED_IN_VEHICLE_SEAT(tempVeh) = PLAYER_PED_ID())
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_THIS_HELP_MESSAGE_WITH_NUMBER_BEING_DISPLAYED(helpButtonPress, iPriceToLaunch)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
GENERIC_LAUNCHER_PrintCarNotification()
|
|
ELSE
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_WRONG_VEHICLE_PRINTED)
|
|
ENDIF
|
|
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player is not the driver of vehicle")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELSE
|
|
#IF NOT LAUNCHER_IGNORE_VEHICLE_HEALTH
|
|
// Player's in the vehicle seat. Normally, we'd launch. Make sure the vehicle has enough health now.
|
|
IF (GET_ENTITY_HEALTH(tempVeh) <= 5) OR IS_ENTITY_ON_FIRE(tempVeh)
|
|
#ENDIF
|
|
#IF LAUNCHER_IGNORE_VEHICLE_HEALTH
|
|
IF IS_ENTITY_ON_FIRE(tempVeh)
|
|
#ENDIF
|
|
// Vehicle is too damaged to enter.
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_THIS_HELP_MESSAGE_WITH_NUMBER_BEING_DISPLAYED(helpButtonPress, iPriceToLaunch)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
GENERIC_LAUNCHER_PrintCarDmgNotification()
|
|
ELSE
|
|
// Clear that we printed the help.
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_PRINTED_VEHICLE_DMG)
|
|
ENDIF
|
|
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Launch vehicle health too low")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// If we find that we're eventually in a correct vehicle, clear the bit associated with this.
|
|
IF bUpdateLaunch
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_WRONG_VEHICLE_PRINTED)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// May need to be a vehicle enter. If so, make sure the vehicle is at teh start pos too.
|
|
#IF LAUNCHER_VEHICLE_ENTER
|
|
#IF NOT LAUNCHER_VEHICLE_GETTING_IN
|
|
IF IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Launch vehicle dead")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELIF NOT IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't in launch vehicle")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELSE
|
|
VEHICLE_INDEX tempVeh
|
|
tempVeh = GET_VEHICLE_PED_IS_USING(PLAYER_PED_ID())
|
|
|
|
#IF NOT LAUNCHER_VEHICLE_ENTER_ANY_SEAT
|
|
IF NOT (GET_PED_IN_VEHICLE_SEAT(tempVeh, VS_DRIVER) = PLAYER_PED_ID())
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't in launch vehicle driving seat")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
IF bUpdateLaunch
|
|
IF (vehicleLaunch = tempVeh)
|
|
#IF NOT LAUNCHER_VEHICLE_IGNORE_PROXIMITY
|
|
// So here, the player is in the target vehicle. Make sure it's at the launch spot.
|
|
IF NOT IS_ENTITY_AT_COORD(pedPlayer, inCoords.VEC_COORD[0], <<LOCATE_SIZE_ON_FOOT_ONLY, LOCATE_SIZE_ON_FOOT_ONLY, LOCATE_SIZE_HEIGHT>>)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player in launch vehicle at incorrect position")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
ELSE
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player is in vehicle other than launch vehicle")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_VEHICLE_GETTING_IN
|
|
|
|
IF DOES_ENTITY_EXIST(vehicleLaunch)
|
|
//IF IS_PED_IN_VEHICLE(PLAYER_PED_ID(), vehicleLaunch)
|
|
IF NOT IS_ENTITY_AT_COORD(vehicleLaunch, vLaunchLocation, <<fHelpTextScriptDist , fHelpTextScriptDist, fHelpTextScriptDist>>)
|
|
CDEBUG3LN(DEBUG_MISSION, " - generic_launcher - SCRIPT - CASE APPROACH_WAIT - Player is in the vehicle or vehicle not on launch spot - Setting launcherState to UNLOAD_ASSETS.")
|
|
//SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Vehicle not on launch spot - Setting launcherState to UNLOAD_ASSETS.")
|
|
#ENDIF
|
|
//bUpdateLaunch = FALSE
|
|
SWITCH_LAUNCHER_STATE(UNLOAD_ASSETS)
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Launch vehicle is dead")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELIF NOT IS_PED_GETTING_INTO_A_VEHICLE(PLAYER_PED_ID())
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player not entering any vehicle")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ELSE
|
|
VEHICLE_INDEX tempVeh
|
|
tempVeh = GET_VEHICLE_PED_IS_ENTERING(PLAYER_PED_ID())
|
|
|
|
IF bUpdateLaunch
|
|
IF (vehicleLaunch = tempVeh)
|
|
#IF NOT LAUNCHER_VEHICLE_IGNORE_PROXIMITY
|
|
// So here, the player is in the target vehicle. Make sure it's at the launch spot.
|
|
IF NOT IS_ENTITY_AT_COORD(pedPlayer, inCoords.VEC_COORD[0], <<LOCATE_SIZE_ON_FOOT_ONLY, LOCATE_SIZE_ON_FOOT_ONLY, LOCATE_SIZE_HEIGHT>>)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player in launch vehicle at incorrect position")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
ELSE
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player is in vehicle other than launch vehicle")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
#ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_POINT_AUTO_TRIGGER_IN_VEHICLE
|
|
IF NOT IS_ENTITY_AT_COORD(pedPlayer, inCoords.VEC_COORD[0], <<fLaunchScriptDist, fLaunchScriptDist, LOCATE_SIZE_HEIGHT>>)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player in launch vehicle at incorrect position")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Can only run during certain times of day.
|
|
#IF LAUNCHER_TIME_RESTRICTED
|
|
INT iCurHour
|
|
iCurHour = GET_CLOCK_HOURS()
|
|
IF iAvailableAfterHour > iAvailableBeforeHour
|
|
IF (iCurHour < iAvailableAfterHour) AND (iCurHour >= iAvailableBeforeHour)
|
|
// The current time of day does not fall within the acceptable hours.
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Incorrect time of day")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
|
|
// If the player is within range, notify him.
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
PRINT_HELP_WITH_TWO_NUMBERS("MG_NA_TIME", iAvailableAfterHour, iAvailableBeforeHour)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
ENDIF
|
|
ELSE
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
IF (iCurHour < iAvailableAfterHour) OR (iCurHour >= iAvailableBeforeHour)
|
|
// The current time of day does not fall within the acceptable hours.
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Incorrect time of day")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
// If the player is within range, notify him.
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
PRINT_HELP_WITH_TWO_NUMBERS("MG_NA_TIME", iAvailableAfterHour, iAvailableBeforeHour)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
ENDIF
|
|
ELSE
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_TOD_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF bUpdateLaunch AND (GET_TOTAL_CASH(GET_CURRENT_PLAYER_PED_ENUM()) < iPriceToLaunch)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Not enough money")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_PRICE_NOTIFIED)
|
|
// tell player how poor he is
|
|
PRINT_HELP_WITH_NUMBER("MG_YOU_IS_BROKE", iPriceToLaunch)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_PRICE_NOTIFIED)
|
|
ENDIF
|
|
ELSE
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_PRICE_NOTIFIED)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_PED_VARIATIONS
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
IF NOT IS_PED_INJURED(PLAYER_PED_ID()) AND NOT IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
IF GET_CURRENT_PLAYER_PED_ENUM() = CHAR_MICHAEL
|
|
IF michaelVariations.pedCompTorsoDrw >= 0 AND michaelVariations.pedCompTorsoTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> michaelVariations.pedCompTorsoDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> michaelVariations.pedCompTorsoTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Michael has incorrect torso variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player torso")
|
|
ENDIF
|
|
IF michaelVariations.pedCompLegDrw >= 0 AND michaelVariations.pedCompLegTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> michaelVariations.pedCompLegDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> michaelVariations.pedCompLegTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Michael has incorrect leg variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player legs")
|
|
ENDIF
|
|
IF michaelVariations.pedCompFeetDrw >= 0 AND michaelVariations.pedCompFeetTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> michaelVariations.pedCompFeetDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> michaelVariations.pedCompFeetTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Michael has incorrect foot variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player feet")
|
|
ENDIF
|
|
ELIF GET_CURRENT_PLAYER_PED_ENUM() = CHAR_FRANKLIN
|
|
IF franklinVariations.pedCompTorsoDrw >= 0 AND franklinVariations.pedCompTorsoTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> franklinVariations.pedCompTorsoDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> franklinVariations.pedCompTorsoTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Franklin has incorrect torso variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player torso")
|
|
ENDIF
|
|
IF franklinVariations.pedCompLegDrw >= 0 AND franklinVariations.pedCompLegTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> franklinVariations.pedCompLegDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> franklinVariations.pedCompLegTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Franklin has incorrect leg variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player legs")
|
|
ENDIF
|
|
IF franklinVariations.pedCompFeetDrw >= 0 AND franklinVariations.pedCompFeetTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> franklinVariations.pedCompFeetDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> franklinVariations.pedCompFeetTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Franklin has incorrect foot variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player feet")
|
|
ENDIF
|
|
ELIF GET_CURRENT_PLAYER_PED_ENUM() = CHAR_TREVOR
|
|
IF trevorVariations.pedCompTorsoDrw >= 0 AND trevorVariations.pedCompTorsoTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> trevorVariations.pedCompTorsoDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_TORSO) <> trevorVariations.pedCompTorsoTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Trevor has incorrect torso variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player torso")
|
|
ENDIF
|
|
IF trevorVariations.pedCompLegDrw >= 0 AND trevorVariations.pedCompLegTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> trevorVariations.pedCompLegDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_LEG) <> trevorVariations.pedCompLegTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Trevor has incorrect leg variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player legs")
|
|
ENDIF
|
|
IF trevorVariations.pedCompFeetDrw >= 0 AND trevorVariations.pedCompFeetTxt >= 0
|
|
IF GET_PED_DRAWABLE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> trevorVariations.pedCompFeetDrw
|
|
OR GET_PED_TEXTURE_VARIATION(PLAYER_PED_ID(), PED_COMP_FEET) <> trevorVariations.pedCompFeetTxt
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Trevor has incorrect foot variations")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED) AND NOT IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(outfitHelpLabel)
|
|
PRINT_HELP(outfitHelpLabel)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
PRINTLN("Skipping component variation check on player feet")
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_OUTFIT_NOTIFIED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_ON_FOOT_RESTRICTED
|
|
IF (fPlayerDistToLauncher < (fLaunchScriptDist*fLaunchScriptDist) + 4.0)
|
|
IF IS_PED_IN_ANY_VEHICLE(PLAYER_PED_ID())
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_BLIP_INACTIVE)
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player isn't on foot")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
// tell player he can only start on foot
|
|
PRINT_HELP("MG_GET_ON_FOOT")
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
ENDIF
|
|
ELSE
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
CLEAR_THIS_PRINT("MG_GET_ON_FOOT")
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_ON_FOOT_NOTIFIED)
|
|
CLEAR_THIS_PRINT("MG_GET_ON_FOOT")
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
#IF NOT LAUNCHER_IGNORE_PLAYER_CONTROL
|
|
IF NOT IS_PLAYER_CONTROL_ON(PLAYER_ID())
|
|
#IF IS_DEBUG_BUILD
|
|
PRINT_LAUNCHER_UPDATE_BLOCK_REASON("Player control off")
|
|
#ENDIF
|
|
bUpdateLaunch = FALSE
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
IF bUpdateLaunch
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Updating launcher")
|
|
|
|
SET_INPUT_EXCLUSIVE(PLAYER_CONTROL, INPUT_CONTEXT)
|
|
IF GENERIC_LAUNCHER_Reqires_Button_Press(vehicleLaunch)
|
|
// So we're here, which means some magical combination has led us to being allowed to play.
|
|
// Make sure the help is up.
|
|
IF (iContextIntention = NEW_CONTEXT_INTENTION)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Registering new context intention.")
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF iPriceToLaunch > 0
|
|
REGISTER_CONTEXT_INTENTION(iContextIntention, CP_HIGH_PRIORITY, "", TRUE)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Price to launch set to $", iPriceToLaunch, ".")
|
|
PRINT_HELP_FOREVER_WITH_NUMBER(helpButtonPress, iPriceToLaunch)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
ELSE
|
|
REGISTER_CONTEXT_INTENTION(iContextIntention, CP_HIGH_PRIORITY, helpButtonPress)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
ENDIF
|
|
#ENDIF
|
|
#IF NOT LAUNCHER_MONEY_RESTRICTED
|
|
REGISTER_CONTEXT_INTENTION(iContextIntention, CP_HIGH_PRIORITY, helpButtonPress)
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
#ENDIF
|
|
ELSE
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED) OR NOT IS_HELP_MESSAGE_BEING_DISPLAYED()
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
ENDIF
|
|
ENDIF
|
|
// Everything requires a button press to play now.
|
|
IF HAS_CONTEXT_BUTTON_TRIGGERED(iContextIntention)
|
|
helpButtonPress = helpButtonPress
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_HELP_MESSAGE_BEING_DISPLAYED()
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
REQUEST_SCRIPT(scriptToRun)
|
|
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Disabling player control to prevent last moment user interruptions.")
|
|
SET_PLAYER_CONTROL(PLAYER_ID(), FALSE, SPC_REMOVE_PROJECTILES | SPC_REMOVE_EXPLOSIONS | SPC_REMOVE_FIRES)
|
|
|
|
SWITCH_LAUNCHER_STATE(RUN_SCRIPT)
|
|
ENDIF
|
|
ELSE
|
|
helpButtonPress = helpButtonPress
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
IF IS_HELP_MESSAGE_BEING_DISPLAYED()
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
REQUEST_SCRIPT(scriptToRun)
|
|
|
|
#IF NOT LAUNCHER_IGNORE_PLAYER_CONTROL
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Disabling player control to prevent last moment user interruptions.")
|
|
SET_PLAYER_CONTROL(PLAYER_ID(), FALSE, SPC_REMOVE_PROJECTILES | SPC_REMOVE_EXPLOSIONS | SPC_REMOVE_FIRES)
|
|
#ENDIF
|
|
SWITCH_LAUNCHER_STATE(RUN_SCRIPT)
|
|
ENDIF
|
|
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// If, for whatever reason, we shouldn't be displaying help, wipe it.
|
|
IF NOT bUpdateLaunch
|
|
#IF NOT LAUNCHER_MONEY_RESTRICTED
|
|
IF (iContextIntention != NEW_CONTEXT_INTENTION)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up context intention.")
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
#ENDIF
|
|
#IF LAUNCHER_MONEY_RESTRICTED
|
|
IF (iContextIntention != NEW_CONTEXT_INTENTION)
|
|
IF IS_HELP_MESSAGE_BEING_DISPLAYED()
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up help text.")
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_HELP_TEXT_DISPLAYED)
|
|
CLEAR_HELP(FALSE)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
LAUNCHER_CUSTOM_APPROACH_WAIT()
|
|
BREAK
|
|
|
|
CASE RUN_SCRIPT
|
|
//PRINTLN("RUN_SCRIPT")
|
|
SET_INPUT_EXCLUSIVE(PLAYER_CONTROL, INPUT_CONTEXT)
|
|
// Only run once we've loaded.
|
|
IF HAS_SCRIPT_LOADED(scriptToRun)
|
|
IF (iContextIntention != NEW_CONTEXT_INTENTION)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up context intention.")
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
ENDIF
|
|
|
|
// If we were told to run, do so. Friend activities don't ping the mission candidate system.
|
|
// Otherwise we get our launch value from the candidate controller and let it decide if
|
|
// we've been accepted or rejected.
|
|
m_enumMissionCandidateReturnValue eLaunchVal
|
|
eLaunchVal = MCRET_PROCESSING
|
|
bLaunchedAsFriend = FALSE
|
|
|
|
// For friend activies, auto pass the candidate request if this is a friend activity minigame.
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_FRIEND_ACTIVITY)
|
|
IF IS_CURRENTLY_ON_MISSION_OF_TYPE(MISSION_TYPE_FRIEND_ACTIVITY)
|
|
OR IS_CURRENTLY_ON_MISSION_OF_TYPE(MISSION_TYPE_FRIEND_ACTIVITY_WITH_MG)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Auto-passing candidate launch for friend activity!")
|
|
eLaunchVal = MCRET_ACCEPTED
|
|
bLaunchedAsFriend = TRUE
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// // For replays, auto pass the candidate request.
|
|
// #IF LAUNCHER_REPLAYS_ENABLED
|
|
// PRINTLN("RUN_SCRIPT: Auto-passing candidate launch for replay!")
|
|
// eLaunchVal = MCRET_ACCEPTED
|
|
// #ENDIF
|
|
|
|
// Poll for permission to launch if we've not already been accepted.
|
|
IF (eLaunchVal != MCRET_ACCEPTED)
|
|
eLaunchVal = Request_Mission_Launch(iMissionCandInd, MCTID_CONTACT_POINT, eMinigameMissionType)
|
|
ENDIF
|
|
|
|
// We were accepted somehow. Launch!
|
|
IF (eLaunchVal = MCRET_ACCEPTED)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Candidate request passed. Launching minigame script ", scriptName, ".")
|
|
|
|
#IF LAUNCHER_VARIED_VEHICLE_ENTER
|
|
IF NOT IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_VEHICLE_AS_NO_LONGER_NEEDED(vehicleLaunch)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Clean the vehicle
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
IF NOT IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_VEHICLE_AS_NO_LONGER_NEEDED(vehicleLaunch)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Clear wanted levels. They must be 0 to get this far but they
|
|
// may be in the process of being called in. See 446251.
|
|
IF IS_PLAYER_PLAYING(PLAYER_ID())
|
|
CLEAR_PLAYER_WANTED_LEVEL(PLAYER_ID())
|
|
ENDIF
|
|
|
|
SET_CELLPHONE_PROFILE_TO_NORMAL() // Added for B* 1413571 -AsD
|
|
|
|
// Sober the player up
|
|
IF g_isPlayerDrunk
|
|
Make_Ped_Sober(PLAYER_PED_ID())
|
|
ENDIF
|
|
|
|
#IF NOT LAUNCHER_IGNORE_PLAYER_CONTROL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Enabling player control as minigame starts.")
|
|
SET_PLAYER_CONTROL(PLAYER_ID(), TRUE, SPC_REMOVE_PROJECTILES | SPC_REMOVE_EXPLOSIONS | SPC_REMOVE_FIRES)
|
|
#ENDIF
|
|
|
|
// Launch!
|
|
#IF NOT LAUNCHER_CUSTOM_SCRIPT_LAUNCH
|
|
threadInstance = START_NEW_SCRIPT(scriptToRun, iStackSize)
|
|
SET_SCRIPT_AS_NO_LONGER_NEEDED(scriptToRun)
|
|
scriptName = scriptToRun
|
|
scriptToRun = ""
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_CUSTOM_SCRIPT_LAUNCH
|
|
threadInstance = LAUNCHER_CUSTOM_RUN_SCRIPT()
|
|
#ENDIF
|
|
|
|
#IF LAUNCHER_CLEAR_SCENE_ON_START
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_SPAWNED_SCENE_CUSTOM)
|
|
LAUNCHER_CUSTOM_CLEAR_SCENE()
|
|
#ENDIF
|
|
|
|
// Manage replays...
|
|
#IF LAUNCHER_REPLAYS_ENABLED
|
|
IF NOT bIsReplayLaunch
|
|
Store_Minigame_Replay_Starting_Snapshot(scriptName)
|
|
ENDIF
|
|
#ENDIF
|
|
//g_bLaunchMinigameReplay = FALSE
|
|
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
SWITCH_LAUNCHER_STATE(RUN_WAIT)
|
|
|
|
START_TIMER_NOW_SAFE(ojTimer) //starts timer at 0
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Set odd-job start timer to ", GET_TIMER_IN_SECONDS(ojTimer), " secs.")
|
|
|
|
// Inform the playstats system that a minigame has launched.
|
|
// TODO: This will need a lot more further work.
|
|
// Need to standardise how minigames know what variation they are on.
|
|
IF eMinigame != MINIGAME_NONE
|
|
SET_RICH_PRESENCE_FOR_SP_MINIGAME(eMinigame)
|
|
CPRINTLN(DEBUG_FLOW, "Setting RICH PRESENCE for minigame: ", GET_MINIGAME_STAT_ID(eMinigame))
|
|
SCRIPT_PLAYSTATS_MISSION_STARTED(GET_MINIGAME_STAT_ID(eMinigame), 0)
|
|
CPRINTLN(DEBUG_FLOW, "Flagging playstat MISSION STARTED for minigame. Script:", GET_MINIGAME_STAT_ID(eMinigame), " Variation:", 0)
|
|
ENDIF
|
|
|
|
ELIF (eLaunchVal = MCRET_PROCESSING)
|
|
LAUNCHER_CUSTOM_LOAD_SCRIPT_WAIT()
|
|
CDEBUG3LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Still processing mission candidate...")
|
|
|
|
ELIF (eLaunchVal = MCRET_DENIED)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Failed to secure mission candidate. Cleaning up.")
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
|
|
ELSE
|
|
LAUNCHER_CUSTOM_LOAD_SCRIPT_WAIT()
|
|
ENDIF
|
|
BREAK
|
|
|
|
CASE RUN_WAIT
|
|
//DEBUG_MESSAGE("RUN_WAIT")
|
|
#IF NOT LAUNCHER_DONT_FADE_DOWN
|
|
IF NOT IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_FINISHED_INIT_FADE_DOWN)
|
|
IF IS_SCREEN_FADING_OUT() OR IS_SCREEN_FADED_IN()
|
|
SET_INPUT_EXCLUSIVE(PLAYER_CONTROL, INPUT_CONTEXT)
|
|
ELIF IS_SCREEN_FADED_OUT()
|
|
SET_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_FINISHED_INIT_FADE_DOWN)
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
//Check if launcher should perform a 1-time event
|
|
IF IS_BITMASK_AS_ENUM_SET(sLauncherData.iLauncherFlags, LAUNCHER_PERFORM_ONE_TIME_TASK)
|
|
CLEAR_BITMASK_AS_ENUM(sLauncherData.iLauncherFlags, LAUNCHER_PERFORM_ONE_TIME_TASK)
|
|
PERFORM_ONE_TIME_TASK()
|
|
ENDIF
|
|
|
|
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_IF_MISSION_RUNNING)
|
|
IF NOT IS_AMBIENT_SCRIPT_ALLOWED_TO_RUN(RUN_ON_MISSION_NEVER) AND NOT IS_THREAD_ACTIVE(threadInstance)
|
|
// Only want to kill ourselves if a mission hasn't started, and that mission is not the script we launch.
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Mission started while we were waiting to launch. Cleaning up.")
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// Normally, we'll just quit when our script is done running.
|
|
IF NOT IS_THREAD_ACTIVE(threadInstance)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame thread no longer active. Cleaning up.")
|
|
|
|
PLAYSTATS_ODDJOB_DONE(ROUND(GET_TIMER_IN_SECONDS(ojTimer)*1000), ENUM_TO_INT(eMinigame))
|
|
CDEBUG2LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> PLAYSTATS_ODDJOB_DONE(", ROUND(GET_TIMER_IN_SECONDS(ojTimer))*1000, ")")
|
|
|
|
CANCEL_TIMER(ojTimer)
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_FINISHED_INIT_FADE_DOWN)
|
|
|
|
//Set rich presence back to default.
|
|
SET_DEFAULT_RICH_PRESENCE_FOR_SP()
|
|
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
IF DOES_ENTITY_EXIST(vehicleLaunch)
|
|
IF NOT IS_ENTITY_DEAD(vehicleLaunch)
|
|
SET_VEHICLE_AS_NO_LONGER_NEEDED(vehicleLaunch)
|
|
vehicleLaunch = NULL
|
|
ENDIF
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// Friend missions don't really get a mission candidate ID.
|
|
IF bLaunchedAsFriend
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
ELSE
|
|
// non friend
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
IF IS_BITMASK_AS_ENUM_SET(sLauncherData.iLauncherFlags, LAUNCHED_SCRIPT_MinigameFailed)
|
|
// mission failed, cleanup if replays are not enabled
|
|
#IF NOT LAUNCHER_REPLAYS_ENABLED
|
|
Mission_Over(iMissionCandInd)
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
DEBUG_MESSAGE("Clearing the mission candidate.")
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame failed and replay disabled. Cleaning up.")
|
|
CPRINTLN(DEBUG_REPLAY, "Minigame failed and replay not enabled. Cleaning up.")
|
|
#ENDIF
|
|
ELSE
|
|
// mission passed, cleanup
|
|
Mission_Over(iMissionCandInd)
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
DEBUG_MESSAGE("Clearing the mission candidate.")
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame passed. Cleaning up.")
|
|
CPRINTLN(DEBUG_REPLAY, "Minigame passed. Cleaning up.")
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// By default, we'll just completely restart.
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
|
|
// If we're a replay, need to setup a different state, and wait for some notification.
|
|
#IF LAUNCHER_REPLAYS_ENABLED
|
|
IF IS_BITMASK_AS_ENUM_SET(sLauncherData.iLauncherFlags, LAUNCHED_SCRIPT_MinigameFailed)
|
|
Setup_Minigame_Replay(scriptName)
|
|
// Since we're doing a replay, we need to wait and see if that'll really happen.
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame failed and replay enabled. Moving to fail screen.")
|
|
CPRINTLN(DEBUG_REPLAY, "Minigame failed and replay enabled. Moving to fail screen.")
|
|
SWITCH_LAUNCHER_STATE(WAIT_FOR_FAILSCREEN_REPLAY)
|
|
ELSE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame passed and replay enabled. Resetting replay.")
|
|
CPRINTLN(DEBUG_REPLAY, "Minigame passed and replay enabled. Resetting replay.")
|
|
Reset_All_Replay_Variables()
|
|
ENDIF
|
|
bIsReplayLaunch = FALSE
|
|
#ENDIF
|
|
|
|
// Inform the playstats system that a minigame has passed/failed.
|
|
// TODO: This will need a lot more further work.
|
|
// Need to standardise how minigames know what variation they are on.
|
|
IF eMinigame != MINIGAME_NONE
|
|
IF IS_BITMASK_AS_ENUM_SET(sLauncherData.iLauncherFlags, LAUNCHED_SCRIPT_MinigameFailed)
|
|
PLAYSTATS_MISSION_CHECKPOINT(GET_MINIGAME_STAT_ID(eMinigame), 0, g_replayMissionStage, 0)
|
|
SCRIPT_PLAYSTATS_MISSION_OVER(GET_MINIGAME_STAT_ID(eMinigame), 0, g_replayMissionStage, TRUE)
|
|
CPRINTLN(DEBUG_FLOW, "Flagging playstat MISSION FAILED for minigame. ID:", GET_MINIGAME_STAT_ID(eMinigame), " Variation:", 0)
|
|
ELSE
|
|
PLAYSTATS_MISSION_CHECKPOINT(GET_MINIGAME_STAT_ID(eMinigame), 0, g_replayMissionStage, 0)
|
|
SCRIPT_PLAYSTATS_MISSION_OVER(GET_MINIGAME_STAT_ID(eMinigame), 0, g_replayMissionStage)
|
|
CPRINTLN(DEBUG_FLOW, "Flagging playstat MISSION PASSED for minigame. ID:", GET_MINIGAME_STAT_ID(eMinigame), " Variation:", 0)
|
|
ENDIF
|
|
ENDIF
|
|
|
|
// Regardless, flag this script as over.
|
|
LAUNCHER_CUSTOM_SCRIPT_END()
|
|
|
|
CLEAR_BITMASK_AS_ENUM(sLauncherData.iLauncherFlags, LAUNCHED_SCRIPT_MinigameFailed)
|
|
|
|
// We may have just been told to shut down.
|
|
IF IS_BITMASK_AS_ENUM_SET(launcherFlags, LAUNCHER_SHUTDOWN_FORCED_ON_FINISH)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher cleaning up after minigame has finished.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
|
|
// The script we just ran might have messed with our minigame active bitset state. Re-examine it.
|
|
IF eMinigame != MINIGAME_NONE
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Double checking minigame is still active after minigame has finished.")
|
|
#if USE_CLF_DLC
|
|
IF (g_savedGlobalsClifford.sFlow.isGameflowActive)
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_CLF_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Clifford minigame no longer active. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
ENDIF
|
|
#endif
|
|
#if USE_NRM_DLC
|
|
IF (g_savedGlobalsnorman.sFlow.isGameflowActive)
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_NRM_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Norman minigame no longer active. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
ENDIF
|
|
#endif
|
|
#if NOT USE_SP_DLC
|
|
IF (g_savedGlobals.sFlow.isGameflowActive)
|
|
IF NOT (GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame)))
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Minigame no longer active. Cleaning up.")
|
|
SCRIPT_CLEANUP()
|
|
ENDIF
|
|
ENDIF
|
|
#endif
|
|
|
|
ENDIF
|
|
ENDIF
|
|
LAUNCHER_CUSTOM_RUN_WAIT()
|
|
BREAK
|
|
|
|
CASE WAIT_FOR_FAILSCREEN_REPLAY
|
|
// Wait for some kind of signal that we should be handling a replay...
|
|
#IF LAUNCHER_REPLAYS_ENABLED
|
|
IF (g_replay.replayStageID = RS_ACTIVE)
|
|
IF g_bLaunchMinigameReplay
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Replay is active. Our script: ", scriptToRun, " Replay script: ", g_replay.replayScriptName, ".")
|
|
bIsReplayLaunch = TRUE
|
|
scriptToRun = g_replay.replayScriptName
|
|
|
|
// Launchers with vehicles need to go back to streaming them.
|
|
#IF LAUNCHER_VEHICLE_SPAWN
|
|
REQUEST_MODEL(vehicleModel)
|
|
SWITCH_LAUNCHER_STATE(STREAMING_WAIT)
|
|
#ENDIF
|
|
|
|
// Launchers without vehicles just need to stream the script and go.
|
|
#IF NOT LAUNCHER_VEHICLE_SPAWN
|
|
REQUEST_SCRIPT(scriptToRun)
|
|
SWITCH_LAUNCHER_STATE(RUN_SCRIPT)
|
|
#ENDIF
|
|
ELSE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> There is no replay available. Running replay reject cleanup.")
|
|
|
|
// No replay...cleanup
|
|
Mission_Over(iMissionCandInd)
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
Reset_All_Replay_Variables()
|
|
bIsReplayLaunch = FALSE
|
|
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
ENDIF
|
|
|
|
ELIF (g_replay.replayStageID = RS_NOT_REQUIRED)
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Replay refused by player. Running replay reject cleanup.")
|
|
|
|
// Replay rejected...cleanup
|
|
Mission_Over(iMissionCandInd)
|
|
iMissionCandInd = NO_CANDIDATE_ID
|
|
CLEAR_BITMASK_AS_ENUM(launcherFlags, LAUNCHER_MISSION_CANDIDATE_STARTED)
|
|
Reset_All_Replay_Variables()
|
|
bIsReplayLaunch = FALSE
|
|
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
ENDIF
|
|
#ENDIF
|
|
|
|
// If we magically get here somehow, break out.
|
|
#IF NOT LAUNCHER_REPLAYS_ENABLED
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
#ENDIF
|
|
BREAK
|
|
|
|
CASE CLEANUP_LAUNCHER
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Cleaning up launcher.")
|
|
SCRIPT_CLEANUP()
|
|
BREAK
|
|
|
|
CASE WAIT_FOR_TERMINATE
|
|
IF (fFlatSquaredPlayerDistanceToLauncher > (fLauncherShutdownDist*fLauncherShutdownDist)) // We use vdist2 and square the check dist to save performance
|
|
//prevent the blip from being destroyed.
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Turning blip back on before terminating.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
BREAK
|
|
|
|
CASE UNLOAD_ASSETS
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Releasing assets as we enter WAIT state.")
|
|
LAUNCHER_CUSTOM_RELEASE_ASSETS()
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Turning blip off as we unload assets.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, FALSE)
|
|
ENDIF
|
|
IF iContextIntention != NEW_CONTEXT_INTENTION
|
|
RELEASE_CONTEXT_INTENTION(iContextIntention)
|
|
ENDIF
|
|
IF NOT IS_STRING_NULL_OR_EMPTY(helpButtonPress)
|
|
IF IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(helpButtonPress)
|
|
CDEBUG1LN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Clearing button help text as we eneter WAIT state.")
|
|
CLEAR_HELP()
|
|
ENDIF
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(IDLE_WAIT)
|
|
BREAK
|
|
|
|
CASE IDLE_WAIT
|
|
IF iFrameCount % SLEEP_MODE_POLL_FREQ = 0
|
|
IF NOT IS_PED_INJURED(PLAYER_PED_ID())
|
|
IF eLauncherSleepReason = ASLEEP_WAITING_FOR_MISSION
|
|
IF eLauncherSleepReason = ASLEEP_WAITING_FOR_MISSION
|
|
IF CAN_MISSION_TYPE_START_AGAINST_CURRENT_TYPE(eMinigameMissionType)
|
|
#if USE_CLF_DLC
|
|
AND GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_CLF_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#if USE_NRM_DLC
|
|
AND GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_NRM_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#if not USE_CLF_DLC
|
|
#if not USE_NRM_DLC
|
|
AND GET_MISSION_FLOW_BITSET_BIT_STATE(FLOWBITSET_MINIGAME_ACTIVE, ENUM_TO_INT(eMinigame))
|
|
#endif
|
|
#endif
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher is safe to run. Exiting sleep mode.")
|
|
|
|
//switch launcher back on
|
|
LAUNCHER_CUSTOM_SCRIPT_INIT()
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Turning blip back on as launcher comes out of sleep mode.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
ENDIF
|
|
ENDIF
|
|
ELIF eLauncherSleepReason = ASLEEP_WAITING_FOR_PLAYER_TO_LEAVE
|
|
IF (fFlatSquaredPlayerDistanceToLauncher > (fLauncherShutdownDist*fLauncherShutdownDist)) // We use vdist2 and square the check dist to save performance
|
|
//prevent the blip from being destroyed.
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<",GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player left shutdown range while in IDLE_WAIT. Turning blip back on before cleaning up.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
eLauncherStaticBlip = STATIC_BLIP_NAME_DUMMY_FINAL
|
|
ENDIF
|
|
PRINTLN("Too far away from launcher! Cleaning up! fFlatSquaredPlayerDistanceToLauncher is... ", fFlatSquaredPlayerDistanceToLauncher, " and fLauncherShutdownDist*fLauncherShutdownDist is... ", fLauncherShutdownDist*fLauncherShutdownDist)
|
|
SWITCH_LAUNCHER_STATE(CLEANUP_LAUNCHER)
|
|
ENDIF
|
|
ELIF eLauncherSleepReason = ASLEEP_WAITING_FOR_PLAYER_TO_SPAWN_VEH
|
|
IF fFlatSquaredPlayerDistanceToLauncher > (LAUNCHER_VEHICLE_SPAWN_DISTANCE+5)*(LAUNCHER_VEHICLE_SPAWN_DISTANCE+5) //5 meter difference. just in case!
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Launcher is safe to spawn veh!. Exiting sleep mode.")
|
|
//switch launcher back on
|
|
LAUNCHER_CUSTOM_SCRIPT_INIT()
|
|
IF eLauncherStaticBlip != STATIC_BLIP_NAME_DUMMY_FINAL
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Turning blip back on as launcher comes out of sleep mode.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
ENDIF
|
|
SWITCH_LAUNCHER_STATE(STREAM_ASSETS)
|
|
ENDIF
|
|
ENDIF
|
|
ELSE
|
|
CPRINTLN(DEBUG_MG_LAUNCHER, "<", GET_MINIGAME_DISPLAY_STRING_FROM_ID(eMinigame), "> Player was detected injured! Turning blip back on as launcher comes out of sleep mode.")
|
|
SET_STATIC_BLIP_ACTIVE_STATE(eLauncherStaticBlip, TRUE)
|
|
ENDIF
|
|
ELSE
|
|
iFrameCount++
|
|
ENDIF
|
|
BREAK
|
|
ENDSWITCH
|
|
ENDIF
|
|
|
|
WAIT(0)
|
|
ENDWHILE
|
|
ENDSCRIPT
|