summaryrefslogtreecommitdiffstats
path: root/src/control/Script.h
diff options
context:
space:
mode:
authorwithmorten <morten.with@gmail.com>2021-01-19 13:35:48 +0100
committerwithmorten <morten.with@gmail.com>2021-01-21 03:18:15 +0100
commitac0f759b274368b9424222a392d9f28b73980eb0 (patch)
tree613c034aea3e8a98d9a752954198216ffebce83e /src/control/Script.h
parentfix RWLIBS build without GTA_PS2_STUFF (diff)
downloadre3-ac0f759b274368b9424222a392d9f28b73980eb0.tar
re3-ac0f759b274368b9424222a392d9f28b73980eb0.tar.gz
re3-ac0f759b274368b9424222a392d9f28b73980eb0.tar.bz2
re3-ac0f759b274368b9424222a392d9f28b73980eb0.tar.lz
re3-ac0f759b274368b9424222a392d9f28b73980eb0.tar.xz
re3-ac0f759b274368b9424222a392d9f28b73980eb0.tar.zst
re3-ac0f759b274368b9424222a392d9f28b73980eb0.zip
Diffstat (limited to '')
-rw-r--r--src/control/Script.h300
1 files changed, 150 insertions, 150 deletions
diff --git a/src/control/Script.h b/src/control/Script.h
index ff1a9706..5682024b 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -248,6 +248,156 @@ 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
+};
+
+class CRunningScript
+{
+ enum {
+ ANDOR_NONE = 0,
+ ANDS_1 = 1,
+ ANDS_2,
+ ANDS_3,
+ ANDS_4,
+ ANDS_5,
+ ANDS_6,
+ ANDS_7,
+ ANDS_8,
+ ORS_1 = 21,
+ ORS_2,
+ ORS_3,
+ ORS_4,
+ ORS_5,
+ ORS_6,
+ ORS_7,
+ ORS_8
+ };
+
+public:
+ CRunningScript* next;
+ CRunningScript* prev;
+ char m_abScriptName[8];
+ uint32 m_nIp;
+ uint32 m_anStack[MAX_STACK_DEPTH];
+ uint16 m_nStackPointer;
+ int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
+ bool m_bCondResult;
+ bool m_bIsMissionScript;
+ bool m_bSkipWakeTime;
+ uint32 m_nWakeTime;
+ uint16 m_nAndOrState;
+ bool m_bNotFlag;
+ bool m_bDeatharrestEnabled;
+ bool m_bDeatharrestExecuted;
+ bool m_bMissionFlag;
+
+public:
+ void SetIP(uint32 ip) { m_nIp = ip; }
+ CRunningScript* GetNext() const { return next; }
+
+ void Save(uint8*& buf);
+ void Load(uint8*& buf);
+
+ void UpdateTimers(float timeStep) {
+ m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
+ m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
+ }
+
+ void Init();
+ void Process();
+
+ void RemoveScriptFromList(CRunningScript**);
+ void AddScriptToList(CRunningScript**);
+
+ static const uint32 nSaveStructSize;
+
+ void CollectParameters(uint32*, int16);
+ int32 CollectNextParameterWithoutIncreasingPC(uint32);
+ int32* GetPointerToScriptVariable(uint32*, int16);
+ void StoreParameters(uint32*, int16);
+
+ int8 ProcessOneCommand();
+ void DoDeatharrestCheck();
+ void UpdateCompareFlag(bool);
+ int16 GetPadState(uint16, uint16);
+
+ int8 ProcessCommands0To99(int32);
+ int8 ProcessCommands100To199(int32);
+ int8 ProcessCommands200To299(int32);
+ int8 ProcessCommands300To399(int32);
+ int8 ProcessCommands400To499(int32);
+ int8 ProcessCommands500To599(int32);
+ int8 ProcessCommands600To699(int32);
+ int8 ProcessCommands700To799(int32);
+ int8 ProcessCommands800To899(int32);
+ int8 ProcessCommands900To999(int32);
+ int8 ProcessCommands1000To1099(int32);
+#if GTA_VERSION > GTA3_PS2_160
+ int8 ProcessCommands1100To1199(int32);
+#endif
+ void LocatePlayerCommand(int32, uint32*);
+ void LocatePlayerCharCommand(int32, uint32*);
+ void LocatePlayerCarCommand(int32, uint32*);
+ void LocateCharCommand(int32, uint32*);
+ void LocateCharCharCommand(int32, uint32*);
+ void LocateCharCarCommand(int32, uint32*);
+ void LocateCharObjectCommand(int32, uint32*);
+ void LocateCarCommand(int32, uint32*);
+ void LocateSniperBulletCommand(int32, uint32*);
+ void PlayerInAreaCheckCommand(int32, uint32*);
+ void PlayerInAngledAreaCheckCommand(int32, uint32*);
+ void CharInAreaCheckCommand(int32, uint32*);
+ void CarInAreaCheckCommand(int32, uint32*);
+
+#ifdef GTA_SCRIPT_COLLECTIVE
+ void LocateCollectiveCommand(int32, uint32*);
+ void LocateCollectiveCharCommand(int32, uint32*);
+ void LocateCollectiveCarCommand(int32, uint32*);
+ void LocateCollectivePlayerCommand(int32, uint32*);
+ void CollectiveInAreaCheckCommand(int32, uint32*);
+#endif
+
+#ifdef MISSION_REPLAY
+ bool CanAllowMissionReplay();
+#endif
+
+#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+ int CollectParameterForDebug(char* buf, bool& var);
+ void GetStoredParameterForDebug(char* buf);
+#endif
+
+ 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;
+ }
+ }
+};
+
+
+enum {
VAR_LOCAL = 1,
VAR_GLOBAL = 2,
};
@@ -428,156 +578,6 @@ public:
#endif
};
-
-enum {
-#if GTA_VERSION > GTA3_PS2_160
- MAX_STACK_DEPTH = 6,
-#else
- MAX_STACK_DEPTH = 4,
-#endif
- NUM_LOCAL_VARS = 16,
- NUM_TIMERS = 2
-};
-
-class CRunningScript
-{
- enum {
- ANDOR_NONE = 0,
- ANDS_1 = 1,
- ANDS_2,
- ANDS_3,
- ANDS_4,
- ANDS_5,
- ANDS_6,
- ANDS_7,
- ANDS_8,
- ORS_1 = 21,
- ORS_2,
- ORS_3,
- ORS_4,
- ORS_5,
- ORS_6,
- ORS_7,
- ORS_8
- };
-
-public:
- CRunningScript* next;
- CRunningScript* prev;
- char m_abScriptName[8];
- uint32 m_nIp;
- uint32 m_anStack[MAX_STACK_DEPTH];
- uint16 m_nStackPointer;
- int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
- bool m_bCondResult;
- bool m_bIsMissionScript;
- bool m_bSkipWakeTime;
- uint32 m_nWakeTime;
- uint16 m_nAndOrState;
- bool m_bNotFlag;
- bool m_bDeatharrestEnabled;
- bool m_bDeatharrestExecuted;
- bool m_bMissionFlag;
-
-public:
- void SetIP(uint32 ip) { m_nIp = ip; }
- CRunningScript* GetNext() const { return next; }
-
- void Save(uint8*& buf);
- void Load(uint8*& buf);
-
- void UpdateTimers(float timeStep) {
- m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
- m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
- }
-
- void Init();
- void Process();
-
- void RemoveScriptFromList(CRunningScript**);
- void AddScriptToList(CRunningScript**);
-
- static const uint32 nSaveStructSize;
-
- void CollectParameters(uint32*, int16);
- int32 CollectNextParameterWithoutIncreasingPC(uint32);
- int32* GetPointerToScriptVariable(uint32*, int16);
- void StoreParameters(uint32*, int16);
-
- int8 ProcessOneCommand();
- void DoDeatharrestCheck();
- void UpdateCompareFlag(bool);
- int16 GetPadState(uint16, uint16);
-
- int8 ProcessCommands0To99(int32);
- int8 ProcessCommands100To199(int32);
- int8 ProcessCommands200To299(int32);
- int8 ProcessCommands300To399(int32);
- int8 ProcessCommands400To499(int32);
- int8 ProcessCommands500To599(int32);
- int8 ProcessCommands600To699(int32);
- int8 ProcessCommands700To799(int32);
- int8 ProcessCommands800To899(int32);
- int8 ProcessCommands900To999(int32);
- int8 ProcessCommands1000To1099(int32);
-#if GTA_VERSION > GTA3_PS2_160
- int8 ProcessCommands1100To1199(int32);
-#endif
- void LocatePlayerCommand(int32, uint32*);
- void LocatePlayerCharCommand(int32, uint32*);
- void LocatePlayerCarCommand(int32, uint32*);
- void LocateCharCommand(int32, uint32*);
- void LocateCharCharCommand(int32, uint32*);
- void LocateCharCarCommand(int32, uint32*);
- void LocateCharObjectCommand(int32, uint32*);
- void LocateCarCommand(int32, uint32*);
- void LocateSniperBulletCommand(int32, uint32*);
- void PlayerInAreaCheckCommand(int32, uint32*);
- void PlayerInAngledAreaCheckCommand(int32, uint32*);
- void CharInAreaCheckCommand(int32, uint32*);
- void CarInAreaCheckCommand(int32, uint32*);
-
-#ifdef GTA_SCRIPT_COLLECTIVE
- void LocateCollectiveCommand(int32, uint32*);
- void LocateCollectiveCharCommand(int32, uint32*);
- void LocateCollectiveCarCommand(int32, uint32*);
- void LocateCollectivePlayerCommand(int32, uint32*);
- void CollectiveInAreaCheckCommand(int32, uint32*);
-#endif
-
-#ifdef MISSION_REPLAY
- bool CanAllowMissionReplay();
-#endif
-
-#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
- int CollectParameterForDebug(char* buf, bool& var);
- void GetStoredParameterForDebug(char* buf);
-#endif
-
- 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;
- }
- }
-};
-
#ifdef MISSION_REPLAY
extern int AllowMissionReplay;
extern uint32 WaitForMissionActivate;