diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-26 00:25:47 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-26 00:25:47 +0100 |
commit | 46e63da4d8e6b4c50a663e98d150bd83e0eefb83 (patch) | |
tree | e7a03e5010280216424260da796151cc8c235e15 /src/control | |
parent | garage stuff (diff) | |
parent | Merge pull request #992 from ForeverL95/ForeverL95-patch-1 (diff) | |
download | re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar.gz re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar.bz2 re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar.lz re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar.xz re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.tar.zst re3-46e63da4d8e6b4c50a663e98d150bd83e0eefb83.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/OnscreenTimer.cpp | 8 | ||||
-rw-r--r-- | src/control/Pickups.h | 2 | ||||
-rw-r--r-- | src/control/RoadBlocks.cpp | 4 | ||||
-rw-r--r-- | src/control/Script.h | 334 | ||||
-rw-r--r-- | src/control/Script5.cpp | 4 |
5 files changed, 176 insertions, 176 deletions
diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp index 08e6fa3f..53ed14c7 100644 --- a/src/control/OnscreenTimer.cpp +++ b/src/control/OnscreenTimer.cpp @@ -14,7 +14,7 @@ void COnscreenTimer::Init() { for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) { m_sCounters[i].m_nCounterOffset = 0; - for(uint32 j = 0; j < ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText); j++) { + for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) { m_sCounters[i].m_aCounterText[j] = 0; } @@ -24,7 +24,7 @@ void COnscreenTimer::Init() { for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { m_sClocks[i].m_nClockOffset = 0; - for(uint32 j = 0; j < ARRAY_SIZE(COnscreenTimerEntry::m_aClockText); j++) { + for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) { m_sClocks[i].m_aClockText[j] = 0; } @@ -92,7 +92,7 @@ void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 p m_sCounters[pos].m_nCounterOffset = offset; if(text) { - strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText)); + strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText)); } else { m_sCounters[pos].m_aCounterText[0] = 0; } @@ -114,7 +114,7 @@ void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) { m_sClocks[i].m_nClockOffset = offset; m_sClocks[i].m_bClockGoingDown = bGoingDown; if(text) { - strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(COnscreenTimerEntry::m_aClockText)); + strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText)); } else { m_sClocks[i].m_aClockText[0] = 0; } diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 08fb2bc8..fd8b15cd 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -147,7 +147,7 @@ public: class CPacManPickups { - friend CPacManPickup; + friend class CPacManPickup; static CPacManPickup aPMPickUps[NUMPACMANPICKUPS]; static CVector LastPickUpCoors; diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index f75b4f50..4f714e80 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -55,8 +55,8 @@ CRoadBlocks::Init(void) void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType) { - static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f}, - {1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} }; + static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f), + CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) }; CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle(); if (!pEntityToAttack) pEntityToAttack = (CEntity*)FindPlayerPed(); diff --git a/src/control/Script.h b/src/control/Script.h index 11c1b185..8b54f28f 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -289,6 +289,173 @@ struct script_corona int flareType; }; +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 + }; + + enum { + STACKVALUE_IP_BITS = 22, + STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS, + STACKVALUE_IS_FUNCTION_CALL_BIT, + STACKVALUE_IP_PARAMS_OFFSET, + + STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1) + }; + +public: + CRunningScript* next; + CRunningScript* prev; + int32 m_nId; + char m_abScriptName[8]; + uint32 m_nIp; + uint32 m_anStack[MAX_STACK_DEPTH]; + uint16 m_nStackPointer; + int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106 + int32 m_nLocalsPointer; + bool m_bIsActive; + 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) { + for (int i = 0; i < NUM_TIMERS; i++) + m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep; + } + + void Init(); + void Process(); + + void RemoveScriptFromList(CRunningScript**); + void AddScriptToList(CRunningScript**); + + static const uint32 nSaveStructSize; + + void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams); + int32 CollectNextParameterWithoutIncreasingPC(uint32); + int32* GetPointerToScriptVariable(uint32*, int16); + void StoreParameters(uint32*, int16); + + int8 ProcessOneCommand(); + void DoDeatharrestCheck(); + void UpdateCompareFlag(bool flag) + { + if (m_bNotFlag) + flag = !flag; + if (m_nAndOrState == ANDOR_NONE) { + m_bCondResult = flag; + return; + } + if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8) { + m_bCondResult &= flag; + if (m_nAndOrState == ANDS_1) { + m_nAndOrState = ANDOR_NONE; + return; + } + } + else { + m_bCondResult |= flag; + if (m_nAndOrState <= ORS_1) { + m_nAndOrState = ANDOR_NONE; + return; + } + } + m_nAndOrState--; + } + 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); + int8 ProcessCommands1100To1199(int32); + int8 ProcessCommands1200To1299(int32); + int8 ProcessCommands1300To1399(int32); + int8 ProcessCommands1400To1499(int32); + int8 ProcessCommands1500To1599(int32); + int8 ProcessCommands1600To1699(int32); + + uint32 CollectLocateParameters(uint32*, bool); + 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*); + void LocateObjectCommand(int32, uint32*); + void ObjectInAreaCheckCommand(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 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); + + void ReturnFromGosubOrFunction(); + +}; + enum { VAR_LOCAL = 1, @@ -494,173 +661,6 @@ extern int ScriptParams[32]; VALIDATE_SIZE(uStackReturnValue, 4); -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 - }; - - enum { - STACKVALUE_IP_BITS = 22, - STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS, - STACKVALUE_IS_FUNCTION_CALL_BIT, - STACKVALUE_IP_PARAMS_OFFSET, - - STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1) - }; - -public: - CRunningScript* next; - CRunningScript* prev; - int32 m_nId; - char m_abScriptName[8]; - uint32 m_nIp; - uint32 m_anStack[MAX_STACK_DEPTH]; - uint16 m_nStackPointer; - int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106 - int32 m_nLocalsPointer; - bool m_bIsActive; - 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) { - for (int i = 0; i < NUM_TIMERS; i++) - m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep; - } - - void Init(); - void Process(); - - void RemoveScriptFromList(CRunningScript**); - void AddScriptToList(CRunningScript**); - - static const uint32 nSaveStructSize; - - void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams); - int32 CollectNextParameterWithoutIncreasingPC(uint32); - int32* GetPointerToScriptVariable(uint32*, int16); - void StoreParameters(uint32*, int16); - - int8 ProcessOneCommand(); - void DoDeatharrestCheck(); - void UpdateCompareFlag(bool flag) - { - if (m_bNotFlag) - flag = !flag; - if (m_nAndOrState == ANDOR_NONE) { - m_bCondResult = flag; - return; - } - if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8) { - m_bCondResult &= flag; - if (m_nAndOrState == ANDS_1) { - m_nAndOrState = ANDOR_NONE; - return; - } - } - else { - m_bCondResult |= flag; - if (m_nAndOrState <= ORS_1) { - m_nAndOrState = ANDOR_NONE; - return; - } - } - m_nAndOrState--; - } - 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); - int8 ProcessCommands1100To1199(int32); - int8 ProcessCommands1200To1299(int32); - int8 ProcessCommands1300To1399(int32); - int8 ProcessCommands1400To1499(int32); - int8 ProcessCommands1500To1599(int32); - int8 ProcessCommands1600To1699(int32); - - uint32 CollectLocateParameters(uint32*, bool); - 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*); - void LocateObjectCommand(int32, uint32*); - void ObjectInAreaCheckCommand(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 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); - - void ReturnFromGosubOrFunction(); - -}; - #ifdef USE_DEBUG_SCRIPT_LOADER extern int scriptToLoad; #endif diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 74d187ca..502bc005 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -2665,7 +2665,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed) { if (pPed->InVehicle()) return IsVehicleStopped(pPed->m_pMyVehicle); - return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && + return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) && !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; } @@ -2679,7 +2679,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer) RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE)) return false; - return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && + return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) && !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; } |