diff options
Diffstat (limited to 'src/control/Script.h')
-rw-r--r-- | src/control/Script.h | 123 |
1 files changed, 68 insertions, 55 deletions
diff --git a/src/control/Script.h b/src/control/Script.h index eedf17d4..7f9a7717 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -6,6 +6,7 @@ class CEntity; class CBuilding; +class CPhysical; class CVehicle; class CPed; class CObject; @@ -20,18 +21,19 @@ void FlushLog(); #define PICKUP_PLACEMENT_OFFSET (0.5f) #define PED_FIND_Z_OFFSET (5.0f) +#define COP_PED_FIND_Z_OFFSET (10.0f) #define UPSIDEDOWN_UP_THRESHOLD (-0.97f) #define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f) #define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f) #define UPSIDEDOWN_TIMER_THRESHOLD (1000) -#define SPHERE_MARKER_R (0) -#define SPHERE_MARKER_G (128) -#define SPHERE_MARKER_B (255) -#define SPHERE_MARKER_A (128) -#define SPHERE_MARKER_PULSE_PERIOD (2048) -#define SPHERE_MARKER_PULSE_FRACTION (0.1f) +#define SPHERE_MARKER_R (252) +#define SPHERE_MARKER_G (138) +#define SPHERE_MARKER_B (242) +#define SPHERE_MARKER_A (228) +#define SPHERE_MARKER_PULSE_PERIOD 2048 +#define SPHERE_MARKER_PULSE_FRACTION 0.1f #ifdef USE_PRECISE_MEASUREMENT_CONVERTION #define MILES_IN_METER (0.000621371192f) @@ -45,9 +47,7 @@ void FlushLog(); #define KEY_LENGTH_IN_SCRIPT (8) -#if GTA_VERSION <= GTA3_PS2_160 -#define GTA_SCRIPT_COLLECTIVE -#endif +//#define GTA_SCRIPT_COLLECTIVE struct intro_script_rectangle { @@ -64,7 +64,7 @@ struct intro_script_rectangle VALIDATE_SIZE(intro_script_rectangle, 0x18); enum { - SCRIPT_TEXT_MAX_LENGTH = 500 + SCRIPT_TEXT_MAX_LENGTH = 100 }; struct intro_text_line @@ -105,7 +105,7 @@ struct intro_text_line m_sBackgroundColor = CRGBA(128, 128, 128, 128); m_bTextProportional = true; m_bTextBeforeFade = false; - m_nFont = FONT_HEADING; + m_nFont = FONT_STANDARD; m_fAtX = 0.0f; m_fAtY = 0.0f; memset(&m_Text, 0, sizeof(m_Text)); @@ -149,7 +149,7 @@ struct cleanup_entity_struct enum { MAX_CLEANUP = 50, MAX_UPSIDEDOWN_CAR_CHECKS = 6, - MAX_STUCK_CAR_CHECKS = 6 + MAX_STUCK_CAR_CHECKS = 16 }; class CMissionCleanup @@ -165,6 +165,7 @@ public: void AddEntityToList(int32, uint8); void RemoveEntityFromList(int32, uint8); void Process(); + void CheckIfCollisionHasLoadedForMissionObjects(); }; struct upsidedown_car_data @@ -248,11 +249,7 @@ struct tBuildingSwap enum { -#if GTA_VERSION > GTA3_PS2_160 MAX_STACK_DEPTH = 6, -#else - MAX_STACK_DEPTH = 4, -#endif NUM_LOCAL_VARS = 16, NUM_TIMERS = 2 }; @@ -287,6 +284,7 @@ public: uint32 m_anStack[MAX_STACK_DEPTH]; uint16 m_nStackPointer; int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS]; + bool m_bIsActive; bool m_bCondResult; bool m_bIsMissionScript; bool m_bSkipWakeTime; @@ -338,9 +336,11 @@ public: int8 ProcessCommands800To899(int32); int8 ProcessCommands900To999(int32); int8 ProcessCommands1000To1099(int32); -#if GTA_VERSION > GTA3_PS2_160 int8 ProcessCommands1100To1199(int32); -#endif + int8 ProcessCommands1200To1299(int32); + int8 ProcessCommands1300To1399(int32); + int8 ProcessCommands1400To1499(int32); + void LocatePlayerCommand(int32, uint32*); void LocatePlayerCharCommand(int32, uint32*); void LocatePlayerCarCommand(int32, uint32*); @@ -354,6 +354,8 @@ public: void PlayerInAngledAreaCheckCommand(int32, uint32*); void CharInAreaCheckCommand(int32, uint32*); void CarInAreaCheckCommand(int32, uint32*); + void LocateObjectCommand(int32, uint32*); + void ObjectInAreaCheckCommand(int32, uint32*); #ifdef GTA_SCRIPT_COLLECTIVE void LocateCollectiveCommand(int32, uint32*); @@ -381,26 +383,11 @@ public: float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } - bool ThisIsAValidRandomPed(uint32 pedtype) { - switch (pedtype) { - case PEDTYPE_CIVMALE: - case PEDTYPE_CIVFEMALE: - case PEDTYPE_GANG1: - case PEDTYPE_GANG2: - case PEDTYPE_GANG3: - case PEDTYPE_GANG4: - case PEDTYPE_GANG5: - case PEDTYPE_GANG6: - case PEDTYPE_GANG7: - case PEDTYPE_GANG8: - case PEDTYPE_GANG9: - case PEDTYPE_CRIMINAL: - case PEDTYPE_PROSTITUTE: - return true; - default: - return false; - } - } + bool ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami); + bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal); + + bool CheckDamagedWeaponType(int32 actual, int32 type); + }; @@ -410,20 +397,22 @@ enum { }; enum { - SIZE_MAIN_SCRIPT = 128 * 1024, - SIZE_MISSION_SCRIPT = 32 * 1024, +#ifdef PS2 + SIZE_MAIN_SCRIPT = 205512, +#else + SIZE_MAIN_SCRIPT = 225512, +#endif + SIZE_MISSION_SCRIPT = 35000, SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT }; enum { MAX_NUM_SCRIPTS = 128, - MAX_NUM_CONTACTS = 16, - MAX_NUM_INTRO_TEXT_LINES = 2, + MAX_NUM_INTRO_TEXT_LINES = 48, MAX_NUM_INTRO_RECTANGLES = 16, MAX_NUM_SCRIPT_SRPITES = 16, MAX_NUM_SCRIPT_SPHERES = 16, - MAX_NUM_COLLECTIVES = 32, - MAX_NUM_USED_OBJECTS = 200, + MAX_NUM_USED_OBJECTS = 220, MAX_NUM_MISSION_SCRIPTS = 120, MAX_NUM_BUILDING_SWAPS = 25, MAX_NUM_INVISIBILITY_SETTINGS = 20, @@ -435,13 +424,10 @@ class CTheScripts public: static uint8 ScriptSpace[SIZE_SCRIPT_SPACE]; static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS]; - static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS]; - static int32 OnAMissionForContactFlag[MAX_NUM_CONTACTS]; static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES]; static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES]; static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES]; - static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES]; static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS]; static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS]; static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS]; @@ -465,14 +451,26 @@ public: static uint32 LargestMissionScriptSize; static uint32 MainScriptSize; static uint8 FailCurrentMission; - static uint8 CountdownToMakePlayerUnsafe; - static uint8 DelayMakingPlayerUnsafeThisTime; static uint16 NumScriptDebugLines; static uint16 NumberOfIntroRectanglesThisFrame; static uint16 NumberOfIntroTextLinesThisFrame; static uint8 UseTextCommands; static uint16 CommandsExecuted; static uint16 ScriptsUpdated; + static uint32 LastMissionPassedTime; + static uint16 NumberOfExclusiveMissionScripts; +#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) +#define CARDS_IN_SUIT (13) +#define NUM_SUITS (4) +#define MAX_DECKS (6) +#define CARDS_IN_DECK (CARDS_IN_SUIT * NUM_SUITS) +#define CARDS_IN_STACK (CARDS_IN_DECK * MAX_DECKS) + static int16 CardStack[CARDS_IN_STACK]; + static int16 CardStackPosition; +#endif + static bool bPlayerIsInTheStatium; + static uint8 RiotIntensity; + static bool bPlayerHasMetDebbieHarry; static void Init(); static void Process(); @@ -495,9 +493,6 @@ public: static int32* GetPointerToScriptVariable(int32 offset) { assert(offset >= 8 && offset < CTheScripts::GetSizeOfVariableSpace()); return (int32*)&ScriptSpace[offset]; } - static void ResetCountdownToMakePlayerUnsafe() { CountdownToMakePlayerUnsafe = 0; } - static bool IsCountdownToMakePlayerUnsafeOn() { return CountdownToMakePlayerUnsafe != 0; } - static int32 Read4BytesFromScript(uint32* pIp) { int32 retval = ScriptSpace[*pIp + 3] << 24 | ScriptSpace[*pIp + 2] << 16 | ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp]; *pIp += 4; @@ -559,6 +554,14 @@ public: static int32 AddScriptSphere(int32 id, CVector pos, float radius); static int32 GetNewUniqueScriptSphereIndex(int32 index); static void RemoveScriptSphere(int32 index); + static void RemoveScriptTextureDictionary(); +public: + static void RemoveThisPed(CPed* pPed); + + static uint32& GetLastMissionPassedTime() { return LastMissionPassedTime; } +#ifdef MISSION_SWITCHER + static void SwitchToMission(int32 mission); +#endif #ifdef GTA_SCRIPT_COLLECTIVE static void AdvanceCollectiveIndex() @@ -579,9 +582,11 @@ public: static void SetObjectiveForAllPedsInCollective(int, eObjective); #endif -#ifdef MISSION_SWITCHER -public: - static void SwitchToMission(int32 mission); +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT + static bool MissionSupportsMissionReplay(int index) + { + return index >= 3 && index <= 35 || index >= 51 && index <= 65 || index >= 67 && index <= 74 || index >= 83 && index <= 87; + } #endif #ifdef USE_DEBUG_SCRIPT_LOADER @@ -603,6 +608,14 @@ extern uint32 WaitForSave; extern uint32 MissionStartTime; extern int missionRetryScriptIndex; extern bool doingMissionRetry; +extern bool gbTryingPorn4Again; +extern int IsInAmmunation; +extern int MissionSkipLevel; + +#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT +extern bool UsingMobileScript; +extern bool AlreadySavedGame; +#endif uint32 AddExtraDeathDelay(); void RetryMission(int, int unk = 0); |