From 52d0d811b79f810aae9d10beb671f9889b8e4330 Mon Sep 17 00:00:00 2001 From: saml1er Date: Thu, 16 Apr 2020 23:46:08 +0500 Subject: Reverse CWorld --- src/animation/CutsceneMgr.h | 1 + src/control/Replay.cpp | 2 +- src/core/World.cpp | 846 +++++++++++++++++++++++++++++++++++++++++++- src/core/World.h | 33 +- src/entities/Entity.cpp | 10 + src/entities/Entity.h | 3 + src/objects/Object.cpp | 4 +- src/objects/Object.h | 2 +- 8 files changed, 867 insertions(+), 34 deletions(-) diff --git a/src/animation/CutsceneMgr.h b/src/animation/CutsceneMgr.h index 3c915eea..a455e784 100644 --- a/src/animation/CutsceneMgr.h +++ b/src/animation/CutsceneMgr.h @@ -28,6 +28,7 @@ public: static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; } static bool IsRunning(void) { return ms_running; } + static bool HasLoaded(void) { return ms_loaded; } static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; } static bool UseLodMultiplier(void) { return ms_useLodMultiplier; } static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; } diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 0da32dd2..97debfdc 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1087,7 +1087,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca Playback.m_bSlot = first; Playback.m_nOffset = 0; Playback.m_pBase = Buffers[first]; - CObject::DeleteAllTempObjectInArea(CVector(0.0f, 0.0f, 0.0f), 1000000.0f); + CObject::DeleteAllTempObjectsInArea(CVector(0.0f, 0.0f, 0.0f), 1000000.0f); StoreStuffInMem(); EmptyPedsAndVehiclePools(); SlowMotion = 1; diff --git a/src/core/World.cpp b/src/core/World.cpp index d64569b3..7f18abbf 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -20,6 +20,14 @@ #include "Replay.h" #include "Population.h" #include "Fire.h" +#include "ProjectileInfo.h" +#include "WaterLevel.h" +#include "CopPed.h" +#include "Object.h" +#include "Shadows.h" +#include "Explosion.h" + +#define OBJECT_REPOSITION_OFFSET_Z 0.2f CColPoint *gaTempSphereColPoints = (CColPoint*)0x6E64C0; // [32] @@ -40,24 +48,24 @@ bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B; bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C; bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA; -WRAPPER void CWorld::ClearForRestart(void) { EAXJMP(0x4AE850); } -WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); } -WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); } -WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); } -WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); } -WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); } -WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); } -WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8) { EAXJMP(0x4B4E70) }; -WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B2E70); } -WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); } -WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); } -WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); } -WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool) { EAXJMP(0x4B3680); } -WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); } -WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); } -WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); } -WRAPPER void CWorld::TriggerExplosion(const CVector& a1, float a2, float a3, CEntity *a4, bool a5) { EAXJMP(0x4B1140); } -WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); } +//WRAPPER void CWorld::ClearForRestart(void) { EAXJMP(0x4AE850); } +//WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); } +//WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); } +//WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); } +//WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); } +//WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); } +//WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); } +//WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8 unused) { EAXJMP(0x4B4E70) }; +//WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B2E70); } +//WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); } +//WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); } +//WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); } +//WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool) { EAXJMP(0x4B3680); } +//WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); } +//WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); } +//WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); } +WRAPPER void CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity *pCreator, bool bProcessVehicleBombTimer) { EAXJMP(0x4B1140); } +//WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); } void CWorld::Initialise() @@ -128,6 +136,48 @@ CWorld::ClearScanCodes(void) } } +void +CWorld::ClearExcitingStuffFromArea(const CVector& pos, float radius, bool bRemoveProjectilesAndTidyUpShadows) +{ + CPedPool* pedPool = CPools::GetPedPool(); + for (int32 i = 0; i < pedPool->GetSize(); i++) { + CPed* pPed = pedPool->GetSlot(i); + if (pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() && + CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) { + CPopulation::RemovePed(pPed); + } + } + CVehiclePool* VehiclePool = CPools::GetVehiclePool(); + for (int32 i = 0; i < VehiclePool->GetSize(); i++) { + CVehicle* pVehicle = VehiclePool->GetSlot(i); + if (pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius && + !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if (pVehicle->pDriver) { + CPopulation::RemovePed(pVehicle->pDriver); + pVehicle->pDriver = nil; + } + for (int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { + if (pVehicle->pPassengers[j]) { + CPopulation::RemovePed(pVehicle->pPassengers[j]); + pVehicle->pPassengers[j] = nil; + --pVehicle->m_nNumPassengers; + } + } + CCarCtrl::RemoveFromInterestingVehicleList(pVehicle); + CWorld::Remove(pVehicle); + delete pVehicle; + } + } + CObject::DeleteAllTempObjectsInArea(pos, radius); + gFireManager.ExtinguishPoint(pos, radius); + CWorld::ExtinguishAllCarFiresInArea(pos, radius); + CExplosion::RemoveAllExplosionsInArea(pos, radius); + if (bRemoveProjectilesAndTidyUpShadows) { + CProjectileInfo::RemoveAllProjectiles(); + CShadows::TidyUpShadows(); + } +} + bool CWorld::CameraToIgnoreThisObject(CEntity *ent) { @@ -694,6 +744,67 @@ CWorld::FindObjectsInRange(CVector ¢re, float radius, bool ignoreZ, short *n } } +void +CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity->m_scanCode != ms_nCurrentScanCode) { + pEntity->m_scanCode = ms_nCurrentScanCode; + float fMagnitude = 0.0f; + if (bCheck2DOnly) + fMagnitude = CVector2D(position - pEntity->GetPosition()).Magnitude(); + else + fMagnitude = CVector(position - pEntity->GetPosition()).Magnitude(); + if (fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { + if (aEntities) + aEntities[*nEntitiesFound] = pEntity; + ++*nEntitiesFound; + } + } + pNode = pNode->next; + } +} + +void +CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +{ + CWorld::AdvanceCurrentScanCode(); + *nEntitiesFound = 0; + const CVector2D vecSectorStartPos(position.x - radius, position.y - radius); + const CVector2D vecSectorEndPos(position.x + radius, position.y + radius); + const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + if (bBuildings) { + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bVehicles) { + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bPeds) { + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bObjects) { + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bDummies) { + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + } + } +} + CEntity* CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects) { @@ -872,6 +983,273 @@ CWorld::FindRoofZFor3DCoord(float x, float y, float z, bool *found) } } +void +CWorld::RemoveReferencesToDeletedObject(CEntity* pDeletedObject) +{ + int32 i = CPools::GetPedPool()->GetSize(); + while (--i >= 0) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (pPed && pPed != pDeletedObject) { + pPed->RemoveRefsToEntity(pDeletedObject); + if (pPed->m_pCurrentPhysSurface == pDeletedObject) + pPed->m_pCurrentPhysSurface = nil; + } + } + i = CPools::GetVehiclePool()->GetSize(); + while (--i >= 0) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if (pVehicle && pVehicle != pDeletedObject) { + pVehicle->RemoveRefsToEntity(pDeletedObject); + pVehicle->RemoveRefsToVehicle(pDeletedObject); + } + } + i = CPools::GetObjectPool()->GetSize(); + while (--i >= 0) { + CObject* pObject = CPools::GetObjectPool()->GetSlot(i); + if (pObject && pObject != pDeletedObject) { + pObject->RemoveRefsToEntity(pDeletedObject); + } + } +} + +void +CWorld::FindObjectsKindaColliding(const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +{ + CWorld::AdvanceCurrentScanCode(); + *nCollidingEntities = 0; + const CVector2D vecSectorStartPos(position.x - radius, position.y - radius); + const CVector2D vecSectorEndPos(position.x + radius, position.y + radius); + const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + if (bBuildings) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + } + if (bVehicles) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + } + if (bPeds) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + } + if (bObjects) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + } + if (bDummies) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + } + } + } +} + +void +CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity->m_scanCode != ms_nCurrentScanCode) { + pEntity->m_scanCode = ms_nCurrentScanCode; + float fMagnitude = 0.0f; + if (bCheck2DOnly) + fMagnitude = CVector2D(position - pEntity->GetPosition()).Magnitude(); + else + fMagnitude = CVector(position - pEntity->GetPosition()).Magnitude(); + if (pEntity->GetBoundRadius() + radius > fMagnitude && *nCollidingEntities < maxEntitiesToFind) { + if (aEntities) + aEntities[*nCollidingEntities] = pEntity; + ++*nCollidingEntities; + } + } + pNode = pNode->next; + } +} + +void +CWorld::FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +{ + CWorld::AdvanceCurrentScanCode(); + *nIntersecting = 0; + const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + if (bBuildings) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + } + if (bVehicles) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + } + if (bPeds) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + } + if (bObjects) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + } + if (bDummies) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + } + } + } + +} + +void +CWorld::FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { + pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + float fRadius = pEntity->GetBoundRadius(); + const CVector& entityPos = pEntity->GetPosition(); + if (fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && + fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y && + fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && + *nIntersecting < maxEntitiesToFind) { + if (aEntities) + aEntities[*nIntersecting] = pEntity; + ++*nIntersecting; + } + } + pNode = pNode->next; + } +} + +void +CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, float fStartX, float fStartY, float fEndX, float fEndY, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +{ + CWorld::AdvanceCurrentScanCode(); + *nEntitiesFound = 0; + const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + if (bBuildings) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bVehicles) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bPeds) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bObjects) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if (bDummies) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + } + } + } +} + +void +CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { + pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + CColSphere sphere; + CVector vecDistance = pEntity->m_matrix.GetPosition() - position; + sphere.radius = pEntity->GetBoundRadius(); + sphere.center = Multiply3x3(vecDistance, matrix); + if (CCollision::TestSphereBox(sphere, boundingBox) && *nEntitiesFound < maxEntitiesToFind) { + if (aEntities) + aEntities[*nEntitiesFound] = pEntity; + ++*nEntitiesFound; + } + } + pNode = pNode->next; + } +} + +void +CWorld::FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects) +{ + CWorld::AdvanceCurrentScanCode(); + *nIntersecting = 0; + const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + if (bVehicles) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, true, false); + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, true, false); + } + if (bPeds) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, true); + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, true); + } + if (bObjects) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, false); + CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, false); + } + } + } +} + +void +CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { + pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + bool bIsMissionEntity = false; + if (bIsVehicleList) + bIsMissionEntity = ((CVehicle*)pEntity)->VehicleCreatedBy == MISSION_VEHICLE; + else if (bIsPedList) + bIsMissionEntity = ((CPed*)pEntity)->CharCreatedBy == MISSION_CHAR; + else + bIsMissionEntity = ((CObject*)pEntity)->ObjectCreatedBy == MISSION_OBJECT; + float fRadius = pEntity->GetBoundRadius(); + const CVector& entityPos = pEntity->GetPosition(); + if (bIsMissionEntity && + fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && + fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y && + fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && + *nIntersecting < maxEntitiesToFind) { + if (aEntities) + aEntities[*nIntersecting] = (CEntity*)pEntity; + ++*nIntersecting; + } + } + pNode = pNode->next; + } +} + CPlayerPed* FindPlayerPed(void) { @@ -960,6 +1338,155 @@ FindPlayerHeading(void) return FindPlayerPed()->GetForward().Heading(); } + +void CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2) +{ + CVehiclePool *pVehiclePool = CPools::GetVehiclePool(); + for (int32 i = 0; i < pVehiclePool->GetSize(); i++) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if (pVehicle) { + const CVector& position = pVehicle->GetPosition(); + if (position.x >= x1 && position.x <= x2 && + position.y >= y1 && position.y <= y2 && + position.z >= z1 && position.z <= z2 && + !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if (pVehicle->pDriver) { + CPopulation::RemovePed(pVehicle->pDriver); + pVehicle->pDriver = nil; + } + for (int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { + if (pVehicle->pPassengers[j]) { + CPopulation::RemovePed(pVehicle->pPassengers[j]); + pVehicle->pPassengers[j] = nil; + --pVehicle->m_nNumPassengers; + } + } + CCarCtrl::RemoveFromInterestingVehicleList(pVehicle); + CWorld::Remove(pVehicle); + delete pVehicle; + } + } + } +} + +void +CWorld::ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2) +{ + CPedPool* pPedPool = CPools::GetPedPool(); + for (int32 i = 0; i < pPedPool->GetSize(); i++) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (pPed) { + const CVector& position = pPed->GetPosition(); + if (!pPed->IsPlayer() && pPed->CanBeDeleted() && + position.x >= x1 && position.x <= x2 && + position.y >= y1 && position.y <= y2 && + position.z >= z1 && position.z <= z2) { + CPopulation::RemovePed(pPed); + } + } + } +} + +void +CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2) +{ + CWorld::AdvanceCurrentScanCode(); + float fStartX = x1 - 10.0f; + float fStartY = y1 - 10.0f; + float fEndX = x2 + 10.0f; + float fEndY = y2 + 10.0f; + const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2, y2, fStartX, fStartY, fEndX, fEndY); + CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1, y1, x2, y2, fStartX, fStartY, fEndX, fEndY); + CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS], x1, y1, x2, y2); + CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2, y2); + } + } +} + +void +CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CVehicle *pVehicle = (CVehicle*)pNode->item; + if (pVehicle->m_scanCode != CWorld::ms_nCurrentScanCode) { + pVehicle->m_scanCode = CWorld::ms_nCurrentScanCode; + const CVector& vehiclePos = pVehicle->m_matrix.GetPosition(); + eCarMission carMission = pVehicle->AutoPilot.m_nCarMission; + if (pVehicle != FindPlayerVehicle() && + vehiclePos.x > fStartX && vehiclePos.x < fEndX && + vehiclePos.y > fStartY && vehiclePos.y < fEndY && + pVehicle->bIsLawEnforcer && + (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE || + carMission == MISSION_BLOCKPLAYER_FARAWAY || carMission == MISSION_BLOCKPLAYER_CLOSE) + ) { + pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; + CColModel* pColModel = pVehicle->GetColModel(); + bool bInsideSphere = false; + for (int32 i = 0; i < pColModel->numSpheres; i++) { + CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center; + float fRadius = pColModel->spheres[i].radius; + if (pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && pos.y - fRadius < y2) + bInsideSphere = true; + // Maybe break the loop when bInsideSphere is set to true? + } + if (bInsideSphere) { + if (pVehicle->m_matrix.GetPosition().x <= (x1 + x2) * 0.5f) + pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f); + else + pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f); + if (pVehicle->m_matrix.GetPosition().y <= (y1 + y2) * 0.5f) + pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f); + else + pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f); + } + } + } + pNode = pNode->next; + } +} + +void +CWorld::CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CPed* pPed = (CPed*)pNode->item; + const CVector& pedPos = pPed->GetPosition(); + if (pPed->m_scanCode != CWorld::ms_nCurrentScanCode) + { + pPed->m_scanCode = CWorld::ms_nCurrentScanCode; + if (pPed != FindPlayerPed() && pPed->m_leader != FindPlayerPed() && + pedPos.x > x1 && pedPos.x < x2 && + pedPos.y > y1 && pedPos.y < y2 && + (pPed->m_pedInObjective == FindPlayerPed() || pPed->m_carInObjective && pPed->m_carInObjective == FindPlayerVehicle()) && + pPed->m_nPedState != PED_DEAD && pPed->m_nPedState != PED_DIE && + (pPed->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || + pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || + pPed->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS)) { + if (pPed->IsPedInControl()) { + if (pPed->m_nPedType == PEDTYPE_COP) + ((CCopPed*)pPed)->ClearPursuit(); + else + pPed->SetIdle(); + pPed->SetObjective(OBJECTIVE_NONE); + } + else { + pPed->m_prevObjective = OBJECTIVE_NONE; + pPed->m_nLastPedState = PED_IDLE; + } + } + } + } +} + void CWorld::RemoveEntityInsteadOfProcessingIt(CEntity* ent) { @@ -1056,6 +1583,214 @@ CWorld::ExtinguishAllCarFiresInArea(CVector point, float range) } } +void +CWorld::AddParticles(void) +{ + for (int32 y = 0; y < NUMSECTORS_Y; y++) { + for (int32 x = 0; x < NUMSECTORS_X; x++) { + CSector* pSector = GetSector(x, y); + CEntity::AddSteamsFromGround1(pSector->m_lists[ENTITYLIST_BUILDINGS]); + CEntity::AddSteamsFromGround1(pSector->m_lists[ENTITYLIST_DUMMIES]); + } + } +} + +void +CWorld::ShutDown(void) +{ + for (int32 y = 0; y < NUMSECTORS_Y; y++) { + for (int32 x = 0; x < NUMSECTORS_X; x++) { + CSector *pSector = GetSector(x, y); + CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_PEDS].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); + } + } + for (int32 i = 0; i < 4; i ++) { + CPtrNode* pNode = GetBigBuildingList((eLevelName)i).first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + // Maybe remove from world here? + delete pEntity; + } + pNode = pNode->next; + } + GetBigBuildingList((eLevelName)i).Flush(); + } + for (int32 y = 0; y < NUMSECTORS_Y; y++) { + for (int32 x = 0; x < NUMSECTORS_X; x++) { + CSector* pSector = GetSector(x, y); + if (pSector->m_lists[ENTITYLIST_BUILDINGS].first) { + sprintf(gString, "Building list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + } + if (pSector->m_lists[ENTITYLIST_DUMMIES].first) { + sprintf(gString, "Dummy list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + } + if (pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) { + sprintf(gString, "Building overlap list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) { + sprintf(gString, "Vehicle overlap list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) { + sprintf(gString, "Ped overlap list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) { + sprintf(gString, "Object overlap list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) { + sprintf(gString, "Dummy overlap list %d,%d not empty\n", x, y); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); + } + } + } + ms_listMovingEntityPtrs.Flush(); +} + +void +CWorld::ClearForRestart(void) +{ + if (CCutsceneMgr::HasLoaded()) + CCutsceneMgr::DeleteCutsceneData(); + CProjectileInfo::RemoveAllProjectiles(); + CObject::DeleteAllTempObjects(); + CObject::DeleteAllMissionObjects(); + CPopulation::ConvertAllObjectsToDummyObjects(); + for (int32 y = 0; y < NUMSECTORS_Y; y++) { + for (int32 x = 0; x < NUMSECTORS_X; x++) { + CSector *pSector = GetSector(x, y); + CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; + while (pNode) { + CEntity *pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = GetBigBuildingList(LEVEL_NONE).first; + while (pNode) { + CVehicle *pVehicle = (CVehicle*)pNode->item; + if (pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { + CWorld::Remove(pVehicle); + delete pVehicle; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + } + } + CPools::CheckPoolsEmpty(); +} + +void +CWorld::RepositionCertainDynamicObjects() +{ + int32 i = CPools::GetDummyPool()->GetSize(); + while (--i >= 0) { + CDummy* dummy = CPools::GetDummyPool()->GetSlot(i); + if (dummy) { + RepositionOneObject(dummy); + } + } +} + +void +CWorld::RepositionOneObject(CEntity* pEntity) +{ + int16 modeId = pEntity->m_modelIndex; + if (MI_SINGLESTREETLIGHTS1 == modeId || MI_SINGLESTREETLIGHTS2 == modeId || MI_SINGLESTREETLIGHTS3 == modeId + || MI_DOUBLESTREETLIGHTS == modeId || MI_TREE1 == modeId || MI_TREE2 == modeId || MI_TREE3 == modeId + || MI_TREE4 == modeId || MI_TREE5 == modeId || MI_TREE6 == modeId || MI_TREE7 == modeId + || MI_TREE8 == modeId || MI_TREE9 == modeId || MI_TREE10 == modeId || MI_TREE11 == modeId + || MI_TREE12 == modeId || MI_TREE13 == modeId || MI_TREE14 == modeId || MI_TRAFFICLIGHTS == modeId + || MI_PARKINGMETER == modeId || MI_PHONEBOOTH1 == modeId || MI_WASTEBIN == modeId || MI_BIN == modeId + || MI_POSTBOX1 == modeId || MI_NEWSSTAND == modeId || MI_TRAFFICCONE == modeId || MI_DUMP1 == modeId + || MI_ROADWORKBARRIER1 == modeId || MI_BUSSIGN1 == modeId || MI_NOPARKINGSIGN1 == modeId + || MI_PHONESIGN == modeId || MI_TAXISIGN == modeId || MI_FISHSTALL01 == modeId || MI_FISHSTALL02 == modeId + || MI_FISHSTALL03 == modeId || MI_FISHSTALL04 == modeId || MI_BAGELSTAND2 == modeId || MI_FIRE_HYDRANT == modeId + || MI_BOLLARDLIGHT == modeId || MI_PARKTABLE == modeId) { + CVector& position = pEntity->m_matrix.GetPosition(); + float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; + position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - fBoundingBoxMinZ; + pEntity->m_matrix.UpdateRW(); + pEntity->UpdateRwFrame(); + } else if (MI_BUOY == modeId) { + float fWaterLevel = 0.0f; + bool found = true; + const CVector& position = pEntity->m_matrix.GetPosition(); + float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &found); + if (CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &fWaterLevel)) { + if (!found || fWaterLevel > fGroundZ) { + CColModel* pColModel = pEntity->GetColModel(); + float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; + pEntity->m_matrix.GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; + } + } + } +} + void CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason) { @@ -1069,6 +1804,60 @@ CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason) } } +void +CWorld::SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason) +{ + int32 poolSize = CPools::GetPedPool()->GetSize(); + for (int32 i = poolSize - 1; i >= 0; i--) { + CPed* pPed = CPools::GetPedPool()->GetSlot(i); + if (pPed && pPed->m_nPedState != PED_DEAD && !pPed->bInVehicle && !pPed->m_pFire && !pPed->bFireProof) { + if (Abs(pPed->GetPosition().z - z) < 5.0f && Abs(pPed->GetPosition().x - x) < radius && Abs(pPed->GetPosition().y - y) < radius) + gFireManager.StartFire(pPed, reason, 0.8f, true); + } + } +} + +void +CWorld::RemoveStaticObjects() +{ + for (int32 y = 0; y < NUMSECTORS_Y; y++) { + for (int32 x = 0; x < NUMSECTORS_X; x++) { + CSector* pSector = GetSector(x, y); + CPtrNode* pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; + while (pNode) { + CEntity* pEntity = (CEntity*)pNode->item; + if (pEntity) { + CWorld::Remove(pEntity); + delete pEntity; + } + pNode = pNode->next; + } + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); + } + } +} + void CWorld::Process(void) { @@ -1246,6 +2035,27 @@ CWorld::Process(void) } } } +/* +void +CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) +{ + CVector2D vecStartPos(position.x - fRadius, position.y - fRadius); + CVector2D vecEndPos(position.x + fRadius, position.y + fRadius); + const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0); + const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); + const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); + const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); + for (int32 y = nStartY; y <= nEndY; y++) { + for (int32 x = nStartX; x <= nEndX; x++) { + CSector* pSector = CWorld::GetSector(x, y); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius, fPower, pCreator, bDrecementBombTimer); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower, pCreator, bDrecementBombTimer); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius, fPower, pCreator, bDrecementBombTimer); + } + } + +} +*/ STARTPATCHES InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP); diff --git a/src/core/World.h b/src/core/World.h index 07e7889f..bcb9ca27 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -85,7 +85,7 @@ public: } } static void ClearScanCodes(void); - static void ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8); + static void ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemoveProjectilesAndTidyUpShadows); static bool CameraToIgnoreThisObject(CEntity *ent); @@ -103,19 +103,26 @@ public: static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool); static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**); static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); - static void FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**); - static void FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); + static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); + static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); static float FindGroundZForCoord(float x, float y); static float FindGroundZFor3DCoord(float x, float y, float z, bool *found); static float FindRoofZFor3DCoord(float x, float y, float z, bool *found); static void RemoveReferencesToDeletedObject(CEntity*); - static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool); - static void FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool); + static void FindObjectsKindaColliding(const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); + static void FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities); + static void FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); + static void FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities); static void FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool); - static void FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool); - static void ClearCarsFromArea(float, float, float, float, float, float); - static void ClearPedsFromArea(float, float, float, float, float, float); - static void CallOffChaseForArea(float, float, float, float); + static void FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); + static void FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects); + static void FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList); + + static void ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2); + static void ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2); + static void CallOffChaseForArea(float x1, float y1, float x2, float y2); + static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY); + static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2); static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); } static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); } @@ -131,17 +138,19 @@ public: static void StopAllLawEnforcersInTheirTracks(); static void SetAllCarsCanBeDamaged(bool); static void ExtinguishAllCarFiresInArea(CVector, float); - static void SetCarsOnFire(float, float, float, float, CEntity*); - static void SetPedsOnFire(float, float, float, float, CEntity*); + static void SetCarsOnFire(float x, float y, float z, float radius, CEntity* reason); + static void SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason); static void Initialise(); static void AddParticles(); static void ShutDown(); static void ClearForRestart(void); static void RepositionCertainDynamicObjects(); + static void RepositionOneObject(CEntity* pEntity); static void RemoveStaticObjects(); static void Process(); - static void TriggerExplosion(const CVector &, float, float, CEntity*, bool); + static void TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); + static void TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); }; extern CColPoint *gaTempSphereColPoints; diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 25e5db48..c0da6ede 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -865,6 +865,16 @@ CEntity::ModifyMatrixForBannerInWind(void) UpdateRwFrame(); } +void +CEntity::AddSteamsFromGround1(CPtrList& list) +{ + CPtrNode *pNode = list.first; + while (pNode) { + ((CEntity*)pNode->item)->AddSteamsFromGround(nil); + pNode = pNode->next; + } +} + #include class CEntity_ : public CEntity diff --git a/src/entities/Entity.h b/src/entities/Entity.h index ca501ba4..15333162 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -4,6 +4,7 @@ #include "Placeable.h" struct CReference; +class CPtrList; enum eEntityType { @@ -152,5 +153,7 @@ public: void ModifyMatrixForTreeInWind(void); void ModifyMatrixForBannerInWind(void); void ProcessLightsForEntity(void); + + static void AddSteamsFromGround1(CPtrList& list); }; static_assert(sizeof(CEntity) == 0x64, "CEntity: error"); diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 867624c7..88773b83 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -383,7 +383,7 @@ CObject::DeleteAllTempObjects() } void -CObject::DeleteAllTempObjectInArea(CVector point, float fRadius) +CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius) { CObjectPool *objectPool = CPools::GetObjectPool(); for (int32 i = 0; i < objectPool->GetSize(); i++) { @@ -426,5 +426,5 @@ STARTPATCHES InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP); InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP); InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP); - InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP); + InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectsInArea, PATCH_JUMP); ENDPATCHES diff --git a/src/objects/Object.h b/src/objects/Object.h index 6d04c78a..80c742a0 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -99,6 +99,6 @@ public: static void DeleteAllMissionObjects(); static void DeleteAllTempObjects(); - static void DeleteAllTempObjectInArea(CVector point, float fRadius); + static void DeleteAllTempObjectsInArea(CVector point, float fRadius); }; static_assert(sizeof(CObject) == 0x198, "CObject: error"); -- cgit v1.2.3 From 6b1093f1c8f2a2c59383c2d8f2223b22e2f6cb42 Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 03:20:34 +0500 Subject: CWorld complete --- src/core/World.cpp | 147 ++++++++++++++++++++++++++++++++++++------- src/core/World.h | 2 +- src/modelinfo/ModelIndices.h | 7 +++ 3 files changed, 133 insertions(+), 23 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index 324be962..131625a5 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -26,6 +26,9 @@ #include "Object.h" #include "Shadows.h" #include "Explosion.h" +#include "Glass.h" +#include "ParticleObject.h" +#include "EventList.h" #define OBJECT_REPOSITION_OFFSET_Z 0.2f @@ -48,26 +51,6 @@ bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B; bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C; bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA; -//WRAPPER void CWorld::ClearForRestart(void) { EAXJMP(0x4AE850); } -//WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); } -//WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); } -//WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); } -//WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); } -//WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); } -//WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); } -//WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8 unused) { EAXJMP(0x4B4E70) }; -//WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B2E70); } -//WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); } -//WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); } -//WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); } -//WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool) { EAXJMP(0x4B3680); } -//WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); } -//WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); } -//WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); } -WRAPPER void CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity *pCreator, bool bProcessVehicleBombTimer) { EAXJMP(0x4B1140); } -//WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); } -WRAPPER void CWorld::UseDetonator(CEntity *) { EAXJMP(0x4B4650); } - void CWorld::Initialise() { @@ -2037,7 +2020,6 @@ CWorld::Process(void) } } -/* void CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) { @@ -2057,7 +2039,128 @@ CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, C } } -*/ + +void +CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) +{ + CPtrNode* pNode = list.first; + while (pNode) { + CPhysical* pEntity = (CPhysical*)pNode->item; + CVector vecDistance = pEntity->m_matrix.GetPosition() - position; + float fMagnitude = vecDistance.Magnitude(); + if (fRadius > fMagnitude) { + CWeapon::BlowUpExplosiveThings(pEntity); + CPed* pPed = (CPed*)pEntity; + CObject* pObject = (CObject*)pEntity; + CVehicle* pVehicle = (CVehicle*)pEntity; + if (!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { + if (pEntity->bIsStatic) { + if (pEntity->IsObject()) { + if (fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { + if (IsGlass(pObject->m_modelIndex)) { + CGlass::WindowRespondsToExplosion(pObject, position); + } else { + pObject->bIsStatic = false; + pObject->AddToMovingList(); + int16 modelId = pEntity->m_modelIndex; + if (modelId != MI_FIRE_HYDRANT || pObject->bHasBeenDamaged) { + if (pEntity->IsObject() && modelId != MI_EXPLODINGBARREL && modelId != MI_PETROLPUMP) + pObject->bHasBeenDamaged = true; + } else { + CVector pos = pEntity->m_matrix.GetPosition(); + pos.z -= 0.5f; + CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, pos, true); + pObject->bHasBeenDamaged = true; + } + } + } + if (pEntity->bIsStatic) { + float fDamageMultiplier = (fRadius - fMagnitude) * 2.0f / fRadius; + float fDamage = 300.0f * min(fDamageMultiplier, 1.0f); + pObject->ObjectDamage(fDamage); + } + } else { + pEntity->bIsStatic = false; + pEntity->AddToMovingList(); + } + } + if (!pEntity->bIsStatic) { + float fDamageMultiplier = min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f); + CVector vecForceDir = vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier / max(fMagnitude, 0.01f)); + vecForceDir.z = max(vecForceDir.z, 0.0f); + if (pEntity == FindPlayerPed()) + vecForceDir.z = min(vecForceDir.z, 1.0f); + pEntity->ApplyMoveForce(vecForceDir); + if (!pEntity->bPedPhysics) { + float fBoundRadius = pEntity->GetBoundRadius(); + float fDistanceZ = position.z - pEntity->m_matrix.GetPosition().z; + float fPointZ = fBoundRadius; + if (max(fDistanceZ, -fBoundRadius) < fBoundRadius) + { + if (fDistanceZ <= -fBoundRadius) + fPointZ = -fBoundRadius; + else + fPointZ = fDistanceZ; + } + pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z, 0.0f, 0.0f, fPointZ); + } + switch (pEntity->m_type) + { + case ENTITY_TYPE_VEHICLE: + if (pEntity->m_status == STATUS_SIMPLE) { + pEntity->m_status = STATUS_PHYSICS; + CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); + } + pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, 1100.0f * fDamageMultiplier); + if (bProcessVehicleBombTimer) { + if (pVehicle->m_nBombTimer) + pVehicle->m_nBombTimer /= 10; + } + break; + case ENTITY_TYPE_PED: { + int8 direction = pPed->GetLocalDirection(-vecForceDir); + pPed->bIsStanding = false; + pPed->ApplyMoveForce(0.0, 0.0, 2.0f); + float fDamage = 250.0f * fDamageMultiplier; + pPed->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, fDamage, PEDPIECE_TORSO, direction); + if (pPed->m_nPedState!= PED_DIE) + pPed->SetFall(2000, (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0); + if (pCreator && pCreator->IsPed()) { + eEventType eventType = EVENT_SHOOT_PED; + if (pPed->m_nPedType == PEDTYPE_COP) + eventType = EVENT_SHOOT_COP; + CEventList::RegisterEvent(eventType, EVENT_ENTITY_PED, pEntity, (CPed*)pCreator, 10000); + pPed->RegisterThreatWithGangPeds(pCreator); + } + break; + } + case ENTITY_TYPE_OBJECT: + pObject->ObjectDamage(300.0f * fDamageMultiplier); + break; + } + } + } + } + pNode = pNode->next; + } +} + +void +CWorld::UseDetonator(CEntity* pEntity) +{ + int32 i = CPools::GetVehiclePool()->GetSize(); + while (--i >= 0) { + CAutomobile* pVehicle = (CAutomobile*)CPools::GetVehiclePool()->GetSlot(i); + if (pVehicle && !pVehicle->m_vehType && pVehicle->m_bombType == CARBOMB_REMOTE && pVehicle->m_pBombRigger == pEntity) { + pVehicle->m_bombType = CARBOMB_NONE; + pVehicle->m_nBombTimer = 500; + pVehicle->m_pBlowUpEntity = pVehicle->m_pBombRigger; + if (pVehicle->m_pBlowUpEntity) + pVehicle->m_pBlowUpEntity->RegisterReference(&pVehicle->m_pBlowUpEntity); + } + } +} + STARTPATCHES InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP); InjectHook(0x4AE9D0, CWorld::Remove, PATCH_JUMP); diff --git a/src/core/World.h b/src/core/World.h index fcf7b7cb..a1e2acfd 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -151,7 +151,7 @@ public: static void Process(); static void TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); static void TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); - static void UseDetonator(CEntity *); + static void UseDetonator(CEntity *pEntity); }; extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 309fa1bb..cc8399e7 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -496,4 +496,11 @@ IsExplosiveThingModel(int16 id) { return id == MI_EXPLODINGBARREL || id == MI_PETROLPUMP; +} + +inline bool +IsFence(int16 id) +{ + return id == MI_FENCE || + id == MI_FENCE2; } \ No newline at end of file -- cgit v1.2.3 From 03247ce98f9f6b9f09861e50c8903ec6221e42fa Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 03:54:22 +0500 Subject: Fix CWorld::RepositionOneObject bugs --- src/core/World.cpp | 61 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index 131625a5..a9571c8b 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1743,30 +1743,59 @@ CWorld::RepositionCertainDynamicObjects() void CWorld::RepositionOneObject(CEntity* pEntity) { - int16 modeId = pEntity->m_modelIndex; - if (MI_SINGLESTREETLIGHTS1 == modeId || MI_SINGLESTREETLIGHTS2 == modeId || MI_SINGLESTREETLIGHTS3 == modeId - || MI_DOUBLESTREETLIGHTS == modeId || MI_TREE1 == modeId || MI_TREE2 == modeId || MI_TREE3 == modeId - || MI_TREE4 == modeId || MI_TREE5 == modeId || MI_TREE6 == modeId || MI_TREE7 == modeId - || MI_TREE8 == modeId || MI_TREE9 == modeId || MI_TREE10 == modeId || MI_TREE11 == modeId - || MI_TREE12 == modeId || MI_TREE13 == modeId || MI_TREE14 == modeId || MI_TRAFFICLIGHTS == modeId - || MI_PARKINGMETER == modeId || MI_PHONEBOOTH1 == modeId || MI_WASTEBIN == modeId || MI_BIN == modeId - || MI_POSTBOX1 == modeId || MI_NEWSSTAND == modeId || MI_TRAFFICCONE == modeId || MI_DUMP1 == modeId - || MI_ROADWORKBARRIER1 == modeId || MI_BUSSIGN1 == modeId || MI_NOPARKINGSIGN1 == modeId - || MI_PHONESIGN == modeId || MI_TAXISIGN == modeId || MI_FISHSTALL01 == modeId || MI_FISHSTALL02 == modeId - || MI_FISHSTALL03 == modeId || MI_FISHSTALL04 == modeId || MI_BAGELSTAND2 == modeId || MI_FIRE_HYDRANT == modeId - || MI_BOLLARDLIGHT == modeId || MI_PARKTABLE == modeId) { + int16 modelId = pEntity->m_modelIndex; + if (modelId == MI_SINGLESTREETLIGHTS1 + || modelId == MI_SINGLESTREETLIGHTS2 + || modelId == MI_SINGLESTREETLIGHTS3 + || modelId == MI_DOUBLESTREETLIGHTS + || modelId == MI_TREE1 + || modelId == MI_TREE2 + || modelId == MI_TREE3 + || modelId == MI_TREE4 + || modelId == MI_TREE5 + || modelId == MI_TREE6 + || modelId == MI_TREE7 + || modelId == MI_TREE8 + || modelId == MI_TREE9 + || modelId == MI_TREE10 + || modelId == MI_TREE11 + || modelId == MI_TREE12 + || modelId == MI_TREE13 + || modelId == MI_TREE14 + || modelId == MI_TRAFFICLIGHTS + || modelId == MI_PARKINGMETER + || modelId == MI_PHONEBOOTH1 + || modelId == MI_WASTEBIN + || modelId == MI_BIN + || modelId == MI_POSTBOX1 + || modelId == MI_NEWSSTAND + || modelId == MI_TRAFFICCONE + || modelId == MI_DUMP1 + || modelId == MI_ROADWORKBARRIER1 + || modelId == MI_BUSSIGN1 + || modelId == MI_NOPARKINGSIGN1 + || modelId == MI_PHONESIGN + || modelId == MI_TAXISIGN + || modelId == MI_FISHSTALL01 + || modelId == MI_FISHSTALL02 + || modelId == MI_FISHSTALL03 + || modelId == MI_FISHSTALL04 + || modelId == MI_BAGELSTAND2 + || modelId == MI_FIRE_HYDRANT + || modelId == MI_BOLLARDLIGHT + || modelId == MI_PARKTABLE) { CVector& position = pEntity->m_matrix.GetPosition(); float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - fBoundingBoxMinZ; pEntity->m_matrix.UpdateRW(); pEntity->UpdateRwFrame(); - } else if (MI_BUOY == modeId) { + } else if (modelId == MI_BUOY) { float fWaterLevel = 0.0f; - bool found = true; + bool bFound = true; const CVector& position = pEntity->m_matrix.GetPosition(); - float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &found); + float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); if (CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &fWaterLevel)) { - if (!found || fWaterLevel > fGroundZ) { + if (!bFound || fWaterLevel > fGroundZ) { CColModel* pColModel = pEntity->GetColModel(); float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; pEntity->m_matrix.GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; -- cgit v1.2.3 From e777f240642a6f287d08d7c536e878cae372fdfa Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 05:38:05 +0500 Subject: More CWorld fixes --- src/core/World.cpp | 48 ++++++++++++++++++++++++------------------------ src/entities/Entity.cpp | 4 ++-- src/entities/Entity.h | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index a9571c8b..02c0e2f6 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -30,7 +30,7 @@ #include "ParticleObject.h" #include "EventList.h" -#define OBJECT_REPOSITION_OFFSET_Z 0.2f +#define OBJECT_REPOSITION_OFFSET_Z 2.0f CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; @@ -738,9 +738,9 @@ CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const pEntity->m_scanCode = ms_nCurrentScanCode; float fMagnitude = 0.0f; if (bCheck2DOnly) - fMagnitude = CVector2D(position - pEntity->GetPosition()).Magnitude(); + fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); else - fMagnitude = CVector(position - pEntity->GetPosition()).Magnitude(); + fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr(); if (fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { if (aEntities) aEntities[*nEntitiesFound] = pEntity; @@ -1044,9 +1044,9 @@ CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& posit pEntity->m_scanCode = ms_nCurrentScanCode; float fMagnitude = 0.0f; if (bCheck2DOnly) - fMagnitude = CVector2D(position - pEntity->GetPosition()).Magnitude(); + fMagnitude = (position - pEntity->GetPosition()).Magnitude2D(); else - fMagnitude = CVector(position - pEntity->GetPosition()).Magnitude(); + fMagnitude = (position - pEntity->GetPosition()).Magnitude(); if (pEntity->GetBoundRadius() + radius > fMagnitude && *nCollidingEntities < maxEntitiesToFind) { if (aEntities) aEntities[*nCollidingEntities] = pEntity; @@ -1162,7 +1162,7 @@ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, cons if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; CColSphere sphere; - CVector vecDistance = pEntity->m_matrix.GetPosition() - position; + CVector vecDistance = pEntity->GetPosition() - position; sphere.radius = pEntity->GetBoundRadius(); sphere.center = Multiply3x3(vecDistance, matrix); if (CCollision::TestSphereBox(sphere, boundingBox) && *nEntitiesFound < maxEntitiesToFind) { @@ -1226,7 +1226,7 @@ CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVec fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && *nIntersecting < maxEntitiesToFind) { if (aEntities) - aEntities[*nIntersecting] = (CEntity*)pEntity; + aEntities[*nIntersecting] = pEntity; ++*nIntersecting; } } @@ -1402,7 +1402,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1 CVehicle *pVehicle = (CVehicle*)pNode->item; if (pVehicle->m_scanCode != CWorld::ms_nCurrentScanCode) { pVehicle->m_scanCode = CWorld::ms_nCurrentScanCode; - const CVector& vehiclePos = pVehicle->m_matrix.GetPosition(); + const CVector& vehiclePos = pVehicle->GetPosition(); eCarMission carMission = pVehicle->AutoPilot.m_nCarMission; if (pVehicle != FindPlayerVehicle() && vehiclePos.x > fStartX && vehiclePos.x < fEndX && @@ -1422,11 +1422,11 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1 // Maybe break the loop when bInsideSphere is set to true? } if (bInsideSphere) { - if (pVehicle->m_matrix.GetPosition().x <= (x1 + x2) * 0.5f) + if (pVehicle->GetPosition().x <= (x1 + x2) * 0.5f) pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f); else pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f); - if (pVehicle->m_matrix.GetPosition().y <= (y1 + y2) * 0.5f) + if (pVehicle->GetPosition().y <= (y1 + y2) * 0.5f) pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f); else pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f); @@ -1573,8 +1573,8 @@ CWorld::AddParticles(void) for (int32 y = 0; y < NUMSECTORS_Y; y++) { for (int32 x = 0; x < NUMSECTORS_X; x++) { CSector* pSector = GetSector(x, y); - CEntity::AddSteamsFromGround1(pSector->m_lists[ENTITYLIST_BUILDINGS]); - CEntity::AddSteamsFromGround1(pSector->m_lists[ENTITYLIST_DUMMIES]); + CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]); + CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]); } } } @@ -1605,7 +1605,7 @@ CWorld::ShutDown(void) } pNode = pSector->m_lists[ENTITYLIST_PEDS].first; while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; + CEntity *pEntity = (CEntity*)pNode->item; if (pEntity) { CWorld::Remove(pEntity); delete pEntity; @@ -1614,7 +1614,7 @@ CWorld::ShutDown(void) } pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; + CEntity *pEntity = (CEntity*)pNode->item; if (pEntity) { CWorld::Remove(pEntity); delete pEntity; @@ -1623,7 +1623,7 @@ CWorld::ShutDown(void) } pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; + CEntity *pEntity = (CEntity*)pNode->item; if (pEntity) { CWorld::Remove(pEntity); delete pEntity; @@ -1637,9 +1637,9 @@ CWorld::ShutDown(void) } } for (int32 i = 0; i < 4; i ++) { - CPtrNode* pNode = GetBigBuildingList((eLevelName)i).first; + CPtrNode *pNode = GetBigBuildingList((eLevelName)i).first; while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; + CEntity *pEntity = (CEntity*)pNode->item; if (pEntity) { // Maybe remove from world here? delete pEntity; @@ -1650,7 +1650,7 @@ CWorld::ShutDown(void) } for (int32 y = 0; y < NUMSECTORS_Y; y++) { for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector* pSector = GetSector(x, y); + CSector *pSector = GetSector(x, y); if (pSector->m_lists[ENTITYLIST_BUILDINGS].first) { sprintf(gString, "Building list %d,%d not empty\n", x, y); pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); @@ -1784,7 +1784,7 @@ CWorld::RepositionOneObject(CEntity* pEntity) || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || modelId == MI_PARKTABLE) { - CVector& position = pEntity->m_matrix.GetPosition(); + CVector& position = pEntity->GetPosition(); float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - fBoundingBoxMinZ; pEntity->m_matrix.UpdateRW(); @@ -1792,13 +1792,13 @@ CWorld::RepositionOneObject(CEntity* pEntity) } else if (modelId == MI_BUOY) { float fWaterLevel = 0.0f; bool bFound = true; - const CVector& position = pEntity->m_matrix.GetPosition(); + const CVector& position = pEntity->GetPosition(); float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); if (CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &fWaterLevel)) { if (!bFound || fWaterLevel > fGroundZ) { CColModel* pColModel = pEntity->GetColModel(); float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; - pEntity->m_matrix.GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; + pEntity->GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; } } } @@ -2075,7 +2075,7 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa CPtrNode* pNode = list.first; while (pNode) { CPhysical* pEntity = (CPhysical*)pNode->item; - CVector vecDistance = pEntity->m_matrix.GetPosition() - position; + CVector vecDistance = pEntity->GetPosition() - position; float fMagnitude = vecDistance.Magnitude(); if (fRadius > fMagnitude) { CWeapon::BlowUpExplosiveThings(pEntity); @@ -2096,7 +2096,7 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa if (pEntity->IsObject() && modelId != MI_EXPLODINGBARREL && modelId != MI_PETROLPUMP) pObject->bHasBeenDamaged = true; } else { - CVector pos = pEntity->m_matrix.GetPosition(); + CVector pos = pEntity->GetPosition(); pos.z -= 0.5f; CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, pos, true); pObject->bHasBeenDamaged = true; @@ -2122,7 +2122,7 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa pEntity->ApplyMoveForce(vecForceDir); if (!pEntity->bPedPhysics) { float fBoundRadius = pEntity->GetBoundRadius(); - float fDistanceZ = position.z - pEntity->m_matrix.GetPosition().z; + float fDistanceZ = position.z - pEntity->GetPosition().z; float fPointZ = fBoundRadius; if (max(fDistanceZ, -fBoundRadius) < fBoundRadius) { diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index c0da6ede..0efee4e7 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -866,7 +866,7 @@ CEntity::ModifyMatrixForBannerInWind(void) } void -CEntity::AddSteamsFromGround1(CPtrList& list) +CEntity::AddSteamsFromGround(CPtrList& list) { CPtrNode *pNode = list.first; while (pNode) { @@ -922,7 +922,7 @@ STARTPATCHES InjectHook(0x473F60, &CEntity::DetachFromRwObject, PATCH_JUMP); InjectHook(0x475A20, &CEntity::PreRenderForGlassWindow, PATCH_JUMP); - InjectHook(0x50CE40, &CEntity::AddSteamsFromGround, PATCH_JUMP); + InjectHook(0x50CE40, (void (CEntity::*)(CVector*))& CEntity::AddSteamsFromGround, PATCH_JUMP); InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP); InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP); InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP); diff --git a/src/entities/Entity.h b/src/entities/Entity.h index 15333162..dadeee54 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -154,6 +154,6 @@ public: void ModifyMatrixForBannerInWind(void); void ProcessLightsForEntity(void); - static void AddSteamsFromGround1(CPtrList& list); + static void AddSteamsFromGround(CPtrList& list); }; static_assert(sizeof(CEntity) == 0x64, "CEntity: error"); -- cgit v1.2.3 From a4922d5cb77e31657768d5da4b286a2e67ee0e6f Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Fri, 17 Apr 2020 08:54:14 +0300 Subject: rem refs --- src/animation/RpAnimBlend.cpp | 2 +- src/animation/RpAnimBlend.h | 2 +- src/audio/AudioManager.cpp | 24 ++--- src/audio/DMAudio.cpp | 2 +- src/audio/DMAudio.h | 2 +- src/audio/PoliceRadio.cpp | 16 ++-- src/control/CarAI.cpp | 1 - src/control/CarCtrl.cpp | 38 ++++---- src/control/CarCtrl.h | 36 +++---- src/control/GameLogic.cpp | 2 +- src/control/PathFind.cpp | 10 +- src/control/PathFind.h | 6 +- src/control/Phones.cpp | 12 +-- src/control/Phones.h | 12 +-- src/control/Pickups.cpp | 16 ++-- src/control/Pickups.h | 10 +- src/control/Record.cpp | 28 +++--- src/control/Record.h | 30 +++--- src/control/Replay.cpp | 134 +++++++++++++------------- src/control/Replay.h | 124 ++++++++++++------------ src/control/Restart.cpp | 32 +++---- src/control/Restart.h | 32 +++---- src/control/RoadBlocks.cpp | 6 +- src/control/RoadBlocks.h | 6 +- src/control/Script.cpp | 82 ++++++++-------- src/control/Script.h | 80 ++++++++-------- src/core/Accident.cpp | 2 +- src/core/Accident.h | 2 +- src/core/Cam.cpp | 2 +- src/core/Camera.cpp | 6 +- src/core/Camera.h | 6 +- src/core/Clock.cpp | 20 ++-- src/core/Clock.h | 18 ++-- src/core/ControllerConfig.cpp | 2 +- src/core/ControllerConfig.h | 2 +- src/core/EventList.cpp | 1 - src/core/FileMgr.cpp | 4 +- src/core/FileMgr.h | 4 +- src/core/Fire.cpp | 2 +- src/core/Fire.h | 2 +- src/core/Frontend.cpp | 2 +- src/core/Game.cpp | 22 +++-- src/core/Game.h | 16 ++-- src/core/IniFile.cpp | 4 +- src/core/Pad.cpp | 24 ++--- src/core/Pad.h | 22 ++--- src/core/Pools.cpp | 18 ++-- src/core/Pools.h | 18 ++-- src/core/Radar.cpp | 44 ++++----- src/core/References.cpp | 4 +- src/core/References.h | 4 +- src/core/Stats.cpp | 106 ++++++++++----------- src/core/Stats.h | 106 ++++++++++----------- src/core/Streaming.cpp | 84 ++++++++-------- src/core/Streaming.h | 56 +++++------ src/core/SurfaceTable.cpp | 2 +- src/core/SurfaceTable.h | 3 +- src/core/TempColModels.cpp | 26 ++--- src/core/TempColModels.h | 26 ++--- src/core/TimeStep.cpp | 6 +- src/core/TimeStep.h | 6 +- src/core/Timer.cpp | 50 +++++----- src/core/Timer.h | 20 ++-- src/core/User.cpp | 8 +- src/core/User.h | 8 +- src/core/Wanted.cpp | 4 +- src/core/Wanted.h | 4 +- src/core/ZoneCull.cpp | 30 +++--- src/core/ZoneCull.h | 28 +++--- src/core/Zones.cpp | 24 ++--- src/core/Zones.h | 22 ++--- src/core/config.h | 1 + src/core/main.cpp | 17 ++-- src/core/main.h | 16 ++-- src/modelinfo/ModelInfo.cpp | 5 +- src/modelinfo/ModelInfo.h | 2 +- src/modelinfo/VehicleModelInfo.cpp | 16 ++-- src/modelinfo/VehicleModelInfo.h | 10 +- src/objects/Object.cpp | 4 +- src/objects/Object.h | 4 +- src/objects/ParticleObject.cpp | 8 +- src/objects/ParticleObject.h | 8 +- src/peds/PedRoutes.cpp | 2 +- src/peds/PedStats.cpp | 1 - src/peds/PedType.cpp | 2 +- src/peds/PedType.h | 2 +- src/render/Clouds.cpp | 14 +-- src/render/Clouds.h | 12 +-- src/render/Console.cpp | 2 +- src/render/Console.h | 2 +- src/render/Coronas.cpp | 16 ++-- src/render/Coronas.h | 16 ++-- src/render/Credits.cpp | 4 +- src/render/Credits.h | 4 +- src/render/Draw.cpp | 16 ++-- src/render/Draw.h | 16 ++-- src/render/Font.cpp | 10 +- src/render/Font.h | 11 ++- src/render/Hud.cpp | 78 +++++++-------- src/render/MBlur.cpp | 6 +- src/render/MBlur.h | 6 +- src/render/Particle.cpp | 15 +-- src/render/Particle.h | 7 +- src/render/PointLights.cpp | 6 +- src/render/PointLights.h | 4 +- src/render/RenderBuffer.cpp | 12 +-- src/render/RenderBuffer.h | 12 +-- src/render/Shadows.cpp | 46 ++++----- src/render/Shadows.h | 30 +++--- src/render/Sprite.cpp | 14 +-- src/render/Sprite.h | 8 +- src/render/Timecycle.cpp | 190 ++++++++++++++++++------------------- src/render/Timecycle.h | 184 +++++++++++++++++------------------ src/render/WaterLevel.cpp | 4 +- src/render/WaterLevel.h | 2 +- src/render/Weather.cpp | 48 +++++----- src/render/Weather.h | 50 +++++----- src/rw/Lights.cpp | 24 ++--- src/rw/NodeName.cpp | 2 +- src/rw/RwHelper.cpp | 2 + src/rw/TexRead.cpp | 4 +- src/rw/TxdStore.cpp | 4 +- src/rw/VisibilityPlugins.cpp | 36 +++---- src/save/GenericGameStorage.cpp | 30 +++--- src/save/PCSave.cpp | 2 +- src/skel/skeleton.cpp | 3 +- src/skel/skeleton.h | 2 +- src/skel/win/win.cpp | 26 ++--- src/skel/win/win.h | 6 +- src/text/Messages.cpp | 6 +- src/text/Text.cpp | 2 +- src/vehicles/Automobile.cpp | 2 +- src/vehicles/Boat.cpp | 10 +- src/vehicles/Floater.cpp | 4 +- src/vehicles/HandlingMgr.cpp | 2 +- src/vehicles/Heli.cpp | 12 +-- src/vehicles/Plane.cpp | 70 +++++++------- src/weapons/ShotInfo.cpp | 2 - src/weapons/WeaponInfo.cpp | 1 - 139 files changed, 1380 insertions(+), 1430 deletions(-) diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 9c847139..07b8e7d8 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -8,7 +8,7 @@ #include "AnimBlendAssociation.h" #include "RpAnimBlend.h" -RwInt32 &ClumpOffset = *(RwInt32*)0x8F1B84; +RwInt32 ClumpOffset; enum { diff --git a/src/animation/RpAnimBlend.h b/src/animation/RpAnimBlend.h index f9e14c42..ccfa5872 100644 --- a/src/animation/RpAnimBlend.h +++ b/src/animation/RpAnimBlend.h @@ -11,7 +11,7 @@ struct AnimBlendFrameUpdateData CAnimBlendNode *nodes[16]; }; -extern RwInt32 &ClumpOffset; +extern RwInt32 ClumpOffset; #define RPANIMBLENDCLUMPDATA(o) (RWPLUGINOFFSET(CAnimBlendClumpData*, o, ClumpOffset)) bool RpAnimBlendPluginAttach(void); diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 8a9a81f9..2ee7e602 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -40,18 +40,18 @@ #include "sampman.h" cAudioManager AudioManager; -uint32 gPornNextTime; // = *(uint32*)0x6508A0; -uint32 gSawMillNextTime; // = *(uint32*)0x6508A4; -uint32 gShopNextTime; // = *(uint32*)0x6508A8; -uint32 gAirportNextTime; // = *(uint32*)0x6508AC; -uint32 gCinemaNextTime; //= *(uint32*)0x6508B0; -uint32 gDocksNextTime; // = *(uint32*)0x6508B4; -uint32 gHomeNextTime; // = *(uint32*)0x6508B8; -uint32 gCellNextTime; // = *(uint32*)0x6508BC; -uint32 gNextCryTime; // = *(uint32*)0x6508C0; -uint8 gJumboVolOffsetPercentage; // = *(uint8 *)0x6508ED; -bool bPlayerJustEnteredCar; // = *(bool *)0x6508C4; -bool g_bMissionAudioLoadFailed; // = *(bool *)0x95CD8E; +uint32 gPornNextTime; +uint32 gSawMillNextTime; +uint32 gShopNextTime; +uint32 gAirportNextTime; +uint32 gCinemaNextTime; +uint32 gDocksNextTime; +uint32 gHomeNextTime; +uint32 gCellNextTime; +uint32 gNextCryTime; +uint8 gJumboVolOffsetPercentage; +bool bPlayerJustEnteredCar; +bool g_bMissionAudioLoadFailed; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index a01c85ae..e55790ea 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -6,7 +6,7 @@ #include "AudioScriptObject.h" #include "sampman.h" -cDMAudio &DMAudio = *(cDMAudio*)0x95CDBE; +cDMAudio DMAudio; void cDMAudio::Initialise(void) diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index d2cdf466..9ce073b4 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -256,4 +256,4 @@ public: void SetRadioInCar(uint32 radio); void SetRadioChannel(int8 radio, int32 pos); }; -extern cDMAudio &DMAudio; +extern cDMAudio DMAudio; diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index 255d7026..a81fcbe9 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -21,14 +21,14 @@ struct tPoliceRadioZone { int32 field_12; }; -tPoliceRadioZone (&ZoneSfx)[NUMAUDIOZONES] = *(tPoliceRadioZone(*)[NUMAUDIOZONES])*(uintptr*)0x880240; -char *SubZo2Label = (char*)0x6E9918; -char *SubZo3Label = (char*)0x6E9870; - -int32 &g_nMissionAudioSfx = *(int32*)0x60ED84; -int8 &g_nMissionAudioPlayingStatus = *(int8*)0x60ED88; -uint8 &gSpecialSuspectLastSeenReport = *(uint8*)0x95CD4D; -uint32 (&gMinTimeToNextReport)[NUM_CRIME_TYPES] = *(uint32(*)[NUM_CRIME_TYPES])*(uintptr*)0x8E2828; +tPoliceRadioZone ZoneSfx[NUMAUDIOZONES]; +char SubZo2Label[8]; +char SubZo3Label[8]; + +int32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES; +int8 g_nMissionAudioPlayingStatus = 2; +uint8 gSpecialSuspectLastSeenReport; +uint32 gMinTimeToNextReport[NUM_CRIME_TYPES]; void cAudioManager::InitialisePoliceRadioZones() diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index e47e3d5e..f48e4c78 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -33,7 +33,6 @@ float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle) void CCarAI::UpdateCarAI(CVehicle* pVehicle) { - //((void(*)(CVehicle*))(0x413E50))(pVehicle); //return; if (pVehicle->bIsLawEnforcer){ if (pVehicle->AutoPilot.m_nCarMission == MISSION_BLOCKCAR_FARAWAY || diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 197fca63..6e47670d 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -67,25 +67,25 @@ #define MIN_ANGLE_TO_APPLY_HANDBRAKE 0.7f #define MIN_SPEED_TO_APPLY_HANDBRAKE 0.3f -int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38; -int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0; -int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0; -bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A; -float& CCarCtrl::CarDensityMultiplier = *(float*)0x5EC8B4; -int32 &CCarCtrl::NumMissionCars = *(int32*)0x8F1B54; -int32 &CCarCtrl::NumRandomCars = *(int32*)0x943118; -int32 &CCarCtrl::NumParkedCars = *(int32*)0x8F29E0; -int32 &CCarCtrl::NumPermanentCars = *(int32*)0x8F29F0; -int8 &CCarCtrl::CountDownToCarsAtStart = *(int8*)0x95CD63; -int32 &CCarCtrl::MaxNumberOfCarsInUse = *(int32*)0x5EC8B8; -uint32 &CCarCtrl::LastTimeLawEnforcerCreated = *(uint32*)0x8F5FF0; -uint32 &CCarCtrl::LastTimeFireTruckCreated = *(uint32*)0x880F5C; -uint32 &CCarCtrl::LastTimeAmbulanceCreated = *(uint32*)0x941450; -int32 (&CCarCtrl::TotalNumOfCarsOfRating)[TOTAL_CUSTOM_CLASSES] = *(int32(*)[TOTAL_CUSTOM_CLASSES])*(uintptr*)0x8F1A60; -int32 (&CCarCtrl::NextCarOfRating)[TOTAL_CUSTOM_CLASSES] = *(int32(*)[TOTAL_CUSTOM_CLASSES])*(uintptr*)0x9412AC; -int32 (&CCarCtrl::CarArrays)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY] = *(int32(*)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY])*(uintptr*)0x6EB860; -CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP] = *(CVehicle*(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x70D830; -uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x87F9A8; +int CCarCtrl::NumLawEnforcerCars; +int CCarCtrl::NumAmbulancesOnDuty; +int CCarCtrl::NumFiretrucksOnDuty; +bool CCarCtrl::bCarsGeneratedAroundCamera; +float CCarCtrl::CarDensityMultiplier = 1.0f; +int32 CCarCtrl::NumMissionCars; +int32 CCarCtrl::NumRandomCars; +int32 CCarCtrl::NumParkedCars; +int32 CCarCtrl::NumPermanentCars; +int8 CCarCtrl::CountDownToCarsAtStart; +int32 CCarCtrl::MaxNumberOfCarsInUse = 12; +uint32 CCarCtrl::LastTimeLawEnforcerCreated; +uint32 CCarCtrl::LastTimeFireTruckCreated; +uint32 CCarCtrl::LastTimeAmbulanceCreated; +int32 CCarCtrl::TotalNumOfCarsOfRating[TOTAL_CUSTOM_CLASSES]; +int32 CCarCtrl::NextCarOfRating[TOTAL_CUSTOM_CLASSES]; +int32 CCarCtrl::CarArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY]; +CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP]; +uint32 aCarsToKeepTime[MAX_CARS_TO_KEEP]; void CCarCtrl::GenerateRandomCars() diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h index 925552b5..44ef9ab6 100644 --- a/src/control/CarCtrl.h +++ b/src/control/CarCtrl.h @@ -120,23 +120,23 @@ public: return angle; } - static int32 &NumLawEnforcerCars; - static int32 &NumAmbulancesOnDuty; - static int32 &NumFiretrucksOnDuty; - static int32 &NumRandomCars; - static int32 &NumMissionCars; - static int32 &NumParkedCars; - static int32 &NumPermanentCars; - static bool &bCarsGeneratedAroundCamera; - static float &CarDensityMultiplier; - static int8 &CountDownToCarsAtStart; - static int32 &MaxNumberOfCarsInUse; - static uint32 &LastTimeLawEnforcerCreated; - static uint32 &LastTimeFireTruckCreated; - static uint32 &LastTimeAmbulanceCreated; - static int32 (&TotalNumOfCarsOfRating)[TOTAL_CUSTOM_CLASSES]; - static int32 (&NextCarOfRating)[TOTAL_CUSTOM_CLASSES]; - static int32 (&CarArrays)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY]; + static int32 NumLawEnforcerCars; + static int32 NumAmbulancesOnDuty; + static int32 NumFiretrucksOnDuty; + static int32 NumRandomCars; + static int32 NumMissionCars; + static int32 NumParkedCars; + static int32 NumPermanentCars; + static bool bCarsGeneratedAroundCamera; + static float CarDensityMultiplier; + static int8 CountDownToCarsAtStart; + static int32 MaxNumberOfCarsInUse; + static uint32 LastTimeLawEnforcerCreated; + static uint32 LastTimeFireTruckCreated; + static uint32 LastTimeAmbulanceCreated; + static int32 TotalNumOfCarsOfRating[TOTAL_CUSTOM_CLASSES]; + static int32 NextCarOfRating[TOTAL_CUSTOM_CLASSES]; + static int32 CarArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY]; }; -extern CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP]; \ No newline at end of file +extern CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP]; \ No newline at end of file diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 8e0ea02d..0cfaac17 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -20,7 +20,7 @@ #include "Script.h" #include "Garages.h" -uint8 CGameLogic::ActivePlayers; // 0x95CD5E +uint8 CGameLogic::ActivePlayers; void CGameLogic::InitAtStartOfGame() diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 9f45c454..d9594490 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -12,7 +12,7 @@ bool gbShowPedPaths; bool gbShowCarPaths; bool gbShowCarPathsLinks; -CPathFind &ThePaths = *(CPathFind*)0x8F6754; +CPathFind ThePaths; #define MAX_DIST INT16_MAX-1 #define MIN_PED_ROUTE_DISTANCE 23.8f @@ -21,11 +21,11 @@ CPathFind &ThePaths = *(CPathFind*)0x8F6754; // 1 UseInRoadBlock // 2 east/west road(?) -CPathInfoForObject *&InfoForTileCars = *(CPathInfoForObject**)0x8F1A8C; -CPathInfoForObject *&InfoForTilePeds = *(CPathInfoForObject**)0x8F1AE4; +CPathInfoForObject *InfoForTileCars; +CPathInfoForObject *InfoForTilePeds; // unused -CTempDetachedNode *&DetachedNodesCars = *(CTempDetachedNode**)0x8E2824; -CTempDetachedNode *&DetachedNodesPeds = *(CTempDetachedNode**)0x8E28A0; +CTempDetachedNode *DetachedNodesCars; +CTempDetachedNode *DetachedNodesPeds; bool CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints) diff --git a/src/control/PathFind.h b/src/control/PathFind.h index ea88ade6..64c12d5b 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -138,8 +138,8 @@ struct CPathInfoForObject int8 numRightLanes; uint8 crossing : 1; }; -extern CPathInfoForObject *&InfoForTileCars; -extern CPathInfoForObject *&InfoForTilePeds; +extern CPathInfoForObject *InfoForTileCars; +extern CPathInfoForObject *InfoForTilePeds; struct CTempNode { @@ -234,7 +234,7 @@ public: }; static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error"); -extern CPathFind &ThePaths; +extern CPathFind ThePaths; extern bool gbShowPedPaths; extern bool gbShowCarPaths; diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index 276f02b9..90939f0e 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -13,13 +13,13 @@ #include "RpAnimBlend.h" #include "AnimBlendAssociation.h" -CPhoneInfo &gPhoneInfo = *(CPhoneInfo*)0x732A20; +CPhoneInfo gPhoneInfo; -bool &CPhoneInfo::bDisplayingPhoneMessage = *(bool*)0x6283AC; // is phone picked up -uint32 &CPhoneInfo::PhoneEnableControlsTimer = *(uint32*)0x6283A8; -CPhone *&CPhoneInfo::pPhoneDisplayingMessages = *(CPhone**)0x6283B0; -bool &CPhoneInfo::bPickingUpPhone = *(bool*)0x6283B4; -CPed *&CPhoneInfo::pCallBackPed = *(CPed**)0x6283B8; // ped who picking up the phone (reset after pickup cb) +bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up +uint32 CPhoneInfo::PhoneEnableControlsTimer; +CPhone *CPhoneInfo::pPhoneDisplayingMessages; +bool CPhoneInfo::bPickingUpPhone; +CPed *CPhoneInfo::pCallBackPed; // ped who picking up the phone (reset after pickup cb) /* Entering phonebooth cutscene, showing messages and triggering these things diff --git a/src/control/Phones.h b/src/control/Phones.h index e7e3c9a7..7fbf403f 100644 --- a/src/control/Phones.h +++ b/src/control/Phones.h @@ -36,11 +36,11 @@ static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); class CPhoneInfo { public: - static bool &bDisplayingPhoneMessage; - static uint32 &PhoneEnableControlsTimer; - static CPhone *&pPhoneDisplayingMessages; - static bool &bPickingUpPhone; - static CPed *&pCallBackPed; + static bool bDisplayingPhoneMessage; + static uint32 PhoneEnableControlsTimer; + static CPhone *pPhoneDisplayingMessages; + static bool bPickingUpPhone; + static CPed *pCallBackPed; int32 m_nMax; int32 m_nScriptPhonesMax; @@ -63,7 +63,7 @@ public: void Update(void); }; -extern CPhoneInfo &gPhoneInfo; +extern CPhoneInfo gPhoneInfo; void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg); void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg); diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index eb561670..d52c386c 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -31,16 +31,16 @@ #include "WaterLevel.h" #include "World.h" -CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98; -int16 CPickups::NumMessages;// = *(int16*)0x95CC98; -int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];// = *(int32(*)[NUMCOLLECTEDPICKUPS])*(uintptr*)0x87C538; -int16 CPickups::CollectedPickUpIndex;// = *(int16*)0x95CC8A; +CPickup CPickups::aPickUps[NUMPICKUPS]; +int16 CPickups::NumMessages; +int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS]; +int16 CPickups::CollectedPickUpIndex; // unused -bool &CPickups::bPickUpcamActivated = *(bool*)0x95CD71; -CVehicle *&CPickups::pPlayerVehicle = *(CVehicle**)0x8F29E8; -CVector &CPickups::StaticCamCoors = *(CVector*)0x9404C8; -uint32 &CPickups::StaticCamStartTime = *(uint32*)0x8E289C; +bool CPickups::bPickUpcamActivated; +CVehicle *CPickups::pPlayerVehicle; +CVector CPickups::StaticCamCoors; +uint32 CPickups::StaticCamStartTime; tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES]; diff --git a/src/control/Pickups.h b/src/control/Pickups.h index b5b4f396..11da5f54 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -89,13 +89,13 @@ public: static void Load(uint8 *buf, uint32 size); static void Save(uint8 *buf, uint32 *size); - static CPickup(&aPickUps)[NUMPICKUPS]; + static CPickup aPickUps[NUMPICKUPS]; // unused - static bool &bPickUpcamActivated; - static CVehicle *&pPlayerVehicle; - static CVector &StaticCamCoors; - static uint32 &StaticCamStartTime; + static bool bPickUpcamActivated; + static CVehicle *pPlayerVehicle; + static CVector StaticCamCoors; + static uint32 StaticCamStartTime; }; extern uint16 AmmoForWeapon[20]; diff --git a/src/control/Record.cpp b/src/control/Record.cpp index ca4128e3..08e3c5b9 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -10,11 +10,11 @@ #include "VehicleModelInfo.h" #include "World.h" -uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24; -uint8*& CRecordDataForGame::pDataBuffer = *(uint8**)0x8F1B70; -uint8*& CRecordDataForGame::pDataBufferPointer = *(uint8**)0x8F1AB0; -int& CRecordDataForGame::FId = *(int*)0x885BA4; -tGameBuffer& CRecordDataForGame::pDataBufferForFrame = *(tGameBuffer*)0x72CED0; +uint16 CRecordDataForGame::RecordingState; +uint8* CRecordDataForGame::pDataBuffer; +uint8* CRecordDataForGame::pDataBufferPointer; +int CRecordDataForGame::FId; +tGameBuffer CRecordDataForGame::pDataBufferForFrame; #define MEMORY_FOR_GAME_RECORD (150000) @@ -176,15 +176,15 @@ uint16 CRecordDataForGame::CalcGameChecksum(void) return checksum ^ checksum >> 16; } -uint8& CRecordDataForChase::Status = *(uint8*)0x95CDCE; -int& CRecordDataForChase::PositionChanges = *(int*)0x8F59C8; -uint8& CRecordDataForChase::CurrentCar = *(uint8*)0x95CDC9; -CAutomobile* (&CRecordDataForChase::pChaseCars)[NUM_CHASE_CARS] = *(CAutomobile * (*)[NUM_CHASE_CARS])*(uintptr*)0x6F46A8; -uint32& CRecordDataForChase::AnimStartTime = *(uint32*)0x8F1AEC; -float& CRecordDataForChase::AnimTime = *(float*)0x880F88; -CCarStateEachFrame* (&CRecordDataForChase::pBaseMemForCar)[NUM_CHASE_CARS] = *(CCarStateEachFrame * (*)[NUM_CHASE_CARS])*(uintptr*)0x70EA18; -float& CRecordDataForChase::TimeMultiplier = *(float*)0x8E2A94; -int& CRecordDataForChase::FId2 = *(int*)0x8E2C18; +uint8 CRecordDataForChase::Status; +int CRecordDataForChase::PositionChanges; +uint8 CRecordDataForChase::CurrentCar; +CAutomobile* CRecordDataForChase::pChaseCars[NUM_CHASE_CARS]; +uint32 CRecordDataForChase::AnimStartTime; +float CRecordDataForChase::AnimTime; +CCarStateEachFrame* CRecordDataForChase::pBaseMemForCar[NUM_CHASE_CARS]; +float CRecordDataForChase::TimeMultiplier; +int CRecordDataForChase::FId2; #define CHASE_SCENE_LENGTH_IN_SECONDS (80) #define CHASE_SCENE_FRAMES_PER_SECOND (15) // skipping every second frame diff --git a/src/control/Record.h b/src/control/Record.h index 4abeb68a..7af733ba 100644 --- a/src/control/Record.h +++ b/src/control/Record.h @@ -23,7 +23,7 @@ public: CVector pos; }; -extern char* gString; +extern char gString[256];; class CRecordDataForChase { @@ -37,15 +37,15 @@ class CRecordDataForChase STATE_PLAYBACK = 3, STATE_PLAYBACK_BEFORE_RECORDING = 4 }; - static uint8 &Status; - static int &PositionChanges; - static uint8 &CurrentCar; - static CAutomobile*(&pChaseCars)[NUM_CHASE_CARS]; - static float &AnimTime; - static uint32 &AnimStartTime; - static CCarStateEachFrame* (&pBaseMemForCar)[NUM_CHASE_CARS]; - static float &TimeMultiplier; - static int &FId2; + static uint8 Status; + static int PositionChanges; + static uint8 CurrentCar; + static CAutomobile*pChaseCars[NUM_CHASE_CARS]; + static float AnimTime; + static uint32 AnimStartTime; + static CCarStateEachFrame* pBaseMemForCar[NUM_CHASE_CARS]; + static float TimeMultiplier; + static int FId2; public: static bool IsRecording(void) { return Status == STATE_RECORD; } @@ -86,11 +86,11 @@ class CRecordDataForGame STATE_RECORD = 1, STATE_PLAYBACK = 2, }; - static uint16& RecordingState; - static uint8* &pDataBuffer; - static uint8* &pDataBufferPointer; - static int &FId; - static tGameBuffer &pDataBufferForFrame; + static uint16 RecordingState; + static uint8* pDataBuffer; + static uint8* pDataBufferPointer; + static int FId; + static tGameBuffer pDataBufferForFrame; public: static bool IsRecording() { return RecordingState == STATE_RECORD; } diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 9e0bed66..92d1736d 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -39,71 +39,70 @@ #include "Camera.h" #include "Radar.h" -uint8 &CReplay::Mode = *(uint8*)0x95CD5B; -CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C; -CAddressInReplayBuffer &CReplay::Playback = *(CAddressInReplayBuffer*)0x8F5F48; -uint8 *&CReplay::pBuf0 = *(uint8**)0x8E2C64; -CAutomobile *&CReplay::pBuf1 = *(CAutomobile**)0x8E2C68; -uint8 *&CReplay::pBuf2 = *(uint8**)0x8E2C6C; -CPlayerPed *&CReplay::pBuf3 = *(CPlayerPed**)0x8E2C70; -uint8 *&CReplay::pBuf4 = *(uint8**)0x8E2C74; -CCutsceneHead *&CReplay::pBuf5 = *(CCutsceneHead**)0x8E2C78; -uint8 *&CReplay::pBuf6 = *(uint8**)0x8E2C80; -CPtrNode *&CReplay::pBuf7 = *(CPtrNode**)0x8E2C84; -uint8 *&CReplay::pBuf8 = *(uint8**)0x8E2C54; -CEntryInfoNode *&CReplay::pBuf9 = *(CEntryInfoNode**)0x8E2C58; -uint8 *&CReplay::pBuf10 = *(uint8**)0x8F2C28; -CDummyPed *&CReplay::pBuf11 = *(CDummyPed**)0x8F2C2C; -uint8 *&CReplay::pRadarBlips = *(uint8**)0x8F29F8; -uint8 *&CReplay::pStoredCam = *(uint8**)0x8F2C34; -uint8 *&CReplay::pWorld1 = *(uint8**)0x8E29C4; -CReference *&CReplay::pEmptyReferences = *(CReference**)0x8F256C; -CStoredDetailedAnimationState *&CReplay::pPedAnims = *(CStoredDetailedAnimationState**)0x8F6260; -uint8 *&CReplay::pPickups = *(uint8**)0x8F1A48; -uint8 *&CReplay::pReferences = *(uint8**)0x880FAC; -uint8(&CReplay::BufferStatus)[NUM_REPLAYBUFFERS] = *(uint8(*)[NUM_REPLAYBUFFERS])*(uintptr*)0x8804D8; -uint8(&CReplay::Buffers)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE] = *(uint8(*)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE])*(uintptr*)0x779958; -bool &CReplay::bPlayingBackFromFile = *(bool*)0x95CD58; -bool &CReplay::bReplayEnabled = *(bool*)0x617CAC; -uint32 &CReplay::SlowMotion = *(uint32*)0x9414D4; -uint32 &CReplay::FramesActiveLookAroundCam = *(uint32*)0x880F84; -bool &CReplay::bDoLoadSceneWhenDone = *(bool*)0x95CD76; -CPtrList &CReplay::WorldPtrList = *(CPtrList*)0x880F90; -CPtrList &CReplay::BigBuildingPtrList = *(CPtrList*)0x941284; -CWanted &CReplay::PlayerWanted = *(CWanted*)0x8F6278; -CPlayerInfo &CReplay::PlayerInfo = *(CPlayerInfo*)0x8F5840; -uint32 &CReplay::Time1 = *(uint32*)0x8F29DC; -uint32 &CReplay::Time2 = *(uint32*)0x8F29D0; -uint32 &CReplay::Time3 = *(uint32*)0x8F29D4; -uint32 &CReplay::Time4 = *(uint32*)0x8F29C8; -uint32 &CReplay::Frame = *(uint32*)0x8F2554; -uint8 &CReplay::ClockHours = *(uint8*)0x95CDC5; -uint8 &CReplay::ClockMinutes = *(uint8*)0x95CDA2; -uint16 &CReplay::OldWeatherType = *(uint16*)0x95CCEA; -uint16 &CReplay::NewWeatherType = *(uint16*)0x95CC6E; -float &CReplay::WeatherInterpolationValue = *(float*)0x8F1A28; -float &CReplay::TimeStepNonClipped = *(float*)0x8F5FF4; -float &CReplay::TimeStep = *(float*)0x8F2C24; -float &CReplay::TimeScale = *(float*)0x880E20; -float &CReplay::CameraFixedX = *(float*)0x943054; -float &CReplay::CameraFixedY = *(float*)0x943058; -float &CReplay::CameraFixedZ = *(float*)0x94305C; -int32 &CReplay::OldRadioStation = *(int32*)0x94151C; -int8 &CReplay::CameraMode = *(int8*)0x95CD5F; -bool &CReplay::bAllowLookAroundCam = *(bool*)0x95CDCD; -float &CReplay::LoadSceneX = *(float*)0x880F9C; -float &CReplay::LoadSceneY = *(float*)0x880F98; -float &CReplay::LoadSceneZ = *(float*)0x880F94; -float &CReplay::CameraFocusX = *(float*)0x942F5C; -float &CReplay::CameraFocusY = *(float*)0x942F74; -float &CReplay::CameraFocusZ = *(float*)0x942F58; -bool &CReplay::bPlayerInRCBuggy = *(bool*)0x95CDC3; -float &CReplay::fDistanceLookAroundCam = *(float*)0x885B44; -float &CReplay::fBetaAngleLookAroundCam = *(float*)0x94072C; -float &CReplay::fAlphaAngleLookAroundCam = *(float*)0x8F2A0C; +uint8 CReplay::Mode; +CAddressInReplayBuffer CReplay::Record; +CAddressInReplayBuffer CReplay::Playback; +uint8 *CReplay::pBuf0; +CAutomobile *CReplay::pBuf1; +uint8 *CReplay::pBuf2; +CPlayerPed *CReplay::pBuf3; +uint8 *CReplay::pBuf4; +CCutsceneHead *CReplay::pBuf5; +uint8 *CReplay::pBuf6; +CPtrNode *CReplay::pBuf7; +uint8 *CReplay::pBuf8; +CEntryInfoNode *CReplay::pBuf9; +uint8 *CReplay::pBuf10; +CDummyPed *CReplay::pBuf11; +uint8 *CReplay::pRadarBlips; +uint8 *CReplay::pStoredCam; +uint8 *CReplay::pWorld1; +CReference *CReplay::pEmptyReferences; +CStoredDetailedAnimationState *CReplay::pPedAnims; +uint8 *CReplay::pPickups; +uint8 *CReplay::pReferences; +uint8 CReplay::BufferStatus[NUM_REPLAYBUFFERS]; +uint8 CReplay::Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE]; +bool CReplay::bPlayingBackFromFile; +bool CReplay::bReplayEnabled = true; +uint32 CReplay::SlowMotion; +uint32 CReplay::FramesActiveLookAroundCam; +bool CReplay::bDoLoadSceneWhenDone; +CPtrList CReplay::WorldPtrList; +CPtrList CReplay::BigBuildingPtrList; +CWanted CReplay::PlayerWanted; +CPlayerInfo CReplay::PlayerInfo; +uint32 CReplay::Time1; +uint32 CReplay::Time2; +uint32 CReplay::Time3; +uint32 CReplay::Time4; +uint32 CReplay::Frame; +uint8 CReplay::ClockHours; +uint8 CReplay::ClockMinutes; +uint16 CReplay::OldWeatherType; +uint16 CReplay::NewWeatherType; +float CReplay::WeatherInterpolationValue; +float CReplay::TimeStepNonClipped; +float CReplay::TimeStep; +float CReplay::TimeScale; +float CReplay::CameraFixedX; +float CReplay::CameraFixedY; +float CReplay::CameraFixedZ; +int32 CReplay::OldRadioStation; +int8 CReplay::CameraMode; +bool CReplay::bAllowLookAroundCam; +float CReplay::LoadSceneX; +float CReplay::LoadSceneY; +float CReplay::LoadSceneZ; +float CReplay::CameraFocusX; +float CReplay::CameraFocusY; +float CReplay::CameraFocusZ; +bool CReplay::bPlayerInRCBuggy; +float CReplay::fDistanceLookAroundCam; +float CReplay::fBetaAngleLookAroundCam; +float CReplay::fAlphaAngleLookAroundCam; -static void(*(&CBArray)[30])(CAnimBlendAssociation*, void*) = *(void(*(*)[30])(CAnimBlendAssociation*, void*))*(uintptr*)0x61052C; -static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) = +static void(*CBArray[])(CAnimBlendAssociation*, void*) = { nil, &CPed::PedGetupCB, &CPed::PedStaggerCB, &CPed::PedEvadeCB, &CPed::FinishDieAnimCB, &CPed::FinishedWaitCB, &CPed::FinishLaunchCB, &CPed::FinishHitHeadCB, &CPed::PedAnimGetInCB, &CPed::PedAnimDoorOpenCB, @@ -119,16 +118,13 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) if (CBArray[i] == f) return i; } - for (int i = 0; i < sizeof(CBArray_RE3) / sizeof(*CBArray_RE3); i++) { - if (CBArray_RE3[i] == f) - return i; - } + return 0; } static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*) { - return CBArray_RE3[id]; + return CBArray[id]; } static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying) diff --git a/src/control/Replay.h b/src/control/Replay.h index 56de52a3..6f6c2a91 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -205,68 +205,68 @@ class CReplay static_assert(sizeof(tVehicleUpdatePacket) == 48, "tVehicleUpdatePacket: error"); private: - static uint8 &Mode; - static CAddressInReplayBuffer &Record; - static CAddressInReplayBuffer &Playback; - static uint8 *&pBuf0; - static CAutomobile *&pBuf1; - static uint8 *&pBuf2; - static CPlayerPed *&pBuf3; - static uint8 *&pBuf4; - static CCutsceneHead *&pBuf5; - static uint8 *&pBuf6; - static CPtrNode *&pBuf7; - static uint8 *&pBuf8; - static CEntryInfoNode *&pBuf9; - static uint8 *&pBuf10; - static CDummyPed *&pBuf11; - static uint8 *&pRadarBlips; - static uint8 *&pStoredCam; - static uint8 *&pWorld1; - static CReference *&pEmptyReferences; - static CStoredDetailedAnimationState *&pPedAnims; - static uint8 *&pPickups; - static uint8 *&pReferences; - static uint8 (&BufferStatus)[NUM_REPLAYBUFFERS]; - static uint8 (&Buffers)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE]; - static bool &bPlayingBackFromFile; - static bool &bReplayEnabled; - static uint32 &SlowMotion; - static uint32 &FramesActiveLookAroundCam; - static bool &bDoLoadSceneWhenDone; - static CPtrList &WorldPtrList; - static CPtrList &BigBuildingPtrList; - static CWanted &PlayerWanted; - static CPlayerInfo &PlayerInfo; - static uint32 &Time1; - static uint32 &Time2; - static uint32 &Time3; - static uint32 &Time4; - static uint32 &Frame; - static uint8 &ClockHours; - static uint8 &ClockMinutes; - static uint16 &OldWeatherType; - static uint16 &NewWeatherType; - static float &WeatherInterpolationValue; - static float &TimeStepNonClipped; - static float &TimeStep; - static float &TimeScale; - static float &CameraFixedX; - static float &CameraFixedY; - static float &CameraFixedZ; - static int32 &OldRadioStation; - static int8 &CameraMode; - static bool &bAllowLookAroundCam; - static float &LoadSceneX; - static float &LoadSceneY; - static float &LoadSceneZ; - static float &CameraFocusX; - static float &CameraFocusY; - static float &CameraFocusZ; - static bool &bPlayerInRCBuggy; - static float &fDistanceLookAroundCam; - static float &fAlphaAngleLookAroundCam; - static float &fBetaAngleLookAroundCam; + static uint8 Mode; + static CAddressInReplayBuffer Record; + static CAddressInReplayBuffer Playback; + static uint8 *pBuf0; + static CAutomobile *pBuf1; + static uint8 *pBuf2; + static CPlayerPed *pBuf3; + static uint8 *pBuf4; + static CCutsceneHead *pBuf5; + static uint8 *pBuf6; + static CPtrNode *pBuf7; + static uint8 *pBuf8; + static CEntryInfoNode *pBuf9; + static uint8 *pBuf10; + static CDummyPed *pBuf11; + static uint8 *pRadarBlips; + static uint8 *pStoredCam; + static uint8 *pWorld1; + static CReference *pEmptyReferences; + static CStoredDetailedAnimationState *pPedAnims; + static uint8 *pPickups; + static uint8 *pReferences; + static uint8 BufferStatus[NUM_REPLAYBUFFERS]; + static uint8 Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE]; + static bool bPlayingBackFromFile; + static bool bReplayEnabled; + static uint32 SlowMotion; + static uint32 FramesActiveLookAroundCam; + static bool bDoLoadSceneWhenDone; + static CPtrList WorldPtrList; + static CPtrList BigBuildingPtrList; + static CWanted PlayerWanted; + static CPlayerInfo PlayerInfo; + static uint32 Time1; + static uint32 Time2; + static uint32 Time3; + static uint32 Time4; + static uint32 Frame; + static uint8 ClockHours; + static uint8 ClockMinutes; + static uint16 OldWeatherType; + static uint16 NewWeatherType; + static float WeatherInterpolationValue; + static float TimeStepNonClipped; + static float TimeStep; + static float TimeScale; + static float CameraFixedX; + static float CameraFixedY; + static float CameraFixedZ; + static int32 OldRadioStation; + static int8 CameraMode; + static bool bAllowLookAroundCam; + static float LoadSceneX; + static float LoadSceneY; + static float LoadSceneZ; + static float CameraFocusX; + static float CameraFocusY; + static float CameraFocusZ; + static bool bPlayerInRCBuggy; + static float fDistanceLookAroundCam; + static float fAlphaAngleLookAroundCam; + static float fBetaAngleLookAroundCam; public: static void Init(void); diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp index 788a054a..2730f5c0 100644 --- a/src/control/Restart.cpp +++ b/src/control/Restart.cpp @@ -4,22 +4,22 @@ #include "Zones.h" #include "PathFind.h" -uint8 &CRestart::OverrideHospitalLevel = *(uint8*)0x95CD4C; -uint8 &CRestart::OverridePoliceStationLevel = *(uint8*)0x95CD50; -bool &CRestart::bFadeInAfterNextArrest = *(bool*)0x95CD69; -bool &CRestart::bFadeInAfterNextDeath = *(bool*)0x95CD9D; - -bool &CRestart::bOverrideRestart = *(bool*)0x95CD5D; -CVector &CRestart::OverridePosition = *(CVector*)0x8E2C00; -float &CRestart::OverrideHeading = *(float*)0x8F2A18; - -CVector(&CRestart::HospitalRestartPoints)[NUM_RESTART_POINTS] = *(CVector(*)[NUM_RESTART_POINTS])*(uintptr*)0x87F9B0; -float(&CRestart::HospitalRestartHeadings)[NUM_RESTART_POINTS] = *(float(*)[NUM_RESTART_POINTS])*(uintptr*)0x6F1D40; -uint16 &CRestart::NumberOfHospitalRestarts = *(uint16*)0x95CC46; - -CVector(&CRestart::PoliceRestartPoints)[NUM_RESTART_POINTS] = *(CVector(*)[NUM_RESTART_POINTS])*(uintptr*)0x846228; -float(&CRestart::PoliceRestartHeadings)[NUM_RESTART_POINTS] = *(float(*)[NUM_RESTART_POINTS])*(uintptr*)0x6F1D20; -uint16 &CRestart::NumberOfPoliceRestarts = *(uint16*)0x95CC44; +uint8 CRestart::OverrideHospitalLevel; +uint8 CRestart::OverridePoliceStationLevel; +bool CRestart::bFadeInAfterNextArrest; +bool CRestart::bFadeInAfterNextDeath; + +bool CRestart::bOverrideRestart; +CVector CRestart::OverridePosition; +float CRestart::OverrideHeading; + +CVector CRestart::HospitalRestartPoints[NUM_RESTART_POINTS]; +float CRestart::HospitalRestartHeadings[NUM_RESTART_POINTS]; +uint16 CRestart::NumberOfHospitalRestarts; + +CVector CRestart::PoliceRestartPoints[NUM_RESTART_POINTS]; +float CRestart::PoliceRestartHeadings[NUM_RESTART_POINTS]; +uint16 CRestart::NumberOfPoliceRestarts; void CRestart::Initialise() diff --git a/src/control/Restart.h b/src/control/Restart.h index fb7806db..5d84c723 100644 --- a/src/control/Restart.h +++ b/src/control/Restart.h @@ -17,20 +17,20 @@ public: static void LoadAllRestartPoints(uint8 *buf, uint32 size); static void SaveAllRestartPoints(uint8 *buf, uint32 *size); - static uint8 &OverrideHospitalLevel; - static uint8 &OverridePoliceStationLevel; - static bool &bFadeInAfterNextArrest; - static bool &bFadeInAfterNextDeath; - - static bool &bOverrideRestart; - static CVector &OverridePosition; - static float &OverrideHeading; - - static CVector(&HospitalRestartPoints)[NUM_RESTART_POINTS]; - static float (&HospitalRestartHeadings)[NUM_RESTART_POINTS]; - static uint16 &NumberOfHospitalRestarts; - - static CVector (&PoliceRestartPoints)[NUM_RESTART_POINTS]; - static float (&PoliceRestartHeadings)[NUM_RESTART_POINTS]; - static uint16 &NumberOfPoliceRestarts; + static uint8 OverrideHospitalLevel; + static uint8 OverridePoliceStationLevel; + static bool bFadeInAfterNextArrest; + static bool bFadeInAfterNextDeath; + + static bool bOverrideRestart; + static CVector OverridePosition; + static float OverrideHeading; + + static CVector HospitalRestartPoints[NUM_RESTART_POINTS]; + static float HospitalRestartHeadings[NUM_RESTART_POINTS]; + static uint16 NumberOfHospitalRestarts; + + static CVector PoliceRestartPoints[NUM_RESTART_POINTS]; + static float PoliceRestartHeadings[NUM_RESTART_POINTS]; + static uint16 NumberOfPoliceRestarts; }; diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 9548bc0a..fcfa42e3 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -15,9 +15,9 @@ #include "CarCtrl.h" #include "General.h" -int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34; -int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8; -bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810; +int16 CRoadBlocks::NumRoadBlocks; +int16 CRoadBlocks::RoadBlockObjects[NUMROADBLOCKS]; +bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; void CRoadBlocks::Init(void) diff --git a/src/control/RoadBlocks.h b/src/control/RoadBlocks.h index 16e3a362..0f0c1882 100644 --- a/src/control/RoadBlocks.h +++ b/src/control/RoadBlocks.h @@ -6,9 +6,9 @@ class CVehicle; class CRoadBlocks { public: - static int16 (&NumRoadBlocks); - static int16 (&RoadBlockObjects)[NUMROADBLOCKS]; - static bool (&InOrOut)[NUMROADBLOCKS]; + static int16 NumRoadBlocks; + static int16 RoadBlockObjects[NUMROADBLOCKS]; + static bool InOrOut[NUMROADBLOCKS]; static void Init(void); static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 428ac66a..d4ede846 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -87,47 +87,47 @@ #define FEET_IN_METER 3.33f #endif -uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SPACE])*(uintptr*)0x74B248; -CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08; -int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200; -int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0; -intro_text_line (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(intro_text_line (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68; -intro_script_rectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(intro_script_rectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108; -CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090; -script_sphere_struct(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(script_sphere_struct(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60; -tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008; -tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8; -int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558; -tBuildingSwap(&CTheScripts::BuildingSwapArray)[MAX_NUM_BUILDING_SWAPS] = *(tBuildingSwap(*)[MAX_NUM_BUILDING_SWAPS])*(uintptr*)0x880E30; -CEntity*(&CTheScripts::InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS] = *(CEntity*(*)[MAX_NUM_INVISIBILITY_SETTINGS])*(uintptr*)0x8620F0; -CStoredLine (&CTheScripts::aStoredLines)[MAX_NUM_STORED_LINES] = *(CStoredLine(*)[MAX_NUM_STORED_LINES])*(uintptr*)0x743018; -bool &CTheScripts::DbgFlag = *(bool*)0x95CD87; -uint32 &CTheScripts::OnAMissionFlag = *(uint32*)0x8F1B64; -int32 &CTheScripts::StoreVehicleIndex = *(int32*)0x8F5F3C; -bool &CTheScripts::StoreVehicleWasRandom = *(bool*)0x95CDBC; -CRunningScript *&CTheScripts::pIdleScripts = *(CRunningScript**)0x9430D4; -CRunningScript *&CTheScripts::pActiveScripts = *(CRunningScript**)0x8E2BF4; -uint32 &CTheScripts::NextFreeCollectiveIndex = *(uint32*)0x942F98; -int32 &CTheScripts::LastRandomPedId = *(int32*)0x8F251C; -uint16 &CTheScripts::NumberOfUsedObjects = *(uint16*)0x95CC72; -bool &CTheScripts::bAlreadyRunningAMissionScript = *(bool*)0x95CDB3; -bool &CTheScripts::bUsingAMultiScriptFile = *(bool*)0x95CD55; -uint16 &CTheScripts::NumberOfMissionScripts = *(uint16*)0x95CC9A; -uint32 &CTheScripts::LargestMissionScriptSize = *(uint32*)0x9414C8; -uint32 &CTheScripts::MainScriptSize = *(uint32*)0x9405A4; -uint8 &CTheScripts::FailCurrentMission = *(uint8*)0x95CD41; -uint8 &CTheScripts::CountdownToMakePlayerUnsafe = *(uint8*)0x95CD51; -uint8 &CTheScripts::DelayMakingPlayerUnsafeThisTime = *(uint8*)0x95CD88; -uint16 &CTheScripts::NumScriptDebugLines = *(uint16*)0x95CC42; -uint16 &CTheScripts::NumberOfIntroRectanglesThisFrame = *(uint16*)0x95CC88; -uint16 &CTheScripts::NumberOfIntroTextLinesThisFrame = *(uint16*)0x95CC32; -uint8 &CTheScripts::UseTextCommands = *(uint8*)0x95CD57; -CMissionCleanup (&CTheScripts::MissionCleanup) = *(CMissionCleanup*)0x8F2A24; -CUpsideDownCarCheck (&CTheScripts::UpsideDownCars) = *(CUpsideDownCarCheck*)0x6EE450; -CStuckCarCheck (&CTheScripts::StuckCars) = *(CStuckCarCheck*)0x87C588; -uint16 &CTheScripts::CommandsExecuted = *(uint16*)0x95CCA6; -uint16 &CTheScripts::ScriptsUpdated = *(uint16*)0x95CC5E; -int32(&ScriptParams)[32] = *(int32(*)[32])*(uintptr*)0x6ED460; +uint8 CTheScripts::ScriptSpace[SIZE_SCRIPT_SPACE]; +CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS]; +int32 CTheScripts::BaseBriefIdForContact[MAX_NUM_CONTACTS]; +int32 CTheScripts::OnAMissionForContactFlag[MAX_NUM_CONTACTS]; +intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; +intro_script_rectangle CTheScripts::IntroRectangles[MAX_NUM_INTRO_RECTANGLES]; +CSprite2d CTheScripts::ScriptSprites[MAX_NUM_SCRIPT_SRPITES]; +script_sphere_struct CTheScripts::ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES]; +tCollectiveData CTheScripts::CollectiveArray[MAX_NUM_COLLECTIVES]; +tUsedObject CTheScripts::UsedObjectArray[MAX_NUM_USED_OBJECTS]; +int32 CTheScripts::MultiScriptArray[MAX_NUM_MISSION_SCRIPTS]; +tBuildingSwap CTheScripts::BuildingSwapArray[MAX_NUM_BUILDING_SWAPS]; +CEntity* CTheScripts::InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS]; +CStoredLine CTheScripts::aStoredLines[MAX_NUM_STORED_LINES]; +bool CTheScripts::DbgFlag; +uint32 CTheScripts::OnAMissionFlag; +int32 CTheScripts::StoreVehicleIndex; +bool CTheScripts::StoreVehicleWasRandom; +CRunningScript *CTheScripts::pIdleScripts; +CRunningScript *CTheScripts::pActiveScripts; +uint32 CTheScripts::NextFreeCollectiveIndex; +int32 CTheScripts::LastRandomPedId; +uint16 CTheScripts::NumberOfUsedObjects; +bool CTheScripts::bAlreadyRunningAMissionScript; +bool CTheScripts::bUsingAMultiScriptFile; +uint16 CTheScripts::NumberOfMissionScripts; +uint32 CTheScripts::LargestMissionScriptSize; +uint32 CTheScripts::MainScriptSize; +uint8 CTheScripts::FailCurrentMission; +uint8 CTheScripts::CountdownToMakePlayerUnsafe; +uint8 CTheScripts::DelayMakingPlayerUnsafeThisTime; +uint16 CTheScripts::NumScriptDebugLines; +uint16 CTheScripts::NumberOfIntroRectanglesThisFrame; +uint16 CTheScripts::NumberOfIntroTextLinesThisFrame; +uint8 CTheScripts::UseTextCommands; +CMissionCleanup CTheScripts::MissionCleanup; +CUpsideDownCarCheck CTheScripts::UpsideDownCars; +CStuckCarCheck CTheScripts::StuckCars; +uint16 CTheScripts::CommandsExecuted; +uint16 CTheScripts::ScriptsUpdated; +int32 ScriptParams[32]; CMissionCleanup::CMissionCleanup() { diff --git a/src/control/Script.h b/src/control/Script.h index 4338bd18..2eed29fe 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -240,46 +240,46 @@ enum { class CTheScripts { - 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]; - static CEntity*(&InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS]; - static CStoredLine(&aStoredLines)[MAX_NUM_STORED_LINES]; - static bool &DbgFlag; - static uint32 &OnAMissionFlag; - static CMissionCleanup &MissionCleanup; - static CStuckCarCheck &StuckCars; - static CUpsideDownCarCheck &UpsideDownCars; - static int32 &StoreVehicleIndex; - static bool &StoreVehicleWasRandom; - static CRunningScript *&pIdleScripts; - static CRunningScript *&pActiveScripts; - static uint32 &NextFreeCollectiveIndex; - static int32 &LastRandomPedId; - static uint16 &NumberOfUsedObjects; - static bool &bAlreadyRunningAMissionScript; - static bool &bUsingAMultiScriptFile; - static uint16 &NumberOfMissionScripts; - 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 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]; + static CEntity* InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS]; + static CStoredLine aStoredLines[MAX_NUM_STORED_LINES]; + static bool DbgFlag; + static uint32 OnAMissionFlag; + static CMissionCleanup MissionCleanup; + static CStuckCarCheck StuckCars; + static CUpsideDownCarCheck UpsideDownCars; + static int32 StoreVehicleIndex; + static bool StoreVehicleWasRandom; + static CRunningScript *pIdleScripts; + static CRunningScript *pActiveScripts; + static uint32 NextFreeCollectiveIndex; + static int32 LastRandomPedId; + static uint16 NumberOfUsedObjects; + static bool bAlreadyRunningAMissionScript; + static bool bUsingAMultiScriptFile; + static uint16 NumberOfMissionScripts; + 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; public: static void Init(); diff --git a/src/core/Accident.cpp b/src/core/Accident.cpp index d8313ddc..3c39b11d 100644 --- a/src/core/Accident.cpp +++ b/src/core/Accident.cpp @@ -6,7 +6,7 @@ #include "Pools.h" #include "World.h" -CAccidentManager& gAccidentManager = *(CAccidentManager*)0x87FD10; +CAccidentManager gAccidentManager; CAccident* CAccidentManager::GetNextFreeAccident() diff --git a/src/core/Accident.h b/src/core/Accident.h index 69889645..949d5fb9 100644 --- a/src/core/Accident.h +++ b/src/core/Accident.h @@ -29,4 +29,4 @@ public: bool WorkToDoForMedics(); }; -extern CAccidentManager& gAccidentManager; \ No newline at end of file +extern CAccidentManager gAccidentManager; \ No newline at end of file diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index cfdea46a..4d954ccd 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -28,7 +28,7 @@ const float DefaultFOV = 70.0f; // beta: 80.0f bool PrintDebugCode = false; -int16 &DebugCamMode = *(int16*)0x95CCF2; +int16 DebugCamMode; #ifdef FREE_CAM bool CCamera::bFreeCam = false; diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index c2392d3b..a1f36d93 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -58,9 +58,9 @@ enum #define PLAYER (CWorld::Players[CWorld::PlayerInFocus].m_pPed) // NB: removed explicit TheCamera from all functions -CCamera &TheCamera = *(CCamera*)0x6FACF8; -bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8; -bool &bDidWeProcessAnyCinemaCam = *(bool*)0x95CD46; +CCamera TheCamera; +bool CCamera::m_bUseMouse3rdPerson = true; +bool bDidWeProcessAnyCinemaCam; #ifdef IMPROVED_CAMERA #define KEYJUSTDOWN(k) ControlsManager.GetIsKeyboardKeyJustDown((RsKeyCodes)k) diff --git a/src/core/Camera.h b/src/core/Camera.h index 09a8d603..d1c8ec03 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -6,7 +6,7 @@ class CPed; class CAutomobile; class CGarage; -extern int16 &DebugCamMode; +extern int16 DebugCamMode; enum { @@ -540,7 +540,7 @@ uint32 unknown; // some counter having to do with music uint32 m_uiFadeTimeStarted; uint32 m_uiFadeTimeStartedMusic; - static bool &m_bUseMouse3rdPerson; + static bool m_bUseMouse3rdPerson; #ifdef FREE_CAM static bool bFreeCam; #endif @@ -647,7 +647,7 @@ static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error") static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); -extern CCamera &TheCamera; +extern CCamera TheCamera; void CamShakeNoPos(CCamera*, float); void MakeAngleLessThan180(float &Angle); diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp index a97dcb5f..69fdd682 100644 --- a/src/core/Clock.cpp +++ b/src/core/Clock.cpp @@ -6,17 +6,17 @@ #include "Stats.h" _TODO("gbFastTime"); -bool &gbFastTime = *(bool*)0x95CDBB; +bool gbFastTime; -uint8 &CClock::ms_nGameClockHours = *(uint8*)0x95CDA6; -uint8 &CClock::ms_nGameClockMinutes = *(uint8*)0x95CDC8; -uint16 &CClock::ms_nGameClockSeconds = *(uint16*)0x95CC7C; -uint8 &CClock::ms_Stored_nGameClockHours = *(uint8*)0x95CD7B; -uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B; -uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C; -uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64; -uint32 &CClock::ms_nLastClockTick = *(uint32*)0x9430E4; -bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82; +uint8 CClock::ms_nGameClockHours; +uint8 CClock::ms_nGameClockMinutes; +uint16 CClock::ms_nGameClockSeconds; +uint8 CClock::ms_Stored_nGameClockHours; +uint8 CClock::ms_Stored_nGameClockMinutes; +uint16 CClock::ms_Stored_nGameClockSeconds; +uint32 CClock::ms_nMillisecondsPerGameMinute; +uint32 CClock::ms_nLastClockTick; +bool CClock::ms_bClockHasBeenStored; void CClock::Initialise(uint32 scale) diff --git a/src/core/Clock.h b/src/core/Clock.h index 6b9908ba..a611cd50 100644 --- a/src/core/Clock.h +++ b/src/core/Clock.h @@ -3,15 +3,15 @@ class CClock { public: - static uint8 &ms_nGameClockHours; - static uint8 &ms_nGameClockMinutes; - static uint16 &ms_nGameClockSeconds; - static uint8 &ms_Stored_nGameClockHours; - static uint8 &ms_Stored_nGameClockMinutes; - static uint16 &ms_Stored_nGameClockSeconds; - static uint32 &ms_nMillisecondsPerGameMinute; - static uint32 &ms_nLastClockTick; - static bool &ms_bClockHasBeenStored; + static uint8 ms_nGameClockHours; + static uint8 ms_nGameClockMinutes; + static uint16 ms_nGameClockSeconds; + static uint8 ms_Stored_nGameClockHours; + static uint8 ms_Stored_nGameClockMinutes; + static uint16 ms_Stored_nGameClockSeconds; + static uint32 ms_nMillisecondsPerGameMinute; + static uint32 ms_nLastClockTick; + static bool ms_bClockHasBeenStored; static void Initialise(uint32 scale); static void Update(void); diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index 541257c6..ce8674d7 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -18,7 +18,7 @@ #include "win.h" #include "GenericGameStorage.h" -CControllerConfigManager &ControlsManager = *(CControllerConfigManager*)0x8F43A4; +CControllerConfigManager ControlsManager; CControllerConfigManager::CControllerConfigManager() { diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index 458e457c..c328594e 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -198,4 +198,4 @@ public: VALIDATE_SIZE(CControllerConfigManager, 0x143C); -extern CControllerConfigManager &ControlsManager; \ No newline at end of file +extern CControllerConfigManager ControlsManager; \ No newline at end of file diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index d1c76f33..5ca4cdb0 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -11,7 +11,6 @@ int32 CEventList::ms_nFirstFreeSlotIndex; CEvent gaEvent[NUMEVENTS]; -//CEvent *gaEvent = (CEvent*)0x6EF830; enum { diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 2a8628b0..382316bb 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -168,8 +168,8 @@ myfeof(int fd) } -char *CFileMgr::ms_rootDirName = (char*)0x5F18F8; -char *CFileMgr::ms_dirName = (char*)0x713CA8; +char CFileMgr::ms_rootDirName[128] = {'\0'}; +char CFileMgr::ms_dirName[128]; void CFileMgr::Initialise(void) diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h index 3df0c7d8..a6e4b6e5 100644 --- a/src/core/FileMgr.h +++ b/src/core/FileMgr.h @@ -2,8 +2,8 @@ class CFileMgr { - static char *ms_rootDirName; //[128]; - static char *ms_dirName; //[128]; + static char ms_rootDirName[128]; + static char ms_dirName[128]; public: static void Initialise(void); static void ChangeDir(const char *dir); diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index cfa849e9..f900091e 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -16,7 +16,7 @@ #include "Ped.h" #include "Fire.h" -CFireManager &gFireManager = *(CFireManager*)0x8F31D0; +CFireManager gFireManager; CFire::CFire() { diff --git a/src/core/Fire.h b/src/core/Fire.h index a4599d11..85e53f61 100644 --- a/src/core/Fire.h +++ b/src/core/Fire.h @@ -48,4 +48,4 @@ public: void RemoveScriptFire(int16 index); void SetScriptFireAudio(int16 index, bool state); }; -extern CFireManager &gFireManager; +extern CFireManager gFireManager; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index a01689e4..b2ecdac5 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -93,7 +93,7 @@ int8 CMenuManager::m_PrefsSpeakers; int32 CMenuManager::m_ControlMethod; int8 CMenuManager::m_PrefsDMA = 1; int32 CMenuManager::m_PrefsLanguage; -uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings +uint8 CMenuManager::m_PrefsStereoMono; // unused except restore settings bool CMenuManager::m_PrefsAllowNastyGame = true; bool CMenuManager::m_bStartUpFrontEndRequested; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 8699ffeb..f115d52f 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -89,19 +89,19 @@ -eLevelName &CGame::currLevel = *(eLevelName*)0x941514; -bool &CGame::bDemoMode = *(bool*)0x5F4DD0; -bool &CGame::nastyGame = *(bool*)0x5F4DD4; -bool &CGame::frenchGame = *(bool*)0x95CDCB; -bool &CGame::germanGame = *(bool*)0x95CD1E; -bool &CGame::noProstitutes = *(bool*)0x95CDCF; -bool &CGame::playingIntro = *(bool*)0x95CDC2; -char *CGame::aDatFile = (char*)0x773A48; +eLevelName CGame::currLevel; +bool CGame::bDemoMode = true; +bool CGame::nastyGame = true; +bool CGame::frenchGame; +bool CGame::germanGame; +bool CGame::noProstitutes; +bool CGame::playingIntro; +char CGame::aDatFile[32]; #ifdef MORE_LANGUAGES bool CGame::russianGame = false; #endif -int &gameTxdSlot = *(int*)0x628D88; +int gameTxdSlot; bool CGame::InitialiseOnceBeforeRW(void) @@ -115,7 +115,9 @@ CGame::InitialiseOnceBeforeRW(void) bool CGame::InitialiseRenderWare(void) { +#ifdef USE_TEXTURE_POOL _TexturePoolsInitialise(); +#endif CTxdStore::Initialise(); CVisibilityPlugins::Initialise(); @@ -188,7 +190,9 @@ void CGame::ShutdownRenderWare(void) CVisibilityPlugins::Shutdown(); +#ifdef USE_TEXTURE_POOL _TexturePoolsShutdown(); +#endif } bool CGame::InitialiseOnceAfterRW(void) diff --git a/src/core/Game.h b/src/core/Game.h index 30581893..8dc73e8a 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -11,17 +11,17 @@ enum eLevelName class CGame { public: - static eLevelName &currLevel; - static bool &bDemoMode; - static bool &nastyGame; - static bool &frenchGame; - static bool &germanGame; + static eLevelName currLevel; + static bool bDemoMode; + static bool nastyGame; + static bool frenchGame; + static bool germanGame; #ifdef MORE_LANGUAGES static bool russianGame; #endif - static bool &noProstitutes; - static bool &playingIntro; - static char *aDatFile; //[32]; + static bool noProstitutes; + static bool playingIntro; + static char aDatFile[32]; static bool InitialiseOnceBeforeRW(void); static bool InitialiseRenderWare(void); diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp index 744f4bd0..d8e91c98 100644 --- a/src/core/IniFile.cpp +++ b/src/core/IniFile.cpp @@ -7,8 +7,8 @@ #include "main.h" #include "Population.h" -float CIniFile::PedNumberMultiplier = 1.0f;// = *(float*)0x6182F4; -float CIniFile::CarNumberMultiplier = 1.0f;// = *(float*)0x6182F8; +float CIniFile::PedNumberMultiplier = 1.0f; +float CIniFile::CarNumberMultiplier = 1.0f; void CIniFile::LoadIniFile() { diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 201dc5b6..2db375b2 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -35,26 +35,26 @@ #include "Wanted.h" #include "General.h" -CPad *Pads = (CPad*)0x6F0360; // [2] -CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C; +CPad Pads[MAX_PADS]; +CMousePointerStateHelper MousePointerStateHelper; -bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52; -bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8; +bool CPad::bDisplayNoControllerMessage; +bool CPad::bObsoleteControllerMessage; bool CPad::bOldDisplayNoControllerMessage; -bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48; +bool CPad::m_bMapPadOneToPadTwo; -CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70; -CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0; -CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8; +CKeyboardState CPad::OldKeyState; +CKeyboardState CPad::NewKeyState; +CKeyboardState CPad::TempKeyState; char CPad::KeyBoardCheatString[20]; -CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0; -CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0; -CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60; +CMouseControllerState CPad::OldMouseControllerState; +CMouseControllerState CPad::NewMouseControllerState; +CMouseControllerState CPad::PCTempMouseControllerState; _TODO("gbFastTime"); -extern bool &gbFastTime; +extern bool gbFastTime; void WeaponCheat() { diff --git a/src/core/Pad.h b/src/core/Pad.h index cb705c6b..9ebd6396 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -66,7 +66,7 @@ public: VALIDATE_SIZE(CMousePointerStateHelper, 0x2); -extern CMousePointerStateHelper &MousePointerStateHelper; +extern CMousePointerStateHelper MousePointerStateHelper; class CKeyboardState @@ -163,18 +163,18 @@ public: CPad() { } ~CPad() { } - static bool &bDisplayNoControllerMessage; - static bool &bObsoleteControllerMessage; + static bool bDisplayNoControllerMessage; + static bool bObsoleteControllerMessage; static bool bOldDisplayNoControllerMessage; - static bool &m_bMapPadOneToPadTwo; + static bool m_bMapPadOneToPadTwo; - static CKeyboardState &OldKeyState; - static CKeyboardState &NewKeyState; - static CKeyboardState &TempKeyState; + static CKeyboardState OldKeyState; + static CKeyboardState NewKeyState; + static CKeyboardState TempKeyState; static char KeyBoardCheatString[20]; - static CMouseControllerState &OldMouseControllerState; - static CMouseControllerState &NewMouseControllerState; - static CMouseControllerState &PCTempMouseControllerState; + static CMouseControllerState OldMouseControllerState; + static CMouseControllerState NewMouseControllerState; + static CMouseControllerState PCTempMouseControllerState; #ifdef GTA_PS2_STUFF @@ -450,4 +450,4 @@ public: }; VALIDATE_SIZE(CPad, 0xFC); -extern CPad *Pads; //[2] +extern CPad Pads[MAX_PADS]; diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 6add9e0c..65294368 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -10,15 +10,15 @@ #include "Wanted.h" #include "World.h" -CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044; -CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448; -CPedPool *&CPools::ms_pPedPool = *(CPedPool**)0x8F2C60; -CVehiclePool *&CPools::ms_pVehiclePool = *(CVehiclePool**)0x9430DC; -CBuildingPool *&CPools::ms_pBuildingPool = *(CBuildingPool**)0x8F2C04; -CTreadablePool *&CPools::ms_pTreadablePool = *(CTreadablePool**)0x8F2568; -CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28; -CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18; -CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C; +CCPtrNodePool *CPools::ms_pPtrNodePool; +CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool; +CPedPool *CPools::ms_pPedPool; +CVehiclePool *CPools::ms_pVehiclePool; +CBuildingPool *CPools::ms_pBuildingPool; +CTreadablePool *CPools::ms_pTreadablePool; +CObjectPool *CPools::ms_pObjectPool; +CDummyPool *CPools::ms_pDummyPool; +CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool; void CPools::Initialise(void) diff --git a/src/core/Pools.h b/src/core/Pools.h index 74b87585..b0ba6598 100644 --- a/src/core/Pools.h +++ b/src/core/Pools.h @@ -22,15 +22,15 @@ typedef CPool CAudioScriptObjectPool; class CPools { - static CCPtrNodePool *&ms_pPtrNodePool; - static CEntryInfoNodePool *&ms_pEntryInfoNodePool; - static CPedPool *&ms_pPedPool; - static CVehiclePool *&ms_pVehiclePool; - static CBuildingPool *&ms_pBuildingPool; - static CTreadablePool *&ms_pTreadablePool; - static CObjectPool *&ms_pObjectPool; - static CDummyPool *&ms_pDummyPool; - static CAudioScriptObjectPool *&ms_pAudioScriptObjectPool; + static CCPtrNodePool *ms_pPtrNodePool; + static CEntryInfoNodePool *ms_pEntryInfoNodePool; + static CPedPool *ms_pPedPool; + static CVehiclePool *ms_pVehiclePool; + static CBuildingPool *ms_pBuildingPool; + static CTreadablePool *ms_pTreadablePool; + static CObjectPool *ms_pObjectPool; + static CDummyPool *ms_pDummyPool; + static CAudioScriptObjectPool *ms_pAudioScriptObjectPool; public: static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; } static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; } diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index ed24814d..48b97832 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -19,28 +19,28 @@ float CRadar::m_radarRange; sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS]; CVector2D vec2DRadarOrigin; -int32 gRadarTxdIds[64];// = (int*)0x6299C0; - -CSprite2d CRadar::AsukaSprite;// = *(CSprite2d*)0x8F1A40; -CSprite2d CRadar::BombSprite;// = (CSprite2d*)0x8F5FB4; -CSprite2d CRadar::CatSprite;// = (CSprite2d*)0x885B24; -CSprite2d CRadar::CentreSprite;// = (CSprite2d*)0x8F6268; -CSprite2d CRadar::CopcarSprite;// = (CSprite2d*)0x8F1A2C; -CSprite2d CRadar::DonSprite;// = (CSprite2d*)0x8F2BE0; -CSprite2d CRadar::EightSprite;// = (CSprite2d*)0x8F2BCC; -CSprite2d CRadar::ElSprite;// = (CSprite2d*)0x8F1B80; -CSprite2d CRadar::IceSprite;// = (CSprite2d*)0x9415FC; -CSprite2d CRadar::JoeySprite;// = (CSprite2d*)0x8F2C00; -CSprite2d CRadar::KenjiSprite;// = (CSprite2d*)0x8F2C68; -CSprite2d CRadar::LizSprite;// = (CSprite2d*)0x8F5830; -CSprite2d CRadar::LuigiSprite;// = (CSprite2d*)0x8F1A3C; -CSprite2d CRadar::NorthSprite;// = (CSprite2d*)0x8F6274; -CSprite2d CRadar::RaySprite;// = (CSprite2d*)0x8E2A7C; -CSprite2d CRadar::SalSprite;// = (CSprite2d*)0x8F29EC; -CSprite2d CRadar::SaveSprite;// = (CSprite2d*)0x8F5F74; -CSprite2d CRadar::SpraySprite;// = (CSprite2d*)0x94307C; -CSprite2d CRadar::TonySprite;// = (CSprite2d*)0x885B58; -CSprite2d CRadar::WeaponSprite;// = (CSprite2d*)0x941534; +int32 gRadarTxdIds[64]; + +CSprite2d CRadar::AsukaSprite; +CSprite2d CRadar::BombSprite; +CSprite2d CRadar::CatSprite; +CSprite2d CRadar::CentreSprite; +CSprite2d CRadar::CopcarSprite; +CSprite2d CRadar::DonSprite; +CSprite2d CRadar::EightSprite; +CSprite2d CRadar::ElSprite; +CSprite2d CRadar::IceSprite; +CSprite2d CRadar::JoeySprite; +CSprite2d CRadar::KenjiSprite; +CSprite2d CRadar::LizSprite; +CSprite2d CRadar::LuigiSprite; +CSprite2d CRadar::NorthSprite; +CSprite2d CRadar::RaySprite; +CSprite2d CRadar::SalSprite; +CSprite2d CRadar::SaveSprite; +CSprite2d CRadar::SpraySprite; +CSprite2d CRadar::TonySprite; +CSprite2d CRadar::WeaponSprite; CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { nil, diff --git a/src/core/References.cpp b/src/core/References.cpp index e87f0fd5..668ea9f1 100644 --- a/src/core/References.cpp +++ b/src/core/References.cpp @@ -6,8 +6,8 @@ #include "Pools.h" #include "References.h" -CReference *CReferences::aRefs = (CReference*)0x70BBE0; //[NUMREFERENCES]; -CReference *&CReferences::pEmptyList = *(CReference**)0x8F1AF8; +CReference CReferences::aRefs[NUMREFERENCES]; +CReference *CReferences::pEmptyList; void CReferences::Init(void) diff --git a/src/core/References.h b/src/core/References.h index 6476e243..e7a64de7 100644 --- a/src/core/References.h +++ b/src/core/References.h @@ -11,8 +11,8 @@ struct CReference class CReferences { public: - static CReference *aRefs; //[NUMREFERENCES]; - static CReference *&pEmptyList; + static CReference aRefs[NUMREFERENCES]; + static CReference *pEmptyList; static void Init(void); static void RemoveReferencesToPlayer(void); diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 02092a30..8d7a3048 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -4,59 +4,59 @@ #include "Text.h" #include "World.h" -int32 &CStats::DaysPassed = *(int32*)0x8F2BB8; -int32 &CStats::HeadsPopped = *(int32*)0x8F647C; -int32& CStats::CommercialPassed = *(int32*)0x8F4334; -int32& CStats::IndustrialPassed = *(int32*)0x8E2A68; -int32& CStats::SuburbanPassed = *(int32*)0x8F2740; -int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C; -int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50; -int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64; -int32(&CStats::PedsKilledOfThisType)[NUM_PEDTYPES] = *(int32(*)[NUM_PEDTYPES]) * (uintptr*)0x880DBC; -int32 &CStats::TimesDied = *(int32*)0x8E2BDC; -int32 &CStats::TimesArrested = *(int32*)0x8E2BEC; -int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C; -int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574; -int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518; -int32 &CStats::ProgressMade = *(int32*)0x8F6224; -int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C; -int32& CStats::CarsExploded = *(int32*)0x941288; -int32& CStats::PeopleKilledByPlayer = *(int32*)0x8F1B7C; -float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC; -float &CStats::MaximumJumpHeight = *(float*)0x940564; -int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524; -int32 &CStats::MaximumJumpSpins = *(int32*)0x8F29B0; -int32 &CStats::BestStuntJump = *(int32*)0x885B50; -int32 &CStats::NumberOfUniqueJumpsFound = *(int32*)0x885B74; -int32 &CStats::TotalNumberOfUniqueJumps = *(int32*)0x8E2DC0; -int32 &CStats::PassengersDroppedOffWithTaxi = *(int32*)0x940724; -int32 &CStats::MoneyMadeWithTaxi = *(int32*)0x941544; -int32 &CStats::MissionsGiven = *(int32*)0x9430E8; -int32 &CStats::MissionsPassed = *(int32*)0x940768; -char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828; -int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004; -int32 &CStats::ElBurroTime = *(int32*)0x8E2A6C; -int32& CStats::Record4x4One = *(int32*)0x940570; -int32& CStats::Record4x4Two = *(int32*)0x94058C; -int32& CStats::Record4x4Three = *(int32*)0x880FA8; -int32& CStats::Record4x4Mayhem = *(int32*)0x885B70; -int32& CStats::LivesSavedWithAmbulance = *(int32*)0x8F57E0; -int32& CStats::CriminalsCaught = *(int32*)0x8F2518; -int32& CStats::HighestLevelAmbulanceMission = *(int32*)0x8F2A04; -int32& CStats::FiresExtinguished = *(int32*)0x8F5FEC; -int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4; -int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24; -int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884; -int32& CStats::TotalNumberMissions = *(int32*)0x8E2820; -int32& CStats::RoundsFiredByPlayer = *(int32*)0x8E2BE8; -int32& CStats::KgsOfExplosivesUsed = *(int32*)0x8F2510; -int32& CStats::InstantHitsFiredByPlayer = *(int32*)0x943070; -int32& CStats::InstantHitsHitByPlayer = *(int32*)0x95CB8C; -int32& CStats::BestTimeBombDefusal = *(int32*)0x880E24; -int32& CStats::mmRain = *(int32*)0x8F2C98; -int32& CStats::CarsCrushed = *(int32*)0x943050; -int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128; -int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0; +int32 CStats::DaysPassed; +int32 CStats::HeadsPopped; +int32 CStats::CommercialPassed; +int32 CStats::IndustrialPassed; +int32 CStats::SuburbanPassed; +int32 CStats::NumberKillFrenziesPassed; +int32 CStats::PeopleKilledByOthers; +int32 CStats::HelisDestroyed; +int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES]; +int32 CStats::TimesDied; +int32 CStats::TimesArrested; +int32 CStats::KillsSinceLastCheckpoint; +int32 CStats::DistanceTravelledInVehicle; +int32 CStats::DistanceTravelledOnFoot; +int32 CStats::ProgressMade; +int32 CStats::TotalProgressInGame; +int32 CStats::CarsExploded; +int32 CStats::PeopleKilledByPlayer; +float CStats::MaximumJumpDistance; +float CStats::MaximumJumpHeight; +int32 CStats::MaximumJumpFlips; +int32 CStats::MaximumJumpSpins; +int32 CStats::BestStuntJump; +int32 CStats::NumberOfUniqueJumpsFound; +int32 CStats::TotalNumberOfUniqueJumps; +int32 CStats::PassengersDroppedOffWithTaxi; +int32 CStats::MoneyMadeWithTaxi; +int32 CStats::MissionsGiven; +int32 CStats::MissionsPassed; +char CStats::LastMissionPassedName[8]; +int32 CStats::TotalLegitimateKills; +int32 CStats::ElBurroTime; +int32 CStats::Record4x4One; +int32 CStats::Record4x4Two; +int32 CStats::Record4x4Three; +int32 CStats::Record4x4Mayhem; +int32 CStats::LivesSavedWithAmbulance; +int32 CStats::CriminalsCaught; +int32 CStats::HighestLevelAmbulanceMission; +int32 CStats::FiresExtinguished; +int32 CStats::LongestFlightInDodo; +int32 CStats::TimeTakenDefuseMission; +int32 CStats::TotalNumberKillFrenzies; +int32 CStats::TotalNumberMissions; +int32 CStats::RoundsFiredByPlayer; +int32 CStats::KgsOfExplosivesUsed; +int32 CStats::InstantHitsFiredByPlayer; +int32 CStats::InstantHitsHitByPlayer; +int32 CStats::BestTimeBombDefusal; +int32 CStats::mmRain; +int32 CStats::CarsCrushed; +int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES]; +int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES]; void CStats::Init() { diff --git a/src/core/Stats.h b/src/core/Stats.h index ac3259f9..4445ecf4 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -9,59 +9,59 @@ public: TOTAL_FASTEST_TIMES = 16, TOTAL_HIGHEST_SCORES = 16 }; - static int32 &DaysPassed; - static int32 &HeadsPopped; - static int32& CommercialPassed; - static int32& IndustrialPassed; - static int32& SuburbanPassed; - static int32 &NumberKillFrenziesPassed; - static int32 &PeopleKilledByOthers; - static int32 &HelisDestroyed; - static int32(&PedsKilledOfThisType)[ePedType::NUM_PEDTYPES]; - static int32 &TimesDied; - static int32 &TimesArrested; - static int32 &KillsSinceLastCheckpoint; - static int32 &DistanceTravelledInVehicle; - static int32 &DistanceTravelledOnFoot; - static int32 &CarsExploded; - static int32 &PeopleKilledByPlayer; - static int32 &ProgressMade; - static int32 &TotalProgressInGame; - static float &MaximumJumpDistance; - static float &MaximumJumpHeight; - static int32 &MaximumJumpFlips; - static int32 &MaximumJumpSpins; - static int32 &BestStuntJump; - static int32 &NumberOfUniqueJumpsFound; - static int32 &TotalNumberOfUniqueJumps; - static int32 &PassengersDroppedOffWithTaxi; - static int32 &MoneyMadeWithTaxi; - static int32 &MissionsGiven; - static int32 &MissionsPassed; - static char (&LastMissionPassedName)[8]; - static int32 &TotalLegitimateKills; - static int32 &ElBurroTime; - static int32 &Record4x4One; - static int32 &Record4x4Two; - static int32 &Record4x4Three; - static int32 &Record4x4Mayhem; - static int32 &LivesSavedWithAmbulance; - static int32 &CriminalsCaught; - static int32 &HighestLevelAmbulanceMission; - static int32 &FiresExtinguished; - static int32 &LongestFlightInDodo; - static int32 &TimeTakenDefuseMission; - static int32 &TotalNumberKillFrenzies; - static int32 &TotalNumberMissions; - static int32 &RoundsFiredByPlayer; - static int32 &KgsOfExplosivesUsed; - static int32 &InstantHitsFiredByPlayer; - static int32 &InstantHitsHitByPlayer; - static int32 &BestTimeBombDefusal; - static int32 &mmRain; - static int32 &CarsCrushed; - static int32(&FastestTimes)[TOTAL_FASTEST_TIMES]; - static int32(&HighestScores)[TOTAL_HIGHEST_SCORES]; + static int32 DaysPassed; + static int32 HeadsPopped; + static int32 CommercialPassed; + static int32 IndustrialPassed; + static int32 SuburbanPassed; + static int32 NumberKillFrenziesPassed; + static int32 PeopleKilledByOthers; + static int32 HelisDestroyed; + static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES]; + static int32 TimesDied; + static int32 TimesArrested; + static int32 KillsSinceLastCheckpoint; + static int32 DistanceTravelledInVehicle; + static int32 DistanceTravelledOnFoot; + static int32 CarsExploded; + static int32 PeopleKilledByPlayer; + static int32 ProgressMade; + static int32 TotalProgressInGame; + static float MaximumJumpDistance; + static float MaximumJumpHeight; + static int32 MaximumJumpFlips; + static int32 MaximumJumpSpins; + static int32 BestStuntJump; + static int32 NumberOfUniqueJumpsFound; + static int32 TotalNumberOfUniqueJumps; + static int32 PassengersDroppedOffWithTaxi; + static int32 MoneyMadeWithTaxi; + static int32 MissionsGiven; + static int32 MissionsPassed; + static char LastMissionPassedName[8]; + static int32 TotalLegitimateKills; + static int32 ElBurroTime; + static int32 Record4x4One; + static int32 Record4x4Two; + static int32 Record4x4Three; + static int32 Record4x4Mayhem; + static int32 LivesSavedWithAmbulance; + static int32 CriminalsCaught; + static int32 HighestLevelAmbulanceMission; + static int32 FiresExtinguished; + static int32 LongestFlightInDodo; + static int32 TimeTakenDefuseMission; + static int32 TotalNumberKillFrenzies; + static int32 TotalNumberMissions; + static int32 RoundsFiredByPlayer; + static int32 KgsOfExplosivesUsed; + static int32 InstantHitsFiredByPlayer; + static int32 InstantHitsHitByPlayer; + static int32 BestTimeBombDefusal; + static int32 mmRain; + static int32 CarsCrushed; + static int32 FastestTimes[TOTAL_FASTEST_TIMES]; + static int32 HighestScores[TOTAL_HIGHEST_SCORES]; public: static void Init(void); diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index d00edf51..56f4a862 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -30,49 +30,49 @@ #include "Streaming.h" #include "main.h" -bool &CStreaming::ms_disableStreaming = *(bool*)0x95CD6E; -bool &CStreaming::ms_bLoadingBigModel = *(bool*)0x95CDB0; -int32 &CStreaming::ms_numModelsRequested = *(int32*)0x8E2C10; -CStreamingInfo *CStreaming::ms_aInfoForModel = (CStreamingInfo*)0x6C7088; -CStreamingInfo &CStreaming::ms_startLoadedList = *(CStreamingInfo*)0x942F60; -CStreamingInfo &CStreaming::ms_endLoadedList = *(CStreamingInfo*)0x8F1AC0; -CStreamingInfo &CStreaming::ms_startRequestedList = *(CStreamingInfo*)0x8F1B3C; -CStreamingInfo &CStreaming::ms_endRequestedList = *(CStreamingInfo*)0x940738; -int32 &CStreaming::ms_oldSectorX = *(int32*)0x8F2C84; -int32 &CStreaming::ms_oldSectorY = *(int32*)0x8F2C88; -int32 &CStreaming::ms_streamingBufferSize = *(int32*)0x942FB0; -int8 **CStreaming::ms_pStreamingBuffer = (int8**)0x87F818; -int32 &CStreaming::ms_memoryUsed = *(int32*)0x940568; -CStreamingChannel *CStreaming::ms_channel = (CStreamingChannel*)0x727EE0; -int32 &CStreaming::ms_channelError = *(int32*)0x880DB8; -int32 &CStreaming::ms_numVehiclesLoaded = *(int32*)0x8F2C80; -int32 *CStreaming::ms_vehiclesLoaded = (int32*)0x773560; -int32 &CStreaming::ms_lastVehicleDeleted = *(int32*)0x95CBF8; -CDirectory *&CStreaming::ms_pExtraObjectsDir = *(CDirectory**)0x95CB90; -int32 &CStreaming::ms_numPriorityRequests = *(int32*)0x8F31C4; -bool &CStreaming::ms_hasLoadedLODs = *(bool*)0x95CD47; -int32 &CStreaming::ms_currentPedGrp = *(int32*)0x8F2BBC; +bool CStreaming::ms_disableStreaming; +bool CStreaming::ms_bLoadingBigModel; +int32 CStreaming::ms_numModelsRequested; +CStreamingInfo CStreaming::ms_aInfoForModel[NUMSTREAMINFO]; +CStreamingInfo CStreaming::ms_startLoadedList; +CStreamingInfo CStreaming::ms_endLoadedList; +CStreamingInfo CStreaming::ms_startRequestedList; +CStreamingInfo CStreaming::ms_endRequestedList; +int32 CStreaming::ms_oldSectorX; +int32 CStreaming::ms_oldSectorY; +int32 CStreaming::ms_streamingBufferSize; +int8 *CStreaming::ms_pStreamingBuffer[2]; +int32 CStreaming::ms_memoryUsed; +CStreamingChannel CStreaming::ms_channel[2]; +int32 CStreaming::ms_channelError; +int32 CStreaming::ms_numVehiclesLoaded; +int32 CStreaming::ms_vehiclesLoaded[MAXVEHICLESLOADED]; +int32 CStreaming::ms_lastVehicleDeleted; +CDirectory *CStreaming::ms_pExtraObjectsDir; +int32 CStreaming::ms_numPriorityRequests; +bool CStreaming::ms_hasLoadedLODs; +int32 CStreaming::ms_currentPedGrp; int32 CStreaming::ms_currentPedLoading; int32 CStreaming::ms_lastCullZone; -uint16 &CStreaming::ms_loadedGangs = *(uint16*)0x95CC60; -uint16 &CStreaming::ms_loadedGangCars = *(uint16*)0x95CC2E; -int32 *CStreaming::ms_imageOffsets = (int32*)0x6E60A0; -int32 &CStreaming::ms_lastImageRead = *(int32*)0x880E2C; -int32 &CStreaming::ms_imageSize = *(int32*)0x8F1A34; -uint32 &CStreaming::ms_memoryAvailable = *(uint32*)0x880F8C; - -int32 &desiredNumVehiclesLoaded = *(int32*)0x5EC194; - -CEntity *&pIslandLODindustEntity = *(CEntity**)0x6212DC; -CEntity *&pIslandLODcomIndEntity = *(CEntity**)0x6212E0; -CEntity *&pIslandLODcomSubEntity = *(CEntity**)0x6212E4; -CEntity *&pIslandLODsubIndEntity = *(CEntity**)0x6212E8; -CEntity *&pIslandLODsubComEntity = *(CEntity**)0x6212EC; -int32 &islandLODindust = *(int32*)0x6212C8; -int32 &islandLODcomInd = *(int32*)0x6212CC; -int32 &islandLODcomSub = *(int32*)0x6212D0; -int32 &islandLODsubInd = *(int32*)0x6212D4; -int32 &islandLODsubCom = *(int32*)0x6212D8; +uint16 CStreaming::ms_loadedGangs; +uint16 CStreaming::ms_loadedGangCars; +int32 CStreaming::ms_imageOffsets[NUMCDIMAGES]; +int32 CStreaming::ms_lastImageRead; +int32 CStreaming::ms_imageSize; +uint32 CStreaming::ms_memoryAvailable; + +int32 desiredNumVehiclesLoaded = 12; + +CEntity *pIslandLODindustEntity; +CEntity *pIslandLODcomIndEntity; +CEntity *pIslandLODcomSubEntity; +CEntity *pIslandLODsubIndEntity; +CEntity *pIslandLODsubComEntity; +int32 islandLODindust; +int32 islandLODcomInd; +int32 islandLODcomSub; +int32 islandLODsubInd; +int32 islandLODsubCom; bool CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size) @@ -199,7 +199,7 @@ CStreaming::Init(void) // PC only, figure out how much memory we got #ifdef GTA_PC #define MB (1024*1024) - extern unsigned long &_dwMemAvailPhys; + extern unsigned long _dwMemAvailPhys; ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2; if(ms_memoryAvailable < 50*MB) ms_memoryAvailable = 50*MB; diff --git a/src/core/Streaming.h b/src/core/Streaming.h index 1100fd1b..c910c068 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -77,36 +77,36 @@ class CPtrList; class CStreaming { public: - static bool &ms_disableStreaming; - static bool &ms_bLoadingBigModel; - static int32 &ms_numModelsRequested; - static CStreamingInfo *ms_aInfoForModel; //[NUMSTREAMINFO] - static CStreamingInfo &ms_startLoadedList; - static CStreamingInfo &ms_endLoadedList; - static CStreamingInfo &ms_startRequestedList; - static CStreamingInfo &ms_endRequestedList; - static int32 &ms_oldSectorX; - static int32 &ms_oldSectorY; - static int32 &ms_streamingBufferSize; - static int8 **ms_pStreamingBuffer; //[2] - static int32 &ms_memoryUsed; - static CStreamingChannel *ms_channel; //[2] - static int32 &ms_channelError; - static int32 &ms_numVehiclesLoaded; - static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED] - static int32 &ms_lastVehicleDeleted; - static CDirectory *&ms_pExtraObjectsDir; - static int32 &ms_numPriorityRequests; - static bool &ms_hasLoadedLODs; - static int32 &ms_currentPedGrp; + static bool ms_disableStreaming; + static bool ms_bLoadingBigModel; + static int32 ms_numModelsRequested; + static CStreamingInfo ms_aInfoForModel[NUMSTREAMINFO]; + static CStreamingInfo ms_startLoadedList; + static CStreamingInfo ms_endLoadedList; + static CStreamingInfo ms_startRequestedList; + static CStreamingInfo ms_endRequestedList; + static int32 ms_oldSectorX; + static int32 ms_oldSectorY; + static int32 ms_streamingBufferSize; + static int8 *ms_pStreamingBuffer[2]; + static int32 ms_memoryUsed; + static CStreamingChannel ms_channel[2]; + static int32 ms_channelError; + static int32 ms_numVehiclesLoaded; + static int32 ms_vehiclesLoaded[MAXVEHICLESLOADED]; + static int32 ms_lastVehicleDeleted; + static CDirectory *ms_pExtraObjectsDir; + static int32 ms_numPriorityRequests; + static bool ms_hasLoadedLODs; + static int32 ms_currentPedGrp; static int32 ms_lastCullZone; - static uint16 &ms_loadedGangs; - static uint16 &ms_loadedGangCars; + static uint16 ms_loadedGangs; + static uint16 ms_loadedGangCars; static int32 ms_currentPedLoading; - static int32 *ms_imageOffsets; //[NUMCDIMAGES] - static int32 &ms_lastImageRead; - static int32 &ms_imageSize; - static uint32 &ms_memoryAvailable; + static int32 ms_imageOffsets[NUMCDIMAGES]; + static int32 ms_lastImageRead; + static int32 ms_imageSize; + static uint32 ms_memoryAvailable; static void Init(void); static void Shutdown(void); diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index 2ba884b1..85572fbd 100644 --- a/src/core/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp @@ -6,7 +6,7 @@ #include "Collision.h" #include "SurfaceTable.h" -float (*CSurfaceTable::ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS] = (float (*)[NUMADHESIVEGROUPS])0x8E29D4; +float CSurfaceTable::ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS]; void CSurfaceTable::Initialise(char *filename) diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h index 27f4ecca..4af6a265 100644 --- a/src/core/SurfaceTable.h +++ b/src/core/SurfaceTable.h @@ -98,8 +98,7 @@ struct CColPoint; class CSurfaceTable { -// static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS]; - static float (*ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS]; + static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS]; public: static void Initialise(char *filename); static int GetAdhesionGroup(uint8 surfaceType); diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index 22ef31bd..05b272ab 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -3,19 +3,19 @@ #include "TempColModels.h" #include "SurfaceTable.h" -CColModel &CTempColModels::ms_colModelPed1 = *(CColModel*)0x726CB0; -CColModel &CTempColModels::ms_colModelPed2 = *(CColModel*)0x726D08; -CColModel &CTempColModels::ms_colModelBBox = *(CColModel*)0x727FE0; -CColModel &CTempColModels::ms_colModelBumper1 = *(CColModel*)0x86BE88; -CColModel &CTempColModels::ms_colModelWheel1 = *(CColModel*)0x878C40; -CColModel &CTempColModels::ms_colModelPanel1 = *(CColModel*)0x87BDD8; -CColModel &CTempColModels::ms_colModelBodyPart2 = *(CColModel*)0x87BE30; -CColModel &CTempColModels::ms_colModelBodyPart1 = *(CColModel*)0x87BE88; -CColModel (&CTempColModels::ms_colModelCutObj)[5] = *(CColModel(*)[5]) *(uintptr*)0x87C960; -CColModel &CTempColModels::ms_colModelPedGroundHit = *(CColModel*)0x880480; -CColModel &CTempColModels::ms_colModelBoot1 = *(CColModel*)0x880670; -CColModel &CTempColModels::ms_colModelDoor1 = *(CColModel*)0x880850; -CColModel &CTempColModels::ms_colModelBonnet1 = *(CColModel*)0x8808A8; +CColModel CTempColModels::ms_colModelPed1; +CColModel CTempColModels::ms_colModelPed2; +CColModel CTempColModels::ms_colModelBBox; +CColModel CTempColModels::ms_colModelBumper1; +CColModel CTempColModels::ms_colModelWheel1; +CColModel CTempColModels::ms_colModelPanel1; +CColModel CTempColModels::ms_colModelBodyPart2; +CColModel CTempColModels::ms_colModelBodyPart1; +CColModel CTempColModels::ms_colModelCutObj[5]; +CColModel CTempColModels::ms_colModelPedGroundHit; +CColModel CTempColModels::ms_colModelBoot1; +CColModel CTempColModels::ms_colModelDoor1; +CColModel CTempColModels::ms_colModelBonnet1; CColSphere s_aPedSpheres[3]; diff --git a/src/core/TempColModels.h b/src/core/TempColModels.h index 263904d3..3e1dd5e1 100644 --- a/src/core/TempColModels.h +++ b/src/core/TempColModels.h @@ -5,19 +5,19 @@ class CTempColModels { public: - static CColModel &ms_colModelPed1; - static CColModel &ms_colModelPed2; - static CColModel &ms_colModelBBox; - static CColModel &ms_colModelBumper1; - static CColModel &ms_colModelWheel1; - static CColModel &ms_colModelPanel1; - static CColModel &ms_colModelBodyPart2; - static CColModel &ms_colModelBodyPart1; - static CColModel (&ms_colModelCutObj)[5]; - static CColModel &ms_colModelPedGroundHit; - static CColModel &ms_colModelBoot1; - static CColModel &ms_colModelDoor1; - static CColModel &ms_colModelBonnet1; + static CColModel ms_colModelPed1; + static CColModel ms_colModelPed2; + static CColModel ms_colModelBBox; + static CColModel ms_colModelBumper1; + static CColModel ms_colModelWheel1; + static CColModel ms_colModelPanel1; + static CColModel ms_colModelBodyPart2; + static CColModel ms_colModelBodyPart1; + static CColModel ms_colModelCutObj[5]; + static CColModel ms_colModelPedGroundHit; + static CColModel ms_colModelBoot1; + static CColModel ms_colModelDoor1; + static CColModel ms_colModelBonnet1; static void Initialise(void); }; diff --git a/src/core/TimeStep.cpp b/src/core/TimeStep.cpp index 9ccf7200..09dae911 100644 --- a/src/core/TimeStep.cpp +++ b/src/core/TimeStep.cpp @@ -1,5 +1,5 @@ #include "TimeStep.h" -float &CTimeStep::ms_fTimeScale = *(float*)0x5F76C8; -float &CTimeStep::ms_fFramesPerUpdate = *(float*)0x5F76CC; -float &CTimeStep::ms_fTimeStep = *(float*)0x5F76D0; +float CTimeStep::ms_fTimeScale = 1.0f; +float CTimeStep::ms_fFramesPerUpdate = 1.0f; +float CTimeStep::ms_fTimeStep = 1.0f; diff --git a/src/core/TimeStep.h b/src/core/TimeStep.h index c74df02a..6101b4c2 100644 --- a/src/core/TimeStep.h +++ b/src/core/TimeStep.h @@ -4,7 +4,7 @@ class CTimeStep { public: - static float &ms_fTimeScale; - static float &ms_fFramesPerUpdate; - static float &ms_fTimeStep; + static float ms_fTimeScale; + static float ms_fFramesPerUpdate; + static float ms_fTimeStep; }; diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index fda862f1..68b31e6f 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -5,34 +5,28 @@ #include "Record.h" #include "Timer.h" -uint32 &CTimer::m_snTimeInMilliseconds = *(uint32*)0x885B48; -uint32 &CTimer::m_snTimeInMillisecondsPauseMode = *(uint32*)0x5F7614; -uint32 &CTimer::m_snTimeInMillisecondsNonClipped = *(uint32*)0x9412E8; -uint32 &CTimer::m_snPreviousTimeInMilliseconds = *(uint32*)0x8F29E4; -uint32 &CTimer::m_FrameCounter = *(uint32*)0x9412EC; -float &CTimer::ms_fTimeScale = *(float*)0x8F2C20; -float &CTimer::ms_fTimeStep = *(float*)0x8E2CB4; -float &CTimer::ms_fTimeStepNonClipped = *(float*)0x8E2C4C; -bool &CTimer::m_UserPause = *(bool*)0x95CD7C; -bool &CTimer::m_CodePause = *(bool*)0x95CDB1; - -//UInt32 oldPcTimer; -uint32 &oldPcTimer = *(uint32*)0x9434F4; - -//UInt32 suspendPcTimer; -uint32 &suspendPcTimer = *(uint32*)0x62A308; - -//UInt32 _nCyclesPerMS = 1; -uint32 &_nCyclesPerMS = *(uint32*)0x5F7610; - -//LARGE_INTEGER _oldPerfCounter; -LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310; - -//LARGE_INTEGER perfSuspendCounter; -LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318; - -//UInt32 suspendDepth; -uint32 &suspendDepth = *(uint32*)0x62A320; +uint32 CTimer::m_snTimeInMilliseconds; +uint32 CTimer::m_snTimeInMillisecondsPauseMode = 1; +uint32 CTimer::m_snTimeInMillisecondsNonClipped; +uint32 CTimer::m_snPreviousTimeInMilliseconds; +uint32 CTimer::m_FrameCounter; +float CTimer::ms_fTimeScale; +float CTimer::ms_fTimeStep; +float CTimer::ms_fTimeStepNonClipped; +bool CTimer::m_UserPause; +bool CTimer::m_CodePause; + +uint32 oldPcTimer; + +uint32 suspendPcTimer; + +uint32 _nCyclesPerMS = 1; + +LARGE_INTEGER _oldPerfCounter; + +LARGE_INTEGER perfSuspendCounter; + +uint32 suspendDepth; #ifdef FIX_BUGS double frameTime; diff --git a/src/core/Timer.h b/src/core/Timer.h index a4d674da..00a11409 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -3,17 +3,17 @@ class CTimer { - static uint32 &m_snTimeInMilliseconds; - static uint32 &m_snTimeInMillisecondsPauseMode; - static uint32 &m_snTimeInMillisecondsNonClipped; - static uint32 &m_snPreviousTimeInMilliseconds; - static uint32 &m_FrameCounter; - static float &ms_fTimeScale; - static float &ms_fTimeStep; - static float &ms_fTimeStepNonClipped; + static uint32 m_snTimeInMilliseconds; + static uint32 m_snTimeInMillisecondsPauseMode; + static uint32 m_snTimeInMillisecondsNonClipped; + static uint32 m_snPreviousTimeInMilliseconds; + static uint32 m_FrameCounter; + static float ms_fTimeScale; + static float ms_fTimeStep; + static float ms_fTimeStepNonClipped; public: - static bool &m_UserPause; - static bool &m_CodePause; + static bool m_UserPause; + static bool m_CodePause; static const float &GetTimeStep(void) { return ms_fTimeStep; } static void SetTimeStep(float ts) { ms_fTimeStep = ts; } diff --git a/src/core/User.cpp b/src/core/User.cpp index d89d1cec..a1a69b2d 100644 --- a/src/core/User.cpp +++ b/src/core/User.cpp @@ -9,10 +9,10 @@ #include "World.h" #include "Zones.h" -CPlaceName& CUserDisplay::PlaceName = *(CPlaceName*)0x8F29BC; -COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238; -CPager& CUserDisplay::Pager = *(CPager*)0x8F2744; -CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8; +CPlaceName CUserDisplay::PlaceName; +COnscreenTimer CUserDisplay::OnscnTimer; +CPager CUserDisplay::Pager; +CCurrentVehicle CUserDisplay::CurrentVehicle; CPlaceName::CPlaceName() { diff --git a/src/core/User.h b/src/core/User.h index 02d5f613..153ef57b 100644 --- a/src/core/User.h +++ b/src/core/User.h @@ -31,10 +31,10 @@ public: class CUserDisplay { public: - static CPlaceName &PlaceName; - static COnscreenTimer &OnscnTimer; - static CPager &Pager; - static CCurrentVehicle &CurrentVehicle; + static CPlaceName PlaceName; + static COnscreenTimer OnscnTimer; + static CPager Pager; + static CCurrentVehicle CurrentVehicle; static void Init(); static void Process(); diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp index 29294a2b..1911ae59 100644 --- a/src/core/Wanted.cpp +++ b/src/core/Wanted.cpp @@ -11,8 +11,8 @@ #include "Wanted.h" #include "General.h" -int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6 -int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400 +int32 CWanted::MaximumWantedLevel = 6; +int32 CWanted::nMaximumWantedLevel = 6400; void CWanted::Initialise() diff --git a/src/core/Wanted.h b/src/core/Wanted.h index 9823529c..afeec8b0 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -60,8 +60,8 @@ public: CCrimeBeingQd m_aCrimes[16]; CCopPed *m_pCops[10]; - static int32 &MaximumWantedLevel; - static int32 &nMaximumWantedLevel; + static int32 MaximumWantedLevel; + static int32 nMaximumWantedLevel; public: void Initialise(); diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 4a2bea4f..4cdd283e 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -11,21 +11,21 @@ #include "ZoneCull.h" #include "Zones.h" -int32 &CCullZones::NumCullZones = *(int*)0x8F2564; -CCullZone(&CCullZones::aZones)[NUMCULLZONES] = *(CCullZone(*)[NUMCULLZONES])*(uintptr*)0x864750; -int32 &CCullZones::NumAttributeZones = *(int*)0x8E29D0; -CAttributeZone (&CCullZones::aAttributeZones)[NUMATTRIBZONES] = *(CAttributeZone(*)[NUMATTRIBZONES])*(uintptr*)0x709C60; -uint16 (&CCullZones::aIndices)[NUMZONEINDICES] = *(uint16(*)[NUMZONEINDICES])*(uintptr*)0x847330; -int16 (&CCullZones::aPointersToBigBuildingsForBuildings)[NUMBUILDINGS] = *(int16(*)[NUMBUILDINGS])*(uintptr*)0x86C9D0; -int16 (&CCullZones::aPointersToBigBuildingsForTreadables)[NUMTREADABLES] = *(int16(*)[NUMTREADABLES])*(uintptr*)0x8F1B8C; - -int32 &CCullZones::CurrentWantedLevelDrop_Player = *(int32*)0x880DA8; -int32 &CCullZones::CurrentFlags_Camera = *(int32*)0x940718; -int32 &CCullZones::CurrentFlags_Player = *(int32*)0x9415F0; -int32 &CCullZones::OldCullZone = *(int32*)0x8E2C90; -int32 &CCullZones::EntityIndicesUsed = *(int32*)0x8F2508; -bool &CCullZones::bCurrentSubwayIsInvisible = *(bool*)0x95CDA5; -bool &CCullZones::bCullZonesDisabled = *(bool*)0x95CD4A; +int32 CCullZones::NumCullZones; +CCullZone CCullZones::aZones[NUMCULLZONES]; +int32 CCullZones::NumAttributeZones; +CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES]; +uint16 CCullZones::aIndices[NUMZONEINDICES]; +int16 CCullZones::aPointersToBigBuildingsForBuildings[NUMBUILDINGS]; +int16 CCullZones::aPointersToBigBuildingsForTreadables[NUMTREADABLES]; + +int32 CCullZones::CurrentWantedLevelDrop_Player; +int32 CCullZones::CurrentFlags_Camera; +int32 CCullZones::CurrentFlags_Player; +int32 CCullZones::OldCullZone; +int32 CCullZones::EntityIndicesUsed; +bool CCullZones::bCurrentSubwayIsInvisible; +bool CCullZones::bCullZonesDisabled; void diff --git a/src/core/ZoneCull.h b/src/core/ZoneCull.h index edaa7c4b..9bc07b8c 100644 --- a/src/core/ZoneCull.h +++ b/src/core/ZoneCull.h @@ -79,21 +79,21 @@ struct CAttributeZone class CCullZones { public: - static int32 &NumCullZones; - static CCullZone (&aZones)[NUMCULLZONES]; - static int32 &NumAttributeZones; - static CAttributeZone(&aAttributeZones)[NUMATTRIBZONES]; - static uint16 (&aIndices)[NUMZONEINDICES]; - static int16 (&aPointersToBigBuildingsForBuildings)[NUMBUILDINGS]; - static int16 (&aPointersToBigBuildingsForTreadables)[NUMTREADABLES]; + static int32 NumCullZones; + static CCullZone aZones[NUMCULLZONES]; + static int32 NumAttributeZones; + static CAttributeZone aAttributeZones[NUMATTRIBZONES]; + static uint16 aIndices[NUMZONEINDICES]; + static int16 aPointersToBigBuildingsForBuildings[NUMBUILDINGS]; + static int16 aPointersToBigBuildingsForTreadables[NUMTREADABLES]; - static int32 &CurrentWantedLevelDrop_Player; - static int32 &CurrentFlags_Camera; - static int32 &CurrentFlags_Player; - static int32 &OldCullZone; - static int32 &EntityIndicesUsed; - static bool &bCurrentSubwayIsInvisible; - static bool &bCullZonesDisabled; + static int32 CurrentWantedLevelDrop_Player; + static int32 CurrentFlags_Camera; + static int32 CurrentFlags_Player; + static int32 OldCullZone; + static int32 EntityIndicesUsed; + static bool bCurrentSubwayIsInvisible; + static bool bCullZonesDisabled; static void Init(void); static void ResolveVisibilities(void); diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 4bce3e79..39d4c3b5 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -8,18 +8,18 @@ #include "Text.h" #include "World.h" -eLevelName &CTheZones::m_CurrLevel = *(eLevelName*)0x8F2BC8; -CZone *&CTheZones::m_pPlayersZone = *(CZone**)0x8F254C; -int16 &CTheZones::FindIndex = *(int16*)0x95CC40; - -uint16 &CTheZones::NumberOfAudioZones = *(uint16*)0x95CC84; -int16 *CTheZones::AudioZoneArray = (int16*)0x713BC0; -uint16 &CTheZones::TotalNumberOfMapZones = *(uint16*)0x95CC74; -uint16 &CTheZones::TotalNumberOfZones = *(uint16*)0x95CC36; -CZone *CTheZones::ZoneArray = (CZone*)0x86BEE0; -CZone *CTheZones::MapZoneArray = (CZone*)0x663EC0; -uint16 &CTheZones::TotalNumberOfZoneInfos = *(uint16*)0x95CC3C; -CZoneInfo *CTheZones::ZoneInfoArray = (CZoneInfo*)0x714400; +eLevelName CTheZones::m_CurrLevel; +CZone *CTheZones::m_pPlayersZone; +int16 CTheZones::FindIndex; + +uint16 CTheZones::NumberOfAudioZones; +int16 CTheZones::AudioZoneArray[NUMAUDIOZONES]; +uint16 CTheZones::TotalNumberOfMapZones; +uint16 CTheZones::TotalNumberOfZones; +CZone CTheZones::ZoneArray[NUMZONES]; +CZone CTheZones::MapZoneArray[NUMMAPZONES]; +uint16 CTheZones::TotalNumberOfZoneInfos; +CZoneInfo CTheZones::ZoneInfoArray[2*NUMZONES]; #define SWAPF(a, b) { float t; t = a; a = b; b = t; } diff --git a/src/core/Zones.h b/src/core/Zones.h index 76855e8b..bb1585dc 100644 --- a/src/core/Zones.h +++ b/src/core/Zones.h @@ -52,18 +52,18 @@ public: class CTheZones { public: - static eLevelName &m_CurrLevel; - static CZone *&m_pPlayersZone; - static int16 &FindIndex; + static eLevelName m_CurrLevel; + static CZone *m_pPlayersZone; + static int16 FindIndex; - static uint16 &NumberOfAudioZones; - static int16 *AudioZoneArray; //[NUMAUDIOZONES]; - static uint16 &TotalNumberOfMapZones; - static uint16 &TotalNumberOfZones; - static CZone *ZoneArray; //[NUMZONES]; - static CZone *MapZoneArray; //[NUMMAPZONES]; - static uint16 &TotalNumberOfZoneInfos; - static CZoneInfo *ZoneInfoArray; //[2*NUMZONES]; + static uint16 NumberOfAudioZones; + static int16 AudioZoneArray[NUMAUDIOZONES]; + static uint16 TotalNumberOfMapZones; + static uint16 TotalNumberOfZones; + static CZone ZoneArray[NUMZONES]; + static CZone MapZoneArray[NUMMAPZONES]; + static uint16 TotalNumberOfZoneInfos; + static CZoneInfo ZoneInfoArray[2*NUMZONES]; static void Init(void); static void Update(void); diff --git a/src/core/config.h b/src/core/config.h index f9edb74a..ba684092 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -192,6 +192,7 @@ enum Config { #define MORE_LANGUAGES // Add more translations to the game #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) //#define USE_TXD_CDIMAGE // generate and load textures from txd.img +//#define USE_TEXTURE_POOL // Pad #define XINPUT diff --git a/src/core/main.cpp b/src/core/main.cpp index 08463df9..1b46d453 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -60,23 +60,18 @@ #include "GenericGameStorage.h" #include "SceneEdit.h" -GlobalScene &Scene = *(GlobalScene*)0x726768; +GlobalScene Scene; uint8 work_buff[55000]; -//char gString[256]; -//char gString2[512]; -//wchar gUString[256]; -//wchar gUString2[256]; -char *gString = (char*)0x711B40; -char *gString2 = (char*)0x878A40; -wchar *gUString = (wchar*)0x74B018; -wchar *gUString2 = (wchar*)0x6EDD70; - +char gString[256]; +char gString2[512]; +wchar gUString[256]; +wchar gUString2[256]; float FramesPerSecond = 30.0f; bool gbPrintShite = false; -bool &gbModelViewer = *(bool*)0x95CD93; +bool gbModelViewer; int32 frameCount; diff --git a/src/core/main.h b/src/core/main.h index 5ee758a4..90b13fbb 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -5,19 +5,15 @@ struct GlobalScene RpWorld *world; RwCamera *camera; }; -extern GlobalScene &Scene; +extern GlobalScene Scene; extern uint8 work_buff[55000]; -//extern char gString[256]; -//extern char gString2[512]; -//extern wchar gUString[256]; -//extern wchar gUString2[256]; -extern char *gString; -extern char *gString2; -extern wchar *gUString; -extern wchar *gUString2; +extern char gString[256]; +extern char gString2[512]; +extern wchar gUString[256]; +extern wchar gUString2[256]; extern bool gbPrintShite; -extern bool &gbModelViewer; +extern bool gbModelViewer; class CSprite2d; diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index b6a95992..58124e53 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -5,11 +5,8 @@ #include "ModelIndices.h" #include "ModelInfo.h" -CBaseModelInfo **CModelInfo::ms_modelInfoPtrs = (CBaseModelInfo**)0x83D408; +CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE]; -//CStore &CModelInfo::ms_simpleModelStore = *(CStore*)0x885BB4; -//CStore &CModelInfo::ms_timeModelStore = *(CStore*)0x94076C; -//CStore &CModelInfo::ms_2dEffectStore = *(CStore*)0x9434F8; CStore CModelInfo::ms_simpleModelStore; CStore CModelInfo::ms_mloModelStore; CStore CModelInfo::ms_mloInstanceStore; diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index e6dec1d8..65cfa4e7 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -13,7 +13,7 @@ class CModelInfo { - static CBaseModelInfo **ms_modelInfoPtrs; //[MODELINFOSIZE]; + static CBaseModelInfo *ms_modelInfoPtrs[MODELINFOSIZE]; static CStore ms_simpleModelStore; static CStore ms_mloModelStore; static CStore ms_mloInstanceStore; diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 0c45aa12..fb9e0358 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -19,14 +19,14 @@ #include "ModelIndices.h" #include "ModelInfo.h" -int8 *CVehicleModelInfo::ms_compsToUse = (int8*)0x5FF2EC; // -2, -2 -int8 *CVehicleModelInfo::ms_compsUsed = (int8*)0x95CCB2; -RwTexture **CVehicleModelInfo::ms_pEnvironmentMaps = (RwTexture **)0x8F1A30; -RwRGBA *CVehicleModelInfo::ms_vehicleColourTable = (RwRGBA*)0x86BA88; -RwTexture **CVehicleModelInfo::ms_colourTextureTable = (RwTexture**)0x711C40; - -RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8; -RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510; +int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 }; +int8 CVehicleModelInfo::ms_compsUsed[2]; +RwTexture *CVehicleModelInfo::ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; +RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256]; +RwTexture *CVehicleModelInfo::ms_colourTextureTable[256]; + +RwTexture *gpWhiteTexture; +RwFrame *pMatFxIdentityFrame; enum { VEHICLE_FLAG_COLLAPSE = 0x2, diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 5969c4ca..9992ab98 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -81,11 +81,11 @@ public: RpAtomic *m_comps[6]; int32 m_numComps; - static int8 *ms_compsToUse; // [2]; - static int8 *ms_compsUsed; // [2]; - static RwTexture **ms_pEnvironmentMaps; // [NUM_VEHICLE_ENVMAPS] - static RwRGBA *ms_vehicleColourTable; // [256] - static RwTexture **ms_colourTextureTable; // [256] + static int8 ms_compsToUse[2]; + static int8 ms_compsUsed[2]; + static RwTexture *ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; + static RwRGBA ms_vehicleColourTable[256]; + static RwTexture *ms_colourTextureTable[256]; static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES]; CVehicleModelInfo(void); diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 867624c7..57713241 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -12,8 +12,8 @@ #include "World.h" #include "Floater.h" -int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2; -int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000 +int16 CObject::nNoTempObjects; +int16 CObject::nBodyCastHealth = 1000; void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); } void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);}; diff --git a/src/objects/Object.h b/src/objects/Object.h index 6d04c78a..90663cc5 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -73,8 +73,8 @@ public: CEntity *m_pCollidingEntity; int8 m_colour1, m_colour2; - static int16 &nNoTempObjects; - static int16 &nBodyCastHealth; + static int16 nNoTempObjects; + static int16 nBodyCastHealth; static void *operator new(size_t); static void *operator new(size_t, int); diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp index 60827411..5e4ad231 100644 --- a/src/objects/ParticleObject.cpp +++ b/src/objects/ParticleObject.cpp @@ -9,11 +9,11 @@ #include "Game.h" -CParticleObject (&gPObjectArray)[MAX_PARTICLEOBJECTS] = *(CParticleObject(*)[MAX_PARTICLEOBJECTS])*(uintptr*)0x62A58C; +CParticleObject gPObjectArray[MAX_PARTICLEOBJECTS]; -CParticleObject *&CParticleObject::pCloseListHead = *(CParticleObject **)int(0x8F4340); -CParticleObject *&CParticleObject::pFarListHead = *(CParticleObject **)int(0x942F78); -CParticleObject *&CParticleObject::pUnusedListHead = *(CParticleObject **)int(0x94128C); +CParticleObject *CParticleObject::pCloseListHead; +CParticleObject *CParticleObject::pFarListHead; +CParticleObject *CParticleObject::pUnusedListHead; CAudioHydrant List[MAX_AUDIOHYDRANTS]; diff --git a/src/objects/ParticleObject.h b/src/objects/ParticleObject.h index 45a3fa30..cfa5936d 100644 --- a/src/objects/ParticleObject.h +++ b/src/objects/ParticleObject.h @@ -62,9 +62,9 @@ public: int8 m_nCreationChance; char _pad1[2]; - static CParticleObject *&pCloseListHead; - static CParticleObject *&pFarListHead; - static CParticleObject *&pUnusedListHead; + static CParticleObject *pCloseListHead; + static CParticleObject *pFarListHead; + static CParticleObject *pUnusedListHead; CParticleObject(); ~CParticleObject(); @@ -89,7 +89,7 @@ public: static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj); }; -extern CParticleObject (&gPObjectArray)[MAX_PARTICLEOBJECTS]; +extern CParticleObject gPObjectArray[MAX_PARTICLEOBJECTS]; class CAudioHydrant { diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp index 3bc17002..b6512edd 100644 --- a/src/peds/PedRoutes.cpp +++ b/src/peds/PedRoutes.cpp @@ -3,7 +3,7 @@ #include "main.h" #include "PedRoutes.h" -CRouteNode (&gaRoutes)[NUMPEDROUTES] = *(CRouteNode(*)[NUMPEDROUTES]) * (uintptr*)0x62E090; +CRouteNode gaRoutes[NUMPEDROUTES]; void CRouteNode::Initialise() diff --git a/src/peds/PedStats.cpp b/src/peds/PedStats.cpp index 147f11e2..a2ccb567 100644 --- a/src/peds/PedStats.cpp +++ b/src/peds/PedStats.cpp @@ -4,7 +4,6 @@ #include "FileMgr.h" #include "PedStats.h" -//CPedStats *(&CPedStats::ms_apPedStats)[NUM_PEDSTATS] = *(CPedStats *(*)[NUM_PEDSTATS]) *(uintptr*)0x9404D4; CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS]; void diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp index 4c9d6b3f..30af6dcc 100644 --- a/src/peds/PedType.cpp +++ b/src/peds/PedType.cpp @@ -3,7 +3,7 @@ #include "FileMgr.h" #include "PedType.h" -CPedType *(&CPedType::ms_apPedType)[NUM_PEDTYPES] = *(CPedType *(*)[NUM_PEDTYPES]) *(uintptr*)0x941594; +CPedType *CPedType::ms_apPedType[NUM_PEDTYPES]; void CPedType::Initialise(void) diff --git a/src/peds/PedType.h b/src/peds/PedType.h index 3d927df5..c0c72550 100644 --- a/src/peds/PedType.h +++ b/src/peds/PedType.h @@ -71,7 +71,7 @@ class CPedType uint32 m_threats; uint32 m_avoid; - static CPedType *(&ms_apPedType)[NUM_PEDTYPES]; + static CPedType *ms_apPedType[NUM_PEDTYPES]; public: static void Initialise(void); diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 7debe3d3..02035896 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -16,15 +16,15 @@ #define SMALLSTRIPHEIGHT 4.0f #define HORIZSTRIPHEIGHT 48.0f -RwTexture **gpCloudTex = (RwTexture**)0x9411C0; //[5]; +RwTexture *gpCloudTex[5]; -float &CClouds::CloudRotation = *(float*)0x8F5F40; -uint32 &CClouds::IndividualRotation = *(uint32*)0x943078; +float CClouds::CloudRotation; +uint32 CClouds::IndividualRotation; -float &CClouds::ms_cameraRoll = *(float*)0x8F29CC; -float &CClouds::ms_horizonZ = *(float*)0x8F31C0; -CRGBA &CClouds::ms_colourTop = *(CRGBA*)0x94143C; -CRGBA &CClouds::ms_colourBottom = *(CRGBA*)0x8F2C38; +float CClouds::ms_cameraRoll; +float CClouds::ms_horizonZ; +CRGBA CClouds::ms_colourTop; +CRGBA CClouds::ms_colourBottom; void CClouds::Init(void) diff --git a/src/render/Clouds.h b/src/render/Clouds.h index c8000569..4d8cd2c8 100644 --- a/src/render/Clouds.h +++ b/src/render/Clouds.h @@ -3,13 +3,13 @@ class CClouds { public: - static float &CloudRotation; - static uint32 &IndividualRotation; + static float CloudRotation; + static uint32 IndividualRotation; - static float &ms_cameraRoll; - static float &ms_horizonZ; - static CRGBA &ms_colourTop; - static CRGBA &ms_colourBottom; + static float ms_cameraRoll; + static float ms_horizonZ; + static CRGBA ms_colourTop; + static CRGBA ms_colourBottom; static void Init(void); static void Shutdown(void); diff --git a/src/render/Console.cpp b/src/render/Console.cpp index 545122b0..bfdb2701 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -9,7 +9,7 @@ #define CONSOLE_Y_POS (10.0f) #define CONSOLE_LINE_HEIGHT (12.0f) -CConsole &TheConsole = *(CConsole*)0x8F6498; +CConsole TheConsole; void CConsole::AddLine(char *s, uint8 r, uint8 g, uint8 b) diff --git a/src/render/Console.h b/src/render/Console.h index c454d75e..b4fa60c4 100644 --- a/src/render/Console.h +++ b/src/render/Console.h @@ -22,4 +22,4 @@ public: void Init() { m_nCurrentLine = 0; m_nLineCount = 0; } }; -extern CConsole &TheConsole; +extern CConsole TheConsole; diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 68994b0b..38f86f4b 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -48,16 +48,16 @@ FlareDef HeadLightsFlareDef[] = { }; -RwTexture **gpCoronaTexture = (RwTexture**)0x5FAF44; //[9] +RwTexture *gpCoronaTexture[9] = { NULL }; -float &CCoronas::LightsMult = *(float*)0x5FB088; // 1.0 -float &CCoronas::SunScreenX = *(float*)0x8F4358; -float &CCoronas::SunScreenY = *(float*)0x8F4354; -bool &CCoronas::bSmallMoon = *(bool*)0x95CD49; -bool &CCoronas::SunBlockedByClouds = *(bool*)0x95CD73; -int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30; +float CCoronas::LightsMult = 1.0f; +float CCoronas::SunScreenX; +float CCoronas::SunScreenY; +bool CCoronas::bSmallMoon; +bool CCoronas::SunBlockedByClouds; +int CCoronas::bChangeBrightnessImmediately; -CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518; +CRegisteredCorona CCoronas::aCoronas[NUMCORONAS]; const char aCoronaSpriteNames[][32] = { "coronastar", diff --git a/src/render/Coronas.h b/src/render/Coronas.h index 359a34ed..4b49e40e 100644 --- a/src/render/Coronas.h +++ b/src/render/Coronas.h @@ -1,6 +1,6 @@ #pragma once -extern RwTexture **gpCoronaTexture; //[9] +extern RwTexture *gpCoronaTexture[9]; struct CRegisteredCorona { @@ -42,7 +42,7 @@ static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error"); class CCoronas { - static CRegisteredCorona *aCoronas; //[NUMCORONAS]; + static CRegisteredCorona aCoronas[NUMCORONAS]; public: enum { SUN_CORE = 1, @@ -77,12 +77,12 @@ public: STREAK_ON, }; - static float &LightsMult; - static float &SunScreenY; - static float &SunScreenX; - static bool &bSmallMoon; - static bool &SunBlockedByClouds; - static int &bChangeBrightnessImmediately; + static float LightsMult; + static float SunScreenY; + static float SunScreenX; + static bool bSmallMoon; + static bool SunBlockedByClouds; + static int bChangeBrightnessImmediately; static void Init(void); static void Shutdown(void); diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index b423fcc0..25f7bbcf 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -8,8 +8,8 @@ #include "Text.h" #include "Credits.h" -bool &CCredits::bCreditsGoing = *(bool*)0x95CDD3; -uint32 &CCredits::CreditsStartTime = *(uint32*)0x8F2528; +bool CCredits::bCreditsGoing; +uint32 CCredits::CreditsStartTime; void CCredits::Init(void) diff --git a/src/render/Credits.h b/src/render/Credits.h index c39fb035..e049ce76 100644 --- a/src/render/Credits.h +++ b/src/render/Credits.h @@ -2,8 +2,8 @@ class CCredits { - static bool &bCreditsGoing; - static uint32 &CreditsStartTime; + static bool bCreditsGoing; + static uint32 CreditsStartTime; public: static void Init(void); static void Start(void); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 862fc024..dcbb6342 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -8,15 +8,15 @@ float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO; #endif -float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4; -float &CDraw::ms_fFarClipZ = *(float*)0x9434F0; -float &CDraw::ms_fFOV = *(float*)0x5FBC6C; -float &CDraw::ms_fLODDistance = *(float*)0x8F2C30; +float CDraw::ms_fNearClipZ; +float CDraw::ms_fFarClipZ; +float CDraw::ms_fFOV = 45.0f; +float CDraw::ms_fLODDistance; -uint8 &CDraw::FadeValue = *(uint8*)0x95CD68; -uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; -uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; -uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; +uint8 CDraw::FadeValue; +uint8 CDraw::FadeRed; +uint8 CDraw::FadeGreen; +uint8 CDraw::FadeBlue; float CDraw::FindAspectRatio(void) diff --git a/src/render/Draw.h b/src/render/Draw.h index 50e1e294..55958a2a 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -13,11 +13,11 @@ enum eAspectRatio class CDraw { private: - static float &ms_fNearClipZ; - static float &ms_fFarClipZ; - static float &ms_fFOV; + static float ms_fNearClipZ; + static float ms_fFarClipZ; + static float ms_fFOV; public: - static float &ms_fLODDistance; // set but unused? + static float ms_fLODDistance; // set but unused? #ifdef ASPECT_RATIO_SCALE // we use this variable to scale a lot of 2D elements @@ -25,10 +25,10 @@ public: static float ms_fAspectRatio; #endif - static uint8 &FadeValue; - static uint8 &FadeRed; - static uint8 &FadeGreen; - static uint8 &FadeBlue; + static uint8 FadeValue; + static uint8 FadeRed; + static uint8 FadeGreen; + static uint8 FadeBlue; static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } diff --git a/src/render/Font.cpp b/src/render/Font.cpp index ca15cba7..ba4c4301 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -4,18 +4,18 @@ #include "TxdStore.h" #include "Font.h" -CFontDetails &CFont::Details = *(CFontDetails*)0x8F317C; -int16 &CFont::NewLine = *(int16*)0x95CC94; -CSprite2d *CFont::Sprite = (CSprite2d*)0x95CC04; +CFontDetails CFont::Details; +int16 CFont::NewLine; +CSprite2d CFont::Sprite[MAX_FONTS]; #ifdef MORE_LANGUAGES uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS; int32 CFont::Slot = -1; -int16 CFont::Size[2][3][193] = { +int16 CFont::Size[2][MAX_FONTS][193] = { { #else -int16 CFont::Size[3][193] = { +int16 CFont::Size[MAX_FONTS][193] = { #endif { 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31, diff --git a/src/render/Font.h b/src/render/Font.h index 0659dda1..ebf5e292 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -31,6 +31,7 @@ enum { FONT_BANK, FONT_PAGER, FONT_HEADING, + MAX_FONTS }; enum { @@ -50,16 +51,16 @@ enum class CFont { #ifdef MORE_LANGUAGES - static int16 Size[2][3][193]; + static int16 Size[2][MAX_FONTS][193]; static uint8 LanguageSet; static int32 Slot; #else - static int16 Size[3][193]; + static int16 Size[MAX_FONTS][193]; #endif - static int16 - static CSprite2d *Sprite; //[3] + static int16 NewLine; + static CSprite2d Sprite[MAX_FONTS]; public: - static CFontDetails& Details; + static CFontDetails Details; static void Initialise(void); static void Shutdown(void); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 9529c4c1..5bcdd450 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -21,52 +21,52 @@ #include "User.h" #include "World.h" -wchar CHud::m_HelpMessage[256]; // = (wchar*)0x86B888; -wchar CHud::m_LastHelpMessage[256]; // = (wchar*)0x6E8F28; -uint32 CHud::m_HelpMessageState; // = *(int32*)0x880E1C; -uint32 CHud::m_HelpMessageTimer; // = *(int32*)0x880FA4; -int32 CHud::m_HelpMessageFadeTimer; // = *(int32*)0x8F6258; -wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480; -float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28; -bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7; -uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC; +wchar CHud::m_HelpMessage[256]; +wchar CHud::m_LastHelpMessage[256]; +uint32 CHud::m_HelpMessageState; +uint32 CHud::m_HelpMessageTimer; +int32 CHud::m_HelpMessageFadeTimer; +wchar CHud::m_HelpMessageToPrint[256]; +float CHud::m_fHelpMessageTime; +bool CHud::m_HelpMessageQuick; +uint32 CHud::m_ZoneState; int32 CHud::m_ZoneFadeTimer; -uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50; -wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C; -wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C; +uint32 CHud::m_ZoneNameTimer; +wchar *CHud::m_pZoneName; +wchar *CHud::m_pLastZoneName; wchar *CHud::m_ZoneToPrint; -uint32 CHud::m_VehicleState; // = *(int32*)0x940560; +uint32 CHud::m_VehicleState; int32 CHud::m_VehicleFadeTimer; -uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14; -wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4; -wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8; +uint32 CHud::m_VehicleNameTimer; +wchar *CHud::m_VehicleName; +wchar *CHud::m_pLastVehicleName; wchar *CHud::m_pVehicleNameToPrint; -wchar CHud::m_Message[256];// = (wchar*)0x72E318; -wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840; -bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89; -bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62; -wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0; -int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82; +wchar CHud::m_Message[256]; +wchar CHud::m_PagerMessage[256]; +bool CHud::m_Wants_To_Draw_Hud; +bool CHud::m_Wants_To_Draw_3dMarkers; +wchar CHud::m_BigMessage[6][128]; +int16 CHud::m_ItemToFlash; // These aren't really in CHud float CHud::BigMessageInUse[6]; float CHud::BigMessageAlpha[6]; float CHud::BigMessageX[6]; -float CHud::OddJob2OffTimer; // = *(float*)0x942FA0; -bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67; -float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C; -uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20; -uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52; -bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7; -int16 CHud::OddJob2On; //= *(int16*)0x95CC78; -uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C; -int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A; -int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54; -float CHud::PagerXOffset; //= *(float*)0x941590; -int16 CHud::PagerTimer; //= *(int16*)0x95CC3A; -int16 CHud::PagerOn; //= *(int16*)0x95CCA0; - -CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C; +float CHud::OddJob2OffTimer; +bool CHud::CounterOnLastFrame; +float CHud::OddJob2XOffset; +uint16 CHud::CounterFlashTimer; +uint16 CHud::OddJob2Timer; +bool CHud::TimerOnLastFrame; +int16 CHud::OddJob2On; +uint16 CHud::TimerFlashTimer; +int16 CHud::PagerSoundPlayed; +int32 CHud::SpriteBrightness; +float CHud::PagerXOffset; +int16 CHud::PagerTimer; +int16 CHud::PagerOn; + +CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; struct { @@ -98,8 +98,8 @@ struct {"siterocket", "siterocket"} }; -RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834; -RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20; +RwTexture *gpSniperSightTex; +RwTexture *gpRocketSightTex; void CHud::Draw() { diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index d28671fa..d15fa422 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -6,9 +6,9 @@ // Originally taken from RW example 'mblur' -RwRaster *&CMBlur::pFrontBuffer = *(RwRaster**)0x8E2C48; -bool &CMBlur::ms_bJustInitialised = *(bool*)0x95CDAB; -bool &CMBlur::BlurOn = *(bool*)0x95CDAD; +RwRaster *CMBlur::pFrontBuffer; +bool CMBlur::ms_bJustInitialised; +bool CMBlur::BlurOn; static RwIm2DVertex Vertex[4]; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; diff --git a/src/render/MBlur.h b/src/render/MBlur.h index 42827f99..e8a5bef8 100644 --- a/src/render/MBlur.h +++ b/src/render/MBlur.h @@ -3,9 +3,9 @@ class CMBlur { public: - static RwRaster *&pFrontBuffer; - static bool &ms_bJustInitialised; - static bool &BlurOn; + static RwRaster *pFrontBuffer; + static bool ms_bJustInitialised; + static bool BlurOn; public: static void MotionBlurOpen(RwCamera *cam); diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 6956a887..eb188128 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -204,26 +204,21 @@ RwRaster *gpGunShellRaster; RwRaster *gpWakeOldRaster; -//RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect -RwRaster *&gpPointlightRaster = *(RwRaster **)0x8F5FE0; +RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect -//RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks -RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RAINDROP_FILES])*(int *)0x880660; +RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES]; -//Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; // -float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8; +float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; CParticle *CParticle::m_pUnusedListHead; -//Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; // -//Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; / -float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358; -float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18; +float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; +float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; int32 Randomizer; diff --git a/src/render/Particle.h b/src/render/Particle.h index 310ef0d4..604fbb82 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -49,16 +49,11 @@ public: ; } - //static float ms_afRandTable[RAND_TABLE_SIZE]; - static float (&ms_afRandTable)[RAND_TABLE_SIZE]; + static float ms_afRandTable[RAND_TABLE_SIZE]; static CParticle *m_pUnusedListHead; - /* static float m_SinTable[SIN_COS_TABLE_SIZE]; static float m_CosTable[SIN_COS_TABLE_SIZE]; - */ - static float (&m_SinTable)[SIN_COS_TABLE_SIZE]; - static float (&m_CosTable)[SIN_COS_TABLE_SIZE]; static float Sin(int32 value) { return m_SinTable[value]; } static float Cos(int32 value) { return m_CosTable[value]; } diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp index a015ec54..92a89582 100644 --- a/src/render/PointLights.cpp +++ b/src/render/PointLights.cpp @@ -10,8 +10,8 @@ #include "Timer.h" #include "PointLights.h" -int16 &CPointLights::NumLights = *(int16*)0x95CC3E; -CRegisteredPointLight *CPointLights::aLights = (CRegisteredPointLight*)0x7096D0; +int16 CPointLights::NumLights; +CRegisteredPointLight CPointLights::aLights[NUMPOINTLIGHTS]; void CPointLights::InitPerFrame(void) @@ -114,7 +114,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors) return ret; } -extern RwRaster *&gpPointlightRaster; +extern RwRaster *gpPointlightRaster; void CPointLights::RemoveLightsAffectingObject(void) diff --git a/src/render/PointLights.h b/src/render/PointLights.h index c1dad87f..215e1dc9 100644 --- a/src/render/PointLights.h +++ b/src/render/PointLights.h @@ -18,8 +18,8 @@ static_assert(sizeof(CRegisteredPointLight) == 0x2C, "CRegisteredPointLight: err class CPointLights { public: - static int16 &NumLights; - static CRegisteredPointLight *aLights; //[NUMPOINTLIGHTS] + static int16 NumLights; + static CRegisteredPointLight aLights[NUMPOINTLIGHTS]; enum { LIGHT_POINT, diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp index f6499451..4225619f 100644 --- a/src/render/RenderBuffer.cpp +++ b/src/render/RenderBuffer.cpp @@ -2,14 +2,14 @@ #include "patcher.h" #include "RenderBuffer.h" -int32 &TempBufferVerticesStored = *(int32*)0x8F5F78; -int32 &TempBufferIndicesStored = *(int32*)0x8F1A4C; +int32 TempBufferVerticesStored; +int32 TempBufferIndicesStored; -RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex*)0x862330; -RwImVertexIndex *TempBufferRenderIndexList = (RwImVertexIndex*)0x846288; +RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE]; +RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; -int &RenderBuffer::VerticesToBeStored = *(int*)0x8F59C4; -int &RenderBuffer::IndicesToBeStored = *(int*)0x8E28B0; +int RenderBuffer::VerticesToBeStored; +int RenderBuffer::IndicesToBeStored; void RenderBuffer::ClearRenderBuffer(void) diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h index 2b8a9f86..485d24e3 100644 --- a/src/render/RenderBuffer.h +++ b/src/render/RenderBuffer.h @@ -1,8 +1,8 @@ class RenderBuffer { public: - static int &VerticesToBeStored; - static int &IndicesToBeStored; + static int VerticesToBeStored; + static int IndicesToBeStored; static void ClearRenderBuffer(void); static void StartStoring(int numIndices, int numVertices, RwImVertexIndex **indexStart, RwIm3DVertex **vertexStart); static void StopStoring(void); @@ -12,7 +12,7 @@ public: #define TEMPBUFFERVERTSIZE 256 #define TEMPBUFFERINDEXSIZE 1024 -extern int32 &TempBufferVerticesStored; -extern int32 &TempBufferIndicesStored; -extern RwIm3DVertex *TempBufferRenderVertices; -extern RwImVertexIndex *TempBufferRenderIndexList; \ No newline at end of file +extern int32 TempBufferVerticesStored; +extern int32 TempBufferIndicesStored; +extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE]; +extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; \ No newline at end of file diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index e14b0453..56a93238 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -20,43 +20,31 @@ SETTWEAKPATH("Shadows"); TWEAKBOOL(gbPrintShite); -#if 1 RwImVertexIndex ShadowIndexList[24]; -#else -RwImVertexIndex (&ShadowIndexList)[24] = *(RwImVertexIndex (*)[24])*(int *)0x649188; -#endif -RwTexture *&gpShadowCarTex = *(RwTexture **)0x8F2C90; -RwTexture *&gpShadowPedTex = *(RwTexture **)0x8F59D0; -RwTexture *&gpShadowHeliTex = *(RwTexture **)0x8E2A90; -RwTexture *&gpShadowExplosionTex = *(RwTexture **)0x8F2A00; -RwTexture *&gpShadowHeadLightsTex = *(RwTexture **)0x95CB98; -RwTexture *&gpOutline1Tex = *(RwTexture **)0x8F1B24; -RwTexture *&gpOutline2Tex = *(RwTexture **)0x8F1B04; -RwTexture *&gpOutline3Tex = *(RwTexture **)0x8F1B08; -RwTexture *&gpBloodPoolTex = *(RwTexture **)0x9415F8; -RwTexture *&gpReflectionTex = *(RwTexture **)0x8F582C; -RwTexture *&gpGoalMarkerTex = *(RwTexture **)0x94142C; -RwTexture *&gpWalkDontTex = *(RwTexture **)0x95CB4C; -RwTexture *&gpCrackedGlassTex = *(RwTexture **)0x95CB94; -RwTexture *&gpPostShadowTex = *(RwTexture **)0x8F59D4; -RwTexture *&gpGoalTex = *(RwTexture**)0x94142C; - -#if 1 +RwTexture *gpShadowCarTex; +RwTexture *gpShadowPedTex; +RwTexture *gpShadowHeliTex; +RwTexture *gpShadowExplosionTex; +RwTexture *gpShadowHeadLightsTex; +RwTexture *gpOutline1Tex; +RwTexture *gpOutline2Tex; +RwTexture *gpOutline3Tex; +RwTexture *gpBloodPoolTex; +RwTexture *gpReflectionTex; +RwTexture *gpGoalMarkerTex; +RwTexture *gpWalkDontTex; +RwTexture *gpCrackedGlassTex; +RwTexture *gpPostShadowTex; +RwTexture *gpGoalTex; + int16 CShadows::ShadowsStoredToBeRendered; CStoredShadow CShadows::asShadowsStored [MAX_STOREDSHADOWS]; CPolyBunch CShadows::aPolyBunches [MAX_POLYBUNCHES]; CStaticShadow CShadows::aStaticShadows [MAX_STATICSHADOWS]; CPolyBunch *CShadows::pEmptyBunchList; CPermanentShadow CShadows::aPermanentShadows[MAX_PERMAMENTSHADOWS]; -#else -int16 &CShadows::ShadowsStoredToBeRendered = *(int16*)0x95CCEE; -CStoredShadow (&CShadows::asShadowsStored)[MAX_STOREDSHADOWS] = *(CStoredShadow (*)[MAX_STOREDSHADOWS])*(int *)0x779058; -CPolyBunch (&CShadows::aPolyBunches)[MAX_POLYBUNCHES] = *(CPolyBunch (*)[MAX_POLYBUNCHES])*(int *)0x86F4C8; -CStaticShadow (&CShadows::aStaticShadows)[MAX_STATICSHADOWS] = *(CStaticShadow (*)[MAX_STATICSHADOWS])*(int *)0x773BE8; -CPolyBunch *&CShadows::pEmptyBunchList = *(CPolyBunch**)0x8F435C; -CPermanentShadow (&CShadows::aPermanentShadows)[MAX_PERMAMENTSHADOWS] = *(CPermanentShadow (*)[MAX_PERMAMENTSHADOWS])*(int *)0x712040; -#endif + void CShadows::Init(void) diff --git a/src/render/Shadows.h b/src/render/Shadows.h index ced9f11b..d209fe90 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -174,18 +174,18 @@ public: static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity); }; -extern RwTexture *&gpShadowCarTex; -extern RwTexture *&gpShadowPedTex; -extern RwTexture *&gpShadowHeliTex; -extern RwTexture *&gpShadowExplosionTex; -extern RwTexture *&gpShadowHeadLightsTex; -extern RwTexture *&gpOutline1Tex; -extern RwTexture *&gpOutline2Tex; -extern RwTexture *&gpOutline3Tex; -extern RwTexture *&gpBloodPoolTex; -extern RwTexture *&gpReflectionTex; -extern RwTexture *&gpGoalMarkerTex; -extern RwTexture *&gpWalkDontTex; -extern RwTexture *&gpCrackedGlassTex; -extern RwTexture *&gpPostShadowTex; -extern RwTexture *&gpGoalTex; +extern RwTexture *gpShadowCarTex; +extern RwTexture *gpShadowPedTex; +extern RwTexture *gpShadowHeliTex; +extern RwTexture *gpShadowExplosionTex; +extern RwTexture *gpShadowHeadLightsTex; +extern RwTexture *gpOutline1Tex; +extern RwTexture *gpOutline2Tex; +extern RwTexture *gpOutline3Tex; +extern RwTexture *gpBloodPoolTex; +extern RwTexture *gpReflectionTex; +extern RwTexture *gpGoalMarkerTex; +extern RwTexture *gpWalkDontTex; +extern RwTexture *gpCrackedGlassTex; +extern RwTexture *gpPostShadowTex; +extern RwTexture *gpGoalTex; diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 82754121..57ab8f14 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -5,10 +5,10 @@ #include "Camera.h" #include "Sprite.h" -float &CSprite::m_f2DNearScreenZ = *(float*)0x8F1ABC; -float &CSprite::m_f2DFarScreenZ = *(float*)0x8F2C94; -float &CSprite::m_fRecipNearClipPlane = *(float*)0x8F5FFC; -int32 &CSprite::m_bFlushSpriteBufferSwitchZTest = *(int32*)0x8F5FB0; +float CSprite::m_f2DNearScreenZ; +float CSprite::m_f2DFarScreenZ; +float CSprite::m_fRecipNearClipPlane; +int32 CSprite::m_bFlushSpriteBufferSwitchZTest; float CSprite::CalcHorizonCoors(void) @@ -40,9 +40,9 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, } #define SPRITEBUFFERSIZE 64 -static int32 &nSpriteBufferIndex = *(int32*)0x649A80; -static RwIm2DVertex *SpriteBufferVerts = (RwIm2DVertex*)0x649A84; //[SPRITEBUFFERSIZE*6]; -static RwIm2DVertex *verts = (RwIm2DVertex*)0x64C484; //[4]; +static int32 nSpriteBufferIndex; +static RwIm2DVertex SpriteBufferVerts[SPRITEBUFFERSIZE*6]; +static RwIm2DVertex verts[4]; void CSprite::InitSpriteBuffer(void) diff --git a/src/render/Sprite.h b/src/render/Sprite.h index 33953ff3..ec4c1d1b 100644 --- a/src/render/Sprite.h +++ b/src/render/Sprite.h @@ -2,10 +2,10 @@ class CSprite { - static float &m_f2DNearScreenZ; - static float &m_f2DFarScreenZ; - static float &m_fRecipNearClipPlane; - static int32 &m_bFlushSpriteBufferSwitchZTest; + static float m_f2DNearScreenZ; + static float m_f2DFarScreenZ; + static float m_fRecipNearClipPlane; + static int32 m_bFlushSpriteBufferSwitchZTest; public: static float CalcHorizonCoors(void); static bool CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip); diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index 7ab3e91e..6e24a76e 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -10,101 +10,101 @@ #include "FileMgr.h" #include "Timecycle.h" -int (*CTimeCycle::m_nAmbientRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86AF78; -int (*CTimeCycle::m_nAmbientGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x665308; -int (*CTimeCycle::m_nAmbientBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72CF88; -int (*CTimeCycle::m_nDirectionalRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FAB78; -int (*CTimeCycle::m_nDirectionalGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F4528; -int (*CTimeCycle::m_nDirectionalBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83CE58; -int (*CTimeCycle::m_nSkyTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FB90; -int (*CTimeCycle::m_nSkyTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x8460A8; -int (*CTimeCycle::m_nSkyTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87B158; -int (*CTimeCycle::m_nSkyBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FA960; -int (*CTimeCycle::m_nSkyBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70D6A8; -int (*CTimeCycle::m_nSkyBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83D288; -int (*CTimeCycle::m_nSunCoreRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x878360; -int (*CTimeCycle::m_nSunCoreGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE088; -int (*CTimeCycle::m_nSunCoreBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x773A68; -int (*CTimeCycle::m_nSunCoronaRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x664B60; -int (*CTimeCycle::m_nSunCoronaGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F01E0; -int (*CTimeCycle::m_nSunCoronaBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E6340; -float (*CTimeCycle::m_fSunSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733510; -float (*CTimeCycle::m_fSpriteSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87F820; -float (*CTimeCycle::m_fSpriteBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x6E96F0; -short (*CTimeCycle::m_nShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x83CFD8; -short (*CTimeCycle::m_nLightShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x72B0F8; -short (*CTimeCycle::m_nTreeShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x733450; -float (*CTimeCycle::m_fFogStart)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8806C8; -float (*CTimeCycle::m_fFarClip)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8804E0; -float (*CTimeCycle::m_fLightsOnGroundBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x83D108; -int (*CTimeCycle::m_nLowCloudsRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x726770; -int (*CTimeCycle::m_nLowCloudsGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87BF08; -int (*CTimeCycle::m_nLowCloudsBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FA10; -int (*CTimeCycle::m_nFluffyCloudsTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70F2B0; -int (*CTimeCycle::m_nFluffyCloudsTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72D288; -int (*CTimeCycle::m_nFluffyCloudsTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86B108; -int (*CTimeCycle::m_nFluffyCloudsBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E8DA8; -int (*CTimeCycle::m_nFluffyCloudsBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x715AA8; -int (*CTimeCycle::m_nFluffyCloudsBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE2D0; -float (*CTimeCycle::m_fBlurRed)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87C7E0; -float (*CTimeCycle::m_fBlurGreen)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x774C10; -float (*CTimeCycle::m_fBlurBlue)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8784E0; -float (*CTimeCycle::m_fBlurAlpha)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733690; - -float &CTimeCycle::m_fCurrentAmbientRed = *(float*)0x8F29B4; -float &CTimeCycle::m_fCurrentAmbientGreen = *(float*)0x94144C; -float &CTimeCycle::m_fCurrentAmbientBlue = *(float*)0x942FC0; -float &CTimeCycle::m_fCurrentDirectionalRed = *(float*)0x8F29D8; -float &CTimeCycle::m_fCurrentDirectionalGreen = *(float*)0x940594; -float &CTimeCycle::m_fCurrentDirectionalBlue = *(float*)0x942FAC; -int &CTimeCycle::m_nCurrentSkyTopRed = *(int*)0x9403C0; -int &CTimeCycle::m_nCurrentSkyTopGreen = *(int*)0x943074; -int &CTimeCycle::m_nCurrentSkyTopBlue = *(int*)0x8F29B8; -int &CTimeCycle::m_nCurrentSkyBottomRed = *(int*)0x9414D0; -int &CTimeCycle::m_nCurrentSkyBottomGreen = *(int*)0x8F2BD0; -int &CTimeCycle::m_nCurrentSkyBottomBlue = *(int*)0x8F625C; -int &CTimeCycle::m_nCurrentSunCoreRed = *(int*)0x8F2534; -int &CTimeCycle::m_nCurrentSunCoreGreen = *(int*)0x8F6264; -int &CTimeCycle::m_nCurrentSunCoreBlue = *(int*)0x94149C; -int &CTimeCycle::m_nCurrentSunCoronaRed = *(int*)0x8F2C1C; -int &CTimeCycle::m_nCurrentSunCoronaGreen = *(int*)0x885B54; -int &CTimeCycle::m_nCurrentSunCoronaBlue = *(int*)0x880F60; -float &CTimeCycle::m_fCurrentSunSize = *(float*)0x940588; -float &CTimeCycle::m_fCurrentSpriteSize = *(float*)0x8F1AA8; -float &CTimeCycle::m_fCurrentSpriteBrightness = *(float*)0x8F5FDC; -int &CTimeCycle::m_nCurrentShadowStrength = *(int*)0x95CC76; -int &CTimeCycle::m_nCurrentLightShadowStrength = *(int*)0x95CC66; -int &CTimeCycle::m_nCurrentTreeShadowStrength = *(int*)0x95CC86; -float &CTimeCycle::m_fCurrentFogStart = *(float*)0x8F1AE0; -float &CTimeCycle::m_fCurrentFarClip = *(float*)0x8F5FD8; -float &CTimeCycle::m_fCurrentLightsOnGroundBrightness = *(float*)0x8F1B60; -int &CTimeCycle::m_nCurrentLowCloudsRed = *(int*)0x95CB54; -int &CTimeCycle::m_nCurrentLowCloudsGreen = *(int*)0x95CB48; -int &CTimeCycle::m_nCurrentLowCloudsBlue = *(int*)0x95CC1C; -int &CTimeCycle::m_nCurrentFluffyCloudsTopRed = *(int*)0x8F2550; -int &CTimeCycle::m_nCurrentFluffyCloudsTopGreen = *(int*)0x8F59CC; -int &CTimeCycle::m_nCurrentFluffyCloudsTopBlue = *(int*)0x941434; -int &CTimeCycle::m_nCurrentFluffyCloudsBottomRed = *(int*)0x8F1A38; -int &CTimeCycle::m_nCurrentFluffyCloudsBottomGreen = *(int*)0x8E28B8; -int &CTimeCycle::m_nCurrentFluffyCloudsBottomBlue = *(int*)0x8F3960; -float &CTimeCycle::m_fCurrentBlurRed = *(float*)0x8F6000; -float &CTimeCycle::m_fCurrentBlurGreen = *(float*)0x9405A0; -float &CTimeCycle::m_fCurrentBlurBlue = *(float*)0x8F250C; -float &CTimeCycle::m_fCurrentBlurAlpha = *(float*)0x940728; -int &CTimeCycle::m_nCurrentFogColourRed = *(int*)0x940714; -int &CTimeCycle::m_nCurrentFogColourGreen = *(int*)0x8E2A60; -int &CTimeCycle::m_nCurrentFogColourBlue = *(int*)0x8F57EC; - -int &CTimeCycle::m_FogReduction = *(int*)0x880FB8; - -int &CTimeCycle::m_CurrentStoredValue = *(int*)0x94057C; -CVector *CTimeCycle::m_VectorToSun = (CVector*)0x665548; // [16] -float *CTimeCycle::m_fShadowFrontX = (float*)0x72CE90; -float *CTimeCycle::m_fShadowFrontY = (float*)0x72CE50; -float *CTimeCycle::m_fShadowSideX = (float*)0x87C708; -float *CTimeCycle::m_fShadowSideY = (float*)0x87C6C8; -float *CTimeCycle::m_fShadowDisplacementX = (float*)0x6F0748; -float *CTimeCycle::m_fShadowDisplacementY = (float*)0x6F0788; +int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; +short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS]; +short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; +short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; +int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS]; +float CTimeCycle::m_fBlurAlpha[NUMHOURS][NUMWEATHERS]; + +float CTimeCycle::m_fCurrentAmbientRed; +float CTimeCycle::m_fCurrentAmbientGreen; +float CTimeCycle::m_fCurrentAmbientBlue; +float CTimeCycle::m_fCurrentDirectionalRed; +float CTimeCycle::m_fCurrentDirectionalGreen; +float CTimeCycle::m_fCurrentDirectionalBlue; +int CTimeCycle::m_nCurrentSkyTopRed; +int CTimeCycle::m_nCurrentSkyTopGreen; +int CTimeCycle::m_nCurrentSkyTopBlue; +int CTimeCycle::m_nCurrentSkyBottomRed; +int CTimeCycle::m_nCurrentSkyBottomGreen; +int CTimeCycle::m_nCurrentSkyBottomBlue; +int CTimeCycle::m_nCurrentSunCoreRed; +int CTimeCycle::m_nCurrentSunCoreGreen; +int CTimeCycle::m_nCurrentSunCoreBlue; +int CTimeCycle::m_nCurrentSunCoronaRed; +int CTimeCycle::m_nCurrentSunCoronaGreen; +int CTimeCycle::m_nCurrentSunCoronaBlue; +float CTimeCycle::m_fCurrentSunSize; +float CTimeCycle::m_fCurrentSpriteSize; +float CTimeCycle::m_fCurrentSpriteBrightness; +int CTimeCycle::m_nCurrentShadowStrength; +int CTimeCycle::m_nCurrentLightShadowStrength; +int CTimeCycle::m_nCurrentTreeShadowStrength; +float CTimeCycle::m_fCurrentFogStart; +float CTimeCycle::m_fCurrentFarClip; +float CTimeCycle::m_fCurrentLightsOnGroundBrightness; +int CTimeCycle::m_nCurrentLowCloudsRed; +int CTimeCycle::m_nCurrentLowCloudsGreen; +int CTimeCycle::m_nCurrentLowCloudsBlue; +int CTimeCycle::m_nCurrentFluffyCloudsTopRed; +int CTimeCycle::m_nCurrentFluffyCloudsTopGreen; +int CTimeCycle::m_nCurrentFluffyCloudsTopBlue; +int CTimeCycle::m_nCurrentFluffyCloudsBottomRed; +int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen; +int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue; +float CTimeCycle::m_fCurrentBlurRed; +float CTimeCycle::m_fCurrentBlurGreen; +float CTimeCycle::m_fCurrentBlurBlue; +float CTimeCycle::m_fCurrentBlurAlpha; +int CTimeCycle::m_nCurrentFogColourRed; +int CTimeCycle::m_nCurrentFogColourGreen; +int CTimeCycle::m_nCurrentFogColourBlue; + +int CTimeCycle::m_FogReduction; + +int CTimeCycle::m_CurrentStoredValue; +CVector CTimeCycle::m_VectorToSun[16]; +float CTimeCycle::m_fShadowFrontX[16]; +float CTimeCycle::m_fShadowFrontY[16]; +float CTimeCycle::m_fShadowSideX[16]; +float CTimeCycle::m_fShadowSideY[16]; +float CTimeCycle::m_fShadowDisplacementX[16]; +float CTimeCycle::m_fShadowDisplacementY[16]; void diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index ed4a026b..28a0b7dd 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -2,102 +2,102 @@ class CTimeCycle { - static int (*m_nAmbientRed)[NUMWEATHERS]; - static int (*m_nAmbientGreen)[NUMWEATHERS]; - static int (*m_nAmbientBlue)[NUMWEATHERS]; - static int (*m_nDirectionalRed)[NUMWEATHERS]; - static int (*m_nDirectionalGreen)[NUMWEATHERS]; - static int (*m_nDirectionalBlue)[NUMWEATHERS]; - static int (*m_nSkyTopRed)[NUMWEATHERS]; - static int (*m_nSkyTopGreen)[NUMWEATHERS]; - static int (*m_nSkyTopBlue)[NUMWEATHERS]; - static int (*m_nSkyBottomRed)[NUMWEATHERS]; - static int (*m_nSkyBottomGreen)[NUMWEATHERS]; - static int (*m_nSkyBottomBlue)[NUMWEATHERS]; - static int (*m_nSunCoreRed)[NUMWEATHERS]; - static int (*m_nSunCoreGreen)[NUMWEATHERS]; - static int (*m_nSunCoreBlue)[NUMWEATHERS]; - static int (*m_nSunCoronaRed)[NUMWEATHERS]; - static int (*m_nSunCoronaGreen)[NUMWEATHERS]; - static int (*m_nSunCoronaBlue)[NUMWEATHERS]; - static float (*m_fSunSize)[NUMWEATHERS]; - static float (*m_fSpriteSize)[NUMWEATHERS]; - static float (*m_fSpriteBrightness)[NUMWEATHERS]; - static short (*m_nShadowStrength)[NUMWEATHERS]; - static short (*m_nLightShadowStrength)[NUMWEATHERS]; - static short (*m_nTreeShadowStrength)[NUMWEATHERS]; - static float (*m_fFogStart)[NUMWEATHERS]; - static float (*m_fFarClip)[NUMWEATHERS]; - static float (*m_fLightsOnGroundBrightness)[NUMWEATHERS]; - static int (*m_nLowCloudsRed)[NUMWEATHERS]; - static int (*m_nLowCloudsGreen)[NUMWEATHERS]; - static int (*m_nLowCloudsBlue)[NUMWEATHERS]; - static int (*m_nFluffyCloudsTopRed)[NUMWEATHERS]; - static int (*m_nFluffyCloudsTopGreen)[NUMWEATHERS]; - static int (*m_nFluffyCloudsTopBlue)[NUMWEATHERS]; - static int (*m_nFluffyCloudsBottomRed)[NUMWEATHERS]; - static int (*m_nFluffyCloudsBottomGreen)[NUMWEATHERS]; - static int (*m_nFluffyCloudsBottomBlue)[NUMWEATHERS]; - static float (*m_fBlurRed)[NUMWEATHERS]; - static float (*m_fBlurGreen)[NUMWEATHERS]; - static float (*m_fBlurBlue)[NUMWEATHERS]; - static float (*m_fBlurAlpha)[NUMWEATHERS]; + static int m_nAmbientRed[NUMHOURS][NUMWEATHERS]; + static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS]; + static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS]; + static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS]; + static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; + static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; + static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS]; + static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; + static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; + static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; + static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; + static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; + static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; + static float m_fSunSize[NUMHOURS][NUMWEATHERS]; + static float m_fSpriteSize[NUMHOURS][NUMWEATHERS]; + static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; + static short m_nShadowStrength[NUMHOURS][NUMWEATHERS]; + static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; + static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS]; + static float m_fFogStart[NUMHOURS][NUMWEATHERS]; + static float m_fFarClip[NUMHOURS][NUMWEATHERS]; + static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; + static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; + static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; + static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; + static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; + static float m_fBlurRed[NUMHOURS][NUMWEATHERS]; + static float m_fBlurGreen[NUMHOURS][NUMWEATHERS]; + static float m_fBlurBlue[NUMHOURS][NUMWEATHERS]; + static float m_fBlurAlpha[NUMHOURS][NUMWEATHERS]; - static float &m_fCurrentAmbientRed; - static float &m_fCurrentAmbientGreen; - static float &m_fCurrentAmbientBlue; - static float &m_fCurrentDirectionalRed; - static float &m_fCurrentDirectionalGreen; - static float &m_fCurrentDirectionalBlue; - static int &m_nCurrentSkyTopRed; - static int &m_nCurrentSkyTopGreen; - static int &m_nCurrentSkyTopBlue; - static int &m_nCurrentSkyBottomRed; - static int &m_nCurrentSkyBottomGreen; - static int &m_nCurrentSkyBottomBlue; - static int &m_nCurrentSunCoreRed; - static int &m_nCurrentSunCoreGreen; - static int &m_nCurrentSunCoreBlue; - static int &m_nCurrentSunCoronaRed; - static int &m_nCurrentSunCoronaGreen; - static int &m_nCurrentSunCoronaBlue; - static float &m_fCurrentSunSize; - static float &m_fCurrentSpriteSize; - static float &m_fCurrentSpriteBrightness; - static int &m_nCurrentShadowStrength; - static int &m_nCurrentLightShadowStrength; - static int &m_nCurrentTreeShadowStrength; - static float &m_fCurrentFogStart; - static float &m_fCurrentFarClip; - static float &m_fCurrentLightsOnGroundBrightness; - static int &m_nCurrentLowCloudsRed; - static int &m_nCurrentLowCloudsGreen; - static int &m_nCurrentLowCloudsBlue; - static int &m_nCurrentFluffyCloudsTopRed; - static int &m_nCurrentFluffyCloudsTopGreen; - static int &m_nCurrentFluffyCloudsTopBlue; - static int &m_nCurrentFluffyCloudsBottomRed; - static int &m_nCurrentFluffyCloudsBottomGreen; - static int &m_nCurrentFluffyCloudsBottomBlue; - static float &m_fCurrentBlurRed; - static float &m_fCurrentBlurGreen; - static float &m_fCurrentBlurBlue; - static float &m_fCurrentBlurAlpha; - static int &m_nCurrentFogColourRed; - static int &m_nCurrentFogColourGreen; - static int &m_nCurrentFogColourBlue; + static float m_fCurrentAmbientRed; + static float m_fCurrentAmbientGreen; + static float m_fCurrentAmbientBlue; + static float m_fCurrentDirectionalRed; + static float m_fCurrentDirectionalGreen; + static float m_fCurrentDirectionalBlue; + static int m_nCurrentSkyTopRed; + static int m_nCurrentSkyTopGreen; + static int m_nCurrentSkyTopBlue; + static int m_nCurrentSkyBottomRed; + static int m_nCurrentSkyBottomGreen; + static int m_nCurrentSkyBottomBlue; + static int m_nCurrentSunCoreRed; + static int m_nCurrentSunCoreGreen; + static int m_nCurrentSunCoreBlue; + static int m_nCurrentSunCoronaRed; + static int m_nCurrentSunCoronaGreen; + static int m_nCurrentSunCoronaBlue; + static float m_fCurrentSunSize; + static float m_fCurrentSpriteSize; + static float m_fCurrentSpriteBrightness; + static int m_nCurrentShadowStrength; + static int m_nCurrentLightShadowStrength; + static int m_nCurrentTreeShadowStrength; + static float m_fCurrentFogStart; + static float m_fCurrentFarClip; + static float m_fCurrentLightsOnGroundBrightness; + static int m_nCurrentLowCloudsRed; + static int m_nCurrentLowCloudsGreen; + static int m_nCurrentLowCloudsBlue; + static int m_nCurrentFluffyCloudsTopRed; + static int m_nCurrentFluffyCloudsTopGreen; + static int m_nCurrentFluffyCloudsTopBlue; + static int m_nCurrentFluffyCloudsBottomRed; + static int m_nCurrentFluffyCloudsBottomGreen; + static int m_nCurrentFluffyCloudsBottomBlue; + static float m_fCurrentBlurRed; + static float m_fCurrentBlurGreen; + static float m_fCurrentBlurBlue; + static float m_fCurrentBlurAlpha; + static int m_nCurrentFogColourRed; + static int m_nCurrentFogColourGreen; + static int m_nCurrentFogColourBlue; - static int &m_FogReduction; + static int m_FogReduction; public: - static int &m_CurrentStoredValue; - static CVector *m_VectorToSun; // [16] - static float *m_fShadowFrontX; // [16] - static float *m_fShadowFrontY; // [16] - static float *m_fShadowSideX; // [16] - static float *m_fShadowSideY; // [16] - static float *m_fShadowDisplacementX; // [16] - static float *m_fShadowDisplacementY; // [16] + static int m_CurrentStoredValue; + static CVector m_VectorToSun[16]; + static float m_fShadowFrontX[16]; + static float m_fShadowFrontY[16]; + static float m_fShadowSideX[16]; + static float m_fShadowSideY[16]; + static float m_fShadowDisplacementX[16]; + static float m_fShadowDisplacementY[16]; static float GetAmbientRed(void) { return m_fCurrentAmbientRed; } static float GetAmbientGreen(void) { return m_fCurrentAmbientGreen; } diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index a1c2af93..d5a54742 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -39,8 +39,8 @@ int16 CWaterLevel::nGeomUsed; //RwTexture *gpWaterTex; //RwRaster *gpWaterRaster; -RwTexture *&gpWaterTex = *(RwTexture **)0x64D070; -RwRaster *&gpWaterRaster = *(RwRaster **)0x8F5FD4; +RwTexture *gpWaterTex; +RwRaster *gpWaterRaster; const float fAdd1 = 180.0f; diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index 827e83d2..a471bc52 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -64,7 +64,7 @@ #define MAX_BOAT_WAKES 8 -extern RwRaster*& gpWaterRaster; +extern RwRaster* gpWaterRaster; class CWaterLevel { diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 7aa2778f..1aa6be82 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -18,35 +18,35 @@ #include "World.h" #include "ZoneCull.h" -int32 &CWeather::SoundHandle = *(int32*)0x5FFBC4; +int32 CWeather::SoundHandle = -1; -int32 &CWeather::WeatherTypeInList = *(int32*)0x8F626C; -int16 &CWeather::OldWeatherType = *(int16*)0x95CCEC; -int16 &CWeather::NewWeatherType = *(int16*)0x95CC70; -int16 &CWeather::ForcedWeatherType = *(int16*)0x95CC80; +int32 CWeather::WeatherTypeInList; +int16 CWeather::OldWeatherType; +int16 CWeather::NewWeatherType; +int16 CWeather::ForcedWeatherType; -bool &CWeather::LightningFlash = *(bool*)0x95CDA3; -bool &CWeather::LightningBurst = *(bool*)0x95CDAC; -uint32 &CWeather::LightningStart = *(uint32*)0x8F5F84; -uint32 &CWeather::LightningFlashLastChange = *(uint32*)0x8E2C0C; -uint32 &CWeather::WhenToPlayLightningSound = *(uint32*)0x8F57E4; -uint32 &CWeather::LightningDuration = *(uint32*)0x940578; +bool CWeather::LightningFlash; +bool CWeather::LightningBurst; +uint32 CWeather::LightningStart; +uint32 CWeather::LightningFlashLastChange; +uint32 CWeather::WhenToPlayLightningSound; +uint32 CWeather::LightningDuration; -float &CWeather::Foggyness = *(float*)0x885AF4; -float &CWeather::CloudCoverage = *(float*)0x8E2818; -float &CWeather::Wind = *(float*)0x8E2BF8; -float &CWeather::Rain = *(float*)0x8E2BFC; -float &CWeather::InterpolationValue = *(float*)0x8F2520; -float &CWeather::WetRoads = *(float*)0x8F5FF8; -float &CWeather::Rainbow = *(float*)0x940598; +float CWeather::Foggyness; +float CWeather::CloudCoverage; +float CWeather::Wind; +float CWeather::Rain; +float CWeather::InterpolationValue; +float CWeather::WetRoads; +float CWeather::Rainbow; -bool &CWeather::bScriptsForceRain = *(bool*)0x95CD7D; -bool &CWeather::Stored_StateStored = *(bool*)0x95CDC1; +bool CWeather::bScriptsForceRain; +bool CWeather::Stored_StateStored; -float &CWeather::Stored_InterpolationValue = *(float*)0x942F54; -int16 &CWeather::Stored_OldWeatherType = *(int16*)0x95CC68; -int16 &CWeather::Stored_NewWeatherType = *(int16*)0x95CCAE; -float &CWeather::Stored_Rain = *(float*)0x885B4C; +float CWeather::Stored_InterpolationValue; +int16 CWeather::Stored_OldWeatherType; +int16 CWeather::Stored_NewWeatherType; +float CWeather::Stored_Rain; tRainStreak Streaks[NUM_RAIN_STREAKS]; diff --git a/src/render/Weather.h b/src/render/Weather.h index 9e4ea378..9c670317 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -16,34 +16,34 @@ public: WEATHER_FOGGY = 3, WEATHER_TOTAL = 4 }; - static int32 &SoundHandle; + static int32 SoundHandle; - static int32 &WeatherTypeInList; - static int16 &OldWeatherType; - static int16 &NewWeatherType; - static int16 &ForcedWeatherType; + static int32 WeatherTypeInList; + static int16 OldWeatherType; + static int16 NewWeatherType; + static int16 ForcedWeatherType; - static bool &LightningFlash; - static bool &LightningBurst; - static uint32 &LightningStart; - static uint32 &LightningFlashLastChange; - static uint32 &WhenToPlayLightningSound; - static uint32 &LightningDuration; + static bool LightningFlash; + static bool LightningBurst; + static uint32 LightningStart; + static uint32 LightningFlashLastChange; + static uint32 WhenToPlayLightningSound; + static uint32 LightningDuration; - static float &Foggyness; - static float &CloudCoverage; - static float &Wind; - static float &Rain; - static float &InterpolationValue; - static float &WetRoads; - static float &Rainbow; + static float Foggyness; + static float CloudCoverage; + static float Wind; + static float Rain; + static float InterpolationValue; + static float WetRoads; + static float Rainbow; - static bool &bScriptsForceRain; - static bool &Stored_StateStored; - static float &Stored_InterpolationValue; - static int16 &Stored_OldWeatherType; - static int16 &Stored_NewWeatherType; - static float &Stored_Rain; + static bool bScriptsForceRain; + static bool Stored_StateStored; + static float Stored_InterpolationValue; + static int16 Stored_OldWeatherType; + static int16 Stored_NewWeatherType; + static float Stored_Rain; static void RenderRainStreaks(void); static void Update(void); @@ -68,4 +68,4 @@ struct tRainStreak uint32 timer; }; -extern RwTexture* (&gpRainDropTex)[4]; \ No newline at end of file +extern RwTexture* gpRainDropTex[4]; \ No newline at end of file diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp index 112c8982..6e9edbed 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -9,18 +9,18 @@ #include "ZoneCull.h" #include "Frontend.h" -RpLight *pAmbient;// = *(RpLight**)0x885B6C; -RpLight *pDirect;// = *(RpLight**)0x880F7C; -RpLight *pExtraDirectionals[] = { nil, nil, nil, nil };// = (RpLight**)0x60009C; -int LightStrengths[4];// = (int*)0x87BEF0; -int NumExtraDirLightsInWorld;// = *(int*)0x64C608; - -RwRGBAReal AmbientLightColourForFrame;// = *(RwRGBAReal*)0x6F46F8; -RwRGBAReal AmbientLightColourForFrame_PedsCarsAndObjects;// = *(RwRGBAReal*)0x6F1D10; -RwRGBAReal DirectionalLightColourForFrame;// = *(RwRGBAReal*)0x87C6B8; - -RwRGBAReal AmbientLightColour;// = *(RwRGBAReal*)0x86B0F8; -RwRGBAReal DirectionalLightColour;// = *(RwRGBAReal*)0x72E308; +RpLight *pAmbient; +RpLight *pDirect; +RpLight *pExtraDirectionals[] = { nil }; +int LightStrengths[4]; +int NumExtraDirLightsInWorld; + +RwRGBAReal AmbientLightColourForFrame; +RwRGBAReal AmbientLightColourForFrame_PedsCarsAndObjects; +RwRGBAReal DirectionalLightColourForFrame; + +RwRGBAReal AmbientLightColour; +RwRGBAReal DirectionalLightColour; void SetLightsWithTimeOfDayColour(RpWorld *) diff --git a/src/rw/NodeName.cpp b/src/rw/NodeName.cpp index 7422a323..b3477dba 100644 --- a/src/rw/NodeName.cpp +++ b/src/rw/NodeName.cpp @@ -2,7 +2,7 @@ #include "patcher.h" #include "NodeName.h" -static int32 gPluginOffset;// = *(int32*)0x64C610; +static int32 gPluginOffset; enum { diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index cf1a6f2b..6bb78e7b 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -389,8 +389,10 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer) return (nil); } +#ifdef USE_TEXTURE_POOL WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); } WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); } +#endif STARTPATCHES //InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP); diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 1ac5a75e..64fea20f 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -22,8 +22,8 @@ #include "RwHelper.h" #endif //GTA_PC -float texLoadTime;// = *(float*)0x8F1B50; -int32 texNumLoaded;// = *(int32*)0x8F252C; +float texLoadTime; +int32 texNumLoaded; #ifdef LIBRW #define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size) diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index a32755a4..d640d99d 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -6,8 +6,8 @@ #include "RwHelper.h" #include "TxdStore.h" -CPool *CTxdStore::ms_pTxdPool;// = *(CPool**)0x8F5FB8; -RwTexDictionary *CTxdStore::ms_pStoredTxd;// = *(RwTexDictionary**)0x9405BC; +CPool *CTxdStore::ms_pTxdPool; +RwTexDictionary *CTxdStore::ms_pStoredTxd; void CTxdStore::Initialise(void) diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 5438ed0f..b7afd751 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -11,24 +11,24 @@ #define FADE_DISTANCE 20.0f -CLinkList CVisibilityPlugins::m_alphaList;// = *(CLinkList*)0x8F42E4; -CLinkList CVisibilityPlugins::m_alphaEntityList;// = *(CLinkList*)0x943084; - -int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;// = *(int32*)0x600124; -int32 CVisibilityPlugins::ms_framePluginOffset = -1;// = *(int32*)0x600128; -int32 CVisibilityPlugins::ms_clumpPluginOffset = -1;// = *(int32*)0x60012C; - -RwCamera *CVisibilityPlugins::ms_pCamera;// = *(RwCamera**)0x8F2514; -RwV3d *CVisibilityPlugins::ms_pCameraPosn;// = *(RwV3d**)0x8F6270; -float CVisibilityPlugins::ms_cullCompsDist;// = *(float*)0x8F2BC4; -float CVisibilityPlugins::ms_vehicleLod0Dist;// = *(float*)0x885B28; -float CVisibilityPlugins::ms_vehicleLod1Dist;// = *(float*)0x885B30; -float CVisibilityPlugins::ms_vehicleFadeDist;// = *(float*)0x8E28B4; -float CVisibilityPlugins::ms_bigVehicleLod0Dist;// = *(float*)0x8E2A84; -float CVisibilityPlugins::ms_bigVehicleLod1Dist;// = *(float*)0x8E2A8C; -float CVisibilityPlugins::ms_pedLod0Dist;// = *(float*)0x8F2BD4; -float CVisibilityPlugins::ms_pedLod1Dist;// = *(float*)0x8F2BD8; -float CVisibilityPlugins::ms_pedFadeDist;// = *(float*)0x8E2C34; +CLinkList CVisibilityPlugins::m_alphaList; +CLinkList CVisibilityPlugins::m_alphaEntityList; + +int32 CVisibilityPlugins::ms_atomicPluginOffset = -1; +int32 CVisibilityPlugins::ms_framePluginOffset = -1; +int32 CVisibilityPlugins::ms_clumpPluginOffset = -1; + +RwCamera *CVisibilityPlugins::ms_pCamera; +RwV3d *CVisibilityPlugins::ms_pCameraPosn; +float CVisibilityPlugins::ms_cullCompsDist; +float CVisibilityPlugins::ms_vehicleLod0Dist; +float CVisibilityPlugins::ms_vehicleLod1Dist; +float CVisibilityPlugins::ms_vehicleFadeDist; +float CVisibilityPlugins::ms_bigVehicleLod0Dist; +float CVisibilityPlugins::ms_bigVehicleLod1Dist; +float CVisibilityPlugins::ms_pedLod0Dist; +float CVisibilityPlugins::ms_pedLod1Dist; +float CVisibilityPlugins::ms_pedFadeDist; void CVisibilityPlugins::Initialise(void) diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 0bae979b..88f32c33 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -40,22 +40,22 @@ const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729; -char DefaultPCSaveFileName[260];// = *(char(*)[260]) * (uintptr*)0x8E28C0; -char ValidSaveName[260];// = *(char(*)[260])*(uintptr*)0x8E2CBC; -char LoadFileName[256];// = *(char(*)[256])*(uintptr*)0x9403C4; -wchar SlotFileName[SLOT_COUNT][260];// = *(wchar(*)[SLOT_COUNT][260])*(uintptr*)0x6F07C8; -wchar SlotSaveDate[SLOT_COUNT][70];// = *(wchar(*)[SLOT_COUNT][70])*(uintptr*)0x72B858; -int CheckSum;// = *(int*)0x8E2BE0; -eLevelName m_LevelToLoad;// = *(eLevelName*)0x8E29CC; +char DefaultPCSaveFileName[260]; +char ValidSaveName[260]; +char LoadFileName[256]; +wchar SlotFileName[SLOT_COUNT][260]; +wchar SlotSaveDate[SLOT_COUNT][70]; +int CheckSum; +eLevelName m_LevelToLoad; char SaveFileNameJustSaved[260]; -int Slots[SLOT_COUNT+1];// = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C; -CDate CompileDateAndTime;// = *(CDate*)0x72BCB8; - -bool b_FoundRecentSavedGameWantToLoad;// = *(bool*)0x95CDA8; -bool JustLoadedDontFadeInYet;// = *(bool*)0x95CDB4; -bool StillToFadeOut;// = *(bool*)0x95CD99; -uint32 TimeStartedCountingForFade;// = *(uint32*)0x9430EC; -uint32 TimeToStayFadedBeforeFadeOut = 1750;// = *(uint32*)0x611564; +int Slots[SLOT_COUNT+1]; +CDate CompileDateAndTime; + +bool b_FoundRecentSavedGameWantToLoad; +bool JustLoadedDontFadeInYet; +bool StillToFadeOut; +uint32 TimeStartedCountingForFade; +uint32 TimeToStayFadedBeforeFadeOut = 1750; #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp index 4afcb645..06024e04 100644 --- a/src/save/PCSave.cpp +++ b/src/save/PCSave.cpp @@ -9,7 +9,7 @@ const char* _psGetUserFilesFolder(); -C_PcSave PcSaveHelper;// = *(C_PcSave*)0x8E2C60; +C_PcSave PcSaveHelper; void C_PcSave::SetSaveDirectory(const char *path) diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index 73dd8bf8..a02d7e0b 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -17,8 +17,7 @@ static RwBool DefaultVideoMode = TRUE; bool TurnOnAnimViewer = false; -//RsGlobalType RsGlobal; -RsGlobalType &RsGlobal = *(RsGlobalType*)0x8F4360; +RsGlobalType RsGlobal; RwUInt32 RsTimer(void) diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h index 6bf8d2fd..13588411 100644 --- a/src/skel/skeleton.h +++ b/src/skel/skeleton.h @@ -232,7 +232,7 @@ enum RsPadButtons typedef enum RsPadButtons RsPadButtons; -extern RsGlobalType &RsGlobal; +extern RsGlobalType RsGlobal; extern RsEventStatus AppEventHandler(RsEvent event, void *param); extern RwBool AttachInputDevices(void); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index acc9650c..351b7247 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -45,31 +45,25 @@ #define MAX_SUBSYSTEMS (16) -//static RwBool ForegroundApp = TRUE; -static RwBool &ForegroundApp = *(RwBool*)0x060F000; +static RwBool ForegroundApp = TRUE; -//static RwBool RwInitialised = FALSE; -static RwBool &RwInitialised = *(RwBool*)0x885B88; +static RwBool RwInitialised = FALSE; static RwSubSystemInfo GsubSysInfo[MAX_SUBSYSTEMS]; static RwInt32 GnumSubSystems = 0; static RwInt32 GcurSel = 0, GcurSelVM = 0; -//static RwBool startupDeactivate; -static RwBool &startupDeactivate = *(RwBool*)0x8E2878; +static RwBool startupDeactivate; -//static RwBool useDefault; -static RwBool &useDefault = *(RwBool*)0x6510D4; +static RwBool useDefault; -//static RwBool defaultFullscreenRes = TRUE; -static RwBool &defaultFullscreenRes = *(RwBool*)0x60EFFC; +static RwBool defaultFullscreenRes = TRUE; /* Class name for the MS Window's window class. */ static const RwChar *AppClassName = RWSTRING("Grand theft auto 3"); -//static psGlobalType PsGlobal; -static psGlobalType &PsGlobal = *(psGlobalType*)0x72CF60; +static psGlobalType PsGlobal; #define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var) @@ -107,14 +101,14 @@ IMediaSeeking *pMS = nil; DWORD dwDXVersion; DWORD _dwMemTotalPhys; -DWORD &_dwMemAvailPhys = *(DWORD*)0x70F29C; +DWORD _dwMemAvailPhys; DWORD _dwMemTotalVirtual; DWORD _dwMemAvailVirtual; -DWORD &_dwMemTotalVideo = *(DWORD*)0x70F2A8; +DWORD _dwMemTotalVideo; DWORD _dwMemAvailVideo; -DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290; +DWORD _dwOperatingSystemVersion; -RwUInt32 &gGameState = *(RwUInt32*)0x8F5838; +RwUInt32 gGameState; CJoySticks AllValidWinJoys; CJoySticks::CJoySticks() diff --git a/src/skel/win/win.h b/src/skel/win/win.h index 242438ea..ca16c4a0 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -29,9 +29,9 @@ enum eWinVersion OS_WINXP, }; -extern DWORD &_dwOperatingSystemVersion; +extern DWORD _dwOperatingSystemVersion; -extern RwUInt32 &gGameState; +extern RwUInt32 gGameState; /* platform specfic global data */ typedef struct @@ -127,5 +127,5 @@ void HandleExit(); #endif /* __cplusplus */ -extern DWORD &_dwOperatingSystemVersion; +extern DWORD _dwOperatingSystemVersion; #endif /* (!defined(_PLATFORM_WIN_H)) */ diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp index 4b181d67..67a7bab4 100644 --- a/src/text/Messages.cpp +++ b/src/text/Messages.cpp @@ -12,9 +12,9 @@ #include "ControllerConfig.h" -tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];// = *(tMessage(*)[NUMBRIEFMESSAGES]) * (uintptr*)0x8786E0; -tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];// = *(tPreviousBrief(*)[NUMPREVIOUSBRIEFS]) * (uintptr*)0x713C08; -tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];// = *(tBigMessage(*)[NUMBIGMESSAGES]) * (uintptr*)0x773628; +tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES]; +tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS]; +tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES]; char CMessages::PreviousMissionTitle[16]; // unused void diff --git a/src/text/Text.cpp b/src/text/Text.cpp index b3da27e8..144dfed1 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -7,7 +7,7 @@ static wchar WideErrorString[25]; -CText TheText;// = *(CText*)0x941520; +CText TheText; CText::CText(void) { diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 12d4f589..0a0bc7a6 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -49,7 +49,7 @@ bool bAllCarCheat; // unused RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data); -bool CAutomobile::m_sAllTaxiLights;// = *(bool*)0x95CD21; +bool CAutomobile::m_sAllTaxiLights; CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index d694d8b0..478257b6 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -21,16 +21,16 @@ #define INVALID_ORIENTATION (-9999.99f) -float fShapeLength = 0.4f;// *(float*)0x600E78; -float fShapeTime = 0.05f;// *(float*)0x600E7C; -float fRangeMult = 0.75f; // = *(float*)0x600E80; //0.6f; // 0.75f gta 3 -float fTimeMult;// = *(float*)0x943008; +float fShapeLength = 0.4f; +float fShapeTime = 0.05f; +float fRangeMult = 0.75f; //0.6f; // 0.75f gta 3 +float fTimeMult; float MAX_WAKE_LENGTH = 50.0f; float MIN_WAKE_INTERVAL = 1.0f; float WAKE_LIFETIME = 400.0f; -CBoat *CBoat::apFrameWakeGeneratingBoats[4];// = *(CBoat * (*)[4]) * (uintptr*)0x8620E0; +CBoat *CBoat::apFrameWakeGeneratingBoats[4]; CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner) { diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp index ee4a1191..8b5e1e0a 100644 --- a/src/vehicles/Floater.cpp +++ b/src/vehicles/Floater.cpp @@ -7,9 +7,9 @@ #include "Vehicle.h" #include "Floater.h" -cBuoyancy mod_Buoyancy;// = *(cBuoyancy*)0x8F2674; +cBuoyancy mod_Buoyancy; -static float fVolMultiplier = 1.0f; // 0x601394; +static float fVolMultiplier = 1.0f; // amount of boat volume in bounding box // 1.0-volume is the empty space in the bbox static float fBoatVolumeDistribution[9] = { diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 40715887..b33015ab 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -4,7 +4,7 @@ #include "FileMgr.h" #include "HandlingMgr.h" -cHandlingDataMgr mod_HandlingManager;// = *(cHandlingDataMgr*)0x728060; +cHandlingDataMgr mod_HandlingManager; const char *HandlingFilename = "HANDLING.CFG"; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 61714133..81ac9bd3 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -34,13 +34,13 @@ enum HELI_STATUS_HOVER2, }; -CHeli *CHeli::pHelis[NUM_HELIS];// = (CHeli**)0x72CF50; -int16 CHeli::NumRandomHelis;// = *(int16*)0x95CCAA; -uint32 CHeli::TestForNewRandomHelisTimer;// = *(uint32*)0x8F1A7C; +CHeli *CHeli::pHelis[NUM_HELIS]; +int16 CHeli::NumRandomHelis; +uint32 CHeli::TestForNewRandomHelisTimer; int16 CHeli::NumScriptHelis; // unused -bool CHeli::CatalinaHeliOn;// = *(bool*)0x95CD85; -bool CHeli::CatalinaHasBeenShotDown;// = *(bool*)0x95CD56; -bool CHeli::ScriptHeliOn;// = *(bool*)0x95CD43; +bool CHeli::CatalinaHeliOn; +bool CHeli::CatalinaHasBeenShotDown; +bool CHeli::ScriptHeliOn; CHeli::CHeli(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index 49f5d69d..892bc0d5 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -16,35 +16,35 @@ #include "HandlingMgr.h" #include "Plane.h" -CPlaneNode *pPathNodes;// = *(CPlaneNode**)0x8F1B68; -CPlaneNode *pPath2Nodes;// = *(CPlaneNode**)0x885B8C; -CPlaneNode *pPath3Nodes;// = *(CPlaneNode**)0x885B78; -CPlaneNode *pPath4Nodes;// = *(CPlaneNode**)0x885AD8; -int32 NumPathNodes;// = *(int32*)0x8F2BE4; -int32 NumPath2Nodes;// = *(int32*)0x941498; -int32 NumPath3Nodes;// = *(int32*)0x9414D8; -int32 NumPath4Nodes;// = *(int32*)0x9412C8; -float TotalLengthOfFlightPath;// = *(float*)0x8F2C6C; -float TotalLengthOfFlightPath2;// = *(float*)0x64CFBC; -float TotalLengthOfFlightPath3;// = *(float*)0x64CFD0; -float TotalLengthOfFlightPath4;// = *(float*)0x64CFDC; -float TotalDurationOfFlightPath;// = *(float*)0x64CFB8; -float TotalDurationOfFlightPath2;// = *(float*)0x64CFC0; -float TotalDurationOfFlightPath3;// = *(float*)0x64CFD4; -float TotalDurationOfFlightPath4;// = *(float*)0x64CFE0; -float LandingPoint;// = *(float*)0x8F2C7C; -float TakeOffPoint;// = *(float*)0x8E28A4; -CPlaneInterpolationLine aPlaneLineBits[6]; // = (CPlaneInterpolationLine*)0x734168; - -float PlanePathPosition[3];// = (float*)0x8F5FC8; //[3] -float OldPlanePathPosition[3];// = (float*)0x8F5FBC; //[3] -float PlanePathSpeed[3];// = (float*)0x941538; //[3] -float PlanePath2Position[3];// = (float*)0x64CFC4; //[3] -float PlanePath3Position;// = *(float*)0x64CFD8; -float PlanePath4Position;// = *(float*)0x64CFE4; -float PlanePath2Speed[3];// = (float*)0x8F1A54; //[3] -float PlanePath3Speed;// = *(float*)0x8F1A94; -float PlanePath4Speed;// = *(float*)0x8F1AFC; +CPlaneNode *pPathNodes; +CPlaneNode *pPath2Nodes; +CPlaneNode *pPath3Nodes; +CPlaneNode *pPath4Nodes; +int32 NumPathNodes; +int32 NumPath2Nodes; +int32 NumPath3Nodes; +int32 NumPath4Nodes; +float TotalLengthOfFlightPath; +float TotalLengthOfFlightPath2; +float TotalLengthOfFlightPath3; +float TotalLengthOfFlightPath4; +float TotalDurationOfFlightPath; +float TotalDurationOfFlightPath2; +float TotalDurationOfFlightPath3; +float TotalDurationOfFlightPath4; +float LandingPoint; +float TakeOffPoint; +CPlaneInterpolationLine aPlaneLineBits[6]; + +float PlanePathPosition[3]; +float OldPlanePathPosition[3]; +float PlanePathSpeed[3]; +float PlanePath2Position[3]; +float PlanePath3Position; +float PlanePath4Position; +float PlanePath2Speed[3]; +float PlanePath3Speed; +float PlanePath4Speed; enum @@ -55,12 +55,12 @@ enum CESNA_STATUS_LANDED, }; -int32 &CesnaMissionStatus = *(int32*)0x64CFE8; -int32 &CesnaMissionStartTime = *(int32*)0x64CFEC; -CPlane *&pDrugRunCesna = *(CPlane**)0x8F5F80; -int32 &DropOffCesnaMissionStatus = *(int32*)0x64CFF0; -int32 &DropOffCesnaMissionStartTime = *(int32*)0x64CFF4; -CPlane *&pDropOffCesna = *(CPlane**)0x8E2A38; +int32 CesnaMissionStatus; +int32 CesnaMissionStartTime; +CPlane *pDrugRunCesna; +int32 DropOffCesnaMissionStatus; +int32 DropOffCesnaMissionStartTime; +CPlane *pDropOffCesna; CPlane::CPlane(int32 id, uint8 CreatedBy) diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp index 43d0579d..1eae5e87 100644 --- a/src/weapons/ShotInfo.cpp +++ b/src/weapons/ShotInfo.cpp @@ -13,8 +13,6 @@ CShotInfo gaShotInfo[NUMSHOTINFOS]; float CShotInfo::ms_afRandTable[20]; -// CShotInfo (&gaShotInfo)[100] = *(CShotInfo(*)[100])*(uintptr*)0x64F0D0; -// float (&CShotInfo::ms_afRandTable)[20] = *(float(*)[20])*(uintptr*)0x6E9878; /* Used for flamethrower. I don't know why it's name is CShotInfo. diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index a4a1a085..dca120a3 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -7,7 +7,6 @@ #include "AnimBlendAssociation.h" #include "Weapon.h" -//CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC; CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS]; static char ms_aWeaponNames[][32] = { -- cgit v1.2.3 From ce7d6848ba0ffabb6616502c1a18ec2fb2af4259 Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 16:13:55 +0500 Subject: CWorld fixes --- src/core/World.cpp | 371 ++++++++++++++++++++++------------------------------- 1 file changed, 151 insertions(+), 220 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index 02c0e2f6..f0b290a3 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -731,11 +731,10 @@ CWorld::FindObjectsInRange(CVector ¢re, float radius, bool ignoreZ, short *n void CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != ms_nCurrentScanCode) { - pEntity->m_scanCode = ms_nCurrentScanCode; + if (pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); float fMagnitude = 0.0f; if (bCheck2DOnly) fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); @@ -747,7 +746,6 @@ CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const ++*nEntitiesFound; } } - pNode = pNode->next; } } @@ -1037,11 +1035,10 @@ CWorld::FindObjectsKindaColliding(const CVector& position, float radius, bool bC void CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != ms_nCurrentScanCode) { - pEntity->m_scanCode = ms_nCurrentScanCode; + if (pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); float fMagnitude = 0.0f; if (bCheck2DOnly) fMagnitude = (position - pEntity->GetPosition()).Magnitude2D(); @@ -1053,7 +1050,6 @@ CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& posit ++*nCollidingEntities; } } - pNode = pNode->next; } } @@ -1097,11 +1093,10 @@ CWorld::FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& v void CWorld::FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { - pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + if (pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); float fRadius = pEntity->GetBoundRadius(); const CVector& entityPos = pEntity->GetPosition(); if (fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && @@ -1113,7 +1108,6 @@ CWorld::FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vec ++*nIntersecting; } } - pNode = pNode->next; } } @@ -1156,11 +1150,10 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox& boundingBox, co void CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { - pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + if (pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); CColSphere sphere; CVector vecDistance = pEntity->GetPosition() - position; sphere.radius = pEntity->GetBoundRadius(); @@ -1171,7 +1164,6 @@ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, cons ++*nEntitiesFound; } } - pNode = pNode->next; } } @@ -1206,11 +1198,10 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CV void CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != CWorld::ms_nCurrentScanCode) { - pEntity->m_scanCode = CWorld::ms_nCurrentScanCode; + if (pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); bool bIsMissionEntity = false; if (bIsVehicleList) bIsMissionEntity = ((CVehicle*)pEntity)->VehicleCreatedBy == MISSION_VEHICLE; @@ -1230,7 +1221,6 @@ CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVec ++*nIntersecting; } } - pNode = pNode->next; } } @@ -1397,11 +1387,10 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2) void CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CVehicle *pVehicle = (CVehicle*)pNode->item; - if (pVehicle->m_scanCode != CWorld::ms_nCurrentScanCode) { - pVehicle->m_scanCode = CWorld::ms_nCurrentScanCode; + if (pVehicle->m_scanCode != GetCurrentScanCode()) { + pVehicle->m_scanCode = GetCurrentScanCode(); const CVector& vehiclePos = pVehicle->GetPosition(); eCarMission carMission = pVehicle->AutoPilot.m_nCarMission; if (pVehicle != FindPlayerVehicle() && @@ -1411,42 +1400,40 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1 (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE || carMission == MISSION_BLOCKPLAYER_FARAWAY || carMission == MISSION_BLOCKPLAYER_CLOSE) ) { - pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; - CColModel* pColModel = pVehicle->GetColModel(); - bool bInsideSphere = false; - for (int32 i = 0; i < pColModel->numSpheres; i++) { - CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center; - float fRadius = pColModel->spheres[i].radius; - if (pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && pos.y - fRadius < y2) - bInsideSphere = true; - // Maybe break the loop when bInsideSphere is set to true? - } - if (bInsideSphere) { - if (pVehicle->GetPosition().x <= (x1 + x2) * 0.5f) - pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f); - else - pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f); - if (pVehicle->GetPosition().y <= (y1 + y2) * 0.5f) - pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f); - else - pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f); - } + pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; + CColModel* pColModel = pVehicle->GetColModel(); + bool bInsideSphere = false; + for (int32 i = 0; i < pColModel->numSpheres; i++) { + CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center; + float fRadius = pColModel->spheres[i].radius; + if (pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && pos.y - fRadius < y2) + bInsideSphere = true; + // Maybe break the loop when bInsideSphere is set to true? + } + if (bInsideSphere) { + if (pVehicle->GetPosition().x <= (x1 + x2) * 0.5f) + pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f); + else + pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f); + if (pVehicle->GetPosition().y <= (y1 + y2) * 0.5f) + pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f); + else + pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f); } } - pNode = pNode->next; + } } } void CWorld::CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2) { - CPtrNode* pNode = list.first; - while (pNode) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { CPed* pPed = (CPed*)pNode->item; const CVector& pedPos = pPed->GetPosition(); - if (pPed->m_scanCode != CWorld::ms_nCurrentScanCode) + if (pPed->m_scanCode != GetCurrentScanCode()) { - pPed->m_scanCode = CWorld::ms_nCurrentScanCode; + pPed->m_scanCode = GetCurrentScanCode(); if (pPed != FindPlayerPed() && pPed->m_leader != FindPlayerPed() && pedPos.x > x1 && pedPos.x < x2 && pedPos.y > y1 && pedPos.y < y2 && @@ -1582,103 +1569,75 @@ CWorld::AddParticles(void) void CWorld::ShutDown(void) { - for (int32 y = 0; y < NUMSECTORS_Y; y++) { - for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector *pSector = GetSector(x, y); - CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_PEDS].first; - while (pNode) { - CEntity *pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; - while (pNode) { - CEntity *pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; - while (pNode) { - CEntity *pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); - pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); - pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); - pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); + for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); + for (CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); } for (int32 i = 0; i < 4; i ++) { - CPtrNode *pNode = GetBigBuildingList((eLevelName)i).first; - while (pNode) { + for (CPtrNode* pNode = GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) { CEntity *pEntity = (CEntity*)pNode->item; - if (pEntity) { - // Maybe remove from world here? - delete pEntity; - } - pNode = pNode->next; + // Maybe remove from world here? + delete pEntity; } GetBigBuildingList((eLevelName)i).Flush(); } - for (int32 y = 0; y < NUMSECTORS_Y; y++) { - for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector *pSector = GetSector(x, y); - if (pSector->m_lists[ENTITYLIST_BUILDINGS].first) { - sprintf(gString, "Building list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); - } - if (pSector->m_lists[ENTITYLIST_DUMMIES].first) { - sprintf(gString, "Dummy list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); - } - if (pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) { - sprintf(gString, "Building overlap list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); - } - if (pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) { - sprintf(gString, "Vehicle overlap list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].Flush(); - } - if (pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) { - sprintf(gString, "Ped overlap list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].Flush(); - } - if (pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) { - sprintf(gString, "Object overlap list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].Flush(); - } - if (pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) { - sprintf(gString, "Dummy overlap list %d,%d not empty\n", x, y); - pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); - } + for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); + if (pSector->m_lists[ENTITYLIST_BUILDINGS].first) { + sprintf(gString, "Building list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + } + if (pSector->m_lists[ENTITYLIST_DUMMIES].first) { + sprintf(gString, "Dummy list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + } + if (pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) { + sprintf(gString, "Building overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) { + sprintf(gString, "Vehicle overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) { + sprintf(gString, "Ped overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) { + sprintf(gString, "Object overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].Flush(); + } + if (pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) { + sprintf(gString, "Dummy overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); } } ms_listMovingEntityPtrs.Flush(); @@ -1693,37 +1652,25 @@ CWorld::ClearForRestart(void) CObject::DeleteAllTempObjects(); CObject::DeleteAllMissionObjects(); CPopulation::ConvertAllObjectsToDummyObjects(); - for (int32 y = 0; y < NUMSECTORS_Y; y++) { - for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector *pSector = GetSector(x, y); - CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; - while (pNode) { - CEntity *pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = GetBigBuildingList(LEVEL_NONE).first; - while (pNode) { - CVehicle *pVehicle = (CVehicle*)pNode->item; - if (pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { - CWorld::Remove(pVehicle); - delete pVehicle; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; + for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + CSector* pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) { + CVehicle *pVehicle = (CVehicle*)pNode->item; + if (pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { + CWorld::Remove(pVehicle); + delete pVehicle; } } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } } CPools::CheckPoolsEmpty(); } @@ -1833,41 +1780,27 @@ CWorld::SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason) void CWorld::RemoveStaticObjects() { - for (int32 y = 0; y < NUMSECTORS_Y; y++) { - for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector* pSector = GetSector(x, y); - CPtrNode* pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; - while (pNode) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity) { - CWorld::Remove(pEntity); - delete pEntity; - } - pNode = pNode->next; - } - pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); - pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); - pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); - pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); + for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; + } + for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { + CEntity* pEntity = (CEntity*)pNode->item; + CWorld::Remove(pEntity); + delete pEntity; } + pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); } } @@ -2072,18 +2005,17 @@ CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, C void CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) { - CPtrNode* pNode = list.first; - while (pNode) { - CPhysical* pEntity = (CPhysical*)pNode->item; - CVector vecDistance = pEntity->GetPosition() - position; - float fMagnitude = vecDistance.Magnitude(); - if (fRadius > fMagnitude) { - CWeapon::BlowUpExplosiveThings(pEntity); - CPed* pPed = (CPed*)pEntity; - CObject* pObject = (CObject*)pEntity; - CVehicle* pVehicle = (CVehicle*)pEntity; - if (!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { - if (pEntity->bIsStatic) { + for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { + CPhysical* pEntity = (CPhysical*)pNode->item; + CVector vecDistance = pEntity->GetPosition() - position; + float fMagnitude = vecDistance.Magnitude(); + if(fRadius > fMagnitude) { + CWeapon::BlowUpExplosiveThings(pEntity); + CPed *pPed = (CPed *)pEntity; + CObject *pObject = (CObject *)pEntity; + CVehicle *pVehicle = (CVehicle *)pEntity; + if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { + if(pEntity->bIsStatic) { if (pEntity->IsObject()) { if (fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { if (IsGlass(pObject->m_modelIndex)) { @@ -2170,7 +2102,6 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa } } } - pNode = pNode->next; } } -- cgit v1.2.3 From 2a4717fa41c332add177d18ef99bcddff9fece93 Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 16:14:59 +0500 Subject: Apply clang format to CWorld --- src/core/World.cpp | 1969 +++++++++++++++++++++++++++------------------------- 1 file changed, 1031 insertions(+), 938 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index f0b290a3..358e1823 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1,55 +1,54 @@ -#include "common.h" -#include "patcher.h" -#include "Entity.h" -#include "Ped.h" -#include "PlayerPed.h" -#include "Vehicle.h" -#include "Object.h" +#include "World.h" #include "Camera.h" -#include "DMAudio.h" #include "CarCtrl.h" -#include "Garages.h" -#include "TempColModels.h" -#include "World.h" -#include "ModelIndices.h" -#include "References.h" +#include "CopPed.h" #include "CutsceneMgr.h" -#include "Record.h" -#include "RpAnimBlend.h" +#include "DMAudio.h" +#include "Entity.h" +#include "EventList.h" +#include "Explosion.h" +#include "Fire.h" +#include "Garages.h" +#include "Glass.h" #include "Messages.h" -#include "Replay.h" +#include "ModelIndices.h" +#include "Object.h" +#include "ParticleObject.h" +#include "Ped.h" +#include "PlayerPed.h" #include "Population.h" -#include "Fire.h" #include "ProjectileInfo.h" -#include "WaterLevel.h" -#include "CopPed.h" -#include "Object.h" +#include "Record.h" +#include "References.h" +#include "Replay.h" +#include "RpAnimBlend.h" #include "Shadows.h" -#include "Explosion.h" -#include "Glass.h" -#include "ParticleObject.h" -#include "EventList.h" +#include "TempColModels.h" +#include "Vehicle.h" +#include "WaterLevel.h" +#include "common.h" +#include "patcher.h" #define OBJECT_REPOSITION_OFFSET_Z 2.0f CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; -CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60; -CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C; -CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608; -uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64; +CPtrList *CWorld::ms_bigBuildingsList = (CPtrList *)0x6FAB60; +CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList *)0x8F433C; +CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector(*)[NUMSECTORS_Y])0x665608; +uint16 &CWorld::ms_nCurrentScanCode = *(uint16 *)0x95CC64; uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61; CPlayerInfo CWorld::Players[NUMPLAYERS]; -bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC; -CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494; -bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F; -bool &CWorld::bSecondShift = *(bool*)0x95CD54; -bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C; -bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B; +bool &CWorld::bNoMoreCollisionTorque = *(bool *)0x95CDCC; +CEntity *&CWorld::pIgnoreEntity = *(CEntity **)0x8F6494; +bool &CWorld::bIncludeDeadPeds = *(bool *)0x95CD8F; +bool &CWorld::bSecondShift = *(bool *)0x95CD54; +bool &CWorld::bForceProcessControl = *(bool *)0x95CD6C; +bool &CWorld::bProcessCutsceneOnly = *(bool *)0x95CD8B; -bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C; -bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA; +bool &CWorld::bDoingCarCollisions = *(bool *)0x95CD8C; +bool &CWorld::bIncludeCarTyres = *(bool *)0x95CDAA; void CWorld::Initialise() @@ -67,37 +66,31 @@ CWorld::Initialise() void CWorld::Add(CEntity *ent) { - if(ent->IsVehicle() || ent->IsPed()) - DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, true); + if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, true); if(ent->bIsBIGBuilding) ms_bigBuildingsList[ent->m_level].InsertItem(ent); else ent->Add(); - if(ent->IsBuilding() || ent->IsDummy()) - return; + if(ent->IsBuilding() || ent->IsDummy()) return; - if(!ent->bIsStatic) - ((CPhysical*)ent)->AddToMovingList(); + if(!ent->bIsStatic) ((CPhysical *)ent)->AddToMovingList(); } void CWorld::Remove(CEntity *ent) { - if(ent->IsVehicle() || ent->IsPed()) - DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, false); + if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, false); if(ent->bIsBIGBuilding) ms_bigBuildingsList[ent->m_level].RemoveItem(ent); else ent->Remove(); - if(ent->IsBuilding() || ent->IsDummy()) - return; + if(ent->IsBuilding() || ent->IsDummy()) return; - if(!ent->bIsStatic) - ((CPhysical*)ent)->RemoveFromMovingList(); + if(!ent->bIsStatic) ((CPhysical *)ent)->RemoveFromMovingList(); } void @@ -105,43 +98,43 @@ CWorld::ClearScanCodes(void) { CPtrNode *node; for(int i = 0; i < NUMSECTORS_Y; i++) - for(int j = 0; j < NUMSECTORS_X; j++){ - CSector *s = &ms_aSectors[i][j]; - for(node = s->m_lists[ENTITYLIST_BUILDINGS].first; node; node = node->next) - ((CEntity*)node->item)->m_scanCode = 0; - for(node = s->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next) - ((CEntity*)node->item)->m_scanCode = 0; - for(node = s->m_lists[ENTITYLIST_PEDS].first; node; node = node->next) - ((CEntity*)node->item)->m_scanCode = 0; - for(node = s->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next) - ((CEntity*)node->item)->m_scanCode = 0; - for(node = s->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next) - ((CEntity*)node->item)->m_scanCode = 0; - } + for(int j = 0; j < NUMSECTORS_X; j++) { + CSector *s = &ms_aSectors[i][j]; + for(node = s->m_lists[ENTITYLIST_BUILDINGS].first; node; node = node->next) + ((CEntity *)node->item)->m_scanCode = 0; + for(node = s->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next) + ((CEntity *)node->item)->m_scanCode = 0; + for(node = s->m_lists[ENTITYLIST_PEDS].first; node; node = node->next) + ((CEntity *)node->item)->m_scanCode = 0; + for(node = s->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next) + ((CEntity *)node->item)->m_scanCode = 0; + for(node = s->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next) + ((CEntity *)node->item)->m_scanCode = 0; + } } void -CWorld::ClearExcitingStuffFromArea(const CVector& pos, float radius, bool bRemoveProjectilesAndTidyUpShadows) +CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemoveProjectilesAndTidyUpShadows) { - CPedPool* pedPool = CPools::GetPedPool(); - for (int32 i = 0; i < pedPool->GetSize(); i++) { - CPed* pPed = pedPool->GetSlot(i); - if (pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() && - CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) { + CPedPool *pedPool = CPools::GetPedPool(); + for(int32 i = 0; i < pedPool->GetSize(); i++) { + CPed *pPed = pedPool->GetSlot(i); + if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() && + CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) { CPopulation::RemovePed(pPed); } } - CVehiclePool* VehiclePool = CPools::GetVehiclePool(); - for (int32 i = 0; i < VehiclePool->GetSize(); i++) { - CVehicle* pVehicle = VehiclePool->GetSlot(i); - if (pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius && - !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { - if (pVehicle->pDriver) { + CVehiclePool *VehiclePool = CPools::GetVehiclePool(); + for(int32 i = 0; i < VehiclePool->GetSize(); i++) { + CVehicle *pVehicle = VehiclePool->GetSlot(i); + if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius && + !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if(pVehicle->pDriver) { CPopulation::RemovePed(pVehicle->pDriver); pVehicle->pDriver = nil; } - for (int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { - if (pVehicle->pPassengers[j]) { + for(int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { + if(pVehicle->pPassengers[j]) { CPopulation::RemovePed(pVehicle->pPassengers[j]); pVehicle->pPassengers[j] = nil; --pVehicle->m_nNumPassengers; @@ -156,7 +149,7 @@ CWorld::ClearExcitingStuffFromArea(const CVector& pos, float radius, bool bRemov gFireManager.ExtinguishPoint(pos, radius); CWorld::ExtinguishAllCarFiresInArea(pos, radius); CExplosion::RemoveAllExplosionsInArea(pos, radius); - if (bRemoveProjectilesAndTidyUpShadows) { + if(bRemoveProjectilesAndTidyUpShadows) { CProjectileInfo::RemoveAllProjectiles(); CShadows::TidyUpShadows(); } @@ -165,13 +158,14 @@ CWorld::ClearExcitingStuffFromArea(const CVector& pos, float radius, bool bRemov bool CWorld::CameraToIgnoreThisObject(CEntity *ent) { - if(CGarages::IsModelIndexADoor(ent->GetModelIndex())) - return false; - return ((CObject*)ent)->m_bCameraToAvoidThisObject != 1; + if(CGarages::IsModelIndexADoor(ent->GetModelIndex())) return false; + return ((CObject *)ent)->m_bCameraToAvoidThisObject != 1; } bool -CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity, + bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, + bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) { int x, xstart, xend; int y, ystart, yend; @@ -188,94 +182,80 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi xend = GetSectorIndexX(point2.x); yend = GetSectorIndexY(point2.y); -#define LOSARGS CColLine(point1, point2), point, dist, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects +#define LOSARGS \ + CColLine(point1, point2), point, dist, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, \ + checkDummies, ignoreSeeThrough, ignoreSomeObjects - if(xstart == xend && ystart == yend){ + if(xstart == xend && ystart == yend) { // Only one sector return ProcessLineOfSightSector(*GetSector(xstart, ystart), LOSARGS); - }else if(xstart == xend){ + } else if(xstart == xend) { // Only step in y if(ystart < yend) - for(y = ystart; y <= yend; y++) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = ystart; y <= yend; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); else - for(y = ystart; y >= yend; y--) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = ystart; y >= yend; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); return dist < 1.0f; - }else if(ystart == yend){ + } else if(ystart == yend) { // Only step in x if(xstart < xend) - for(x = xstart; x <= xend; x++) - ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS); + for(x = xstart; x <= xend; x++) ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS); else - for(x = xstart; x >= xend; x--) - ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS); + for(x = xstart; x >= xend; x--) ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS); return dist < 1.0f; - }else{ - if(point1.x < point2.x){ + } else { + if(point1.x < point2.x) { // Step from left to right float m = (point2.y - point1.y) / (point2.x - point1.x); y1 = ystart; - y2 = GetSectorIndexY((GetWorldX(xstart+1) - point1.x)*m + point1.y); + y2 = GetSectorIndexY((GetWorldX(xstart + 1) - point1.x) * m + point1.y); if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); - for(x = xstart+1; x < xend; x++){ + for(x = xstart + 1; x < xend; x++) { y1 = y2; - y2 = GetSectorIndexY((GetWorldX(x+1) - point1.x)*m + point1.y); + y2 = GetSectorIndexY((GetWorldX(x + 1) - point1.x) * m + point1.y); if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); } y1 = y2; y2 = yend; if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); - }else{ + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); + } else { // Step from right to left float m = (point2.y - point1.y) / (point2.x - point1.x); y1 = ystart; - y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x)*m + point1.y); + y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x) * m + point1.y); if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS); - for(x = xstart-1; x > xend; x--){ + for(x = xstart - 1; x > xend; x--) { y1 = y2; - y2 = GetSectorIndexY((GetWorldX(x) - point1.x)*m + point1.y); + y2 = GetSectorIndexY((GetWorldX(x) - point1.x) * m + point1.y); if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS); } y1 = y2; y2 = yend; if(y1 < y2) - for(y = y1; y <= y2; y++) - ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); + for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); else - for(y = y1; y >= y2; y--) - ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); + for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS); } return dist < 1.0f; } @@ -284,51 +264,63 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi } bool -CWorld::ProcessLineOfSightSector(CSector §or, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::ProcessLineOfSightSector(CSector §or, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, + bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, + bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) { float mindist = dist; bool deadPeds = !!bIncludeDeadPeds; bIncludeDeadPeds = false; - if(checkBuildings){ - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, ignoreSeeThrough); - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough); + if(checkBuildings) { + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, + ignoreSeeThrough); + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough); } - if(checkVehicles){ - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, ignoreSeeThrough); - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough); + if(checkVehicles) { + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, + ignoreSeeThrough); + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough); } - if(checkPeds){ - if(deadPeds) - bIncludeDeadPeds = true; - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, ignoreSeeThrough); - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough); + if(checkPeds) { + if(deadPeds) bIncludeDeadPeds = true; + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, + ignoreSeeThrough); + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough); bIncludeDeadPeds = false; } - if(checkObjects){ - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, ignoreSeeThrough, ignoreSomeObjects); - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, ignoreSomeObjects); + if(checkObjects) { + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, + ignoreSeeThrough, ignoreSomeObjects); + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough, ignoreSomeObjects); } - if(checkDummies){ - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, ignoreSeeThrough); - ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough); + if(checkDummies) { + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, + ignoreSeeThrough); + ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough); } bIncludeDeadPeds = deadPeds; - if(mindist < dist){ + if(mindist < dist) { dist = mindist; return true; - }else + } else return false; } bool -CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, + CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects) { bool deadPeds = false; float mindist = dist; @@ -336,119 +328,137 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP CEntity *e; CColModel *colmodel; - if(list.first && bIncludeDeadPeds && ((CEntity*)list.first->item)->IsPed()) - deadPeds = true; + if(list.first && bIncludeDeadPeds && ((CEntity *)list.first->item)->IsPed()) deadPeds = true; - for(node = list.first; node; node = node->next){ - e = (CEntity*)node->item; - if(e->m_scanCode != GetCurrentScanCode() && - e != pIgnoreEntity && - (e->bUsesCollision || deadPeds) && - !(ignoreSomeObjects && CameraToIgnoreThisObject(e))){ + for(node = list.first; node; node = node->next) { + e = (CEntity *)node->item; + if(e->m_scanCode != GetCurrentScanCode() && e != pIgnoreEntity && (e->bUsesCollision || deadPeds) && + !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { colmodel = nil; e->m_scanCode = GetCurrentScanCode(); - if(e->IsPed()){ - if(e->bUsesCollision || - deadPeds && ((CPed*)e)->m_nPedState == PED_DEAD){ - if (((CPed*)e)->UseGroundColModel()) + if(e->IsPed()) { + if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD) { + if(((CPed *)e)->UseGroundColModel()) colmodel = &CTempColModels::ms_colModelPedGroundHit; else #ifdef ANIMATE_PED_COL_MODEL - colmodel = CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(), RpClumpGetFrame(e->GetClump())); + colmodel = CPedModelInfo::AnimatePedColModel( + ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex())) + ->GetHitColModel(), + RpClumpGetFrame(e->GetClump())); #else - colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(); + colmodel = + ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex())) + ->GetHitColModel(); #endif - }else + } else colmodel = nil; - }else if(e->bUsesCollision) + } else if(e->bUsesCollision) colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); - if(colmodel && - CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist, ignoreSeeThrough)) + if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist, + ignoreSeeThrough)) entity = e; } } - if(mindist < dist){ + if(mindist < dist) { dist = mindist; return true; - }else + } else return false; } -bool -CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly) +bool +CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, CEntity *&entity, bool checkBuildings, + bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, + bool ignoreSeeThrough, CStoredCollPoly *poly) { AdvanceCurrentScanCode(); CVector point2(point1.x, point1.y, z2); return ProcessVerticalLineSector(*GetSector(GetSectorIndexX(point1.x), GetSectorIndexX(point1.y)), - CColLine(point1, point2), point, entity, - checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly); + CColLine(point1, point2), point, entity, checkBuildings, checkVehicles, + checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly); } bool -CWorld::ProcessVerticalLineSector(CSector §or, const CColLine &line, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly) +CWorld::ProcessVerticalLineSector(CSector §or, const CColLine &line, CColPoint &point, CEntity *&entity, + bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, + bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly) { float mindist = 1.0f; - if(checkBuildings){ - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, ignoreSeeThrough, poly); - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly); + if(checkBuildings) { + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, + ignoreSeeThrough, poly); + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, + entity, ignoreSeeThrough, poly); } - if(checkVehicles){ - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, ignoreSeeThrough, poly); - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly); + if(checkVehicles) { + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, + ignoreSeeThrough, poly); + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough, poly); } - if(checkPeds){ - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, ignoreSeeThrough, poly); - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly); + if(checkPeds) { + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, + ignoreSeeThrough, poly); + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough, poly); } - if(checkObjects){ - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, ignoreSeeThrough, poly); - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly); + if(checkObjects) { + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, + ignoreSeeThrough, poly); + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough, poly); } - if(checkDummies){ - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, ignoreSeeThrough, poly); - ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly); + if(checkDummies) { + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, + ignoreSeeThrough, poly); + ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, + ignoreSeeThrough, poly); } return mindist < 1.0f; } bool -CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly) +CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, + CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly) { float mindist = dist; CPtrNode *node; CEntity *e; CColModel *colmodel; - for(node = list.first; node; node = node->next){ - e = (CEntity*)node->item; - if(e->m_scanCode != GetCurrentScanCode() && - e->bUsesCollision){ + for(node = list.first; node; node = node->next) { + e = (CEntity *)node->item; + if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) { e->m_scanCode = GetCurrentScanCode(); colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); - if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist, ignoreSeeThrough, poly)) + if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist, + ignoreSeeThrough, poly)) entity = e; } } - if(mindist < dist){ + if(mindist < dist) { dist = mindist; return true; - }else + } else return false; } bool -CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool checkBuildings, bool checkVehicles, + bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, + bool ignoreSomeObjects) { int x, xstart, xend; int y, ystart, yend; @@ -461,58 +471,54 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool xend = GetSectorIndexX(point2.x); yend = GetSectorIndexY(point2.y); -#define LOSARGS CColLine(point1, point2), checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects +#define LOSARGS \ + CColLine(point1, point2), checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, \ + ignoreSeeThrough, ignoreSomeObjects - if(xstart == xend && ystart == yend){ + if(xstart == xend && ystart == yend) { // Only one sector return GetIsLineOfSightSectorClear(*GetSector(xstart, ystart), LOSARGS); - }else if(xstart == xend){ + } else if(xstart == xend) { // Only step in y - if(ystart < yend){ + if(ystart < yend) { for(y = ystart; y <= yend; y++) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; + } else { for(y = ystart; y >= yend; y--) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; } - }else if(ystart == yend){ + } else if(ystart == yend) { // Only step in x - if(xstart < xend){ + if(xstart < xend) { for(x = xstart; x <= xend; x++) - if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) return false; + } else { for(x = xstart; x >= xend; x--) - if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) return false; } - }else{ - if(point1.x < point2.x){ + } else { + if(point1.x < point2.x) { // Step from left to right float m = (point2.y - point1.y) / (point2.x - point1.x); y1 = ystart; - y2 = GetSectorIndexY((GetWorldX(xstart+1) - point1.x)*m + point1.y); - if(y1 < y2){ + y2 = GetSectorIndexY((GetWorldX(xstart + 1) - point1.x) * m + point1.y); + if(y1 < y2) { for(y = y1; y <= y2; y++) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; + } else { for(y = y1; y >= y2; y--) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; } - for(x = xstart+1; x < xend; x++){ + for(x = xstart + 1; x < xend; x++) { y1 = y2; - y2 = GetSectorIndexY((GetWorldX(x+1) - point1.x)*m + point1.y); - if(y1 < y2){ + y2 = GetSectorIndexY((GetWorldX(x + 1) - point1.x) * m + point1.y); + if(y1 < y2) { for(y = y1; y <= y2; y++) if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS)) return false; - }else{ + } else { for(y = y1; y >= y2; y--) if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS)) return false; @@ -521,39 +527,35 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool y1 = y2; y2 = yend; - if(y1 < y2){ + if(y1 < y2) { for(y = y1; y <= y2; y++) - if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false; + } else { for(y = y1; y >= y2; y--) - if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false; } - }else{ + } else { // Step from right to left float m = (point2.y - point1.y) / (point2.x - point1.x); y1 = ystart; - y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x)*m + point1.y); - if(y1 < y2){ + y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x) * m + point1.y); + if(y1 < y2) { for(y = y1; y <= y2; y++) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; + } else { for(y = y1; y >= y2; y--) - if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false; } - for(x = xstart-1; x > xend; x--){ + for(x = xstart - 1; x > xend; x--) { y1 = y2; - y2 = GetSectorIndexY((GetWorldX(x) - point1.x)*m + point1.y); - if(y1 < y2){ + y2 = GetSectorIndexY((GetWorldX(x) - point1.x) * m + point1.y); + if(y1 < y2) { for(y = y1; y <= y2; y++) if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS)) return false; - }else{ + } else { for(y = y1; y >= y2; y--) if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS)) return false; @@ -562,14 +564,12 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool y1 = y2; y2 = yend; - if(y1 < y2){ + if(y1 < y2) { for(y = y1; y <= y2; y++) - if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) - return false; - }else{ + if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false; + } else { for(y = y1; y >= y2; y--) - if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) - return false; + if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false; } } } @@ -580,37 +580,43 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool } bool -CWorld::GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool checkBuildings, bool checkVehicles, + bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, + bool ignoreSomeObjects) { - if(checkBuildings){ + if(checkBuildings) { if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS], line, ignoreSeeThrough)) return false; - if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, ignoreSeeThrough)) + if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, + ignoreSeeThrough)) return false; } - if(checkVehicles){ + if(checkVehicles) { if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES], line, ignoreSeeThrough)) return false; - if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, ignoreSeeThrough)) + if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, + ignoreSeeThrough)) return false; } - if(checkPeds){ + if(checkPeds) { if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_PEDS], line, ignoreSeeThrough)) return false; if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, ignoreSeeThrough)) return false; } - if(checkObjects){ - if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS], line, ignoreSeeThrough, ignoreSomeObjects)) + if(checkObjects) { + if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS], line, ignoreSeeThrough, + ignoreSomeObjects)) return false; - if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, ignoreSeeThrough, ignoreSomeObjects)) + if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, ignoreSeeThrough, + ignoreSomeObjects)) return false; } - if(checkDummies){ + if(checkDummies) { if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_DUMMIES], line, ignoreSeeThrough)) return false; if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, ignoreSeeThrough)) @@ -621,21 +627,20 @@ CWorld::GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool } bool -CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects) +CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, + bool ignoreSomeObjects) { CPtrNode *node; CEntity *e; CColModel *colmodel; - for(node = list.first; node; node = node->next){ - e = (CEntity*)node->item; - if(e->m_scanCode != GetCurrentScanCode() && - e->bUsesCollision){ + for(node = list.first; node; node = node->next) { + e = (CEntity *)node->item; + if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) { e->m_scanCode = GetCurrentScanCode(); - if(e != pIgnoreEntity && - !(ignoreSomeObjects && CameraToIgnoreThisObject(e))){ + if(e != pIgnoreEntity && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(); @@ -649,26 +654,25 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo } void -CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects) +CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float radius, bool ignoreZ, short *nextObject, + short lastObject, CEntity **objects) { float radiusSqr = radius * radius; float objDistSqr; - for (CPtrNode *node = list.first; node; node = node->next) { - CEntity *object = (CEntity*)node->item; - if (object->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *node = list.first; node; node = node->next) { + CEntity *object = (CEntity *)node->item; + if(object->m_scanCode != GetCurrentScanCode()) { object->m_scanCode = GetCurrentScanCode(); CVector diff = centre - object->GetPosition(); - if (ignoreZ) + if(ignoreZ) objDistSqr = diff.MagnitudeSqr2D(); else objDistSqr = diff.MagnitudeSqr(); - if (objDistSqr < radiusSqr && *nextObject < lastObject) { - if (objects) { - objects[*nextObject] = object; - } + if(objDistSqr < radiusSqr && *nextObject < lastObject) { + if(objects) { objects[*nextObject] = object; } (*nextObject)++; } } @@ -676,81 +680,96 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float radi } void -CWorld::FindObjectsInRange(CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies) +CWorld::FindObjectsInRange(CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, + CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, + bool checkObjects, bool checkDummies) { int minX = GetSectorIndexX(centre.x - radius); - if (minX <= 0) minX = 0; + if(minX <= 0) minX = 0; int minY = GetSectorIndexY(centre.y - radius); - if (minY <= 0) minY = 0; + if(minY <= 0) minY = 0; int maxX = GetSectorIndexX(centre.x + radius); #ifdef FIX_BUGS - if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; + if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; #else - if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; + if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; #endif int maxY = GetSectorIndexY(centre.y + radius); #ifdef FIX_BUGS - if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; + if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; #else - if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y; + if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y; #endif - + AdvanceCurrentScanCode(); *nextObject = 0; for(int curY = minY; curY <= maxY; curY++) { for(int curX = minX; curX <= maxX; curX++) { CSector *sector = GetSector(curX, curY); - if (checkBuildings) { - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, ignoreZ, nextObject, lastObject, objects); - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects); + if(checkBuildings) { + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, + ignoreZ, nextObject, lastObject, objects); + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, + radius, ignoreZ, nextObject, lastObject, objects); } - if (checkVehicles) { - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, ignoreZ, nextObject, lastObject, objects); - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects); + if(checkVehicles) { + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, + ignoreZ, nextObject, lastObject, objects); + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, + radius, ignoreZ, nextObject, lastObject, objects); } - if (checkPeds) { - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, nextObject, lastObject, objects); - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects); + if(checkPeds) { + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, + nextObject, lastObject, objects); + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, + ignoreZ, nextObject, lastObject, objects); } - if (checkObjects) { - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, ignoreZ, nextObject, lastObject, objects); - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects); + if(checkObjects) { + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, + ignoreZ, nextObject, lastObject, objects); + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, + radius, ignoreZ, nextObject, lastObject, objects); } - if (checkDummies) { - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, ignoreZ, nextObject, lastObject, objects); - FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects); + if(checkDummies) { + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, + ignoreZ, nextObject, lastObject, objects); + FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, + radius, ignoreZ, nextObject, lastObject, objects); } } } } -void -CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) +void +CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList &list, const CVector &position, float radius, + bool bCheck2DOnly, int16 *nEntitiesFound, int16 maxEntitiesToFind, + CEntity **aEntities) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; + if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); float fMagnitude = 0.0f; - if (bCheck2DOnly) + if(bCheck2DOnly) fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); else fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr(); - if (fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { - if (aEntities) - aEntities[*nEntitiesFound] = pEntity; + if(fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { + if(aEntities) aEntities[*nEntitiesFound] = pEntity; ++*nEntitiesFound; } } } } -void -CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +void +CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float radius, bool bCheck2DOnly, + int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, + bool bVehicles, bool bPeds, bool bObjects, bool bDummies) { CWorld::AdvanceCurrentScanCode(); *nEntitiesFound = 0; @@ -760,115 +779,138 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - if (bBuildings) { - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bVehicles) { - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bPeds) { - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bObjects) { - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bDummies) { - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsOfTypeInRangeSectorList(modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); - } - } - } -} - -CEntity* -CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects) + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + if(bBuildings) { + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, + bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bVehicles) { + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, + bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bPeds) { + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bObjects) { + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, + bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bDummies) { + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsOfTypeInRangeSectorList( + modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, + bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); + } + } + } +} + +CEntity * +CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, + bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, + bool ignoreSomeObjects) { - CEntity* foundE = nil; + CEntity *foundE = nil; int minX = GetSectorIndexX(centre.x - radius); - if (minX <= 0) minX = 0; + if(minX <= 0) minX = 0; int minY = GetSectorIndexY(centre.y - radius); - if (minY <= 0) minY = 0; + if(minY <= 0) minY = 0; int maxX = GetSectorIndexX(centre.x + radius); #ifdef FIX_BUGS - if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; + if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; #else - if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; + if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; #endif int maxY = GetSectorIndexY(centre.y + radius); #ifdef FIX_BUGS - if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; + if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; #else - if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y; + if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y; #endif AdvanceCurrentScanCode(); - for (int curY = minY; curY <= maxY; curY++) { - for (int curX = minX; curX <= maxX; curX++) { - CSector* sector = GetSector(curX, curY); - if (checkBuildings) { - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + for(int curY = minY; curY <= maxY; curY++) { + for(int curX = minX; curX <= maxX; curX++) { + CSector *sector = GetSector(curX, curY); + if(checkBuildings) { + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, + radius, entityToIgnore, false); + if(foundE) return foundE; - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], + centre, radius, entityToIgnore, false); + if(foundE) return foundE; } - if (checkVehicles) { - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + if(checkVehicles) { + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, + radius, entityToIgnore, false); + if(foundE) return foundE; - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], + centre, radius, entityToIgnore, false); + if(foundE) return foundE; } - if (checkPeds) { - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + if(checkPeds) { + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, + entityToIgnore, false); + if(foundE) return foundE; - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, + radius, entityToIgnore, false); + if(foundE) return foundE; } - if (checkObjects) { - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, entityToIgnore, ignoreSomeObjects); - if (foundE) - return foundE; + if(checkObjects) { + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, + radius, entityToIgnore, ignoreSomeObjects); + if(foundE) return foundE; - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, entityToIgnore, ignoreSomeObjects); - if (foundE) - return foundE; + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], + centre, radius, entityToIgnore, ignoreSomeObjects); + if(foundE) return foundE; } - if (checkDummies) { - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + if(checkDummies) { + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, + radius, entityToIgnore, false); + if(foundE) return foundE; - foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, entityToIgnore, false); - if (foundE) - return foundE; + foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], + centre, radius, entityToIgnore, false); + if(foundE) return foundE; } } } return foundE; } -CEntity* -CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, bool ignoreSomeObjects) +CEntity * +CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, + bool ignoreSomeObjects) { static CColModel sphereCol; @@ -892,24 +934,27 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad CMatrix sphereMat; sphereMat.SetTranslate(spherePos); - for(CPtrNode *node=list.first; node; node = node->next) { - CEntity *e = (CEntity*)node->item; + for(CPtrNode *node = list.first; node; node = node->next) { + CEntity *e = (CEntity *)node->item; - if (e->m_scanCode != GetCurrentScanCode()) { + if(e->m_scanCode != GetCurrentScanCode()) { e->m_scanCode = GetCurrentScanCode(); - if (e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { + if(e != entityToIgnore && e->bUsesCollision && + !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { CVector diff = spherePos - e->GetPosition(); float distance = diff.Magnitude(); - if (e->GetBoundRadius() + radius > distance) { + if(e->GetBoundRadius() + radius > distance) { CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(); - int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), - *eCol, gaTempSphereColPoints, nil, nil); - - if (collidedSpheres != 0 || - (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR && - e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) { + int collidedSpheres = + CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), *eCol, + gaTempSphereColPoints, nil, nil); + + if(collidedSpheres != 0 || + (e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR && + e->m_modelIndex != MI_DODO && + radius + eCol->boundingBox.max.x > distance)) { return e; } } @@ -925,7 +970,8 @@ CWorld::FindGroundZForCoord(float x, float y) { CColPoint point; CEntity *ent; - if(ProcessVerticalLine(CVector(x, y, 1000.0f), -1000.0f, point, ent, true, false, false, false, true, false, nil)) + if(ProcessVerticalLine(CVector(x, y, 1000.0f), -1000.0f, point, ent, true, false, false, false, true, false, + nil)) return point.point.z; else return 20.0f; @@ -936,13 +982,11 @@ CWorld::FindGroundZFor3DCoord(float x, float y, float z, bool *found) { CColPoint point; CEntity *ent; - if(ProcessVerticalLine(CVector(x, y, z), -1000.0f, point, ent, true, false, false, false, false, false, nil)){ - if(found) - *found = true; + if(ProcessVerticalLine(CVector(x, y, z), -1000.0f, point, ent, true, false, false, false, false, false, nil)) { + if(found) *found = true; return point.point.z; - }else{ - if(found) - *found = false; + } else { + if(found) *found = false; return 0.0f; } } @@ -952,51 +996,49 @@ CWorld::FindRoofZFor3DCoord(float x, float y, float z, bool *found) { CColPoint point; CEntity *ent; - if(ProcessVerticalLine(CVector(x, y, z), 1000.0f, point, ent, true, false, false, false, true, false, nil)){ - if(found) - *found = true; + if(ProcessVerticalLine(CVector(x, y, z), 1000.0f, point, ent, true, false, false, false, true, false, nil)) { + if(found) *found = true; return point.point.z; - }else{ + } else { if(found == nil) - printf("THERE IS NO MAP BELOW THE FOLLOWING COORS:%f %f %f. (FindGroundZFor3DCoord)\n", x, y, z); - if(found) - *found = false; + printf("THERE IS NO MAP BELOW THE FOLLOWING COORS:%f %f %f. (FindGroundZFor3DCoord)\n", x, y, + z); + if(found) *found = false; return 20.0f; } } -void -CWorld::RemoveReferencesToDeletedObject(CEntity* pDeletedObject) -{ +void +CWorld::RemoveReferencesToDeletedObject(CEntity *pDeletedObject) +{ int32 i = CPools::GetPedPool()->GetSize(); - while (--i >= 0) { - CPed* pPed = CPools::GetPedPool()->GetSlot(i); - if (pPed && pPed != pDeletedObject) { + while(--i >= 0) { + CPed *pPed = CPools::GetPedPool()->GetSlot(i); + if(pPed && pPed != pDeletedObject) { pPed->RemoveRefsToEntity(pDeletedObject); - if (pPed->m_pCurrentPhysSurface == pDeletedObject) - pPed->m_pCurrentPhysSurface = nil; + if(pPed->m_pCurrentPhysSurface == pDeletedObject) pPed->m_pCurrentPhysSurface = nil; } } i = CPools::GetVehiclePool()->GetSize(); - while (--i >= 0) { - CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); - if (pVehicle && pVehicle != pDeletedObject) { + while(--i >= 0) { + CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if(pVehicle && pVehicle != pDeletedObject) { pVehicle->RemoveRefsToEntity(pDeletedObject); pVehicle->RemoveRefsToVehicle(pDeletedObject); } } i = CPools::GetObjectPool()->GetSize(); - while (--i >= 0) { - CObject* pObject = CPools::GetObjectPool()->GetSlot(i); - if (pObject && pObject != pDeletedObject) { - pObject->RemoveRefsToEntity(pDeletedObject); - } + while(--i >= 0) { + CObject *pObject = CPools::GetObjectPool()->GetSlot(i); + if(pObject && pObject != pDeletedObject) { pObject->RemoveRefsToEntity(pDeletedObject); } } } -void -CWorld::FindObjectsKindaColliding(const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) -{ +void +CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bCheck2DOnly, int16 *nCollidingEntities, + int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles, + bool bPeds, bool bObjects, bool bDummies) +{ CWorld::AdvanceCurrentScanCode(); *nCollidingEntities = 0; const CVector2D vecSectorStartPos(position.x - radius, position.y - radius); @@ -1005,48 +1047,68 @@ CWorld::FindObjectsKindaColliding(const CVector& position, float radius, bool bC const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - if (bBuildings) { - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - } - if (bVehicles) { - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - } - if (bPeds) { - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - } - if (bObjects) { - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - } - if (bDummies) { - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); - CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, nCollidingEntities, maxEntitiesToFind, aEntities); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + if(bBuildings) { + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + } + if(bVehicles) { + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + } + if(bPeds) { + CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, + radius, bCheck2DOnly, nCollidingEntities, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + } + if(bObjects) { + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + } + if(bDummies) { + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); + CWorld::FindObjectsKindaCollidingSectorList( + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, + nCollidingEntities, maxEntitiesToFind, aEntities); } } } } -void -CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities) +void +CWorld::FindObjectsKindaCollidingSectorList(CPtrList &list, const CVector &position, float radius, bool bCheck2DOnly, + int16 *nCollidingEntities, int16 maxEntitiesToFind, CEntity **aEntities) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; + if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); float fMagnitude = 0.0f; - if (bCheck2DOnly) + if(bCheck2DOnly) fMagnitude = (position - pEntity->GetPosition()).Magnitude2D(); else fMagnitude = (position - pEntity->GetPosition()).Magnitude(); - if (pEntity->GetBoundRadius() + radius > fMagnitude && *nCollidingEntities < maxEntitiesToFind) { - if (aEntities) - aEntities[*nCollidingEntities] = pEntity; + if(pEntity->GetBoundRadius() + radius > fMagnitude && *nCollidingEntities < maxEntitiesToFind) { + if(aEntities) aEntities[*nCollidingEntities] = pEntity; ++*nCollidingEntities; } } @@ -1054,65 +1116,90 @@ CWorld::FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& posit } void -CWorld::FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) -{ +CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &vecEndPos, int16 *nIntersecting, + int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles, + bool bPeds, bool bObjects, bool bDummies) +{ CWorld::AdvanceCurrentScanCode(); *nIntersecting = 0; const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0); const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - if (bBuildings) { - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - } - if (bVehicles) { - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - } - if (bPeds) { - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - } - if (bObjects) { - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - } - if (bDummies) { - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + if(bBuildings) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos, + nIntersecting, maxEntitiesToFind, aEntities); + } + if(bVehicles) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, + nIntersecting, maxEntitiesToFind, aEntities); + } + if(bPeds) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + } + if(bObjects) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + } + if(bDummies) { + CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], + vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities); } } } - } -void -CWorld::FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities) +void +CWorld::FindObjectsIntersectingCubeSectorList(CPtrList &list, const CVector &vecStartPos, const CVector &vecEndPos, + int16 *nIntersecting, int16 maxEntitiesToFind, CEntity **aEntities) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != GetCurrentScanCode()) { - pEntity->m_scanCode = GetCurrentScanCode(); - float fRadius = pEntity->GetBoundRadius(); - const CVector& entityPos = pEntity->GetPosition(); - if (fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && - fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y && - fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && - *nIntersecting < maxEntitiesToFind) { - if (aEntities) - aEntities[*nIntersecting] = pEntity; - ++*nIntersecting; - } + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; + if(pEntity->m_scanCode != GetCurrentScanCode()) { + pEntity->m_scanCode = GetCurrentScanCode(); + float fRadius = pEntity->GetBoundRadius(); + const CVector &entityPos = pEntity->GetPosition(); + if(fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && + fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y && + fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && + *nIntersecting < maxEntitiesToFind) { + if(aEntities) aEntities[*nIntersecting] = pEntity; + ++*nIntersecting; } + } } } -void -CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, float fStartX, float fStartY, float fEndX, float fEndY, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies) +void +CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, const CMatrix &matrix, + const CVector &position, float fStartX, float fStartY, float fEndX, + float fEndY, int16 *nEntitiesFound, int16 maxEntitiesToFind, + CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds, + bool bObjects, bool bDummies) { CWorld::AdvanceCurrentScanCode(); *nEntitiesFound = 0; @@ -1120,47 +1207,69 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox& boundingBox, co const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - if (bBuildings) { - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bVehicles) { - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bPeds) { - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bObjects) { - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - } - if (bDummies) { - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); - CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position, nEntitiesFound, maxEntitiesToFind, aEntities); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + if(bBuildings) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bVehicles) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bPeds) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bObjects) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); + } + if(bDummies) { + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound, + maxEntitiesToFind, aEntities); + CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( + pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position, + nEntitiesFound, maxEntitiesToFind, aEntities); } } } } -void -CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities) +void +CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CColBox &boundingBox, + const CMatrix &matrix, const CVector &position, + int16 *nEntitiesFound, int16 maxEntitiesToFind, + CEntity **aEntities) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; + if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); CColSphere sphere; CVector vecDistance = pEntity->GetPosition() - position; sphere.radius = pEntity->GetBoundRadius(); sphere.center = Multiply3x3(vecDistance, matrix); - if (CCollision::TestSphereBox(sphere, boundingBox) && *nEntitiesFound < maxEntitiesToFind) { - if (aEntities) - aEntities[*nEntitiesFound] = pEntity; + if(CCollision::TestSphereBox(sphere, boundingBox) && *nEntitiesFound < maxEntitiesToFind) { + if(aEntities) aEntities[*nEntitiesFound] = pEntity; ++*nEntitiesFound; } } @@ -1168,7 +1277,9 @@ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, cons } void -CWorld::FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects) +CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CVector &vecEndPos, int16 *nIntersecting, + int16 maxEntitiesToFind, CEntity **aEntities, bool bVehicles, bool bPeds, + bool bObjects) { CWorld::AdvanceCurrentScanCode(); *nIntersecting = 0; @@ -1176,70 +1287,82 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CV const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - if (bVehicles) { - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, true, false); - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, true, false); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + if(bVehicles) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities, true, false); + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, + nIntersecting, maxEntitiesToFind, aEntities, true, false); } - if (bPeds) { - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, true); - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, true); + if(bPeds) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities, false, true); + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities, false, true); } - if (bObjects) { - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, false); - CWorld::FindMissionEntitiesIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, maxEntitiesToFind, aEntities, false, false); + if(bObjects) { + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities, false, false); + CWorld::FindMissionEntitiesIntersectingCubeSectorList( + pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, + maxEntitiesToFind, aEntities, false, false); } } } } void -CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList) +CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList &list, const CVector &vecStartPos, + const CVector &vecEndPos, int16 *nIntersecting, + int16 maxEntitiesToFind, CEntity **aEntities, bool bIsVehicleList, + bool bIsPedList) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; - if (pEntity->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; + if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); bool bIsMissionEntity = false; - if (bIsVehicleList) - bIsMissionEntity = ((CVehicle*)pEntity)->VehicleCreatedBy == MISSION_VEHICLE; - else if (bIsPedList) - bIsMissionEntity = ((CPed*)pEntity)->CharCreatedBy == MISSION_CHAR; + if(bIsVehicleList) + bIsMissionEntity = ((CVehicle *)pEntity)->VehicleCreatedBy == MISSION_VEHICLE; + else if(bIsPedList) + bIsMissionEntity = ((CPed *)pEntity)->CharCreatedBy == MISSION_CHAR; else - bIsMissionEntity = ((CObject*)pEntity)->ObjectCreatedBy == MISSION_OBJECT; + bIsMissionEntity = ((CObject *)pEntity)->ObjectCreatedBy == MISSION_OBJECT; float fRadius = pEntity->GetBoundRadius(); - const CVector& entityPos = pEntity->GetPosition(); - if (bIsMissionEntity && - fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x && - fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y && - fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z && - *nIntersecting < maxEntitiesToFind) { - if (aEntities) - aEntities[*nIntersecting] = pEntity; + const CVector &entityPos = pEntity->GetPosition(); + if(bIsMissionEntity && fRadius + entityPos.x >= vecStartPos.x && + entityPos.x - fRadius <= vecEndPos.x && fRadius + entityPos.y >= vecStartPos.y && + entityPos.y - fRadius <= vecEndPos.y && fRadius + entityPos.z >= vecStartPos.z && + entityPos.z - fRadius <= vecEndPos.z && *nIntersecting < maxEntitiesToFind) { + if(aEntities) aEntities[*nIntersecting] = pEntity; ++*nIntersecting; } } } } -CPlayerPed* +CPlayerPed * FindPlayerPed(void) { return CWorld::Players[CWorld::PlayerInFocus].m_pPed; } -CVehicle* +CVehicle * FindPlayerVehicle(void) { CPlayerPed *ped = FindPlayerPed(); - if(ped && ped->InVehicle()) - return ped->m_pMyVehicle; + if(ped && ped->InVehicle()) return ped->m_pMyVehicle; return nil; } -CVehicle* +CVehicle * FindPlayerTrain(void) { if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain()) @@ -1248,7 +1371,7 @@ FindPlayerTrain(void) return nil; } -CEntity* +CEntity * FindPlayerEntity(void) { CPlayerPed *ped = FindPlayerPed(); @@ -1268,7 +1391,7 @@ FindPlayerCoors(void) return ped->GetPosition(); } -CVector& +CVector & FindPlayerSpeed(void) { CPlayerPed *ped = FindPlayerPed(); @@ -1278,27 +1401,22 @@ FindPlayerSpeed(void) return ped->m_vecMoveSpeed; } -CVector& +CVector & FindPlayerCentreOfWorld(int32 player) { - if(CCarCtrl::bCarsGeneratedAroundCamera) - return TheCamera.GetPosition(); - if(CWorld::Players[player].m_pRemoteVehicle) - return CWorld::Players[player].m_pRemoteVehicle->GetPosition(); - if(FindPlayerVehicle()) - return FindPlayerVehicle()->GetPosition(); + if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition(); + if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition(); + if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition(); return CWorld::Players[player].m_pPed->GetPosition(); } -CVector& +CVector & FindPlayerCentreOfWorld_NoSniperShift(void) { - if(CCarCtrl::bCarsGeneratedAroundCamera) - return TheCamera.GetPosition(); + if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition(); if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle) return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition(); - if(FindPlayerVehicle()) - return FindPlayerVehicle()->GetPosition(); + if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition(); return FindPlayerPed()->GetPosition(); } @@ -1307,29 +1425,26 @@ FindPlayerHeading(void) { if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle) return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading(); - if(FindPlayerVehicle()) - return FindPlayerVehicle()->GetForward().Heading(); + if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading(); return FindPlayerPed()->GetForward().Heading(); } - -void CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2) +void +CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2) { CVehiclePool *pVehiclePool = CPools::GetVehiclePool(); - for (int32 i = 0; i < pVehiclePool->GetSize(); i++) { - CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); - if (pVehicle) { - const CVector& position = pVehicle->GetPosition(); - if (position.x >= x1 && position.x <= x2 && - position.y >= y1 && position.y <= y2 && - position.z >= z1 && position.z <= z2 && - !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { - if (pVehicle->pDriver) { + for(int32 i = 0; i < pVehiclePool->GetSize(); i++) { + CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if(pVehicle) { + const CVector &position = pVehicle->GetPosition(); + if(position.x >= x1 && position.x <= x2 && position.y >= y1 && position.y <= y2 && + position.z >= z1 && position.z <= z2 && !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if(pVehicle->pDriver) { CPopulation::RemovePed(pVehicle->pDriver); pVehicle->pDriver = nil; } - for (int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { - if (pVehicle->pPassengers[j]) { + for(int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) { + if(pVehicle->pPassengers[j]) { CPopulation::RemovePed(pVehicle->pPassengers[j]); pVehicle->pPassengers[j] = nil; --pVehicle->m_nNumPassengers; @@ -1343,25 +1458,23 @@ void CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, } } -void +void CWorld::ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2) { - CPedPool* pPedPool = CPools::GetPedPool(); - for (int32 i = 0; i < pPedPool->GetSize(); i++) { - CPed* pPed = CPools::GetPedPool()->GetSlot(i); - if (pPed) { - const CVector& position = pPed->GetPosition(); - if (!pPed->IsPlayer() && pPed->CanBeDeleted() && - position.x >= x1 && position.x <= x2 && - position.y >= y1 && position.y <= y2 && - position.z >= z1 && position.z <= z2) { + CPedPool *pPedPool = CPools::GetPedPool(); + for(int32 i = 0; i < pPedPool->GetSize(); i++) { + CPed *pPed = CPools::GetPedPool()->GetSlot(i); + if(pPed) { + const CVector &position = pPed->GetPosition(); + if(!pPed->IsPlayer() && pPed->CanBeDeleted() && position.x >= x1 && position.x <= x2 && + position.y >= y1 && position.y <= y2 && position.z >= z1 && position.z <= z2) { CPopulation::RemovePed(pPed); } } } } -void +void CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2) { CWorld::AdvanceCurrentScanCode(); @@ -1373,49 +1486,51 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2) const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2, y2, fStartX, fStartY, fEndX, fEndY); - CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1, y1, x2, y2, fStartX, fStartY, fEndX, fEndY); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2, + y2, fStartX, fStartY, fEndX, fEndY); + CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1, + y1, x2, y2, fStartX, fStartY, fEndX, fEndY); CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS], x1, y1, x2, y2); - CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2, y2); + CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2, + y2); } } } -void -CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY) +void +CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1, float x2, float y2, float fStartX, + float fStartY, float fEndX, float fEndY) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CVehicle *pVehicle = (CVehicle*)pNode->item; - if (pVehicle->m_scanCode != GetCurrentScanCode()) { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CVehicle *pVehicle = (CVehicle *)pNode->item; + if(pVehicle->m_scanCode != GetCurrentScanCode()) { pVehicle->m_scanCode = GetCurrentScanCode(); - const CVector& vehiclePos = pVehicle->GetPosition(); + const CVector &vehiclePos = pVehicle->GetPosition(); eCarMission carMission = pVehicle->AutoPilot.m_nCarMission; - if (pVehicle != FindPlayerVehicle() && - vehiclePos.x > fStartX && vehiclePos.x < fEndX && - vehiclePos.y > fStartY && vehiclePos.y < fEndY && - pVehicle->bIsLawEnforcer && - (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE || - carMission == MISSION_BLOCKPLAYER_FARAWAY || carMission == MISSION_BLOCKPLAYER_CLOSE) - ) { + if(pVehicle != FindPlayerVehicle() && vehiclePos.x > fStartX && vehiclePos.x < fEndX && + vehiclePos.y > fStartY && vehiclePos.y < fEndY && pVehicle->bIsLawEnforcer && + (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE || + carMission == MISSION_BLOCKPLAYER_FARAWAY || carMission == MISSION_BLOCKPLAYER_CLOSE)) { pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; - CColModel* pColModel = pVehicle->GetColModel(); + CColModel *pColModel = pVehicle->GetColModel(); bool bInsideSphere = false; - for (int32 i = 0; i < pColModel->numSpheres; i++) { + for(int32 i = 0; i < pColModel->numSpheres; i++) { CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center; float fRadius = pColModel->spheres[i].radius; - if (pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && pos.y - fRadius < y2) + if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 && + pos.y - fRadius < y2) bInsideSphere = true; // Maybe break the loop when bInsideSphere is set to true? } - if (bInsideSphere) { - if (pVehicle->GetPosition().x <= (x1 + x2) * 0.5f) + if(bInsideSphere) { + if(pVehicle->GetPosition().x <= (x1 + x2) * 0.5f) pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f); else pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f); - if (pVehicle->GetPosition().y <= (y1 + y2) * 0.5f) + if(pVehicle->GetPosition().y <= (y1 + y2) * 0.5f) pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f); else pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f); @@ -1425,31 +1540,29 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1 } } -void -CWorld::CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2) +void +CWorld::CallOffChaseForAreaSectorListPeds(CPtrList &list, float x1, float y1, float x2, float y2) { - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CPed* pPed = (CPed*)pNode->item; - const CVector& pedPos = pPed->GetPosition(); - if (pPed->m_scanCode != GetCurrentScanCode()) - { + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CPed *pPed = (CPed *)pNode->item; + const CVector &pedPos = pPed->GetPosition(); + if(pPed->m_scanCode != GetCurrentScanCode()) { pPed->m_scanCode = GetCurrentScanCode(); - if (pPed != FindPlayerPed() && pPed->m_leader != FindPlayerPed() && - pedPos.x > x1 && pedPos.x < x2 && - pedPos.y > y1 && pedPos.y < y2 && - (pPed->m_pedInObjective == FindPlayerPed() || pPed->m_carInObjective && pPed->m_carInObjective == FindPlayerVehicle()) && - pPed->m_nPedState != PED_DEAD && pPed->m_nPedState != PED_DIE && - (pPed->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || - pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || - pPed->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS)) { - if (pPed->IsPedInControl()) { - if (pPed->m_nPedType == PEDTYPE_COP) - ((CCopPed*)pPed)->ClearPursuit(); + if(pPed != FindPlayerPed() && pPed->m_leader != FindPlayerPed() && pedPos.x > x1 && + pedPos.x < x2 && pedPos.y > y1 && pedPos.y < y2 && + (pPed->m_pedInObjective == FindPlayerPed() || + pPed->m_carInObjective && pPed->m_carInObjective == FindPlayerVehicle()) && + pPed->m_nPedState != PED_DEAD && pPed->m_nPedState != PED_DIE && + (pPed->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || + pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || + pPed->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS)) { + if(pPed->IsPedInControl()) { + if(pPed->m_nPedType == PEDTYPE_COP) + ((CCopPed *)pPed)->ClearPursuit(); else pPed->SetIdle(); pPed->SetObjective(OBJECTIVE_NONE); - } - else { + } else { pPed->m_prevObjective = OBJECTIVE_NONE; pPed->m_nLastPedState = PED_IDLE; } @@ -1459,13 +1572,13 @@ CWorld::CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, fl } void -CWorld::RemoveEntityInsteadOfProcessingIt(CEntity* ent) +CWorld::RemoveEntityInsteadOfProcessingIt(CEntity *ent) { - if (ent->IsPed()) { - if (FindPlayerPed() == ent) + if(ent->IsPed()) { + if(FindPlayerPed() == ent) Remove(ent); else - CPopulation::RemovePed((CPed*)ent); + CPopulation::RemovePed((CPed *)ent); } else { Remove(ent); delete ent; @@ -1476,12 +1589,13 @@ void CWorld::RemoveFallenPeds(void) { int poolSize = CPools::GetPedPool()->GetSize(); - for(int poolIndex = poolSize-1; poolIndex >= 0; poolIndex--) { + for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { CPed *ped = CPools::GetPedPool()->GetSlot(poolIndex); - if (ped) { - if (ped->GetPosition().z < MAP_Z_LOW_LIMIT) { - if (ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) { - int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED, 999999.9f, false, false); + if(ped) { + if(ped->GetPosition().z < MAP_Z_LOW_LIMIT) { + if(ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) { + int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED, + 999999.9f, false, false); CVector newPos = ThePaths.m_pathNodes[closestNode].pos; newPos.z += 2.0f; ped->Teleport(newPos); @@ -1498,17 +1612,20 @@ void CWorld::RemoveFallenCars(void) { int poolSize = CPools::GetVehiclePool()->GetSize(); - for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { - CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if (veh) { - if (veh->GetPosition().z < MAP_Z_LOW_LIMIT) { - if (veh->VehicleCreatedBy == MISSION_VEHICLE || veh == FindPlayerVehicle() || (veh->pDriver && veh->pDriver->IsPlayer())) { - int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR, 999999.9f, false, false); + for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { + CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); + if(veh) { + if(veh->GetPosition().z < MAP_Z_LOW_LIMIT) { + if(veh->VehicleCreatedBy == MISSION_VEHICLE || veh == FindPlayerVehicle() || + (veh->pDriver && veh->pDriver->IsPlayer())) { + int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR, + 999999.9f, false, false); CVector newPos = ThePaths.m_pathNodes[closestNode].pos; newPos.z += 3.0f; veh->Teleport(newPos); veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); - } else if (veh->VehicleCreatedBy == RANDOM_VEHICLE || veh->VehicleCreatedBy == PARKED_VEHICLE) { + } else if(veh->VehicleCreatedBy == RANDOM_VEHICLE || + veh->VehicleCreatedBy == PARKED_VEHICLE) { Remove(veh); delete veh; } @@ -1521,11 +1638,10 @@ void CWorld::StopAllLawEnforcersInTheirTracks(void) { int poolSize = CPools::GetVehiclePool()->GetSize(); - for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { - CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if (veh) { - if (veh->bIsLawEnforcer) - veh->SetMoveSpeed(0.0f, 0.0f, 0.0f); + for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { + CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); + if(veh) { + if(veh->bIsLawEnforcer) veh->SetMoveSpeed(0.0f, 0.0f, 0.0f); } } } @@ -1534,10 +1650,9 @@ void CWorld::SetAllCarsCanBeDamaged(bool toggle) { int poolSize = CPools::GetVehiclePool()->GetSize(); - for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) { + for(int poolIndex = 0; poolIndex < poolSize; poolIndex++) { CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if (veh) - veh->bCanBeDamaged = toggle; + if(veh) veh->bCanBeDamaged = toggle; } } @@ -1545,54 +1660,53 @@ void CWorld::ExtinguishAllCarFiresInArea(CVector point, float range) { int poolSize = CPools::GetVehiclePool()->GetSize(); - for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) { - CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if (veh) { - if ((point - veh->GetPosition()).MagnitudeSqr() < sq(range)) - veh->ExtinguishCarFire(); + for(int poolIndex = 0; poolIndex < poolSize; poolIndex++) { + CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); + if(veh) { + if((point - veh->GetPosition()).MagnitudeSqr() < sq(range)) veh->ExtinguishCarFire(); } } } -void -CWorld::AddParticles(void) +void +CWorld::AddParticles(void) { - for (int32 y = 0; y < NUMSECTORS_Y; y++) { - for (int32 x = 0; x < NUMSECTORS_X; x++) { - CSector* pSector = GetSector(x, y); + for(int32 y = 0; y < NUMSECTORS_Y; y++) { + for(int32 x = 0; x < NUMSECTORS_X; x++) { + CSector *pSector = GetSector(x, y); CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]); CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]); } } } -void +void CWorld::ShutDown(void) { - for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); - for (CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { - CEntity *pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { - CEntity *pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { - CEntity *pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } @@ -1601,41 +1715,41 @@ CWorld::ShutDown(void) pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); } - for (int32 i = 0; i < 4; i ++) { - for (CPtrNode* pNode = GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) { - CEntity *pEntity = (CEntity*)pNode->item; + for(int32 i = 0; i < 4; i++) { + for(CPtrNode *pNode = GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; // Maybe remove from world here? delete pEntity; } GetBigBuildingList((eLevelName)i).Flush(); } - for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); - if (pSector->m_lists[ENTITYLIST_BUILDINGS].first) { + if(pSector->m_lists[ENTITYLIST_BUILDINGS].first) { sprintf(gString, "Building list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); } - if (pSector->m_lists[ENTITYLIST_DUMMIES].first) { + if(pSector->m_lists[ENTITYLIST_DUMMIES].first) { sprintf(gString, "Dummy list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_DUMMIES].Flush(); } - if (pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) { + if(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) { sprintf(gString, "Building overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush(); } - if (pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) { + if(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) { sprintf(gString, "Vehicle overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].Flush(); } - if (pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) { + if(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) { sprintf(gString, "Ped overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].Flush(); } - if (pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) { + if(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) { sprintf(gString, "Object overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].Flush(); } - if (pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) { + if(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) { sprintf(gString, "Dummy overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y); pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush(); } @@ -1643,31 +1757,30 @@ CWorld::ShutDown(void) ms_listMovingEntityPtrs.Flush(); } -void -CWorld::ClearForRestart(void) +void +CWorld::ClearForRestart(void) { - if (CCutsceneMgr::HasLoaded()) - CCutsceneMgr::DeleteCutsceneData(); + if(CCutsceneMgr::HasLoaded()) CCutsceneMgr::DeleteCutsceneData(); CProjectileInfo::RemoveAllProjectiles(); CObject::DeleteAllTempObjects(); CObject::DeleteAllMissionObjects(); CPopulation::ConvertAllObjectsToDummyObjects(); - for (int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { - CSector* pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { - CEntity *pEntity = (CEntity*)pNode->item; + for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { + CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) { - CVehicle *pVehicle = (CVehicle*)pNode->item; - if (pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { + for(CPtrNode *pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) { + CVehicle *pVehicle = (CVehicle *)pNode->item; + if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { CWorld::Remove(pVehicle); delete pVehicle; } } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } @@ -1675,75 +1788,50 @@ CWorld::ClearForRestart(void) CPools::CheckPoolsEmpty(); } -void -CWorld::RepositionCertainDynamicObjects() -{ +void +CWorld::RepositionCertainDynamicObjects() +{ int32 i = CPools::GetDummyPool()->GetSize(); - while (--i >= 0) { - CDummy* dummy = CPools::GetDummyPool()->GetSlot(i); - if (dummy) { - RepositionOneObject(dummy); - } + while(--i >= 0) { + CDummy *dummy = CPools::GetDummyPool()->GetSlot(i); + if(dummy) { RepositionOneObject(dummy); } } } void -CWorld::RepositionOneObject(CEntity* pEntity) +CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->m_modelIndex; - if (modelId == MI_SINGLESTREETLIGHTS1 - || modelId == MI_SINGLESTREETLIGHTS2 - || modelId == MI_SINGLESTREETLIGHTS3 - || modelId == MI_DOUBLESTREETLIGHTS - || modelId == MI_TREE1 - || modelId == MI_TREE2 - || modelId == MI_TREE3 - || modelId == MI_TREE4 - || modelId == MI_TREE5 - || modelId == MI_TREE6 - || modelId == MI_TREE7 - || modelId == MI_TREE8 - || modelId == MI_TREE9 - || modelId == MI_TREE10 - || modelId == MI_TREE11 - || modelId == MI_TREE12 - || modelId == MI_TREE13 - || modelId == MI_TREE14 - || modelId == MI_TRAFFICLIGHTS - || modelId == MI_PARKINGMETER - || modelId == MI_PHONEBOOTH1 - || modelId == MI_WASTEBIN - || modelId == MI_BIN - || modelId == MI_POSTBOX1 - || modelId == MI_NEWSSTAND - || modelId == MI_TRAFFICCONE - || modelId == MI_DUMP1 - || modelId == MI_ROADWORKBARRIER1 - || modelId == MI_BUSSIGN1 - || modelId == MI_NOPARKINGSIGN1 - || modelId == MI_PHONESIGN - || modelId == MI_TAXISIGN - || modelId == MI_FISHSTALL01 - || modelId == MI_FISHSTALL02 - || modelId == MI_FISHSTALL03 - || modelId == MI_FISHSTALL04 - || modelId == MI_BAGELSTAND2 - || modelId == MI_FIRE_HYDRANT - || modelId == MI_BOLLARDLIGHT - || modelId == MI_PARKTABLE) { - CVector& position = pEntity->GetPosition(); + if(modelId == MI_SINGLESTREETLIGHTS1 || modelId == MI_SINGLESTREETLIGHTS2 || + modelId == MI_SINGLESTREETLIGHTS3 || modelId == MI_DOUBLESTREETLIGHTS || modelId == MI_TREE1 || + modelId == MI_TREE2 || modelId == MI_TREE3 || modelId == MI_TREE4 || modelId == MI_TREE5 || + modelId == MI_TREE6 || modelId == MI_TREE7 || modelId == MI_TREE8 || modelId == MI_TREE9 || + modelId == MI_TREE10 || modelId == MI_TREE11 || modelId == MI_TREE12 || modelId == MI_TREE13 || + modelId == MI_TREE14 || modelId == MI_TRAFFICLIGHTS || modelId == MI_PARKINGMETER || + modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || + modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || + modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || + modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 || + modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 || + modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || + modelId == MI_PARKTABLE) { + CVector &position = pEntity->GetPosition(); float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; - position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - fBoundingBoxMinZ; + position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, + position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - + fBoundingBoxMinZ; pEntity->m_matrix.UpdateRW(); pEntity->UpdateRwFrame(); - } else if (modelId == MI_BUOY) { + } else if(modelId == MI_BUOY) { float fWaterLevel = 0.0f; bool bFound = true; - const CVector& position = pEntity->GetPosition(); - float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); - if (CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &fWaterLevel)) { - if (!bFound || fWaterLevel > fGroundZ) { - CColModel* pColModel = pEntity->GetColModel(); + const CVector &position = pEntity->GetPosition(); + float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, + position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); + if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, + &fWaterLevel)) { + if(!bFound || fWaterLevel > fGroundZ) { + CColModel *pColModel = pEntity->GetColModel(); float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; pEntity->GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; } @@ -1755,45 +1843,47 @@ void CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason) { int poolSize = CPools::GetVehiclePool()->GetSize(); - for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { + for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if (veh && veh->m_status != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) { - if (Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius && Abs(veh->GetPosition().y - y) < radius) - gFireManager.StartFire(veh, reason, 0.8f, true); + if(veh && veh->m_status != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) { + if(Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius && + Abs(veh->GetPosition().y - y) < radius) + gFireManager.StartFire(veh, reason, 0.8f, true); } } } -void -CWorld::SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason) +void +CWorld::SetPedsOnFire(float x, float y, float z, float radius, CEntity *reason) { int32 poolSize = CPools::GetPedPool()->GetSize(); - for (int32 i = poolSize - 1; i >= 0; i--) { - CPed* pPed = CPools::GetPedPool()->GetSlot(i); - if (pPed && pPed->m_nPedState != PED_DEAD && !pPed->bInVehicle && !pPed->m_pFire && !pPed->bFireProof) { - if (Abs(pPed->GetPosition().z - z) < 5.0f && Abs(pPed->GetPosition().x - x) < radius && Abs(pPed->GetPosition().y - y) < radius) + for(int32 i = poolSize - 1; i >= 0; i--) { + CPed *pPed = CPools::GetPedPool()->GetSlot(i); + if(pPed && pPed->m_nPedState != PED_DEAD && !pPed->bInVehicle && !pPed->m_pFire && !pPed->bFireProof) { + if(Abs(pPed->GetPosition().z - z) < 5.0f && Abs(pPed->GetPosition().x - x) < radius && + Abs(pPed->GetPosition().y - y) < radius) gFireManager.StartFire(pPed, reason, 0.8f, true); } } } -void -CWorld::RemoveStaticObjects() +void +CWorld::RemoveStaticObjects() { for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) { CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } - for (CPtrNode* pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { - CEntity* pEntity = (CEntity*)pNode->item; + for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { + CEntity *pEntity = (CEntity *)pNode->item; CWorld::Remove(pEntity); delete pEntity; } @@ -1807,16 +1897,18 @@ CWorld::RemoveStaticObjects() void CWorld::Process(void) { - if (!(CTimer::GetFrameCounter() & 63)) - CReferences::PruneAllReferencesInWorld(); + if(!(CTimer::GetFrameCounter() & 63)) CReferences::PruneAllReferencesInWorld(); - if (bProcessCutsceneOnly) { - for (int i = 0; i < NUMCUTSCENEOBJECTS; i++) { + if(bProcessCutsceneOnly) { + for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) { CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i); - if (csObj && csObj->m_entryInfoList.first) { - if (csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP - && RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { - RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep())); + if(csObj && csObj->m_entryInfoList.first) { + if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP && + RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { + RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), + 0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT + ? CTimer::GetTimeStepNonClipped() + : CTimer::GetTimeStep())); } csObj->ProcessControl(); csObj->ProcessCollision(); @@ -1827,102 +1919,98 @@ CWorld::Process(void) CRecordDataForChase::ProcessControlCars(); CRecordDataForChase::SaveOrRetrieveCarPositions(); } else { - for (CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity *movingEnt = (CEntity*)node->item; - if (movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP - && RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { - RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep())); - } - } - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CPhysical* movingEnt = (CPhysical*)node->item; - if (movingEnt->bRemoveFromWorld) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; + if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && + RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { + RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), + 0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT + ? CTimer::GetTimeStepNonClipped() + : CTimer::GetTimeStep())); + } + } + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CPhysical *movingEnt = (CPhysical *)node->item; + if(movingEnt->bRemoveFromWorld) { RemoveEntityInsteadOfProcessingIt(movingEnt); } else { movingEnt->ProcessControl(); - if (movingEnt->bIsStatic) { - movingEnt->RemoveFromMovingList(); - } + if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); } } } bForceProcessControl = true; - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CPhysical* movingEnt = (CPhysical*)node->item; - if (movingEnt->bWasPostponed) { - if (movingEnt->bRemoveFromWorld) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CPhysical *movingEnt = (CPhysical *)node->item; + if(movingEnt->bWasPostponed) { + if(movingEnt->bRemoveFromWorld) { RemoveEntityInsteadOfProcessingIt(movingEnt); } else { movingEnt->ProcessControl(); - if (movingEnt->bIsStatic) { - movingEnt->RemoveFromMovingList(); - } + if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); } } } } bForceProcessControl = false; - if (CReplay::IsPlayingBack()) { - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity* movingEnt = (CEntity*)node->item; + if(CReplay::IsPlayingBack()) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; movingEnt->bIsInSafePosition = true; movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); } } else { bNoMoreCollisionTorque = false; - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity* movingEnt = (CEntity*)node->item; - if (!movingEnt->bIsInSafePosition) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; + if(!movingEnt->bIsInSafePosition) { movingEnt->ProcessCollision(); movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); } } bNoMoreCollisionTorque = true; - for (int i = 0; i < 4; i++) { - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity* movingEnt = (CEntity*)node->item; - if (!movingEnt->bIsInSafePosition) { + for(int i = 0; i < 4; i++) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; + if(!movingEnt->bIsInSafePosition) { movingEnt->ProcessCollision(); movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); } } } - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity* movingEnt = (CEntity*)node->item; - if (!movingEnt->bIsInSafePosition) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; + if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; movingEnt->ProcessCollision(); movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); - if (!movingEnt->bIsInSafePosition) { - movingEnt->bIsStuck = true; - } + if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; } } } bSecondShift = false; - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CEntity* movingEnt = (CEntity*)node->item; - if (!movingEnt->bIsInSafePosition) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CEntity *movingEnt = (CEntity *)node->item; + if(!movingEnt->bIsInSafePosition) { movingEnt->ProcessShift(); movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); - if (!movingEnt->bIsInSafePosition) { - movingEnt->bIsStuck = true; - } + if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; } } } bSecondShift = true; - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CPhysical* movingEnt = (CPhysical*)node->item; - if (!movingEnt->bIsInSafePosition) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CPhysical *movingEnt = (CPhysical *)node->item; + if(!movingEnt->bIsInSafePosition) { movingEnt->ProcessShift(); movingEnt->GetMatrix().UpdateRW(); movingEnt->UpdateRwFrame(); - if (!movingEnt->bIsInSafePosition) { + if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; - if (movingEnt->m_status == STATUS_PLAYER) { - printf("STUCK: Final Step: Player Entity %d Is Stuck\n", movingEnt->m_modelIndex); + if(movingEnt->m_status == STATUS_PLAYER) { + printf("STUCK: Final Step: Player Entity %d Is Stuck\n", + movingEnt->m_modelIndex); movingEnt->m_vecMoveSpeed *= 0.3f; movingEnt->ApplyMoveSpeed(); movingEnt->ApplyTurnSpeed(); @@ -1931,35 +2019,28 @@ CWorld::Process(void) } } } - for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { - CPed* movingPed = (CPed*)node->item; - if (movingPed->IsPed()) { - if (movingPed->bInVehicle && movingPed->m_nPedState != PED_EXIT_TRAIN || movingPed->EnteringCar()) { + for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { + CPed *movingPed = (CPed *)node->item; + if(movingPed->IsPed()) { + if(movingPed->bInVehicle && movingPed->m_nPedState != PED_EXIT_TRAIN || + movingPed->EnteringCar()) { CVehicle *movingCar = movingPed->m_pMyVehicle; - if (movingCar) { - if (movingCar->IsTrain()) { + if(movingCar) { + if(movingCar->IsTrain()) { movingPed->SetPedPositionInTrain(); } else { - switch (movingPed->m_nPedState) { - case PED_ENTER_CAR: - case PED_CARJACK: - movingPed->EnterCar(); - break; - case PED_DRAG_FROM_CAR: + switch(movingPed->m_nPedState) { + case PED_ENTER_CAR: + case PED_CARJACK: movingPed->EnterCar(); break; + case PED_DRAG_FROM_CAR: movingPed->BeingDraggedFromCar(); break; + case PED_EXIT_CAR: movingPed->ExitCar(); break; + case PED_ARRESTED: + if(movingPed->m_nLastPedState == PED_DRAG_FROM_CAR) { movingPed->BeingDraggedFromCar(); break; - case PED_EXIT_CAR: - movingPed->ExitCar(); - break; - case PED_ARRESTED: - if (movingPed->m_nLastPedState == PED_DRAG_FROM_CAR) { - movingPed->BeingDraggedFromCar(); - break; - } - // fall through - default: - movingPed->SetPedPositionInCar(); - break; + } + // fall through + default: movingPed->SetPedPositionInCar(); break; } } movingPed->GetMatrix().UpdateRW(); @@ -1974,16 +2055,17 @@ CWorld::Process(void) CMessages::Process(); Players[PlayerInFocus].Process(); CRecordDataForChase::SaveOrRetrieveCarPositions(); - if ((CTimer::GetFrameCounter() & 7) == 1) { + if((CTimer::GetFrameCounter() & 7) == 1) { RemoveFallenPeds(); - } else if ((CTimer::GetFrameCounter() & 7) == 5) { + } else if((CTimer::GetFrameCounter() & 7) == 5) { RemoveFallenCars(); } } } -void -CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) +void +CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, CEntity *pCreator, + bool bProcessVehicleBombTimer) { CVector2D vecStartPos(position.x - fRadius, position.y - fRadius); CVector2D vecEndPos(position.x + fRadius, position.y + fRadius); @@ -1991,52 +2073,60 @@ CWorld::TriggerExplosion(const CVector& position, float fRadius, float fPower, C const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0); const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1); const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); - for (int32 y = nStartY; y <= nEndY; y++) { - for (int32 x = nStartX; x <= nEndX; x++) { - CSector* pSector = CWorld::GetSector(x, y); - CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius, fPower, pCreator, bProcessVehicleBombTimer); - CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower, pCreator, bProcessVehicleBombTimer); - CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius, fPower, pCreator, bProcessVehicleBombTimer); + for(int32 y = nStartY; y <= nEndY; y++) { + for(int32 x = nStartX; x <= nEndX; x++) { + CSector *pSector = CWorld::GetSector(x, y); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius, + fPower, pCreator, bProcessVehicleBombTimer); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower, + pCreator, bProcessVehicleBombTimer); + CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius, + fPower, pCreator, bProcessVehicleBombTimer); } } - } void -CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer) -{ - for (CPtrNode* pNode = list.first; pNode; pNode = pNode->next) { - CPhysical* pEntity = (CPhysical*)pNode->item; - CVector vecDistance = pEntity->GetPosition() - position; - float fMagnitude = vecDistance.Magnitude(); - if(fRadius > fMagnitude) { - CWeapon::BlowUpExplosiveThings(pEntity); - CPed *pPed = (CPed *)pEntity; - CObject *pObject = (CObject *)pEntity; - CVehicle *pVehicle = (CVehicle *)pEntity; - if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { - if(pEntity->bIsStatic) { - if (pEntity->IsObject()) { - if (fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { - if (IsGlass(pObject->m_modelIndex)) { +CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, float fRadius, float fPower, + CEntity *pCreator, bool bProcessVehicleBombTimer) +{ + for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) { + CPhysical *pEntity = (CPhysical *)pNode->item; + CVector vecDistance = pEntity->GetPosition() - position; + float fMagnitude = vecDistance.Magnitude(); + if(fRadius > fMagnitude) { + CWeapon::BlowUpExplosiveThings(pEntity); + CPed *pPed = (CPed *)pEntity; + CObject *pObject = (CObject *)pEntity; + CVehicle *pVehicle = (CVehicle *)pEntity; + if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { + if(pEntity->bIsStatic) { + if(pEntity->IsObject()) { + if(fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { + if(IsGlass(pObject->m_modelIndex)) { CGlass::WindowRespondsToExplosion(pObject, position); } else { pObject->bIsStatic = false; pObject->AddToMovingList(); int16 modelId = pEntity->m_modelIndex; - if (modelId != MI_FIRE_HYDRANT || pObject->bHasBeenDamaged) { - if (pEntity->IsObject() && modelId != MI_EXPLODINGBARREL && modelId != MI_PETROLPUMP) + if(modelId != MI_FIRE_HYDRANT || + pObject->bHasBeenDamaged) { + if(pEntity->IsObject() && + modelId != MI_EXPLODINGBARREL && + modelId != MI_PETROLPUMP) pObject->bHasBeenDamaged = true; } else { CVector pos = pEntity->GetPosition(); pos.z -= 0.5f; - CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, pos, true); + CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, + pos, true); pObject->bHasBeenDamaged = true; } } } - if (pEntity->bIsStatic) { - float fDamageMultiplier = (fRadius - fMagnitude) * 2.0f / fRadius; + if(pEntity->bIsStatic) { + float fDamageMultiplier = + (fRadius - fMagnitude) * 2.0f / fRadius; float fDamage = 300.0f * min(fDamageMultiplier, 1.0f); pObject->ObjectDamage(fDamage); } @@ -2045,37 +2135,37 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa pEntity->AddToMovingList(); } } - if (!pEntity->bIsStatic) { + if(!pEntity->bIsStatic) { float fDamageMultiplier = min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f); - CVector vecForceDir = vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier / max(fMagnitude, 0.01f)); + CVector vecForceDir = + vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier / + max(fMagnitude, 0.01f)); vecForceDir.z = max(vecForceDir.z, 0.0f); - if (pEntity == FindPlayerPed()) - vecForceDir.z = min(vecForceDir.z, 1.0f); + if(pEntity == FindPlayerPed()) vecForceDir.z = min(vecForceDir.z, 1.0f); pEntity->ApplyMoveForce(vecForceDir); - if (!pEntity->bPedPhysics) { + if(!pEntity->bPedPhysics) { float fBoundRadius = pEntity->GetBoundRadius(); float fDistanceZ = position.z - pEntity->GetPosition().z; float fPointZ = fBoundRadius; - if (max(fDistanceZ, -fBoundRadius) < fBoundRadius) - { - if (fDistanceZ <= -fBoundRadius) + if(max(fDistanceZ, -fBoundRadius) < fBoundRadius) { + if(fDistanceZ <= -fBoundRadius) fPointZ = -fBoundRadius; else fPointZ = fDistanceZ; } - pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z, 0.0f, 0.0f, fPointZ); + pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z, + 0.0f, 0.0f, fPointZ); } - switch (pEntity->m_type) - { + switch(pEntity->m_type) { case ENTITY_TYPE_VEHICLE: - if (pEntity->m_status == STATUS_SIMPLE) { + if(pEntity->m_status == STATUS_SIMPLE) { pEntity->m_status = STATUS_PHYSICS; CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); } - pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, 1100.0f * fDamageMultiplier); - if (bProcessVehicleBombTimer) { - if (pVehicle->m_nBombTimer) - pVehicle->m_nBombTimer /= 10; + pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, + 1100.0f * fDamageMultiplier); + if(bProcessVehicleBombTimer) { + if(pVehicle->m_nBombTimer) pVehicle->m_nBombTimer /= 10; } break; case ENTITY_TYPE_PED: { @@ -2083,14 +2173,16 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa pPed->bIsStanding = false; pPed->ApplyMoveForce(0.0, 0.0, 2.0f); float fDamage = 250.0f * fDamageMultiplier; - pPed->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, fDamage, PEDPIECE_TORSO, direction); - if (pPed->m_nPedState!= PED_DIE) - pPed->SetFall(2000, (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0); - if (pCreator && pCreator->IsPed()) { + pPed->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, fDamage, + PEDPIECE_TORSO, direction); + if(pPed->m_nPedState != PED_DIE) + pPed->SetFall(2000, + (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0); + if(pCreator && pCreator->IsPed()) { eEventType eventType = EVENT_SHOOT_PED; - if (pPed->m_nPedType == PEDTYPE_COP) - eventType = EVENT_SHOOT_COP; - CEventList::RegisterEvent(eventType, EVENT_ENTITY_PED, pEntity, (CPed*)pCreator, 10000); + if(pPed->m_nPedType == PEDTYPE_COP) eventType = EVENT_SHOOT_COP; + CEventList::RegisterEvent(eventType, EVENT_ENTITY_PED, pEntity, + (CPed *)pCreator, 10000); pPed->RegisterThreatWithGangPeds(pCreator); } break; @@ -2105,17 +2197,18 @@ CWorld::TriggerExplosionSectorList(CPtrList& list, const CVector& position, floa } } -void -CWorld::UseDetonator(CEntity* pEntity) +void +CWorld::UseDetonator(CEntity *pEntity) { int32 i = CPools::GetVehiclePool()->GetSize(); - while (--i >= 0) { - CAutomobile* pVehicle = (CAutomobile*)CPools::GetVehiclePool()->GetSlot(i); - if (pVehicle && !pVehicle->m_vehType && pVehicle->m_bombType == CARBOMB_REMOTE && pVehicle->m_pBombRigger == pEntity) { + while(--i >= 0) { + CAutomobile *pVehicle = (CAutomobile *)CPools::GetVehiclePool()->GetSlot(i); + if(pVehicle && !pVehicle->m_vehType && pVehicle->m_bombType == CARBOMB_REMOTE && + pVehicle->m_pBombRigger == pEntity) { pVehicle->m_bombType = CARBOMB_NONE; pVehicle->m_nBombTimer = 500; pVehicle->m_pBlowUpEntity = pVehicle->m_pBombRigger; - if (pVehicle->m_pBlowUpEntity) + if(pVehicle->m_pBlowUpEntity) pVehicle->m_pBlowUpEntity->RegisterReference(&pVehicle->m_pBlowUpEntity); } } -- cgit v1.2.3 From ac61da3febc557c16e54bbe8cc946b023e434dc5 Mon Sep 17 00:00:00 2001 From: saml1er Date: Fri, 17 Apr 2020 17:04:09 +0500 Subject: Fix CWorld::FindObjectsOfTypeInRangeSectorList bug --- src/core/World.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index 358e1823..c9e3c11f 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -753,14 +753,16 @@ CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList &list, const CEntity *pEntity = (CEntity *)pNode->item; if(pEntity->m_scanCode != GetCurrentScanCode()) { pEntity->m_scanCode = GetCurrentScanCode(); - float fMagnitude = 0.0f; - if(bCheck2DOnly) - fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); - else - fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr(); - if(fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { - if(aEntities) aEntities[*nEntitiesFound] = pEntity; - ++*nEntitiesFound; + if(modelId == pEntity->m_modelIndex) { + float fMagnitude = 0.0f; + if(bCheck2DOnly) + fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); + else + fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr(); + if(fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) { + if(aEntities) aEntities[*nEntitiesFound] = pEntity; + ++*nEntitiesFound; + } } } } -- cgit v1.2.3 From 599164006a9e7eb7328fc194c9bae1acbb2c887d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 17 Apr 2020 16:31:11 +0300 Subject: Remove patches --- premake5.lua | 58 ++- src/animation/AnimBlendAssocGroup.cpp | 14 +- src/animation/AnimBlendAssociation.cpp | 32 +- src/animation/AnimBlendClumpData.cpp | 19 +- src/animation/AnimBlendHierarchy.cpp | 12 +- src/animation/AnimBlendNode.cpp | 12 +- src/animation/AnimBlendSequence.cpp | 8 +- src/animation/AnimManager.cpp | 22 +- src/animation/CutsceneMgr.cpp | 18 +- src/animation/FrameUpdate.cpp | 8 +- src/animation/RpAnimBlend.cpp | 25 +- src/audio/AudioCollision.cpp | 13 +- src/audio/AudioManager.cpp | 216 +-------- src/audio/AudioScriptObject.cpp | 9 +- src/audio/DMAudio.cpp | 56 +-- src/audio/MusicManager.cpp | 33 +- src/audio/PoliceRadio.cpp | 18 +- src/audio/sampman.cpp | 65 +-- src/control/AutoPilot.cpp | 2 +- src/control/Bridge.cpp | 10 +- src/control/CarAI.cpp | 5 +- src/control/CarCtrl.cpp | 19 +- src/control/Curves.cpp | 2 +- src/control/Darkel.cpp | 18 +- src/control/GameLogic.cpp | 10 +- src/control/Garages.cpp | 9 +- src/control/OnscreenTimer.cpp | 17 +- src/control/PathFind.cpp | 47 +- src/control/Phones.cpp | 19 +- src/control/Pickups.cpp | 46 +- src/control/Record.cpp | 2 +- src/control/Remote.cpp | 7 +- src/control/Replay.cpp | 15 +- src/control/Restart.cpp | 15 +- src/control/RoadBlocks.cpp | 8 +- src/control/SceneEdit.cpp | 2 +- src/control/Script.cpp | 16 +- src/control/TrafficLights.cpp | 8 +- src/core/Accident.cpp | 12 +- src/core/AnimViewer.cpp | 2 +- src/core/Cam.cpp | 54 +-- src/core/Camera.cpp | 57 +-- src/core/CdStream.cpp | 23 +- src/core/Clock.cpp | 13 +- src/core/Collision.cpp | 69 +-- src/core/ControllerConfig.cpp | 56 +-- src/core/Directory.cpp | 9 +- src/core/EventList.cpp | 13 +- src/core/FileLoader.cpp | 42 +- src/core/FileMgr.cpp | 18 +- src/core/Fire.cpp | 20 +- src/core/Frontend.cpp | 20 +- src/core/Game.cpp | 19 +- src/core/IniFile.cpp | 2 +- src/core/Pad.cpp | 120 +---- src/core/Placeable.cpp | 20 +- src/core/PlayerInfo.cpp | 19 +- src/core/Pools.cpp | 18 +- src/core/Radar.cpp | 50 +- src/core/References.cpp | 8 +- src/core/Stats.cpp | 10 +- src/core/Streaming.cpp | 81 +--- src/core/SurfaceTable.cpp | 9 +- src/core/TempColModels.cpp | 6 +- src/core/Timer.cpp | 17 +- src/core/User.cpp | 15 +- src/core/Wanted.cpp | 24 +- src/core/World.cpp | 57 +-- src/core/World.h | 26 +- src/core/ZoneCull.cpp | 16 +- src/core/Zones.cpp | 35 +- src/core/main.cpp | 27 +- src/core/re3.cpp | 44 +- src/entities/Building.cpp | 17 +- src/entities/Dummy.cpp | 16 +- src/entities/Entity.cpp | 55 +-- src/entities/Physical.cpp | 57 +-- src/entities/Treadable.cpp | 12 +- src/math/math.cpp | 7 +- src/modelinfo/BaseModelInfo.cpp | 24 +- src/modelinfo/ClumpModelInfo.cpp | 29 +- src/modelinfo/MloModelInfo.cpp | 2 +- src/modelinfo/ModelIndices.cpp | 9 +- src/modelinfo/ModelIndices.h | 2 +- src/modelinfo/ModelInfo.cpp | 14 +- src/modelinfo/PedModelInfo.cpp | 16 +- src/modelinfo/SimpleModelInfo.cpp | 27 +- src/modelinfo/TimeModelInfo.cpp | 6 +- src/modelinfo/VehicleModelInfo.cpp | 64 +-- src/objects/CutsceneHead.cpp | 19 +- src/objects/CutsceneObject.cpp | 24 +- src/objects/DummyObject.cpp | 18 +- src/objects/Object.cpp | 36 +- src/objects/ObjectData.cpp | 7 +- src/objects/ParticleObject.cpp | 38 +- src/objects/Projectile.cpp | 16 +- src/peds/CivilianPed.cpp | 20 +- src/peds/CopPed.cpp | 24 +- src/peds/EmergencyPed.cpp | 19 +- src/peds/Gangs.cpp | 12 +- src/peds/Ped.cpp | 239 +--------- src/peds/PedIK.cpp | 18 +- src/peds/PedPlacement.cpp | 7 +- src/peds/PedRoutes.cpp | 2 +- src/peds/PedStats.cpp | 9 +- src/peds/PedType.cpp | 11 +- src/peds/PlayerPed.cpp | 40 +- src/peds/Population.cpp | 15 +- src/render/Antennas.cpp | 16 +- src/render/Clouds.cpp | 11 +- src/render/Console.cpp | 2 +- src/render/Coronas.cpp | 16 +- src/render/Credits.cpp | 12 +- src/render/Draw.cpp | 9 +- src/render/Fluff.cpp | 30 +- src/render/Font.cpp | 47 +- src/render/Glass.cpp | 25 +- src/render/Hud.cpp | 17 +- src/render/Instance.cpp | 13 +- src/render/Lines.cpp | 2 +- src/render/MBlur.cpp | 10 +- src/render/Particle.cpp | 18 +- src/render/ParticleMgr.cpp | 8 +- src/render/PlayerSkin.cpp | 11 +- src/render/PointLights.cpp | 9 +- src/render/RenderBuffer.cpp | 9 +- src/render/Renderer.cpp | 39 +- src/render/Rubbish.cpp | 2 +- src/render/Shadows.cpp | 35 +- src/render/Skidmarks.cpp | 2 +- src/render/SpecialFX.cpp | 31 +- src/render/Sprite.cpp | 18 +- src/render/Sprite2d.cpp | 36 +- src/render/Timecycle.cpp | 7 +- src/render/WaterCannon.cpp | 16 +- src/render/WaterLevel.cpp | 21 +- src/render/Weather.cpp | 2 +- src/rw/ClumpRead.cpp | 8 +- src/rw/Lights.cpp | 23 +- src/rw/NodeName.cpp | 2 +- src/rw/RwHelper.cpp | 10 +- src/rw/RwMatFX.cpp | 9 +- src/rw/TexRead.cpp | 16 +- src/rw/TxdStore.cpp | 24 +- src/rw/VisibilityPlugins.cpp | 58 +-- src/rw/rw.cpp | 808 +-------------------------------- src/save/GenericGameStorage.cpp | 21 +- src/save/PCSave.cpp | 10 +- src/skel/events.cpp | 13 +- src/skel/skeleton.cpp | 25 +- src/skel/win/win.cpp | 63 +-- src/text/Messages.cpp | 32 +- src/text/Pager.cpp | 14 +- src/text/Text.cpp | 20 +- src/vehicles/Automobile.cpp | 87 +--- src/vehicles/Boat.cpp | 23 +- src/vehicles/CarGen.cpp | 9 +- src/vehicles/Cranes.cpp | 2 +- src/vehicles/DamageManager.cpp | 23 +- src/vehicles/Door.cpp | 18 +- src/vehicles/Floater.cpp | 11 +- src/vehicles/HandlingMgr.cpp | 10 +- src/vehicles/Heli.cpp | 23 +- src/vehicles/Plane.cpp | 23 +- src/vehicles/Train.cpp | 31 +- src/vehicles/Transmission.cpp | 7 +- src/vehicles/Vehicle.cpp | 49 +- src/weapons/BulletInfo.cpp | 2 +- src/weapons/Explosion.cpp | 17 +- src/weapons/ProjectileInfo.cpp | 15 +- src/weapons/ShotInfo.cpp | 11 +- src/weapons/Weapon.cpp | 38 +- src/weapons/WeaponEffects.cpp | 14 +- src/weapons/WeaponInfo.cpp | 13 +- 174 files changed, 244 insertions(+), 4689 deletions(-) diff --git a/premake5.lua b/premake5.lua index cebc8ee9..586996f8 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,7 +1,7 @@ Librw = os.getenv("LIBRW") workspace "re3" - configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW", "DebugLIBRW" } + configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" } location "build" files { "src/*.*" } @@ -51,20 +51,20 @@ workspace "re3" libdirs { "dxsdk/lib" } libdirs { "milessdk/lib" } - filter "configurations:*LIBRW" - files { "src/fakerw/*.*" } - includedirs { "src/fakerw" } - includedirs { Librw } - libdirs { path.join(Librw, "lib/win-x86-d3d9/Debug") } - links { "rw", "d3d9" } - - filter "configurations:not *LIBRW" - includedirs { "rwsdk/include/d3d8" } - - filter "configurations:DebugRW or configurations:ReleaseRW" - defines { "RWLIBS" } - libdirs { "rwsdk/lib/d3d8/release" } - links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp" } + filter "configurations:Debug or Release" + files { "src/fakerw/*.*" } + includedirs { "src/fakerw" } + includedirs { "librw" } + includedirs { "librw/src" } + libdirs { path.join("librw", "lib/win-x86-d3d9/%{cfg.buildcfg}") } + links { "rw", "d3d9" } + filter {} + + filter "configurations:DebugRW or ReleaseRW" + defines { "RWLIBS" } + includedirs { "rwsdk/include/d3d8" } + libdirs { "rwsdk/lib/d3d8/release" } + links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp" } filter {} @@ -95,49 +95,43 @@ workspace "re3" end project "re3" - kind "SharedLib" + kind "WindowedApp" language "C++" targetname "re3" targetdir "bin/%{cfg.buildcfg}" - targetextension ".dll" + targetextension ".exe" characterset ("MBCS") linkoptions "/SAFESEH:NO" filter "configurations:Debug" - defines { "DEBUG" } - staticruntime "on" + defines { "DEBUG", "LIBRW", "RW_D3D9" } + staticruntime "off" symbols "Full" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/") + setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "") filter "configurations:Release" - defines { "NDEBUG" } + defines { "NDEBUG", "LIBRW", "RW_D3D9" } optimize "On" - staticruntime "on" + staticruntime "off" symbols "Full" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/") + setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "") filter "configurations:ReleaseFH" defines { "NDEBUG" } symbols "Full" optimize "off" staticruntime "on" - targetextension ".asi" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "scripts/") + setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "") filter "configurations:DebugRW" defines { "DEBUG" } staticruntime "on" symbols "On" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/") + setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "") filter "configurations:ReleaseRW" defines { "NDEBUG" } optimize "On" staticruntime "on" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/") - - filter "configurations:DebugLIBRW" - defines { "DEBUG", "LIBRW", "RW_D3D9" } - symbols "On" - setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/") + setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "") diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp index ecdebd29..e65bdf8d 100644 --- a/src/animation/AnimBlendAssocGroup.cpp +++ b/src/animation/AnimBlendAssocGroup.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "ModelInfo.h" #include "AnimManager.h" @@ -148,15 +148,3 @@ CAnimBlendAssocGroup::CreateAssociations(const char *blockName, RpClump *clump, } numAssociations = numAssocs; } - - - -STARTPATCHES - InjectHook(0x4012D0, &CAnimBlendAssocGroup::DestroyAssociations, PATCH_JUMP); - InjectHook(0x4013D0, (CAnimBlendAssociation *(CAnimBlendAssocGroup::*)(uint32))&CAnimBlendAssocGroup::GetAnimation, PATCH_JUMP); - InjectHook(0x401300, (CAnimBlendAssociation *(CAnimBlendAssocGroup::*)(const char*))&CAnimBlendAssocGroup::GetAnimation, PATCH_JUMP); - InjectHook(0x401420, (CAnimBlendAssociation *(CAnimBlendAssocGroup::*)(uint32))&CAnimBlendAssocGroup::CopyAnimation, PATCH_JUMP); - InjectHook(0x4013E0, (CAnimBlendAssociation *(CAnimBlendAssocGroup::*)(const char*))&CAnimBlendAssocGroup::CopyAnimation, PATCH_JUMP); - InjectHook(0x401130, (void (CAnimBlendAssocGroup::*)(const char*))&CAnimBlendAssocGroup::CreateAssociations, PATCH_JUMP); - InjectHook(0x401220, (void (CAnimBlendAssocGroup::*)(const char*, RpClump*, const char**, int))&CAnimBlendAssocGroup::CreateAssociations, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimBlendAssociation.cpp b/src/animation/AnimBlendAssociation.cpp index 246322ba..fb8c16d7 100644 --- a/src/animation/AnimBlendAssociation.cpp +++ b/src/animation/AnimBlendAssociation.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendHierarchy.h" #include "AnimBlendClumpData.h" #include "RpAnimBlend.h" @@ -202,33 +202,3 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta) return true; } - -#include - -class CAnimBlendAssociation_ : public CAnimBlendAssociation -{ -public: - CAnimBlendAssociation *ctor1(void) { return ::new (this) CAnimBlendAssociation(); } - CAnimBlendAssociation *ctor2(CAnimBlendAssociation &other) { return ::new (this) CAnimBlendAssociation(other); } - void dtor(void) { this->CAnimBlendAssociation::~CAnimBlendAssociation(); } -}; - -STARTPATCHES - InjectHook(0x4016A0, &CAnimBlendAssociation::AllocateAnimBlendNodeArray, PATCH_JUMP); - InjectHook(0x4016F0, &CAnimBlendAssociation::FreeAnimBlendNodeArray, PATCH_JUMP); - InjectHook(0x4017B0, &CAnimBlendAssociation::GetNode, PATCH_JUMP); - InjectHook(0x401560, (void (CAnimBlendAssociation::*)(RpClump*, CAnimBlendHierarchy*))&CAnimBlendAssociation::Init, PATCH_JUMP); - InjectHook(0x401620, (void (CAnimBlendAssociation::*)(CAnimBlendAssociation&))&CAnimBlendAssociation::Init, PATCH_JUMP); - InjectHook(0x4017E0, &CAnimBlendAssociation::SetBlend, PATCH_JUMP); - InjectHook(0x401820, &CAnimBlendAssociation::SetFinishCallback, PATCH_JUMP); - InjectHook(0x401800, &CAnimBlendAssociation::SetDeleteCallback, PATCH_JUMP); - InjectHook(0x401700, &CAnimBlendAssociation::SetCurrentTime, PATCH_JUMP); - InjectHook(0x401780, &CAnimBlendAssociation::SyncAnimation, PATCH_JUMP); - InjectHook(0x4017D0, &CAnimBlendAssociation::Start, PATCH_JUMP); - InjectHook(0x4031F0, &CAnimBlendAssociation::UpdateTime, PATCH_JUMP); - InjectHook(0x4032B0, &CAnimBlendAssociation::UpdateBlend, PATCH_JUMP); - - InjectHook(0x401460, &CAnimBlendAssociation_::ctor1, PATCH_JUMP); - InjectHook(0x4014C0, &CAnimBlendAssociation_::ctor2, PATCH_JUMP); - InjectHook(0x401520, &CAnimBlendAssociation_::dtor, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimBlendClumpData.cpp b/src/animation/AnimBlendClumpData.cpp index cc4281d6..d40e8357 100644 --- a/src/animation/AnimBlendClumpData.cpp +++ b/src/animation/AnimBlendClumpData.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendClumpData.h" #include "RwHelper.h" @@ -35,20 +35,3 @@ CAnimBlendClumpData::ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void * for(i = 0; i < numFrames; i++) cb(&frames[i], arg); } - -#include - -class CAnimBlendClumpData_ : public CAnimBlendClumpData -{ -public: - CAnimBlendClumpData *ctor(void) { return ::new (this) CAnimBlendClumpData(); } - void dtor(void) { this->CAnimBlendClumpData::~CAnimBlendClumpData(); } -}; - - -STARTPATCHES - InjectHook(0x401880, &CAnimBlendClumpData_::ctor, PATCH_JUMP); - InjectHook(0x4018B0, &CAnimBlendClumpData_::dtor, PATCH_JUMP); - InjectHook(0x4018F0, &CAnimBlendClumpData::SetNumberOfFrames, PATCH_JUMP); - InjectHook(0x401930, &CAnimBlendClumpData::ForAllFrames, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimBlendHierarchy.cpp b/src/animation/AnimBlendHierarchy.cpp index e4bcdc69..7f39d37a 100644 --- a/src/animation/AnimBlendHierarchy.cpp +++ b/src/animation/AnimBlendHierarchy.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendSequence.h" #include "AnimBlendHierarchy.h" @@ -72,13 +72,3 @@ CAnimBlendHierarchy::RemoveUncompressedData(void) // useless compressed = 1; } - -STARTPATCHES - InjectHook(0x4019A0, &CAnimBlendHierarchy::Shutdown, PATCH_JUMP); - InjectHook(0x4019C0, &CAnimBlendHierarchy::SetName, PATCH_JUMP); - InjectHook(0x4019E0, &CAnimBlendHierarchy::CalcTotalTime, PATCH_JUMP); - InjectHook(0x401A80, &CAnimBlendHierarchy::RemoveQuaternionFlips, PATCH_JUMP); - InjectHook(0x401AB0, &CAnimBlendHierarchy::RemoveAnimSequences, PATCH_JUMP); - InjectHook(0x401AD0, &CAnimBlendHierarchy::Uncompress, PATCH_JUMP); - InjectHook(0x401B00, &CAnimBlendHierarchy::RemoveUncompressedData, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimBlendNode.cpp b/src/animation/AnimBlendNode.cpp index be5fcc9c..193e9176 100644 --- a/src/animation/AnimBlendNode.cpp +++ b/src/animation/AnimBlendNode.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendAssociation.h" #include "AnimBlendNode.h" @@ -158,13 +158,3 @@ CAnimBlendNode::GetEndTranslation(CVector &trans, float weight) trans = kf->translation * blend; } } - -STARTPATCHES - InjectHook(0x401B10, &CAnimBlendNode::Init, PATCH_JUMP); - InjectHook(0x401B30, &CAnimBlendNode::Update, PATCH_JUMP); - InjectHook(0x401DC0, &CAnimBlendNode::NextKeyFrame, PATCH_JUMP); - InjectHook(0x4021B0, &CAnimBlendNode::FindKeyFrame, PATCH_JUMP); - InjectHook(0x401E70, &CAnimBlendNode::CalcDeltas, PATCH_JUMP); - InjectHook(0x401FE0, &CAnimBlendNode::GetCurrentTranslation, PATCH_JUMP); - InjectHook(0x402110, &CAnimBlendNode::GetEndTranslation, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimBlendSequence.cpp b/src/animation/AnimBlendSequence.cpp index 4b675774..4578ec50 100644 --- a/src/animation/AnimBlendSequence.cpp +++ b/src/animation/AnimBlendSequence.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendSequence.h" CAnimBlendSequence::CAnimBlendSequence(void) @@ -60,9 +60,3 @@ CAnimBlendSequence::RemoveQuaternionFlips(void) last = frame->rotation; } } - -STARTPATCHES - InjectHook(0x402330, &CAnimBlendSequence::SetName, PATCH_JUMP); - InjectHook(0x402350, &CAnimBlendSequence::SetNumFrames, PATCH_JUMP); - InjectHook(0x4023A0, &CAnimBlendSequence::RemoveQuaternionFlips, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 82343e93..7c09b0dd 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "ModelInfo.h" #include "ModelIndices.h" @@ -909,23 +909,3 @@ CAnimManager::RemoveLastAnimFile(void) for(i = 0; i < ms_aAnimBlocks[ms_numAnimBlocks].numAnims; i++) ms_aAnimations[ms_aAnimBlocks[ms_numAnimBlocks].firstIndex + i].RemoveAnimSequences(); } - - -STARTPATCHES - InjectHook(0x403380, CAnimManager::Initialise, PATCH_JUMP); - InjectHook(0x4033B0, CAnimManager::Shutdown, PATCH_JUMP); - InjectHook(0x403410, CAnimManager::UncompressAnimation, PATCH_JUMP); - InjectHook(0x4034A0, CAnimManager::GetAnimationBlock, PATCH_JUMP); - InjectHook(0x4034F0, (CAnimBlendHierarchy *(*)(const char*, CAnimBlock*))CAnimManager::GetAnimation, PATCH_JUMP); - InjectHook(0x4035B0, CAnimManager::GetAnimGroupName, PATCH_JUMP); - InjectHook(0x4035C0, CAnimManager::CreateAnimAssociation, PATCH_JUMP); - InjectHook(0x4035E0, (CAnimBlendAssociation *(*)(AssocGroupId, AnimationId))CAnimManager::GetAnimAssociation, PATCH_JUMP); - InjectHook(0x403600, (CAnimBlendAssociation *(*)(AssocGroupId, const char*))CAnimManager::GetAnimAssociation, PATCH_JUMP); - InjectHook(0x403620, CAnimManager::AddAnimation, PATCH_JUMP); - InjectHook(0x4036A0, CAnimManager::AddAnimationAndSync, PATCH_JUMP); - InjectHook(0x403710, CAnimManager::BlendAnimation, PATCH_JUMP); - InjectHook(0x4038F0, CAnimManager::LoadAnimFiles, PATCH_JUMP); - InjectHook(0x403A10, (void (*)(const char *))CAnimManager::LoadAnimFile, PATCH_JUMP); - InjectHook(0x403A40, (void (*)(int, bool))CAnimManager::LoadAnimFile, PATCH_JUMP); - InjectHook(0x404320, CAnimManager::RemoveLastAnimFile, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp index 5c0daaf0..6d9b9755 100644 --- a/src/animation/CutsceneMgr.cpp +++ b/src/animation/CutsceneMgr.cpp @@ -1,6 +1,6 @@ #define WITHWINDOWS // just for VK_SPACE #include "common.h" -#include "patcher.h" + #include "General.h" #include "CutsceneMgr.h" #include "Directory.h" @@ -423,19 +423,3 @@ CCutsceneMgr::Update(void) bool CCutsceneMgr::HasCutsceneFinished(void) { return TheCamera.GetPositionAlongSpline() == 1.0f; } -STARTPATCHES - InjectHook(0x4045D0, &CCutsceneMgr::Initialise, PATCH_JUMP); - InjectHook(0x404630, &CCutsceneMgr::Shutdown, PATCH_JUMP); - InjectHook(0x404650, &CCutsceneMgr::LoadCutsceneData, PATCH_JUMP); - InjectHook(0x405140, &CCutsceneMgr::FinishCutscene, PATCH_JUMP); - InjectHook(0x404D80, &CCutsceneMgr::SetHeadAnim, PATCH_JUMP); - InjectHook(0x404DC0, &CCutsceneMgr::SetupCutsceneToStart, PATCH_JUMP); - InjectHook(0x404D20, &CCutsceneMgr::SetCutsceneAnim, PATCH_JUMP); - InjectHook(0x404CD0, &CCutsceneMgr::AddCutsceneHead, PATCH_JUMP); - InjectHook(0x404BE0, &CCutsceneMgr::CreateCutsceneObject, PATCH_JUMP); - InjectHook(0x4048E0, &CCutsceneMgr::DeleteCutsceneData, PATCH_JUMP); - InjectHook(0x404EE0, &CCutsceneMgr::Update, PATCH_JUMP); - InjectHook(0x4051B0, &CCutsceneMgr::GetCutsceneTimeInMilleseconds, PATCH_JUMP); - InjectHook(0x4051F0, &CCutsceneMgr::HasCutsceneFinished, PATCH_JUMP); - InjectHook(0x404B40, &CalculateBoundingSphereRadiusCB, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp index 393d22a8..df45bfb5 100644 --- a/src/animation/FrameUpdate.cpp +++ b/src/animation/FrameUpdate.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "NodeName.h" #include "VisibilityPlugins.h" #include "AnimBlendClumpData.h" @@ -220,9 +220,3 @@ FrameUpdateCallBackWith3dVelocityExtraction(AnimBlendFrameData *frame, void *arg } RwMatrixUpdate(mat); } - -STARTPATCHES - InjectHook(0x4025F0, FrameUpdateCallBack, PATCH_JUMP); - InjectHook(0x4028B0, FrameUpdateCallBackWithVelocityExtraction, PATCH_JUMP); - InjectHook(0x402D40, FrameUpdateCallBackWith3dVelocityExtraction, PATCH_JUMP); -ENDPATCHES diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 07b8e7d8..20290666 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "NodeName.h" #include "VisibilityPlugins.h" @@ -378,26 +378,3 @@ RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta) } RwFrameUpdateObjects(RpClumpGetFrame(clump)); } - - -STARTPATCHES - InjectHook(0x4052D0, RpAnimBlendPluginAttach, PATCH_JUMP); - InjectHook(0x4052A0, RpAnimBlendAllocateData, PATCH_JUMP); - InjectHook(0x405780, (CAnimBlendAssociation *(*)(CAnimBlendAssociation*))RpAnimBlendGetNextAssociation, PATCH_JUMP); - InjectHook(0x4057A0, (CAnimBlendAssociation *(*)(CAnimBlendAssociation*,uint32))RpAnimBlendGetNextAssociation, PATCH_JUMP); - - InjectHook(0x405520, RpAnimBlendClumpSetBlendDeltas, PATCH_JUMP); - InjectHook(0x405560, RpAnimBlendClumpRemoveAllAssociations, PATCH_JUMP); - InjectHook(0x405570, RpAnimBlendClumpRemoveAssociations, PATCH_JUMP); - InjectHook(0x405480, RpAnimBlendClumpInit, PATCH_JUMP); - InjectHook(0x405500, RpAnimBlendClumpIsInitialized, PATCH_JUMP); - InjectHook(0x4055C0, RpAnimBlendClumpGetAssociation, PATCH_JUMP); - InjectHook(0x4055F0, RpAnimBlendClumpGetMainAssociation, PATCH_JUMP); - InjectHook(0x405680, RpAnimBlendClumpGetMainPartialAssociation, PATCH_JUMP); - InjectHook(0x4056D0, RpAnimBlendClumpGetMainAssociation_N, PATCH_JUMP); - InjectHook(0x405710, RpAnimBlendClumpGetMainPartialAssociation_N, PATCH_JUMP); - InjectHook(0x405750, (CAnimBlendAssociation *(*)(RpClump*, uint32))RpAnimBlendClumpGetFirstAssociation, PATCH_JUMP); - InjectHook(0x4031B0, (CAnimBlendAssociation *(*)(RpClump*))RpAnimBlendClumpGetFirstAssociation, PATCH_JUMP); - InjectHook(0x405460, RpAnimBlendClumpFillFrameArray, PATCH_JUMP); - InjectHook(0x4024B0, RpAnimBlendClumpUpdateAnimations, PATCH_JUMP); -ENDPATCHES diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index fecd079e..ac8e04c3 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "Entity.h" #include "AudioCollision.h" @@ -406,14 +406,3 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface m_sCollisionManager.AddCollisionToRequestedQueue(); } } - -STARTPATCHES -InjectHook(0x5685E0, &cAudioCollisionManager::AddCollisionToRequestedQueue, PATCH_JUMP); -InjectHook(0x569060, &cAudioManager::GetCollisionOneShotRatio, PATCH_JUMP); -InjectHook(0x5693B0, &cAudioManager::GetCollisionRatio, PATCH_JUMP); -InjectHook(0x568410, &cAudioManager::ReportCollision, PATCH_JUMP); -InjectHook(0x5686D0, &cAudioManager::ServiceCollisions, PATCH_JUMP); -InjectHook(0x568E20, &cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol, PATCH_JUMP); -InjectHook(0x568D30, &cAudioManager::SetUpLoopingCollisionSound, PATCH_JUMP); -InjectHook(0x5689D0, &cAudioManager::SetUpOneShotCollisionSound, PATCH_JUMP); -ENDPATCHES diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 2ee7e602..4d5f8474 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "audio_enums.h" #include "AudioManager.h" @@ -10147,217 +10147,3 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa quatIntensity; return emittingVolume; } - -// STARTPATCHES -// InjectHook(0x57B210, &cAudioManager::AddDetailsToRequestedOrderList, PATCH_JUMP); -// InjectHook(0x56AD30, &cAudioManager::AddPlayerCarSample, PATCH_JUMP); -// InjectHook(0x57B300, &cAudioManager::AddReflectionsToRequestedQueue, PATCH_JUMP); -// InjectHook(0x57B8D0, &cAudioManager::AddReleasingSounds, PATCH_JUMP); -// InjectHook(0x57B070, &cAudioManager::AddSampleToRequestedQueue, PATCH_JUMP); -// InjectHook(0x5697A0, &cAudioManager::CalculateDistance, PATCH_JUMP); -// InjectHook(0x57AA10, &cAudioManager::CheckForAnAudioFileOnCD, PATCH_JUMP); -// InjectHook(0x57C160, &cAudioManager::ClearActiveSamples, PATCH_JUMP); -// InjectHook(0x5796A0, &cAudioManager::ClearMissionAudio, PATCH_JUMP); -// InjectHook(0x57C120, &cAudioManager::ClearRequestedQueue, PATCH_JUMP); -// InjectHook(0x57AE00, &cAudioManager::ComputeDopplerEffectedFrequency, PATCH_JUMP); -// InjectHook(0x57AD20, &cAudioManager::ComputePan, PATCH_JUMP); -// InjectHook(0x57ABB0, &cAudioManager::ComputeVolume, PATCH_JUMP); -// InjectHook(0x57A310, &cAudioManager::CreateEntity, PATCH_JUMP); -// InjectHook(0x57A830, &cAudioManager::DestroyAllGameCreatedEntities, PATCH_JUMP); -// InjectHook(0x57A400, &cAudioManager::DestroyEntity, PATCH_JUMP); -// InjectHook(0x57C290, &cAudioManager::GenerateIntegerRandomNumberTable, PATCH_JUMP); -// InjectHook(0x57A8C0, &cAudioManager::Get3DProviderName, PATCH_JUMP); -// InjectHook(0x571110, &cAudioManager::GetArmyTalkSfx, PATCH_JUMP); -// InjectHook(0x573AB0, &cAudioManager::GetBlackBusinessFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x572050, &cAudioManager::GetBlackCasualFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574380, &cAudioManager::GetBlackConstructionWorkerTalkSfx, PATCH_JUMP); -// InjectHook(0x571D80, &cAudioManager::GetBlackCriminalTalkSfx, PATCH_JUMP); -// InjectHook(0x5735E0, &cAudioManager::GetBlackDockerMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5724D0, &cAudioManager::GetBlackFatFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5726C0, &cAudioManager::GetBlackFatMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5728B0, &cAudioManager::GetBlackFemaleProstituteTalkSfx, PATCH_JUMP); -// InjectHook(0x572C20, &cAudioManager::GetBlackProjectFemaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x572D20, &cAudioManager::GetBlackProjectFemaleYoungTalkSfx, PATCH_JUMP); -// InjectHook(0x572AF0, &cAudioManager::GetBlackProjectMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5739C0, &cAudioManager::GetBlackWorkerMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574FF0, &cAudioManager::GetBomberTalkSfx, PATCH_JUMP); -// InjectHook(0x5712C0, &cAudioManager::GetBusinessMaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x5713E0, &cAudioManager::GetBusinessMaleYoungTalkSfx, PATCH_JUMP); -// InjectHook(0x572040, &cAudioManager::GetCasualMaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x574FE0, &cAudioManager::GetCatatalinaTalkSfx, PATCH_JUMP); -// InjectHook(0x57AA30, &cAudioManager::GetCDAudioDriveLetter, PATCH_JUMP); -// InjectHook(0x573010, &cAudioManager::GetChinatownFemaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x5730F0, &cAudioManager::GetChinatownFemaleYoungTalkSfx, PATCH_JUMP); -// InjectHook(0x572E10, &cAudioManager::GetChinatownMaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x572F10, &cAudioManager::GetChinatownMaleYoungTalkSfx, PATCH_JUMP); -// InjectHook(0x575120, &cAudioManager::GetChunkyTalkSfx, PATCH_JUMP); -// InjectHook(0x571B00, &cAudioManager::GetColumbianTalkSfx, PATCH_JUMP); -// InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP); -// InjectHook(0x57A8F0, &cAudioManager::GetCurrent3DProviderIndex, PATCH_JUMP); -// InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP); -// InjectHook(0x569750, &cAudioManager::GetDistanceSquared, PATCH_JUMP); -// InjectHook(0x574DA0, &cAudioManager::GetEightTalkSfx, PATCH_JUMP); -// InjectHook(0x574040, &cAudioManager::GetFanFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x573F60, &cAudioManager::GetFanMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP); -// InjectHook(0x572280, &cAudioManager::GetFemaleNo3TalkSfx, PATCH_JUMP); -// InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP); -// InjectHook(0x574E50, &cAudioManager::GetFrankieTalkSfx, PATCH_JUMP); -// InjectHook(0x575510, &cAudioManager::GetGenericFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x571C30, &cAudioManager::GetHoodTalkSfx, PATCH_JUMP); -// InjectHook(0x5741F0, &cAudioManager::GetHospitalFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574120, &cAudioManager::GetHospitalMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x56F410, &cAudioManager::GetJumboTaxiFreq, PATCH_JUMP); -// InjectHook(0x573310, &cAudioManager::GetLittleItalyFemaleOldTalkSfx, PATCH_JUMP); -// InjectHook(0x573400, &cAudioManager::GetLittleItalyFemaleYoungTalkSfx, PATCH_JUMP); -// InjectHook(0x5731E0, &cAudioManager::GetLittleItalyMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP); -// InjectHook(0x571F40, &cAudioManager::GetMaleNo2TalkSfx, PATCH_JUMP); -// InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP); -// InjectHook(0x5795D0, &cAudioManager::GetMissionAudioLoadingStatus, PATCH_JUMP); -// InjectHook(0x574F00, &cAudioManager::GetMistyTalkSfx, PATCH_JUMP); -// InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x57A8A0, &cAudioManager::GetNum3DProvidersAvailable, PATCH_JUMP); -// InjectHook(0x574FD0, &cAudioManager::GetOJGTalkSfx, PATCH_JUMP); -// InjectHook(0x570960, &cAudioManager::GetPedCommentSfx, PATCH_JUMP); -// InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP); -// InjectHook(0x56BF80, &cAudioManager::GetVehicleDriveWheelSkidValue, PATCH_JUMP); -// InjectHook(0x56C120, &cAudioManager::GetVehicleNonDriveWheelSkidValue, PATCH_JUMP); -// InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP); -// InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP); -// InjectHook(0x5737E0, &cAudioManager::GetScumFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5736D0, &cAudioManager::GetScumMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x575060, &cAudioManager::GetSecurityGuardTalkSfx, PATCH_JUMP); -// InjectHook(0x574480, &cAudioManager::GetShopperFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574790, &cAudioManager::GetSpecialCharacterTalkSfx, PATCH_JUMP); -// InjectHook(0x573E90, &cAudioManager::GetStewardFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x573DC0, &cAudioManager::GetStewardMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574690, &cAudioManager::GetStudentFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574590, &cAudioManager::GetStudentMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x573CD0, &cAudioManager::GetSupermodelFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x573BD0, &cAudioManager::GetSupermodelMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP); -// InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP); -// InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP); -// InjectHook(0x5723A0, &cAudioManager::GetWhiteBusinessFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x572170, &cAudioManager::GetWhiteCasualFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x574290, &cAudioManager::GetWhiteConstructionWorkerTalkSfx, PATCH_JUMP); -// InjectHook(0x571E60, &cAudioManager::GetWhiteCriminalTalkSfx, PATCH_JUMP); -// InjectHook(0x5734F0, &cAudioManager::GetWhiteDockerMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5727B0, &cAudioManager::GetWhiteFatFemaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5725D0, &cAudioManager::GetWhiteFatMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5729D0, &cAudioManager::GetWhiteFemaleProstituteTalkSfx, PATCH_JUMP); -// InjectHook(0x5738D0, &cAudioManager::GetWhiteWorkerMaleTalkSfx, PATCH_JUMP); -// InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP); -// InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP); -// InjectHook(0x56CAB0, &cAudioManager::HasAirBrakes, PATCH_JUMP); -// InjectHook(0x57A0E0, &cAudioManager::Initialise, PATCH_JUMP); -// InjectHook(0x57B030, &cAudioManager::InterrogateAudioEntities, PATCH_JUMP); -// InjectHook(0x57AA50, &cAudioManager::IsAudioInitialised, PATCH_JUMP); -// InjectHook(0x579650, &cAudioManager::IsMissionAudioSampleFinished, PATCH_JUMP); -// InjectHook(0x57A9C0, &cAudioManager::IsMP3RadioChannelAvailable, PATCH_JUMP); -// InjectHook(0x579520, &cAudioManager::MissionScriptAudioUsesPoliceChannel, PATCH_JUMP); -// InjectHook(0x56AD10, &cAudioManager::PlayerJustGotInCar, PATCH_JUMP); -// InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP); -// InjectHook(0x579620, &cAudioManager::PlayLoadedMissionAudio, PATCH_JUMP); -// InjectHook(0x57A500, &cAudioManager::PlayOneShot, PATCH_JUMP); -// InjectHook(0x569420, &cAudioManager::PostInitialiseGameSpecificSetup, PATCH_JUMP); -// InjectHook(0x569640, &cAudioManager::PostTerminateGameSpecificShutdown, PATCH_JUMP); -// InjectHook(0x569400, &cAudioManager::PreInitialiseGameSpecificSetup, PATCH_JUMP); -// InjectHook(0x579550, &cAudioManager::PreloadMissionAudio, PATCH_JUMP); -// InjectHook(0x569570, &cAudioManager::PreTerminateGameSpecificShutdown, PATCH_JUMP); -// InjectHook(0x57BA60, &cAudioManager::ProcessActiveQueues, PATCH_JUMP); -// InjectHook(0x56C940, &cAudioManager::ProcessAirBrakes, PATCH_JUMP); -// InjectHook(0x577B30, &cAudioManager::ProcessAirportScriptObject, PATCH_JUMP); -// InjectHook(0x56DE80, &cAudioManager::ProcessBoatEngine, PATCH_JUMP); -// InjectHook(0x56E500, &cAudioManager::ProcessBoatMovingOverWater, PATCH_JUMP); -// InjectHook(0x5790D0, &cAudioManager::ProcessBridge, PATCH_JUMP); -// InjectHook(0x579250, &cAudioManager::ProcessBridgeMotor, PATCH_JUMP); -// InjectHook(0x579310, &cAudioManager::ProcessBridgeOneShots, PATCH_JUMP); -// InjectHook(0x579170, &cAudioManager::ProcessBridgeWarning, PATCH_JUMP); -// InjectHook(0x56CC20, &cAudioManager::ProcessCarBombTick, PATCH_JUMP); -// InjectHook(0x577CA0, &cAudioManager::ProcessCinemaScriptObject, PATCH_JUMP); -// InjectHook(0x577E50, &cAudioManager::ProcessDocksScriptObject, PATCH_JUMP); -// InjectHook(0x56CAF0, &cAudioManager::ProcessEngineDamage, PATCH_JUMP); -// InjectHook(0x569870, &cAudioManager::ProcessEntity, PATCH_JUMP); -// InjectHook(0x575AC0, &cAudioManager::ProcessExplosions, PATCH_JUMP); -// InjectHook(0x578FD0, &cAudioManager::ProcessFireHydrant, PATCH_JUMP); -// InjectHook(0x5785E0, &cAudioManager::ProcessFrontEnd, PATCH_JUMP); -// InjectHook(0x56E6A0, &cAudioManager::ProcessHelicopter, PATCH_JUMP); -// InjectHook(0x577FE0, &cAudioManager::ProcessHomeScriptObject, PATCH_JUMP); -// InjectHook(0x56E8F0, &cAudioManager::ProcessJumbo, PATCH_JUMP); -// InjectHook(0x56EA40, &cAudioManager::ProcessJumboAccel, PATCH_JUMP); -// InjectHook(0x56EE40, &cAudioManager::ProcessJumboDecel, PATCH_JUMP); -// InjectHook(0x56ECF0, &cAudioManager::ProcessJumboFlying, PATCH_JUMP); -// InjectHook(0x56ED10, &cAudioManager::ProcessJumboLanding, PATCH_JUMP); -// InjectHook(0x56EC00, &cAudioManager::ProcessJumboTakeOff, PATCH_JUMP); -// InjectHook(0x56EA10, &cAudioManager::ProcessJumboTaxi, PATCH_JUMP); -// InjectHook(0x5777E0, &cAudioManager::ProcessLaunderetteScriptObject, PATCH_JUMP); -// InjectHook(0x576770, &cAudioManager::ProcessLoopingScriptObject, PATCH_JUMP); -// InjectHook(0x5796E0, &cAudioManager::ProcessMissionAudio, PATCH_JUMP); -// InjectHook(0x56A050, &cAudioManager::ProcessModelCarEngine, PATCH_JUMP); -// InjectHook(0x5760C0, &cAudioManager::ProcessOneShotScriptObject, PATCH_JUMP); -// InjectHook(0x56F450, &cAudioManager::ProcessPed, PATCH_JUMP); -// InjectHook(0x56F4D0, &cAudioManager::ProcessPedHeadphones, PATCH_JUMP); -// InjectHook(0x56F650, &cAudioManager::ProcessPedOneShots, PATCH_JUMP); -// InjectHook(0x5699C0, &cAudioManager::ProcessPhysical, PATCH_JUMP); -// InjectHook(0x56E860, &cAudioManager::ProcessPlane, PATCH_JUMP); -// InjectHook(0x56B0D0, &cAudioManager::ProcessPlayersVehicleEngine, PATCH_JUMP); -// InjectHook(0x578190, &cAudioManager::ProcessPoliceCellBeatingScriptObject, PATCH_JUMP); -// InjectHook(0x577280, &cAudioManager::ProcessPornCinema, PATCH_JUMP); -// InjectHook(0x578A80, &cAudioManager::ProcessProjectiles, PATCH_JUMP); -// InjectHook(0x569CC0, &cAudioManager::ProcessRainOnVehicle, PATCH_JUMP); -// InjectHook(0x569700, &cAudioManager::ProcessReverb, PATCH_JUMP); -// InjectHook(0x569E50, &cAudioManager::ProcessReverseGear, PATCH_JUMP); -// InjectHook(0x577630, &cAudioManager::ProcessSawMillScriptObject, PATCH_JUMP); -// InjectHook(0x576070, &cAudioManager::ProcessScriptObject, PATCH_JUMP); -// InjectHook(0x577970, &cAudioManager::ProcessShopScriptObject, PATCH_JUMP); -// InjectHook(0x5697D0, &cAudioManager::ProcessSpecial, PATCH_JUMP); -// InjectHook(0x56DBF0, &cAudioManager::ProcessTrainNoise, PATCH_JUMP); -// InjectHook(0x569A00, &cAudioManager::ProcessVehicle, PATCH_JUMP); -// InjectHook(0x56C770, &cAudioManager::ProcessVehicleDoors, PATCH_JUMP); -// InjectHook(0x56C200, &cAudioManager::ProcessVehicleHorn, PATCH_JUMP); -// InjectHook(0x56C640, &cAudioManager::ProcessVehicleReverseWarning, PATCH_JUMP); -// InjectHook(0x56A230, &cAudioManager::ProcessVehicleRoadNoise, PATCH_JUMP); -// InjectHook(0x56C420, &cAudioManager::ProcessVehicleSirenOrAlarm, PATCH_JUMP); -// InjectHook(0x56BCB0, &cAudioManager::ProcessVehicleSkidding, PATCH_JUMP); -// InjectHook(0x575F30, &cAudioManager::ProcessWaterCannon, PATCH_JUMP); -// InjectHook(0x578370, &cAudioManager::ProcessWeather, PATCH_JUMP); -// InjectHook(0x56A440, &cAudioManager::ProcessWetRoadNoise, PATCH_JUMP); -// InjectHook(0x577530, &cAudioManager::ProcessWorkShopScriptObject, PATCH_JUMP); -// InjectHook(0x57AF90, &cAudioManager::RandomDisplacement, PATCH_JUMP); -// InjectHook(0x57A9F0, &cAudioManager::ReacquireDigitalHandle, PATCH_JUMP); -// InjectHook(0x57A9E0, &cAudioManager::ReleaseDigitalHandle, PATCH_JUMP); -// InjectHook(0x569650, &cAudioManager::ResetAudioLogicTimers, PATCH_JUMP); -// InjectHook(0x57A7B0, &cAudioManager::ResetTimers, PATCH_JUMP); -// InjectHook(0x57A2A0, &cAudioManager::Service, PATCH_JUMP); -// InjectHook(0x57AA60, &cAudioManager::ServiceSoundEffects, PATCH_JUMP); -// InjectHook(0x57A910, &cAudioManager::SetCurrent3DProvider, PATCH_JUMP); -// InjectHook(0x57AA00, &cAudioManager::SetDynamicAcousticModelingStatus, PATCH_JUMP); -// InjectHook(0x57A770, &cAudioManager::SetEffectsFadeVolume, PATCH_JUMP); -// InjectHook(0x57A730, &cAudioManager::SetEffectsMasterVolume, PATCH_JUMP); -// InjectHook(0x57A4C0, &cAudioManager::SetEntityStatus, PATCH_JUMP); -// InjectHook(0x5795F0, &cAudioManager::SetMissionAudioLocation, PATCH_JUMP); -// InjectHook(0x57A790, &cAudioManager::SetMusicFadeVolume, PATCH_JUMP); -// InjectHook(0x57A750, &cAudioManager::SetMusicMasterVolume, PATCH_JUMP); -// InjectHook(0x57A9A0, &cAudioManager::SetSpeakerConfig, PATCH_JUMP); -// InjectHook(0x56F230, &cAudioManager::SetupJumboFlySound, PATCH_JUMP); -// InjectHook(0x56F310, &cAudioManager::SetupJumboRumbleSound, PATCH_JUMP); -// InjectHook(0x56EF20, &cAudioManager::SetupJumboTaxiSound, PATCH_JUMP); -// InjectHook(0x56F070, &cAudioManager::SetupJumboWhineSound, PATCH_JUMP); -// InjectHook(0x570690, &cAudioManager::SetupPedComments, PATCH_JUMP); -// InjectHook(0x57A150, &cAudioManager::Terminate, PATCH_JUMP); -// InjectHook(0x57AC60, &cAudioManager::TranslateEntity, PATCH_JUMP); -// InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP); -// InjectHook(0x57B470, &cAudioManager::UpdateReflections, PATCH_JUMP); -// InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP); -// InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP); -// InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP); - -// InjectHook(0x57C2B0, &cAudioManager::AdjustSamplesVolume, PATCH_JUMP); -// InjectHook(0x57C320, &cAudioManager::ComputeEmittingVolume, PATCH_JUMP); - -// InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP); -// InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP); -// ENDPATCHES diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index da9e1d2e..3d84006d 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AudioScriptObject.h" #include "Pools.h" #include "DMAudio.h" @@ -86,10 +86,3 @@ PlayOneShotScriptObject(uint8 id, CVector const &pos) audioScriptObject->AudioEntity = AEHANDLE_NONE; DMAudio.CreateOneShotScriptObject(audioScriptObject); } - -STARTPATCHES -InjectHook(0x57C430, &cAudioScriptObject::Reset, PATCH_JUMP); -InjectHook(0x57C5F0, &PlayOneShotScriptObject, PATCH_JUMP); -InjectHook(0x57C560, &cAudioScriptObject::LoadAllAudioScriptObjects, PATCH_JUMP); -InjectHook(0x57c460, &cAudioScriptObject::SaveAllAudioScriptObjects, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index e55790ea..11c85dbd 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "MusicManager.h" #include "AudioManager.h" @@ -318,57 +318,3 @@ cDMAudio::SetRadioChannel(int8 radio, int32 pos) { MusicManager.SetRadioChannelByScript(radio, pos); } - -STARTPATCHES - InjectHook(0x57C760, &cDMAudio::Initialise, PATCH_JUMP); - InjectHook(0x57C780, &cDMAudio::Terminate, PATCH_JUMP); - InjectHook(0x57C7A0, &cDMAudio::Service, PATCH_JUMP); - InjectHook(0x57C7C0, &cDMAudio::CreateEntity, PATCH_JUMP); - InjectHook(0x57C7F0, &cDMAudio::DestroyEntity, PATCH_JUMP); - InjectHook(0x57C810, &cDMAudio::SetEntityStatus, PATCH_JUMP); - InjectHook(0x57C840, &cDMAudio::PlayOneShot, PATCH_JUMP); - InjectHook(0x57C870, &cDMAudio::DestroyAllGameCreatedEntities, PATCH_JUMP); - InjectHook(0x57C890, &cDMAudio::SetEffectsMasterVolume, PATCH_JUMP); - InjectHook(0x57C8C0, &cDMAudio::SetMusicMasterVolume, PATCH_JUMP); - InjectHook(0x57C8F0, &cDMAudio::SetEffectsFadeVol, PATCH_JUMP); - InjectHook(0x57C920, &cDMAudio::SetMusicFadeVol, PATCH_JUMP); - InjectHook(0x57C950, &cDMAudio::GetNum3DProvidersAvailable, PATCH_JUMP); - InjectHook(0x57C970, &cDMAudio::Get3DProviderName, PATCH_JUMP); - InjectHook(0x57C990, &cDMAudio::GetCurrent3DProviderIndex, PATCH_JUMP); - InjectHook(0x57C9B0, &cDMAudio::SetCurrent3DProvider, PATCH_JUMP); - InjectHook(0x57C9D0, &cDMAudio::SetSpeakerConfig, PATCH_JUMP); - InjectHook(0x57C9F0, &cDMAudio::IsMP3RadioChannelAvailable, PATCH_JUMP); - InjectHook(0x57CA10, &cDMAudio::ReleaseDigitalHandle, PATCH_JUMP); - InjectHook(0x57CA30, &cDMAudio::ReacquireDigitalHandle, PATCH_JUMP); - InjectHook(0x57CA50, &cDMAudio::SetDynamicAcousticModelingStatus, PATCH_JUMP); - InjectHook(0x57CA70, &cDMAudio::CheckForAnAudioFileOnCD, PATCH_JUMP); - InjectHook(0x57CA90, &cDMAudio::GetCDAudioDriveLetter, PATCH_JUMP); - InjectHook(0x57CAB0, &cDMAudio::IsAudioInitialised, PATCH_JUMP); - InjectHook(0x57CAD0, &cDMAudio::ReportCrime, PATCH_JUMP); - InjectHook(0x57CB00, &cDMAudio::CreateLoopingScriptObject, PATCH_JUMP); - InjectHook(0x57CB40, &cDMAudio::DestroyLoopingScriptObject, PATCH_JUMP); - InjectHook(0x57CB60, &cDMAudio::CreateOneShotScriptObject, PATCH_JUMP); - InjectHook(0x57CBB0, &cDMAudio::PlaySuspectLastSeen, PATCH_JUMP); - InjectHook(0x57CBE0, &cDMAudio::ReportCollision, PATCH_JUMP); - InjectHook(0x57CC20, &cDMAudio::PlayFrontEndSound, PATCH_JUMP); - InjectHook(0x57CC60, &cDMAudio::PlayRadioAnnouncement, PATCH_JUMP); - InjectHook(0x57CC80, &cDMAudio::PlayFrontEndTrack, PATCH_JUMP); - InjectHook(0x57CCB0, &cDMAudio::StopFrontEndTrack, PATCH_JUMP); - InjectHook(0x57CCD0, &cDMAudio::ResetTimers, PATCH_JUMP); - InjectHook(0x57CCF0, &cDMAudio::ChangeMusicMode, PATCH_JUMP); - InjectHook(0x57CD10, &cDMAudio::PreloadCutSceneMusic, PATCH_JUMP); - InjectHook(0x57CD30, &cDMAudio::PlayPreloadedCutSceneMusic, PATCH_JUMP); - InjectHook(0x57CD50, &cDMAudio::StopCutSceneMusic, PATCH_JUMP); - InjectHook(0x57CD70, &cDMAudio::PreloadMissionAudio, PATCH_JUMP); - InjectHook(0x57CD90, &cDMAudio::GetMissionAudioLoadingStatus, PATCH_JUMP); - InjectHook(0x57CDB0, &cDMAudio::SetMissionAudioLocation, PATCH_JUMP); - InjectHook(0x57CDE0, &cDMAudio::PlayLoadedMissionAudio, PATCH_JUMP); - InjectHook(0x57CE00, &cDMAudio::IsMissionAudioSampleFinished, PATCH_JUMP); - InjectHook(0x57CE20, &cDMAudio::ClearMissionAudio, PATCH_JUMP); - InjectHook(0x57CE40, &cDMAudio::GetRadioInCar, PATCH_JUMP); - InjectHook(0x57CE60, &cDMAudio::SetRadioInCar, PATCH_JUMP); - InjectHook(0x57CE80, &cDMAudio::SetRadioChannel, PATCH_JUMP); - - //InjectHook(0x57CEB0, `global constructor keyed to'dmaudio.cpp, PATCH_JUMP); - //InjectHook(0x57CED0, cDMAudio::~cDMAudio, PATCH_JUMP); -ENDPATCHES diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index d4b60d9b..2cc1d929 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -13,7 +13,7 @@ #include "Timer.h" #include "World.h" #include "sampman.h" -#include "patcher.h" + cMusicManager MusicManager; int32 gNumRetunePresses; @@ -904,34 +904,3 @@ cMusicManager::ChangeRadioChannel() } return true; } - -STARTPATCHES -InjectHook(0x57E4B0, &cMusicManager::PlayerInCar, PATCH_JUMP); -InjectHook(0x57E6D0, &cMusicManager::DisplayRadioStationName, PATCH_JUMP); -InjectHook(0x57CF70, &cMusicManager::Initialise, PATCH_JUMP); -InjectHook(0x57D140, &cMusicManager::Terminate, PATCH_JUMP); -InjectHook(0x57D1D0, &cMusicManager::GetRadioInCar, PATCH_JUMP); -InjectHook(0x57D2C0, &cMusicManager::SetRadioInCar, PATCH_JUMP); -InjectHook(0x57D180, &cMusicManager::SetRadioChannelByScript, PATCH_JUMP); -InjectHook(0x57CF30, &cMusicManager::ResetMusicAfterReload, PATCH_JUMP); -InjectHook(0x57E6A0, &cMusicManager::UsesPoliceRadio, PATCH_JUMP); -InjectHook(0x57D310, &cMusicManager::ChangeMusicMode, PATCH_JUMP); -InjectHook(0x57D420, &cMusicManager::ResetTimers, PATCH_JUMP); -InjectHook(0x57D440, &cMusicManager::Service, PATCH_JUMP); -InjectHook(0x57D530, &cMusicManager::ServiceFrontEndMode, PATCH_JUMP); -InjectHook(0x57E3D0, &cMusicManager::StopFrontEndTrack, PATCH_JUMP); -InjectHook(0x57E430, &cMusicManager::PlayAnnouncement, PATCH_JUMP); -InjectHook(0x57E2E0, &cMusicManager::PlayFrontEndTrack, PATCH_JUMP); -InjectHook(0x57E210, &cMusicManager::PreloadCutSceneMusic, PATCH_JUMP); -InjectHook(0x57E290, &cMusicManager::PlayPreloadedCutSceneMusic, PATCH_JUMP); -InjectHook(0x57E2B0, &cMusicManager::StopCutSceneMusic, PATCH_JUMP); -InjectHook(0x57E450, &cMusicManager::GetTrackStartPos, PATCH_JUMP); -InjectHook(0x57D690, &cMusicManager::ServiceGameMode, PATCH_JUMP); -InjectHook(0x57DCB0, &cMusicManager::ServiceAmbience, PATCH_JUMP); -InjectHook(0x57DEA0, &cMusicManager::ComputeAmbienceVol, PATCH_JUMP); -InjectHook(0x57E100, &cMusicManager::ServiceTrack, PATCH_JUMP); -InjectHook(0x57DFC0, &cMusicManager::ServiceAnnouncement, PATCH_JUMP); -InjectHook(0x57E530, &cMusicManager::GetCarTuning, PATCH_JUMP); -InjectHook(0x57E5A0, &cMusicManager::GetNextCarTuning, PATCH_JUMP); -InjectHook(0x57E130, &cMusicManager::ChangeRadioChannel, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index a81fcbe9..d9c6bfd7 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "AudioManager.h" #include "AudioSamples.h" @@ -774,19 +774,3 @@ cAudioManager::AgeCrimes() } } } - -STARTPATCHES -InjectHook(0x580AF0, &cAudioManager::AgeCrimes, PATCH_JUMP); -InjectHook(0x57F060, &cAudioManager::DoPoliceRadioCrackle, PATCH_JUMP); -InjectHook(0x57F050, &cAudioManager::GetMissionScriptPoliceAudioPlayingStatus, PATCH_JUMP); -InjectHook(0x57EEC0, &cAudioManager::InitialisePoliceRadio, PATCH_JUMP); -InjectHook(0x57EAC0, &cAudioManager::InitialisePoliceRadioZones, PATCH_JUMP); -InjectHook(0x580500, &cAudioManager::PlaySuspectLastSeen, PATCH_JUMP); -InjectHook(0x5803D0, &cAudioManager::ReportCrime, PATCH_JUMP); -InjectHook(0x57EFF0, &cAudioManager::ResetPoliceRadio, PATCH_JUMP); -InjectHook(0x57F110, &cAudioManager::ServicePoliceRadio, PATCH_JUMP); -InjectHook(0x57F1B0, &cAudioManager::ServicePoliceRadioChannel, PATCH_JUMP); -InjectHook(0x57F020, &cAudioManager::SetMissionScriptPoliceAudio, PATCH_JUMP); -InjectHook(0x57F5B0, &cAudioManager::SetupCrimeReport, PATCH_JUMP); -InjectHook(0x57FCC0, &cAudioManager::SetupSuspectLastSeenReport, PATCH_JUMP); -ENDPATCHES diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index 7887c363..d24de27f 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -13,7 +13,7 @@ #include "MusicManager.h" #include "Frontend.h" #include "Timer.h" -#include "patcher.h" + #pragma comment( lib, "mss32.lib" ) @@ -2236,66 +2236,3 @@ cSampleManager::InitialiseSampleBanks(void) return true; } - -STARTPATCHES - //InjectHook(0x565500, cSampleManager::cSampleManager, PATCH_JUMP); - //InjectHook(0x565510, cSampleManager::~cSampleManager, PATCH_JUMP); - InjectHook(0x565520, comp, PATCH_JUMP); - InjectHook(0x565540, add_providers, PATCH_JUMP); - InjectHook(0x565680, release_existing, PATCH_JUMP); - InjectHook(0x5656F0, set_new_provider, PATCH_JUMP); - InjectHook(0x565900, &cSampleManager::SetSpeakerConfig, PATCH_JUMP); - InjectHook(0x565970, &cSampleManager::GetMaximumSupportedChannels, PATCH_JUMP); - InjectHook(0x565990, &cSampleManager::GetCurrent3DProviderIndex, PATCH_JUMP); - InjectHook(0x5659A0, &cSampleManager::SetCurrent3DProvider, PATCH_JUMP); - InjectHook(0x565A10, _ResolveLink, PATCH_JUMP); - InjectHook(0x565B40, _FindMP3s, PATCH_JUMP); - InjectHook(0x566380, _DeleteMP3Entries, PATCH_JUMP); - InjectHook(0x566400, _GetMP3EntryByIndex, PATCH_JUMP); - InjectHook(0x566490, &cSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP); - InjectHook(0x5664B0, &cSampleManager::ReleaseDigitalHandle, PATCH_JUMP); - InjectHook(0x5664F0, &cSampleManager::ReacquireDigitalHandle, PATCH_JUMP); - InjectHook(0x566530, &cSampleManager::Initialise, PATCH_JUMP); - InjectHook(0x566DC0, &cSampleManager::Terminate, PATCH_JUMP); - InjectHook(0x566EA0, &cSampleManager::CheckForAnAudioFileOnCD, PATCH_JUMP); - InjectHook(0x566F20, &cSampleManager::GetCDAudioDriveLetter, PATCH_JUMP); - InjectHook(0x566F50, &cSampleManager::UpdateEffectsVolume, PATCH_JUMP); - InjectHook(0x567010, &cSampleManager::SetEffectsMasterVolume, PATCH_JUMP); - InjectHook(0x567020, &cSampleManager::SetMusicMasterVolume, PATCH_JUMP); - InjectHook(0x567030, &cSampleManager::SetEffectsFadeVolume, PATCH_JUMP); - InjectHook(0x567040, &cSampleManager::SetMusicFadeVolume, PATCH_JUMP); - InjectHook(0x567050, &cSampleManager::LoadSampleBank, PATCH_JUMP); - InjectHook(0x567110, &cSampleManager::UnloadSampleBank, PATCH_JUMP); - InjectHook(0x567130, &cSampleManager::IsSampleBankLoaded, PATCH_JUMP); - InjectHook(0x567150, &cSampleManager::IsPedCommentLoaded, PATCH_JUMP); - InjectHook(0x5671A0, &cSampleManager::LoadPedComment, PATCH_JUMP); - InjectHook(0x5672A0, &cSampleManager::GetSampleBaseFrequency, PATCH_JUMP); - InjectHook(0x5672C0, &cSampleManager::GetSampleLoopStartOffset, PATCH_JUMP); - InjectHook(0x5672E0, &cSampleManager::GetSampleLoopEndOffset, PATCH_JUMP); - InjectHook(0x567300, &cSampleManager::GetSampleLength, PATCH_JUMP); - InjectHook(0x567320, &cSampleManager::UpdateReverb, PATCH_JUMP); - InjectHook(0x567630, &cSampleManager::SetChannelReverbFlag, PATCH_JUMP); - InjectHook(0x5676A0, &cSampleManager::InitialiseChannel, PATCH_JUMP); - InjectHook(0x567820, &cSampleManager::SetChannelEmittingVolume, PATCH_JUMP); - InjectHook(0x567890, &cSampleManager::SetChannel3DPosition, PATCH_JUMP); - InjectHook(0x5678D0, &cSampleManager::SetChannel3DDistances, PATCH_JUMP); - InjectHook(0x567900, &cSampleManager::SetChannelVolume, PATCH_JUMP); - InjectHook(0x567980, &cSampleManager::SetChannelPan, PATCH_JUMP); - InjectHook(0x5679D0, &cSampleManager::SetChannelFrequency, PATCH_JUMP); - InjectHook(0x567A30, &cSampleManager::SetChannelLoopPoints, PATCH_JUMP); - InjectHook(0x567AA0, &cSampleManager::SetChannelLoopCount, PATCH_JUMP); - InjectHook(0x567B00, &cSampleManager::GetChannelUsedFlag, PATCH_JUMP); - InjectHook(0x567B80, &cSampleManager::StartChannel, PATCH_JUMP); - InjectHook(0x567BE0, &cSampleManager::StopChannel, PATCH_JUMP); - InjectHook(0x567C50, &cSampleManager::PreloadStreamedFile, PATCH_JUMP); - InjectHook(0x567D30, &cSampleManager::PauseStream, PATCH_JUMP); - InjectHook(0x567D60, &cSampleManager::StartPreloadedStreamedFile, PATCH_JUMP); - InjectHook(0x567D80, &cSampleManager::StartStreamedFile, PATCH_JUMP); - InjectHook(0x5680E0, &cSampleManager::StopStreamedFile, PATCH_JUMP); - InjectHook(0x568130, &cSampleManager::GetStreamedFilePosition, PATCH_JUMP); - InjectHook(0x5681D0, &cSampleManager::SetStreamedVolumeAndPan, PATCH_JUMP); - InjectHook(0x568270, &cSampleManager::GetStreamedFileLength, PATCH_JUMP); - InjectHook(0x568290, &cSampleManager::IsStreamPlaying, PATCH_JUMP); - InjectHook(0x5682D0, &cSampleManager::InitialiseSampleBanks, PATCH_JUMP); - //InjectHook(0x5683F0, `global constructor keyed to'sampman.cpp, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/AutoPilot.cpp b/src/control/AutoPilot.cpp index 65e73e5d..3fc9b154 100644 --- a/src/control/AutoPilot.cpp +++ b/src/control/AutoPilot.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AutoPilot.h" #include "CarCtrl.h" diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index 53cf6af2..8514ef9e 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Bridge.h" #include "Pools.h" #include "ModelIndices.h" @@ -144,11 +144,3 @@ bool CBridge::ThisIsABridgeObjectMovingUp(int index) return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP; } - -STARTPATCHES - InjectHook(0x413A30, &CBridge::Init, PATCH_JUMP); - InjectHook(0x413AC0, &CBridge::Update, PATCH_JUMP); - InjectHook(0x413D10, &CBridge::ShouldLightsBeFlashing, PATCH_JUMP); - InjectHook(0x413D20, &CBridge::FindBridgeEntities, PATCH_JUMP); - InjectHook(0x413DE0, &CBridge::ThisIsABridgeObjectMovingUp, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index f48e4c78..7c9a1ad4 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "CarAI.h" #include "Accident.h" @@ -636,6 +636,3 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle) } } } - -STARTPATCHES -ENDPATCHES diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 6e47670d..827c97e7 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "CarCtrl.h" #include "Accident.h" @@ -2736,20 +2736,3 @@ bool CCarCtrl::MapCouldMoveInThisArea(float x, float y) return x > -342.0f && x < -219.0f && y > -677.0f && y < -580.0f; } - -STARTPATCHES -InjectHook(0x416580, &CCarCtrl::GenerateRandomCars, PATCH_JUMP); -InjectHook(0x417EC0, &CCarCtrl::ChooseModel, PATCH_JUMP); -InjectHook(0x418320, &CCarCtrl::RemoveDistantCars, PATCH_JUMP); -InjectHook(0x418430, &CCarCtrl::PossiblyRemoveVehicle, PATCH_JUMP); -InjectHook(0x41D280, &CCarCtrl::Init, PATCH_JUMP); -InjectHook(0x41D3B0, &CCarCtrl::ReInit, PATCH_JUMP); -InjectHook(0x41E250, &CCarCtrl::SteerAIBoatWithPhysics, PATCH_JUMP); -InjectHook(0x41F6E0, &CCarCtrl::RegisterVehicleOfInterest, PATCH_JUMP); -InjectHook(0x41F780, &CCarCtrl::IsThisVehicleInteresting, PATCH_JUMP); -InjectHook(0x41F7A0, &CCarCtrl::RemoveFromInterestingVehicleList, PATCH_JUMP); -InjectHook(0x41F7D0, &CCarCtrl::ClearInterestingVehicleList, PATCH_JUMP); -InjectHook(0x41F7F0, &CCarCtrl::SwitchVehicleToRealPhysics, PATCH_JUMP); -InjectHook(0x41F820, &CCarCtrl::JoinCarWithRoadSystem, PATCH_JUMP); -InjectHook(0x41FA00, &CCarCtrl::JoinCarWithRoadSystemGotoCoors, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/Curves.cpp b/src/control/Curves.cpp index 5c6ef06d..623ab040 100644 --- a/src/control/Curves.cpp +++ b/src/control/Curves.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Curves.h" float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y) diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 3265d1c2..e81d4112 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Darkel.h" #include "PlayerPed.h" @@ -371,19 +371,3 @@ CDarkel::Update() DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0); } } - -STARTPATCHES - InjectHook(0x421380, CDarkel::CalcFade, PATCH_JUMP); - InjectHook(0x420650, CDarkel::Init, PATCH_JUMP); - InjectHook(0x420660, CDarkel::Update, PATCH_JUMP); - InjectHook(0x420E60, CDarkel::FrenzyOnGoing, PATCH_JUMP); - InjectHook(0x420E50, CDarkel::ReadStatus, PATCH_JUMP); - InjectHook(0x420E70, CDarkel::ResetOnPlayerDeath, PATCH_JUMP); - InjectHook(0x4210E0, CDarkel::StartFrenzy, PATCH_JUMP); - InjectHook(0x421370, CDarkel::QueryModelsKilledByPlayer, PATCH_JUMP); - InjectHook(0x421060, CDarkel::RegisterKillNotByPlayer, PATCH_JUMP); - InjectHook(0x421310, CDarkel::ResetModelsKilledByPlayer, PATCH_JUMP); - InjectHook(0x420920, CDarkel::DrawMessages, PATCH_JUMP); - InjectHook(0x421070, CDarkel::RegisterCarBlownUpByPlayer, PATCH_JUMP); - InjectHook(0x420F60, CDarkel::RegisterKillByPlayer, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 0cfaac17..e7f642fe 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "GameLogic.h" #include "Clock.h" #include "Stats.h" @@ -284,11 +284,3 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector CWorld::Remove(pPlayerPed); CWorld::Add(pPlayerPed); } - -STARTPATCHES - InjectHook(0x4213F0, &CGameLogic::InitAtStartOfGame, PATCH_JUMP); - InjectHook(0x421C00, &CGameLogic::PassTime, PATCH_JUMP); - InjectHook(0x421A20, &CGameLogic::SortOutStreamingAndMemory, PATCH_JUMP); - InjectHook(0x421400, &CGameLogic::Update, PATCH_JUMP); - InjectHook(0x421A60, &CGameLogic::RestorePlayerStuffDuringResurrection, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index cca8c3b8..1ee8f99c 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Garages.h" #include "main.h" @@ -2357,10 +2357,3 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_CRUSHERBODY || id == MI_CRUSHERLID; } - - -STARTPATCHES - InjectHook(0x427AB0, CGarages::IsPointInAGarageCameraZone, PATCH_JUMP); // CCamera::CamControl - InjectHook(0x427BC0, CGarages::CameraShouldBeOutside, PATCH_JUMP); // CCamera::CamControl - InjectHook(0x428940, CGarages::Load, PATCH_JUMP); // GenericLoad -ENDPATCHES diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp index 5406522c..d128efeb 100644 --- a/src/control/OnscreenTimer.cpp +++ b/src/control/OnscreenTimer.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "Hud.h" @@ -153,18 +153,3 @@ void COnscreenTimerEntry::ProcessForDisplayCounter() { uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset); sprintf(m_bCounterBuffer, "%d", counter); } - -STARTPATCHES - InjectHook(0x429160, &COnscreenTimerEntry::Process, PATCH_JUMP); - InjectHook(0x429110, &COnscreenTimerEntry::ProcessForDisplay, PATCH_JUMP); - InjectHook(0x429080, &COnscreenTimerEntry::ProcessForDisplayClock, PATCH_JUMP); - InjectHook(0x4290F0, &COnscreenTimerEntry::ProcessForDisplayCounter, PATCH_JUMP); - - InjectHook(0x429220, &COnscreenTimer::Init, PATCH_JUMP); - InjectHook(0x429320, &COnscreenTimer::Process, PATCH_JUMP); - InjectHook(0x4292E0, &COnscreenTimer::ProcessForDisplay, PATCH_JUMP); - InjectHook(0x429450, &COnscreenTimer::ClearCounter, PATCH_JUMP); - InjectHook(0x429410, &COnscreenTimer::ClearClock, PATCH_JUMP); - InjectHook(0x4293B0, &COnscreenTimer::AddCounter, PATCH_JUMP); - InjectHook(0x429350, &COnscreenTimer::AddClock, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index d9594490..9d0959a8 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "FileMgr.h" // only needed for empty function #include "Camera.h" @@ -1766,48 +1766,3 @@ CPathFind::DisplayPathData(void) } } } - -STARTPATCHES - InjectHook(0x42E680, &CPedPath::CalcPedRoute, PATCH_JUMP); - InjectHook(0x42F100, &CPedPath::AddNodeToPathList, PATCH_JUMP); - InjectHook(0x42F140, &CPedPath::RemoveNodeFromList, PATCH_JUMP); - InjectHook(0x42F160, &CPedPath::AddNodeToList, PATCH_JUMP); - InjectHook(0x42F1A0, &CPedPath::AddBlockade, PATCH_JUMP); - InjectHook(0x42F420, &CPedPath::AddBlockadeSectorList, PATCH_JUMP); - - InjectHook(0x4294A0, &CPathFind::Init, PATCH_JUMP); - InjectHook(0x42D580, &CPathFind::AllocatePathFindInfoMem, PATCH_JUMP); - InjectHook(0x429540, &CPathFind::RegisterMapObject, PATCH_JUMP); - InjectHook(0x42D7E0, &CPathFind::StoreNodeInfoPed, PATCH_JUMP); - InjectHook(0x42D690, &CPathFind::StoreNodeInfoCar, PATCH_JUMP); - InjectHook(0x429610, &CPathFind::PreparePathData, PATCH_JUMP); - InjectHook(0x42B810, &CPathFind::CountFloodFillGroups, PATCH_JUMP); - InjectHook(0x429C20, &CPathFind::PreparePathDataForType, PATCH_JUMP); - - InjectHook(0x42C990, &CPathFind::CalcRoadDensity, PATCH_JUMP); - InjectHook(0x42E1B0, &CPathFind::TestForPedTrafficLight, PATCH_JUMP); - InjectHook(0x42E340, &CPathFind::TestCrossesRoad, PATCH_JUMP); - InjectHook(0x42CBE0, &CPathFind::AddNodeToList, PATCH_JUMP); - InjectHook(0x42CBB0, &CPathFind::RemoveNodeFromList, PATCH_JUMP); - InjectHook(0x42B790, &CPathFind::RemoveBadStartNode, PATCH_JUMP); - InjectHook(0x42E3B0, &CPathFind::SetLinksBridgeLights, PATCH_JUMP); - InjectHook(0x42DED0, &CPathFind::SwitchOffNodeAndNeighbours, PATCH_JUMP); - InjectHook(0x42D960, &CPathFind::SwitchRoadsOffInArea, PATCH_JUMP); - InjectHook(0x42DA50, &CPathFind::SwitchPedRoadsOffInArea, PATCH_JUMP); - InjectHook(0x42DB50, &CPathFind::SwitchRoadsInAngledArea, PATCH_JUMP); - InjectHook(0x42E140, &CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours, PATCH_JUMP); - InjectHook(0x42DF50, &CPathFind::MarkRoadsBetweenLevelsInArea, PATCH_JUMP); - InjectHook(0x42E040, &CPathFind::PedMarkRoadsBetweenLevelsInArea, PATCH_JUMP); - InjectHook(0x42CC30, &CPathFind::FindNodeClosestToCoors, PATCH_JUMP); - InjectHook(0x42CDC0, &CPathFind::FindNodeClosestToCoorsFavourDirection, PATCH_JUMP); - InjectHook(0x42CFC0, &CPathFind::FindNodeOrientationForCarPlacement, PATCH_JUMP); - InjectHook(0x42D060, &CPathFind::FindNodeOrientationForCarPlacementFacingDestination, PATCH_JUMP); - InjectHook(0x42BF10, &CPathFind::NewGenerateCarCreationCoors, PATCH_JUMP); - InjectHook(0x42C1E0, &CPathFind::GeneratePedCreationCoors, PATCH_JUMP); - InjectHook(0x42D2A0, &CPathFind::FindRoadObjectClosestToCoors, PATCH_JUMP); - InjectHook(0x42B9F0, &CPathFind::FindNextNodeWandering, PATCH_JUMP); - InjectHook(0x42B040, &CPathFind::DoPathSearch, PATCH_JUMP); - InjectHook(0x42C8C0, &CPathFind::TestCoorsCloseness, PATCH_JUMP); - InjectHook(0x42E450, &CPathFind::Save, PATCH_JUMP); - InjectHook(0x42E550, &CPathFind::Load, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index 90939f0e..7fdc81c5 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Phones.h" #include "Pools.h" #include "ModelIndices.h" @@ -377,20 +377,3 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) CPhoneInfo::pCallBackPed = nil; } - -STARTPATCHES - InjectHook(0x42F720, &CPhoneInfo::FindNearestFreePhone, PATCH_JUMP); - InjectHook(0x42FD50, &CPhoneInfo::PhoneAtThisPosition, PATCH_JUMP); - InjectHook(0x42FFF0, &CPhoneInfo::HasMessageBeenDisplayed, PATCH_JUMP); - InjectHook(0x430030, &CPhoneInfo::IsMessageBeingDisplayed, PATCH_JUMP); - InjectHook(0x430120, &CPhoneInfo::Load, PATCH_JUMP); - InjectHook(0x42FF90, &CPhoneInfo::SetPhoneMessage_JustOnce, PATCH_JUMP); - InjectHook(0x42FF30, &CPhoneInfo::SetPhoneMessage_Repeatedly, PATCH_JUMP); - InjectHook(0x430060, &CPhoneInfo::Save, PATCH_JUMP); - InjectHook(0x42F710, &CPhoneInfo::Shutdown, PATCH_JUMP); - InjectHook(0x42F640, &CPhoneInfo::Initialise, PATCH_JUMP); - InjectHook(0x42FDB0, &CPhoneInfo::GrabPhone, PATCH_JUMP); - InjectHook(0x42F7A0, &CPhoneInfo::Update, PATCH_JUMP); - InjectHook(0x42F570, &PhonePutDownCB, PATCH_JUMP); - InjectHook(0x42F470, &PhonePickUpCB, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index d52c386c..9836c9c2 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Camera.h" @@ -1406,47 +1406,3 @@ CPacManPickups::ResetPowerPillsCarriedByPlayer() FindPlayerVehicle()->m_fForceMultiplier = 1.0f; } } - -STARTPATCHES - InjectHook(0x430220, CPickups::Init, PATCH_JUMP); - InjectHook(0x4303D0, CPickups::Update, PATCH_JUMP); - InjectHook(0x432440, CPickups::RenderPickUpText, PATCH_JUMP); - InjectHook(0x431C30, CPickups::DoCollectableEffects, PATCH_JUMP); - InjectHook(0x431F40, CPickups::DoMoneyEffects, PATCH_JUMP); - InjectHook(0x4321C0, CPickups::DoMineEffects, PATCH_JUMP); - InjectHook(0x431520, CPickups::DoPickUpEffects, PATCH_JUMP); - InjectHook(0x4304B0, CPickups::GenerateNewOne, PATCH_JUMP); - InjectHook(0x430660, CPickups::GenerateNewOne_WeaponType, PATCH_JUMP); - InjectHook(0x4307A0, CPickups::RemovePickUp, PATCH_JUMP); - InjectHook(0x430800, CPickups::RemoveAllFloatingPickups, PATCH_JUMP); - InjectHook(0x433D60, CPickups::AddToCollectedPickupsArray, PATCH_JUMP); - InjectHook(0x430770, CPickups::IsPickUpPickedUp, PATCH_JUMP); - InjectHook(0x430690, CPickups::ModelForWeapon, PATCH_JUMP); - InjectHook(0x4306F0, CPickups::WeaponForModel, PATCH_JUMP); - InjectHook(0x431510, CPickups::FindColourIndexForWeaponMI, PATCH_JUMP);/**/ - InjectHook(0x433DF0, CPickups::GetActualPickupIndex, PATCH_JUMP); - InjectHook(0x433DB0, CPickups::GetNewUniquePickupIndex, PATCH_JUMP); - InjectHook(0x433B60, CPickups::PassTime, PATCH_JUMP); - InjectHook(0x4339F0, CPickups::GivePlayerGoodiesWithPickUpMI, PATCH_JUMP); - InjectHook(0x433F60, CPickups::Load, PATCH_JUMP); - InjectHook(0x433E40, CPickups::Save, PATCH_JUMP); - InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP); - InjectHook(0x430860, &CPickup::Update, PATCH_JUMP); - InjectHook(0x4331B0, &CPacManPickup::Update, PATCH_JUMP); - InjectHook(0x432760, CPacManPickups::Init, PATCH_JUMP); - InjectHook(0x432800, CPacManPickups::Update, PATCH_JUMP); - InjectHook(0x432AE0, CPacManPickups::GeneratePMPickUps, PATCH_JUMP); - InjectHook(0x432D50, CPacManPickups::GeneratePMPickUpsForRace, PATCH_JUMP); - InjectHook(0x432F20, CPacManPickups::GenerateOnePMPickUp, PATCH_JUMP); - InjectHook(0x432F60, CPacManPickups::Render, PATCH_JUMP); - InjectHook(0x433150, CPacManPickups::ClearPMPickUps, PATCH_JUMP); - InjectHook(0x433340, CPacManPickups::StartPacManRace, PATCH_JUMP); - InjectHook(0x433360, CPacManPickups::StartPacManRecord, PATCH_JUMP); - InjectHook(0x4333A0, CPacManPickups::QueryPowerPillsEatenInRace, PATCH_JUMP); - InjectHook(0x4333B0, CPacManPickups::ResetPowerPillsEatenInRace, PATCH_JUMP); - InjectHook(0x4333C0, CPacManPickups::CleanUpPacManStuff, PATCH_JUMP); - InjectHook(0x4333D0, CPacManPickups::StartPacManScramble, PATCH_JUMP); - InjectHook(0x4333F0, CPacManPickups::QueryPowerPillsCarriedByPlayer, PATCH_JUMP); - InjectHook(0x433410, CPacManPickups::ResetPowerPillsCarriedByPlayer, PATCH_JUMP); - -ENDPATCHES diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 08e3c5b9..6687cbff 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Record.h" #include "FileMgr.h" diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp index f7d12702..9c749bd9 100644 --- a/src/control/Remote.cpp +++ b/src/control/Remote.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Automobile.h" #include "CarCtrl.h" #include "Camera.h" @@ -49,8 +49,3 @@ CRemote::TakeRemoteControlledCarFromPlayer(void) CWorld::Players[CWorld::PlayerInFocus].m_bInRemoteMode = true; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true; } - -STARTPATCHES - InjectHook(0x435C30, &CRemote::GivePlayerRemoteControlledCar, PATCH_JUMP); - InjectHook(0x435DA0, &CRemote::TakeRemoteControlledCarFromPlayer, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 0570f9a8..c67e7cbf 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "AnimBlendAssociation.h" #include "Boat.h" #include "SpecialFX.h" @@ -1570,16 +1570,3 @@ void CReplay::Display() if (Mode == MODE_PLAYBACK) CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY")); } - -STARTPATCHES -InjectHook(0x592FE0, &CReplay::Init, PATCH_JUMP); -InjectHook(0x593150, &CReplay::DisableReplays, PATCH_JUMP); -InjectHook(0x593160, &CReplay::EnableReplays, PATCH_JUMP); -InjectHook(0x593170, &CReplay::Update, PATCH_JUMP); -InjectHook(0x595B20, &CReplay::FinishPlayback, PATCH_JUMP); -InjectHook(0x595BD0, &CReplay::EmptyReplayBuffer, PATCH_JUMP); -InjectHook(0x595EE0, &CReplay::Display, PATCH_JUMP); -InjectHook(0x596030, &CReplay::TriggerPlayback, PATCH_JUMP); -InjectHook(0x597560, &CReplay::StreamAllNecessaryCarsAndPeds, PATCH_JUMP); -InjectHook(0x597680, &CReplay::ShouldStandardCameraBeProcessed, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp index 2730f5c0..2a31f8f1 100644 --- a/src/control/Restart.cpp +++ b/src/control/Restart.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Restart.h" #include "Zones.h" #include "PathFind.h" @@ -247,16 +247,3 @@ INITSAVEBUF WriteSaveBuf(buf, OverridePoliceStationLevel); VALIDATESAVEBUF(*size); } - - -STARTPATCHES - InjectHook(0x435E20, &CRestart::Initialise, PATCH_JUMP); - InjectHook(0x436100, &CRestart::AddHospitalRestartPoint, PATCH_JUMP); - InjectHook(0x436150, &CRestart::AddPoliceRestartPoint, PATCH_JUMP); - InjectHook(0x4366C0, &CRestart::OverrideNextRestart, PATCH_JUMP); - InjectHook(0x4366F0, &CRestart::CancelOverrideRestart, PATCH_JUMP); - InjectHook(0x4361A0, &CRestart::FindClosestHospitalRestartPoint, PATCH_JUMP); - InjectHook(0x436450, &CRestart::FindClosestPoliceRestartPoint, PATCH_JUMP); - InjectHook(0x436B20, &CRestart::LoadAllRestartPoints, PATCH_JUMP); - InjectHook(0x436700, &CRestart::SaveAllRestartPoints, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index fcfa42e3..7fb0c211 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "RoadBlocks.h" #include "PathFind.h" #include "ModelIndices.h" @@ -195,9 +195,3 @@ CRoadBlocks::GenerateRoadBlocks(void) } } } - -STARTPATCHES - InjectHook(0x436F50, &CRoadBlocks::Init, PATCH_JUMP); - InjectHook(0x4376A0, &CRoadBlocks::GenerateRoadBlockCopsForCar, PATCH_JUMP); - InjectHook(0x436FA0, &CRoadBlocks::GenerateRoadBlocks, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index 8d804e4d..571b526a 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "SceneEdit.h" #include "Automobile.h" diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d4ede846..6a8028a2 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1,6 +1,6 @@ #define WITHWINDOWS // for our script loading hack #include "common.h" -#include "patcher.h" + #include "Script.h" #include "ScriptCommands.h" @@ -11626,17 +11626,3 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript() MultiScriptArray[i] = Read4BytesFromScript(&ip); } } - -STARTPATCHES -InjectHook(0x438790, &CTheScripts::Init, PATCH_JUMP); -InjectHook(0x439040, &CTheScripts::Process, PATCH_JUMP); -InjectHook(0x439400, &CTheScripts::StartTestScript, PATCH_JUMP); -InjectHook(0x439410, &CTheScripts::IsPlayerOnAMission, PATCH_JUMP); -InjectHook(0x44FD10, &CTheScripts::UndoBuildingSwaps, PATCH_JUMP); -InjectHook(0x44FD60, &CTheScripts::UndoEntityInvisibilitySettings, PATCH_JUMP); -InjectHook(0x4534E0, &CTheScripts::ScriptDebugLine3D, PATCH_JUMP); -InjectHook(0x453550, &CTheScripts::RenderTheScriptDebugLines, PATCH_JUMP); -InjectHook(0x4535E0, &CTheScripts::SaveAllScripts, PATCH_JUMP); -InjectHook(0x453B30, &CTheScripts::LoadAllScripts, PATCH_JUMP); -InjectHook(0x454060, &CTheScripts::ClearSpaceForMissionEntity, PATCH_JUMP); -ENDPATCHES diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index ab9cd92d..096bb484 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Camera.h" #include "World.h" @@ -327,9 +327,3 @@ CTrafficLights::LightForCars2(void) else return CAR_LIGHTS_RED; } - -STARTPATCHES - InjectHook(0x455760, &CTrafficLights::LightForCars1, PATCH_JUMP); - InjectHook(0x455790, &CTrafficLights::LightForCars2, PATCH_JUMP); - InjectHook(0x4557D0, &CTrafficLights::LightForPeds, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Accident.cpp b/src/core/Accident.cpp index 3c39b11d..1fd6c123 100644 --- a/src/core/Accident.cpp +++ b/src/core/Accident.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Accident.h" #include "Ped.h" @@ -122,13 +122,3 @@ CAccidentManager::UnattendedAccidents() } return false; } - -STARTPATCHES - InjectHook(0x4565A0, &CAccidentManager::GetNextFreeAccident, PATCH_JUMP); - InjectHook(0x4565D0, &CAccidentManager::ReportAccident, PATCH_JUMP); - InjectHook(0x456710, &CAccidentManager::Update, PATCH_JUMP); - InjectHook(0x456760, &CAccidentManager::FindNearestAccident, PATCH_JUMP); - InjectHook(0x456880, &CAccidentManager::CountActiveAccidents, PATCH_JUMP); - InjectHook(0x4568A0, &CAccidentManager::WorkToDoForMedics, PATCH_JUMP); - InjectHook(0x4568D0, &CAccidentManager::UnattendedAccidents, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 1086db20..20e94bf4 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Font.h" #include "Pad.h" #include "Text.h" diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 4d954ccd..07dc2051 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Draw.h" #include "World.h" @@ -5236,55 +5236,3 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } } #endif - -STARTPATCHES - InjectHook(0x456F40, WellBufferMe, PATCH_JUMP); - InjectHook(0x458410, &CCam::Init, PATCH_JUMP); - InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP); - InjectHook(0x457710, &CCam::DoAverageOnVector, PATCH_JUMP); - InjectHook(0x458060, &CCam::GetPedBetaAngleForClearView, PATCH_JUMP); - InjectHook(0x457210, &CCam::Cam_On_A_String_Unobscured, PATCH_JUMP); - InjectHook(0x457A80, &CCam::FixCamWhenObscuredByVehicle, PATCH_JUMP); - InjectHook(0x457B90, &CCam::FixCamIfObscured, PATCH_JUMP); - InjectHook(0x465DA0, &CCam::RotCamIfInFrontCar, PATCH_JUMP); - InjectHook(0x4662D0, &CCam::WorkOutCamHeightWeeCar, PATCH_JUMP); - InjectHook(0x466650, &CCam::WorkOutCamHeight, PATCH_JUMP); - InjectHook(0x458600, &CCam::LookBehind, PATCH_JUMP); - InjectHook(0x458C40, &CCam::LookLeft, PATCH_JUMP); - InjectHook(0x458FB0, &CCam::LookRight, PATCH_JUMP); - InjectHook(0x4574C0, &CCam::ClipIfPedInFrontOfPlayer, PATCH_JUMP); - InjectHook(0x459300, &CCam::KeepTrackOfTheSpeed, PATCH_JUMP); - InjectHook(0x458580, &CCam::IsTargetInWater, PATCH_JUMP); - InjectHook(0x4570C0, &CCam::AvoidWallsTopDownPed, PATCH_JUMP); - InjectHook(0x4595B0, &CCam::PrintMode, PATCH_JUMP); - - InjectHook(0x467400, &CCam::ProcessSpecialHeightRoutines, PATCH_JUMP); - InjectHook(0x4596A0, &CCam::Process, PATCH_JUMP); - InjectHook(0x45E3A0, &CCam::Process_FollowPed, PATCH_JUMP); - InjectHook(0x45FF70, &CCam::Process_FollowPedWithMouse, PATCH_JUMP); - InjectHook(0x45BE60, &CCam::Process_BehindCar, PATCH_JUMP); - InjectHook(0x45C090, &CCam::Process_Cam_On_A_String, PATCH_JUMP); - InjectHook(0x463EB0, &CCam::Process_TopDown, PATCH_JUMP); - InjectHook(0x464390, &CCam::Process_TopDownPed, PATCH_JUMP); - InjectHook(0x461AF0, &CCam::Process_Rocket, PATCH_JUMP); - InjectHook(0x460E00, &CCam::Process_M16_1stPerson, PATCH_JUMP); - InjectHook(0x459FA0, &CCam::Process_1stPerson, PATCH_JUMP); - InjectHook(0x462420, &CCam::Process_Sniper, PATCH_JUMP); - InjectHook(0x463130, &CCam::Process_Syphon, PATCH_JUMP); - InjectHook(0x463A70, &CCam::Process_Syphon_Crim_In_Front, PATCH_JUMP); - InjectHook(0x45B470, &CCam::Process_BehindBoat, PATCH_JUMP); - InjectHook(0x45D2F0, &CCam::Process_Fight_Cam, PATCH_JUMP); - InjectHook(0x45DC20, &CCam::Process_FlyBy, PATCH_JUMP); - InjectHook(0x464D10, &CCam::Process_WheelCam, PATCH_JUMP); - InjectHook(0x45DA20, &CCam::Process_Fixed, PATCH_JUMP); - InjectHook(0x461940, &CCam::Process_Player_Fallen_Water, PATCH_JUMP); - InjectHook(0x45C400, &CCam::Process_Circle, PATCH_JUMP); - InjectHook(0x462FC0, &CCam::Process_SpecialFixedForSyphon, PATCH_JUMP); - InjectHook(0x45CCC0, &CCam::Process_Debug, PATCH_JUMP); - InjectHook(0x4656C0, &CCam::ProcessPedsDeadBaby, PATCH_JUMP); - InjectHook(0x465000, &CCam::ProcessArrestCamOne, PATCH_JUMP); - InjectHook(0x4653C0, &CCam::ProcessArrestCamTwo, PATCH_JUMP); - - InjectHook(0x456CE0, &FindSplinePathPositionFloat, PATCH_JUMP); - InjectHook(0x4569A0, &FindSplinePathPositionVector, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index a1f36d93..f1445d2e 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Draw.h" #include "World.h" @@ -3386,58 +3386,3 @@ CCamPathSplines::CCamPathSplines(void) for(i = 0; i < MAXPATHLENGTH; i++) m_arr_PathData[i] = 0.0f; } - - -STARTPATCHES - InjectHook(0x42C760, (bool (CCamera::*)(const CVector ¢er, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP); - InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP); - - InjectHook(0x46FD40, &CCamera::SetMotionBlur, PATCH_JUMP); - InjectHook(0x46FD80, &CCamera::SetMotionBlurAlpha, PATCH_JUMP); - InjectHook(0x46F940, &CCamera::RenderMotionBlur, PATCH_JUMP); - - InjectHook(0x46FC90, &CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString, PATCH_JUMP); - - InjectHook(0x46FF00, &CCamera::SetWideScreenOn, PATCH_JUMP); - InjectHook(0x46FF10, &CCamera::SetWideScreenOff, PATCH_JUMP); - - InjectHook(0x46FCC0, &CCamera::SetCamPositionForFixedMode, PATCH_JUMP); - InjectHook(0x46FEC0, &CCamera::SetRwCamera, PATCH_JUMP); - InjectHook(0x46B920, &CCamera::GetCutSceneFinishTime, PATCH_JUMP); - InjectHook(0x46B560, &CCamera::FinishCutscene, PATCH_JUMP); - InjectHook(0x46FF30, &CCamera::SetZoomValueFollowPedScript, PATCH_JUMP); - InjectHook(0x46FF90, &CCamera::SetZoomValueCamStringScript, PATCH_JUMP); - - - InjectHook(0x46F8E0, &CCamera::ProcessWideScreenOn, PATCH_JUMP); - InjectHook(0x46FDE0, &CCamera::SetParametersForScriptInterpolation, PATCH_JUMP); - InjectHook(0x46BA20, &CCamera::GetLookingLRBFirstPerson, PATCH_JUMP); - InjectHook(0x470D80, &CCamera::StartTransitionWhenNotFinishedInter, PATCH_JUMP); - InjectHook(0x46FFF0, &CCamera::StartTransition, PATCH_JUMP); - InjectHook(0x46BEB0, &CCamera::InitialiseCameraForDebugMode, PATCH_JUMP); - InjectHook(0x471500, &CCamera::TakeControl, PATCH_JUMP); - InjectHook(0x4715B0, &CCamera::TakeControlNoEntity, PATCH_JUMP); - InjectHook(0x46B3A0, &CCamera::Fade, PATCH_JUMP); - InjectHook(0x46FE20, &CCamera::SetPercentAlongCutScene, PATCH_JUMP); - InjectHook(0x46B100, &CamShakeNoPos, PATCH_JUMP); - InjectHook(0x46B200, &CCamera::CamShake, PATCH_JUMP); - InjectHook(0x46F520, &CCamera::ProcessObbeCinemaCameraPed, PATCH_JUMP); - InjectHook(0x46F3E0, &CCamera::ProcessObbeCinemaCameraCar, PATCH_JUMP); - InjectHook(0x470DA0, &CCamera::StoreValuesDuringInterPol, PATCH_JUMP); - InjectHook(0x46B430, &CCamera::DrawBordersForWideScreen, PATCH_JUMP); - InjectHook(0x46F990, &CCamera::Restore, PATCH_JUMP); - InjectHook(0x46FAE0, &CCamera::RestoreWithJumpCut, PATCH_JUMP); - InjectHook(0x46F080, &CCamera::ProcessFade, PATCH_JUMP); - InjectHook(0x46EEA0, &CCamera::CalculateDerivedValues, PATCH_JUMP); - InjectHook(0x46F1E0, &CCamera::ProcessMusicFade, PATCH_JUMP); - InjectHook(0x46D1D0, &CCamera::LoadPathSplines, PATCH_JUMP); - InjectHook(0x4712A0, &CCamera::UpdateTargetEntity, PATCH_JUMP); - InjectHook(0x46B580, &CCamera::Find3rdPersonCamTargetVector, PATCH_JUMP); - InjectHook(0x46BAD0, &CCamera::Init, PATCH_JUMP); - InjectHook(0x46C9E0, &CCamera::LoadTrainCamNodes, PATCH_JUMP); - InjectHook(0x46F600, &CCamera::Process_Train_Camera_Control, PATCH_JUMP); - InjectHook(0x470EA0, &CCamera::UpdateSoundDistances, PATCH_JUMP); - InjectHook(0x46BF10, &CCamera::IsItTimeForNewcam, PATCH_JUMP); - InjectHook(0x471650, &CCamera::TryToStartNewCamMode, PATCH_JUMP); -// InjectHook(0x46D3F0, &CCamera::Process, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index a400c039..1ab1c8b0 100644 --- a/src/core/CdStream.cpp +++ b/src/core/CdStream.cpp @@ -1,6 +1,6 @@ #include #include "common.h" -#include "patcher.h" + #include "CdStream.h" #include "rwcore.h" #include "RwHelper.h" @@ -507,24 +507,3 @@ CdStreamGetNumImages(void) { return gNumImages; } - - -STARTPATCHES - InjectHook(0x405B50, CdStreamInitThread, PATCH_JUMP); - InjectHook(0x405C80, CdStreamInit, PATCH_JUMP); - //InjectHook(0x405DB0, debug, PATCH_JUMP); - InjectHook(0x405DC0, GetGTA3ImgSize, PATCH_JUMP); - InjectHook(0x405DD0, CdStreamShutdown, PATCH_JUMP); - InjectHook(0x405E40, CdStreamRead, PATCH_JUMP); - InjectHook(0x405F90, CdStreamGetStatus, PATCH_JUMP); - InjectHook(0x406000, CdStreamGetLastPosn, PATCH_JUMP); - InjectHook(0x406010, CdStreamSync, PATCH_JUMP); - InjectHook(0x4060B0, AddToQueue, PATCH_JUMP); - InjectHook(0x4060F0, GetFirstInQueue, PATCH_JUMP); - InjectHook(0x406110, RemoveFirstInQueue, PATCH_JUMP); - InjectHook(0x406140, CdStreamThread, PATCH_JUMP); - InjectHook(0x406270, CdStreamAddImage, PATCH_JUMP); - InjectHook(0x4062E0, CdStreamGetImageName, PATCH_JUMP); - InjectHook(0x406300, CdStreamRemoveImages, PATCH_JUMP); - InjectHook(0x406370, CdStreamGetNumImages, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp index 69fdd682..e4b908e0 100644 --- a/src/core/Clock.cpp +++ b/src/core/Clock.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Timer.h" #include "Pad.h" #include "Clock.h" @@ -115,14 +115,3 @@ CClock::RestoreClock(void) ms_nGameClockMinutes = ms_Stored_nGameClockMinutes; ms_nGameClockSeconds = ms_Stored_nGameClockSeconds; } - - -STARTPATCHES - InjectHook(0x473370, CClock::Initialise, PATCH_JUMP); - InjectHook(0x473460, CClock::Update, PATCH_JUMP); - InjectHook(0x4733C0, CClock::SetGameClock, PATCH_JUMP); - InjectHook(0x4733F0, CClock::GetGameClockMinutesUntil, PATCH_JUMP); - InjectHook(0x473420, CClock::GetIsTimeInRange, PATCH_JUMP); - InjectHook(0x473540, CClock::StoreClock, PATCH_JUMP); - InjectHook(0x473570, CClock::RestoreClock, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 85145e86..5bdb32dc 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lists.h" #include "Game.h" @@ -2140,70 +2140,3 @@ CColModel::operator=(const CColModel &other) } return *this; } - -#include -struct CColLine_ : public CColLine -{ - CColLine *ctor(CVector *p0, CVector *p1) { return ::new (this) CColLine(*p0, *p1); } -}; - -struct CColModel_ : public CColModel -{ - CColModel *ctor(void) { return ::new (this) CColModel(); } - void dtor(void) { this->CColModel::~CColModel(); } -}; - - -STARTPATCHES - InjectHook(0x4B9C30, (CMatrix& (*)(const CMatrix &src, CMatrix &dst))Invert, PATCH_JUMP); - - InjectHook(0x40B380, CCollision::Init, PATCH_JUMP); - InjectHook(0x40B3A0, CCollision::Shutdown, PATCH_JUMP); - InjectHook(0x40B3B0, CCollision::Update, PATCH_JUMP); - InjectHook(0x40B5B0, CCollision::LoadCollisionWhenINeedIt, PATCH_JUMP); - InjectHook(0x40B900, CCollision::SortOutCollisionAfterLoad, PATCH_JUMP); - - InjectHook(0x40BB70, CCollision::TestSphereBox, PATCH_JUMP); - InjectHook(0x40E130, CCollision::TestLineBox, PATCH_JUMP); - InjectHook(0x40E5C0, CCollision::TestVerticalLineBox, PATCH_JUMP); - InjectHook(0x40EC10, CCollision::TestLineTriangle, PATCH_JUMP); - InjectHook(0x40DAA0, CCollision::TestLineSphere, PATCH_JUMP); - InjectHook(0x40C580, CCollision::TestSphereTriangle, PATCH_JUMP); - InjectHook(0x40F720, CCollision::TestLineOfSight, PATCH_JUMP); - - InjectHook(0x40B9F0, CCollision::ProcessSphereSphere, PATCH_JUMP); - InjectHook(0x40BC00, CCollision::ProcessSphereBox, PATCH_JUMP); - InjectHook(0x40E670, CCollision::ProcessLineBox, PATCH_JUMP); - InjectHook(0x40DE80, CCollision::ProcessLineSphere, PATCH_JUMP); - InjectHook(0x40FB50, CCollision::ProcessVerticalLineTriangle, PATCH_JUMP); - InjectHook(0x40F140, CCollision::ProcessLineTriangle, PATCH_JUMP); - InjectHook(0x40CE30, CCollision::ProcessSphereTriangle, PATCH_JUMP); - - InjectHook(0x40F910, CCollision::ProcessLineOfSight, PATCH_JUMP); - InjectHook(0x410120, CCollision::ProcessVerticalLine, PATCH_JUMP); - InjectHook(0x410BE0, CCollision::ProcessColModels, PATCH_JUMP); - - InjectHook(0x40B960, CCollision::CalculateTrianglePlanes, PATCH_JUMP); - InjectHook(0x411640, &CLink::Remove, PATCH_JUMP); - InjectHook(0x411620, &CLink::Insert, PATCH_JUMP); - InjectHook(0x4115C0, &CLinkList::Insert, PATCH_JUMP); - InjectHook(0x411600, &CLinkList::Remove, PATCH_JUMP); -// InjectHook(0x411530, &CLinkList::Init, PATCH_JUMP); - - InjectHook(0x411E40, (void (CColSphere::*)(float, const CVector&, uint8, uint8))&CColSphere::Set, PATCH_JUMP); - InjectHook(0x40B2A0, &CColBox::Set, PATCH_JUMP); - InjectHook(0x40B320, &CColLine_::ctor, PATCH_JUMP); - InjectHook(0x40B350, &CColLine::Set, PATCH_JUMP); - InjectHook(0x411E70, &CColTriangle::Set, PATCH_JUMP); - - InjectHook(0x411EA0, &CColTrianglePlane::Set, PATCH_JUMP); - InjectHook(0x412140, &CColTrianglePlane::GetNormal, PATCH_JUMP); - - InjectHook(0x411680, &CColModel_::ctor, PATCH_JUMP); - InjectHook(0x4116E0, &CColModel_::dtor, PATCH_JUMP); - InjectHook(0x411D80, &CColModel::RemoveCollisionVolumes, PATCH_JUMP); - InjectHook(0x411CB0, &CColModel::CalculateTrianglePlanes, PATCH_JUMP); - InjectHook(0x411D10, &CColModel::RemoveTrianglePlanes, PATCH_JUMP); - InjectHook(0x411D40, &CColModel::SetLinkPtr, PATCH_JUMP); - InjectHook(0x411D60, &CColModel::GetLinkPtr, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index ce8674d7..a2382c12 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -1,7 +1,7 @@ #define DIRECTINPUT_VERSION 0x0800 #include #include "common.h" -#include "patcher.h" + #include "ControllerConfig.h" #include "Pad.h" #include "FileMgr.h" @@ -2362,57 +2362,3 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action) } } } - - -STARTPATCHES - InjectHook(0x58B7A0, &CControllerConfigManager::MakeControllerActionsBlank, PATCH_JUMP); - InjectHook(0x58B7D0, &CControllerConfigManager::GetJoyButtonJustDown, PATCH_JUMP); - InjectHook(0x58B800, &CControllerConfigManager::SaveSettings, PATCH_JUMP); - InjectHook(0x58B870, &CControllerConfigManager::LoadSettings, PATCH_JUMP); - InjectHook(0x58B930, &CControllerConfigManager::InitDefaultControlConfiguration, PATCH_JUMP); - InjectHook(0x58BD00, &CControllerConfigManager::InitDefaultControlConfigMouse, PATCH_JUMP); - InjectHook(0x58BD90, &CControllerConfigManager::InitDefaultControlConfigJoyPad, PATCH_JUMP); - InjectHook(0x58C060, &CControllerConfigManager::InitialiseControllerActionNameArray, PATCH_JUMP); - InjectHook(0x58C5E0, &CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown, PATCH_JUMP); - InjectHook(0x58C730, &CControllerConfigManager::AffectControllerStateOn_ButtonDown, PATCH_JUMP); - InjectHook(0x58C880, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_Driving, PATCH_JUMP); - InjectHook(0x58CAD0, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstPersonOnly, PATCH_JUMP); - InjectHook(0x58CB10, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnly, PATCH_JUMP); - InjectHook(0x58CBD0, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstAndThirdPersonOnly, PATCH_JUMP); - InjectHook(0x58CD70, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_AllStates, PATCH_JUMP); - InjectHook(0x58CE50, &CControllerConfigManager::AffectControllerStateOn_ButtonDown_VehicleAndThirdPersonOnly, PATCH_JUMP); - InjectHook(0x58CE80, &CControllerConfigManager::UpdateJoyInConfigMenus_ButtonUp, PATCH_JUMP); - InjectHook(0x58CFD0, &CControllerConfigManager::AffectControllerStateOn_ButtonUp, PATCH_JUMP); - InjectHook(0x58D090, &CControllerConfigManager::AffectControllerStateOn_ButtonUp_All_Player_States, PATCH_JUMP); - InjectHook(0x58D0C0, &CControllerConfigManager::AffectPadFromKeyBoard, PATCH_JUMP); - InjectHook(0x58D1A0, &CControllerConfigManager::AffectPadFromMouse, PATCH_JUMP); - InjectHook(0x58D220, &CControllerConfigManager::ClearSimButtonPressCheckers, PATCH_JUMP); - InjectHook(0x58D2A0, &CControllerConfigManager::GetIsKeyboardKeyDown, PATCH_JUMP); - InjectHook(0x58D8A0, &CControllerConfigManager::GetIsKeyboardKeyJustDown, PATCH_JUMP); - InjectHook(0x58E280, &CControllerConfigManager::GetIsMouseButtonDown, PATCH_JUMP); - InjectHook(0x58E360, &CControllerConfigManager::GetIsMouseButtonUp, PATCH_JUMP); - InjectHook(0x58E440, &CControllerConfigManager::DeleteMatchingCommonControls, PATCH_JUMP); - InjectHook(0x58E540, &CControllerConfigManager::DeleteMatching3rdPersonControls, PATCH_JUMP); - InjectHook(0x58E630, &CControllerConfigManager::DeleteMatching1rst3rdPersonControls, PATCH_JUMP); - InjectHook(0x58E710, &CControllerConfigManager::DeleteMatchingVehicleControls, PATCH_JUMP); - InjectHook(0x58E890, &CControllerConfigManager::DeleteMatchingVehicle_3rdPersonControls, PATCH_JUMP); - InjectHook(0x58E8D0, &CControllerConfigManager::DeleteMatching1rstPersonControls, PATCH_JUMP); - InjectHook(0x58E920, &CControllerConfigManager::DeleteMatchingActionInitiators, PATCH_JUMP); - InjectHook(0x58EA70, &CControllerConfigManager::GetIsKeyBlank, PATCH_JUMP); - InjectHook(0x58EAD0, &CControllerConfigManager::GetActionType, PATCH_JUMP); - InjectHook(0x58EB40, &CControllerConfigManager::ClearSettingsAssociatedWithAction, PATCH_JUMP); - InjectHook(0x58EBF0, &CControllerConfigManager::GetControllerSettingTextWithOrderNumber, PATCH_JUMP); - InjectHook(0x58EC50, &CControllerConfigManager::GetControllerSettingTextKeyBoard, PATCH_JUMP); - InjectHook(0x58F320, &CControllerConfigManager::GetControllerSettingTextMouse, PATCH_JUMP); - InjectHook(0x58F3D0, &CControllerConfigManager::GetControllerSettingTextJoystick, PATCH_JUMP); - InjectHook(0x58F420, &CControllerConfigManager::GetNumOfSettingsForAction, PATCH_JUMP); - InjectHook(0x58F460, &CControllerConfigManager::GetWideStringOfCommandKeys, PATCH_JUMP); - InjectHook(0x58F590, &CControllerConfigManager::GetControllerKeyAssociatedWithAction, PATCH_JUMP); - InjectHook(0x58F5B0, &CControllerConfigManager::UpdateJoyButtonState, PATCH_JUMP); - InjectHook(0x58F660, &CControllerConfigManager::GetIsActionAButtonCombo, PATCH_JUMP); - InjectHook(0x58F690, &CControllerConfigManager::GetButtonComboText, PATCH_JUMP); - InjectHook(0x58F700, &CControllerConfigManager::SetControllerKeyAssociatedWithAction, PATCH_JUMP); - InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP); - InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP); - InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Directory.cpp b/src/core/Directory.cpp index d4b4279d..27539824 100644 --- a/src/core/Directory.cpp +++ b/src/core/Directory.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "FileMgr.h" #include "Directory.h" @@ -57,10 +57,3 @@ CDirectory::FindItem(const char *name, uint32 &offset, uint32 &size) } return false; } - -STARTPATCHES - InjectHook(0x473630, &CDirectory::ReadDirFile, PATCH_JUMP); - InjectHook(0x473690, &CDirectory::WriteDirFile, PATCH_JUMP); - InjectHook(0x473600, &CDirectory::AddItem, PATCH_JUMP); - InjectHook(0x4736E0, &CDirectory::FindItem, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index 5ca4cdb0..675040ea 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Pools.h" #include "ModelIndices.h" #include "World.h" @@ -227,14 +227,3 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar FindPlayerPed()->SetWantedLevelNoDrop(2); } - -STARTPATCHES - InjectHook(0x475B60, CEventList::Initialise, PATCH_JUMP); - InjectHook(0x475BE0, CEventList::Update, PATCH_JUMP); - InjectHook(0x475C50, (void (*)(eEventType,eEventEntity,CEntity *,CPed *,int32))CEventList::RegisterEvent, PATCH_JUMP); - InjectHook(0x475E10, (void (*)(eEventType,CVector,int32))CEventList::RegisterEvent, PATCH_JUMP); - InjectHook(0x475F40, CEventList::GetEvent, PATCH_JUMP); - InjectHook(0x475F70, CEventList::ClearEvent, PATCH_JUMP); - InjectHook(0x475F90, CEventList::FindClosestEvent, PATCH_JUMP); - InjectHook(0x476070, CEventList::ReportCrimeForEvent, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index e0a0fafc..b7d82089 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "Quaternion.h" #include "ModelInfo.h" #include "ModelIndices.h" @@ -1355,43 +1355,3 @@ CFileLoader::ReLoadScene(const char *filename) } CFileMgr::CloseFile(fd); } - -STARTPATCHES - InjectHook(0x476290, CFileLoader::LoadLevel, PATCH_JUMP); - - InjectHook(0x476520, CFileLoader::LoadCollisionFromDatFile, PATCH_JUMP); - InjectHook(0x4761D0, CFileLoader::LoadLine, PATCH_JUMP); - InjectHook(0x4765B0, CFileLoader::LoadTexDictionary, PATCH_JUMP); - InjectHook(0x478B20, CFileLoader::LoadCollisionFile, PATCH_JUMP); - InjectHook(0x478C20, CFileLoader::LoadCollisionModel, PATCH_JUMP); - InjectHook(0x476750, CFileLoader::LoadModelFile, PATCH_JUMP); - InjectHook(0x476810, (void (*)(const char*))CFileLoader::LoadClumpFile, PATCH_JUMP); - InjectHook(0x476990, (bool (*)(RwStream*,uint32))CFileLoader::LoadClumpFile, PATCH_JUMP); - InjectHook(0x476A20, CFileLoader::StartLoadClumpFile, PATCH_JUMP); - InjectHook(0x476A70, CFileLoader::FinishLoadClumpFile, PATCH_JUMP); - InjectHook(0x476930, CFileLoader::LoadAtomicFile, PATCH_JUMP); - InjectHook(0x4767C0, CFileLoader::LoadAtomicFile2Return, PATCH_JUMP); - InjectHook(0x476630, CFileLoader::AddTexDictionaries, PATCH_JUMP); - - InjectHook(0x476AC0, CFileLoader::LoadObjectTypes, PATCH_JUMP); - InjectHook(0x477040, CFileLoader::LoadObject, PATCH_JUMP); - InjectHook(0x4774B0, CFileLoader::LoadTimeObject, PATCH_JUMP); - InjectHook(0x477920, CFileLoader::LoadClumpObject, PATCH_JUMP); - InjectHook(0x477990, CFileLoader::LoadVehicleObject, PATCH_JUMP); - InjectHook(0x477DE0, CFileLoader::LoadPedObject, PATCH_JUMP); - InjectHook(0x477ED0, CFileLoader::LoadPathHeader, PATCH_JUMP); - InjectHook(0x477FF0, CFileLoader::LoadCarPathNode, PATCH_JUMP); - InjectHook(0x477F00, CFileLoader::LoadPedPathNode, PATCH_JUMP); - InjectHook(0x4780E0, CFileLoader::Load2dEffect, PATCH_JUMP); - - InjectHook(0x478370, CFileLoader::LoadScene, PATCH_JUMP); - InjectHook(0x4786B0, CFileLoader::LoadObjectInstance, PATCH_JUMP); - InjectHook(0x478A00, CFileLoader::LoadZone, PATCH_JUMP); - InjectHook(0x478A90, CFileLoader::LoadCullZone, PATCH_JUMP); - - InjectHook(0x478550, CFileLoader::LoadMapZones, PATCH_JUMP); - - InjectHook(0x476DB0, CFileLoader::ReloadPaths, PATCH_JUMP); - InjectHook(0x476F30, CFileLoader::ReloadObjectTypes, PATCH_JUMP); - InjectHook(0x4772B0, CFileLoader::ReloadObject, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 382316bb..46d725cd 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -2,7 +2,7 @@ #include #include #include "common.h" -#include "patcher.h" + #include "FileMgr.h" const char *_psGetUserFilesFolder(); @@ -282,19 +282,3 @@ CFileMgr::GetErrorReadWrite(int fd) { return myfeof(fd); } - -STARTPATCHES - InjectHook(0x478F80, CFileMgr::Initialise, PATCH_JUMP); - InjectHook(0x478FB0, CFileMgr::ChangeDir, PATCH_JUMP); - InjectHook(0x479020, CFileMgr::SetDir, PATCH_JUMP); - InjectHook(0x479080, CFileMgr::SetDirMyDocuments, PATCH_JUMP); - InjectHook(0x479090, CFileMgr::LoadFile, PATCH_JUMP); - InjectHook(0x479100, CFileMgr::OpenFile, PATCH_JUMP); - InjectHook(0x479120, CFileMgr::OpenFileForWriting, PATCH_JUMP); - InjectHook(0x479140, CFileMgr::Read, PATCH_JUMP); - InjectHook(0x479160, CFileMgr::Write, PATCH_JUMP); - InjectHook(0x479180, CFileMgr::Seek, PATCH_JUMP); - InjectHook(0x4791D0, CFileMgr::ReadLine, PATCH_JUMP); - InjectHook(0x479200, CFileMgr::CloseFile, PATCH_JUMP); - InjectHook(0x479210, CFileMgr::GetErrorReadWrite, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp index f900091e..65b6deb2 100644 --- a/src/core/Fire.cpp +++ b/src/core/Fire.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Vector.h" #include "PlayerPed.h" #include "Entity.h" @@ -438,21 +438,3 @@ CFireManager::SetScriptFireAudio(int16 index, bool state) { m_aFires[index].m_bAudioSet = state; } - -STARTPATCHES - InjectHook(0x4798D0, &CFire::ProcessFire, PATCH_JUMP); - InjectHook(0x4798B0, &CFire::ReportThisFire, PATCH_JUMP); - InjectHook(0x479D40, &CFire::Extinguish, PATCH_JUMP); - InjectHook(0x479500, (void(CFireManager::*)(CVector pos, float size, bool propagation))&CFireManager::StartFire, PATCH_JUMP); - InjectHook(0x479590, (CFire *(CFireManager::*)(CEntity *, CEntity *, float, bool))&CFireManager::StartFire, PATCH_JUMP); - InjectHook(0x479310, &CFireManager::Update, PATCH_JUMP); - InjectHook(0x479430, &CFireManager::FindFurthestFire_NeverMindFireMen, PATCH_JUMP); - InjectHook(0x479340, &CFireManager::FindNearestFire, PATCH_JUMP); - InjectHook(0x4792E0, &CFireManager::GetNextFreeFire, PATCH_JUMP); - InjectHook(0x479DB0, &CFireManager::ExtinguishPoint, PATCH_JUMP); - InjectHook(0x479E60, &CFireManager::StartScriptFire, PATCH_JUMP); - InjectHook(0x479FC0, &CFireManager::IsScriptFireExtinguish, PATCH_JUMP); - InjectHook(0x47A000, &CFireManager::RemoveAllScriptFires, PATCH_JUMP); - InjectHook(0x479FE0, &CFireManager::RemoveScriptFire, PATCH_JUMP); - InjectHook(0x47A040, &CFireManager::SetScriptFireAudio, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index b2ecdac5..790de046 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1,7 +1,7 @@ #define DIRECTINPUT_VERSION 0x0800 #include #include "common.h" -#include "patcher.h" + #include "win.h" #include "Frontend.h" #include "Font.h" @@ -5624,21 +5624,3 @@ uint8 CMenuManager::GetNumberOfMenuOptions() #undef GetBackJustUp #undef GetBackJustDown - -STARTPATCHES - for (int i = 1; i < ARRAY_SIZE(aScreens); i++) - Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]); - InjectHook(0x4856F0, &CMenuManager::ProcessButtonPresses, PATCH_JUMP); - InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP); - InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP); - InjectHook(0x47A540, &CMenuManager::DrawFrontEnd, PATCH_JUMP); - - InjectHook(0x48ABE0, &CMenuManager::StretchX, PATCH_JUMP); - InjectHook(0x48AC20, &CMenuManager::StretchY, PATCH_JUMP); - InjectHook(0x488EE0, &CMenuManager::LoadSettings, PATCH_JUMP); - InjectHook(0x488CC0, &CMenuManager::SaveSettings, PATCH_JUMP); - InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP); - InjectHook(0x48AB40, &CMenuManager::DoSettingsBeforeStartingAGame, PATCH_JUMP); - InjectHook(0x48AE60, &CMenuManager::ProcessOnOffMenuOptions, PATCH_JUMP); - InjectHook(0x489710, &CMenuManager::DrawControllerBound, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/core/Game.cpp b/src/core/Game.cpp index f115d52f..7ccf78d0 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -5,7 +5,7 @@ #pragma warning( pop ) #include "common.h" #include "win.h" -#include "patcher.h" + #include "Game.h" #include "main.h" #include "RwHelper.h" @@ -710,20 +710,3 @@ void CGame::ProcessTidyUpMemory(void) // meow #endif } - -STARTPATCHES - InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP); - InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP); - InjectHook(0x48BCB0, CGame::ShutdownRenderWare, PATCH_JUMP); - InjectHook(0x48BD50, CGame::InitialiseOnceAfterRW, PATCH_JUMP); - InjectHook(0x48BEC0, CGame::FinalShutdown, PATCH_JUMP); - InjectHook(0x48BED0, CGame::Initialise, PATCH_JUMP); - InjectHook(0x48C3A0, CGame::ShutDown, PATCH_JUMP); - InjectHook(0x48C4B0, CGame::ReInitGameObjectVariables, PATCH_JUMP); - InjectHook(0x48C620, CGame::ReloadIPLs, PATCH_JUMP); - InjectHook(0x48C6B0, CGame::ShutDownForRestart, PATCH_JUMP); - InjectHook(0x48C740, CGame::InitialiseWhenRestarting, PATCH_JUMP); - InjectHook(0x48C850, CGame::Process, PATCH_JUMP); - InjectHook(0x48CA10, CGame::DrasticTidyUpMemory, PATCH_JUMP); - InjectHook(0x48CA20, CGame::TidyUpMemory, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp index d8e91c98..16e35633 100644 --- a/src/core/IniFile.cpp +++ b/src/core/IniFile.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "IniFile.h" #include "CarCtrl.h" diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 2db375b2..86aff05e 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -9,7 +9,7 @@ #include #pragma comment( lib, "Xinput9_1_0.lib" ) #endif -#include "patcher.h" + #include "Pad.h" #include "ControllerConfig.h" #include "Timer.h" @@ -1285,7 +1285,7 @@ bool CPad::GetLookRight(void) { if ( ArePlayerControlsDisabled() ) return false; - + return !!(NewState.RightShoulder2 && !NewState.LeftShoulder2); } @@ -1294,7 +1294,7 @@ bool CPad::GetLookBehindForCar(void) { if ( ArePlayerControlsDisabled() ) return false; - + return !!(NewState.RightShoulder2 && NewState.LeftShoulder2); } @@ -1768,7 +1768,7 @@ bool CPad::CycleWeaponRightJustDown(void) { if ( ArePlayerControlsDisabled() ) return false; - + return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } @@ -1865,7 +1865,7 @@ bool CPad::ShiftTargetLeftJustDown(void) { if ( ArePlayerControlsDisabled() ) return false; - + return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } @@ -1873,7 +1873,7 @@ bool CPad::ShiftTargetRightJustDown(void) { if ( ArePlayerControlsDisabled() ) return false; - + return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } @@ -2404,111 +2404,3 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize) return pRsKeys; } - -STARTPATCHES - InjectHook(0x490D90, &WeaponCheat, PATCH_JUMP); - InjectHook(0x490E70, &HealthCheat, PATCH_JUMP); - InjectHook(0x490EE0, &TankCheat, PATCH_JUMP); - InjectHook(0x491040, &BlowUpCarsCheat, PATCH_JUMP); - InjectHook(0x4910B0, &ChangePlayerCheat, PATCH_JUMP); - InjectHook(0x4911C0, &MayhemCheat, PATCH_JUMP); - InjectHook(0x491270, &EverybodyAttacksPlayerCheat, PATCH_JUMP); - InjectHook(0x491370, &WeaponsForAllCheat, PATCH_JUMP); - InjectHook(0x4913A0, &FastTimeCheat, PATCH_JUMP); - InjectHook(0x4913F0, &SlowTimeCheat, PATCH_JUMP); - InjectHook(0x491430, &MoneyCheat, PATCH_JUMP); - InjectHook(0x491460, &ArmourCheat, PATCH_JUMP); - InjectHook(0x491490, &WantedLevelUpCheat, PATCH_JUMP); - InjectHook(0x4914F0, &WantedLevelDownCheat, PATCH_JUMP); - InjectHook(0x491520, &SunnyWeatherCheat, PATCH_JUMP); - InjectHook(0x491550, &CloudyWeatherCheat, PATCH_JUMP); - InjectHook(0x491580, &RainyWeatherCheat, PATCH_JUMP); - InjectHook(0x4915B0, &FoggyWeatherCheat, PATCH_JUMP); - InjectHook(0x4915E0, &FastWeatherCheat, PATCH_JUMP); - InjectHook(0x491610, &OnlyRenderWheelsCheat, PATCH_JUMP); - InjectHook(0x491640, &ChittyChittyBangBangCheat, PATCH_JUMP); - InjectHook(0x491670, &StrongGripCheat, PATCH_JUMP); - InjectHook(0x4916A0, &NastyLimbsCheat, PATCH_JUMP); - - InjectHook(0x4916C0, &CControllerState::Clear, PATCH_JUMP); - InjectHook(0x491760, &CKeyboardState::Clear, PATCH_JUMP); - InjectHook(0x491A10, &CPad::Clear, PATCH_JUMP); - InjectHook(0x491B50, &CPad::ClearMouseHistory, PATCH_JUMP); - //InjectHook(0x491B80, &CMouseControllerState::CMouseControllerState, PATCH_JUMP); - InjectHook(0x491BB0, &CMouseControllerState::Clear, PATCH_JUMP); - InjectHook(0x491BD0, &CMousePointerStateHelper::GetMouseSetUp, PATCH_JUMP); - InjectHook(0x491CA0, &CPad::UpdateMouse, PATCH_JUMP); - InjectHook(0x491E60, &CPad::ReconcileTwoControllersInput, PATCH_JUMP); - InjectHook(0x492230, &CPad::StartShake, PATCH_JUMP); - InjectHook(0x492290, &CPad::StartShake_Distance, PATCH_JUMP); - InjectHook(0x492360, &CPad::StartShake_Train, PATCH_JUMP); - InjectHook(0x492450, &CPad::AddToPCCheatString, PATCH_JUMP); - InjectHook(0x492720, CPad::UpdatePads, PATCH_JUMP); - InjectHook(0x492C60, &CPad::ProcessPCSpecificStuff, PATCH_JUMP); - InjectHook(0x492C70, &CPad::Update, PATCH_JUMP); -#pragma warning( push ) -#pragma warning( disable : 4573) - InjectHook(0x492F00, (void (*)())CPad::DoCheats, PATCH_JUMP); -#pragma warning( pop ) - InjectHook(0x492F20, (void (CPad::*)(int16))&CPad::DoCheats, PATCH_JUMP); - InjectHook(0x492F30, CPad::StopPadsShaking, PATCH_JUMP); - InjectHook(0x492F50, &CPad::StopShaking, PATCH_JUMP); - InjectHook(0x492F60, CPad::GetPad, PATCH_JUMP); - InjectHook(0x492F70, &CPad::GetSteeringLeftRight, PATCH_JUMP); - InjectHook(0x492FF0, &CPad::GetSteeringUpDown, PATCH_JUMP); - InjectHook(0x493070, &CPad::GetCarGunUpDown, PATCH_JUMP); - InjectHook(0x4930C0, &CPad::GetCarGunLeftRight, PATCH_JUMP); - InjectHook(0x493110, &CPad::GetPedWalkLeftRight, PATCH_JUMP); - InjectHook(0x493190, &CPad::GetPedWalkUpDown, PATCH_JUMP); - InjectHook(0x493210, &CPad::GetAnalogueUpDown, PATCH_JUMP); - InjectHook(0x493290, &CPad::GetLookLeft, PATCH_JUMP); - InjectHook(0x4932C0, &CPad::GetLookRight, PATCH_JUMP); - InjectHook(0x4932F0, &CPad::GetLookBehindForCar, PATCH_JUMP); - InjectHook(0x493320, &CPad::GetLookBehindForPed, PATCH_JUMP); - InjectHook(0x493350, &CPad::GetHorn, PATCH_JUMP); - InjectHook(0x4933F0, &CPad::HornJustDown, PATCH_JUMP); - InjectHook(0x493490, &CPad::GetCarGunFired, PATCH_JUMP); - InjectHook(0x4934F0, &CPad::CarGunJustDown, PATCH_JUMP); - InjectHook(0x493560, &CPad::GetHandBrake, PATCH_JUMP); - InjectHook(0x4935A0, &CPad::GetBrake, PATCH_JUMP); - InjectHook(0x4935F0, &CPad::GetExitVehicle, PATCH_JUMP); - InjectHook(0x493650, &CPad::ExitVehicleJustDown, PATCH_JUMP); - InjectHook(0x4936C0, &CPad::GetWeapon, PATCH_JUMP); - InjectHook(0x493700, &CPad::WeaponJustDown, PATCH_JUMP); - InjectHook(0x493780, &CPad::GetAccelerate, PATCH_JUMP); - InjectHook(0x4937D0, &CPad::CycleCameraModeUpJustDown, PATCH_JUMP); - InjectHook(0x493830, &CPad::CycleCameraModeDownJustDown, PATCH_JUMP); - InjectHook(0x493870, &CPad::ChangeStationJustDown, PATCH_JUMP); - InjectHook(0x493910, &CPad::CycleWeaponLeftJustDown, PATCH_JUMP); - InjectHook(0x493940, &CPad::CycleWeaponRightJustDown, PATCH_JUMP); - InjectHook(0x493970, &CPad::GetTarget, PATCH_JUMP); - InjectHook(0x4939D0, &CPad::TargetJustDown, PATCH_JUMP); - InjectHook(0x493A40, &CPad::JumpJustDown, PATCH_JUMP); - InjectHook(0x493A70, &CPad::GetSprint, PATCH_JUMP); - InjectHook(0x493AE0, &CPad::ShiftTargetLeftJustDown, PATCH_JUMP); - InjectHook(0x493B10, &CPad::ShiftTargetRightJustDown, PATCH_JUMP); - InjectHook(0x493B40, &CPad::GetAnaloguePadUp, PATCH_JUMP); - InjectHook(0x493BA0, &CPad::GetAnaloguePadDown, PATCH_JUMP); - InjectHook(0x493C00, &CPad::GetAnaloguePadLeft, PATCH_JUMP); - InjectHook(0x493C60, &CPad::GetAnaloguePadRight, PATCH_JUMP); - InjectHook(0x493CC0, &CPad::GetAnaloguePadLeftJustUp, PATCH_JUMP); - InjectHook(0x493D20, &CPad::GetAnaloguePadRightJustUp, PATCH_JUMP); - InjectHook(0x493D80, &CPad::ForceCameraBehindPlayer, PATCH_JUMP); - InjectHook(0x493E00, &CPad::SniperZoomIn, PATCH_JUMP); - InjectHook(0x493E70, &CPad::SniperZoomOut, PATCH_JUMP); - InjectHook(0x493EE0, &CPad::SniperModeLookLeftRight, PATCH_JUMP); - InjectHook(0x493F30, &CPad::SniperModeLookUpDown, PATCH_JUMP); - InjectHook(0x493F80, &CPad::LookAroundLeftRight, PATCH_JUMP); - InjectHook(0x494130, &CPad::LookAroundUpDown, PATCH_JUMP); - InjectHook(0x494290, &CPad::ResetAverageWeapon, PATCH_JUMP); - InjectHook(0x4942B0, CPad::PrintErrorMessage, PATCH_JUMP); - InjectHook(0x494420, LittleTest, PATCH_JUMP); - InjectHook(0x494450, CPad::ResetCheats, PATCH_JUMP); - InjectHook(0x4944B0, CPad::EditString, PATCH_JUMP); - InjectHook(0x494690, CPad::EditCodesForControls, PATCH_JUMP); - - //InjectHook(0x494E50, `global constructor keyed to'Pad.cpp, PATCH_JUMP); - //InjectHook(0x494EB0, sub_494EB0, PATCH_JUMP); - //InjectHook(0x494ED0, &CPad::~CPad, PATCH_JUMP); - //InjectHook(0x494EE0, &CPad::CPad, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp index c882fc27..99ca5659 100644 --- a/src/core/Placeable.cpp +++ b/src/core/Placeable.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "Placeable.h" -#include "patcher.h" + CPlaceable::CPlaceable(void) { @@ -62,21 +62,3 @@ CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float y1 <= GetPosition().y && GetPosition().y <= y2 && z1 <= GetPosition().z && GetPosition().z <= z2; } - -#include - -class CPlaceable_ : public CPlaceable -{ -public: - CPlaceable *ctor(void) { return ::new (this) CPlaceable(); } - void dtor(void) { CPlaceable::~CPlaceable(); } -}; - -STARTPATCHES - InjectHook(0x49F9A0, &CPlaceable_::ctor, PATCH_JUMP); - InjectHook(0x49F9E0, &CPlaceable_::dtor, PATCH_JUMP); - - InjectHook(0x49FA00, &CPlaceable::SetHeading, PATCH_JUMP); - InjectHook(0x49FA50, (bool (CPlaceable::*)(float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP); - InjectHook(0x49FAF0, (bool (CPlaceable::*)(float, float, float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 0043c2f4..cfa0cea4 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "PlayerPed.h" #include "Wanted.h" @@ -558,20 +558,3 @@ CPlayerInfo::Process(void) CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled; } } - -STARTPATCHES - InjectHook(0x4B5DC0, &CPlayerInfo::dtor, PATCH_JUMP); - InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP); - InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP); - InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP); - InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP); - InjectHook(0x49FC10, &CPlayerInfo::Clear, PATCH_JUMP); - InjectHook(0x4A15C0, &CPlayerInfo::BlowUpRCBuggy, PATCH_JUMP); - InjectHook(0x4A13B0, &CPlayerInfo::CancelPlayerEnteringCars, PATCH_JUMP); - InjectHook(0x4A1400, &CPlayerInfo::MakePlayerSafe, PATCH_JUMP); - InjectHook(0x4A0EC0, &CPlayerInfo::EvaluateCarPosition, PATCH_JUMP); - InjectHook(0x4A15F0, &CPlayerInfo::AwardMoneyForExplosion, PATCH_JUMP); - InjectHook(0x4A0B20, &CPlayerInfo::LoadPlayerInfo, PATCH_JUMP); - InjectHook(0x4A0960, &CPlayerInfo::SavePlayerInfo, PATCH_JUMP); - InjectHook(0x49FD30, &CPlayerInfo::Process, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 65294368..dfc6974a 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Pools.h" #include "Boat.h" @@ -425,19 +425,3 @@ INITSAVEBUF } VALIDATESAVEBUF(size) } - -STARTPATCHES - InjectHook(0x4A1770, CPools::Initialise, PATCH_JUMP); - InjectHook(0x4A1880, CPools::ShutDown, PATCH_JUMP); - InjectHook(0x4A1A50, CPools::CheckPoolsEmpty, PATCH_JUMP); - InjectHook(0x4A1A80, CPools::GetPedRef, PATCH_JUMP); - InjectHook(0x4A1AA0, CPools::GetPed, PATCH_JUMP); - InjectHook(0x4A1AC0, CPools::GetVehicleRef, PATCH_JUMP); - InjectHook(0x4A1AE0, CPools::GetVehicle, PATCH_JUMP); - InjectHook(0x4A1B00, CPools::GetObjectRef, PATCH_JUMP); - InjectHook(0x4A1B20, CPools::GetObject, PATCH_JUMP); - InjectHook(0x4A2DB0, CPools::MakeSureSlotInObjectPoolIsEmpty, PATCH_JUMP); - InjectHook(0x4A1B40, CPools::LoadVehiclePool, PATCH_JUMP); - InjectHook(0x4A2550, CPools::LoadObjectPool, PATCH_JUMP); - InjectHook(0x4A2B50, CPools::LoadPedPool, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 48b97832..2b3e6f1e 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1,6 +1,6 @@ #include "config.h" #include "common.h" -#include "patcher.h" + #include "RwHelper.h" #include "Radar.h" #include "Camera.h" @@ -1458,51 +1458,3 @@ CRadar::ToggleTargetMarker(float x, float y) } #endif -STARTPATCHES - InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP); - InjectHook(0x4A3F60, CRadar::Shutdown, PATCH_JUMP); - InjectHook(0x4A4030, CRadar::LoadTextures, PATCH_JUMP); - InjectHook(0x4A4180, CRadar::GetNewUniqueBlipIndex, PATCH_JUMP); - InjectHook(0x4A41C0, CRadar::GetActualBlipArrayIndex, PATCH_JUMP); - InjectHook(0x4A4200, CRadar::DrawMap, PATCH_JUMP); - InjectHook(0x4A42F0, CRadar::DrawBlips, PATCH_JUMP); - InjectHook(0x4A4C70, CRadar::Draw3dMarkers, PATCH_JUMP); - InjectHook(0x4A4F30, CRadar::LimitRadarPoint, PATCH_JUMP); - InjectHook(0x4A4F90, CRadar::CalculateBlipAlpha, PATCH_JUMP); - InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP); - InjectHook(0x4A50D0, CRadar::TransformRealWorldPointToRadarSpace, PATCH_JUMP); - InjectHook(0x4A5300, CRadar::TransformRadarPointToRealWorldSpace, PATCH_JUMP); - InjectHook(0x4A5530, CRadar::TransformRealWorldToTexCoordSpace, PATCH_JUMP); - InjectHook(0x4A5590, CRadar::SetCoordBlip, PATCH_JUMP); - InjectHook(0x4A5640, CRadar::SetEntityBlip, PATCH_JUMP); - InjectHook(0x4A56C0, CRadar::ClearBlipForEntity, PATCH_JUMP); - InjectHook(0x4A5720, CRadar::ClearBlip, PATCH_JUMP); - InjectHook(0x4A5770, CRadar::ChangeBlipColour, PATCH_JUMP); - InjectHook(0x4A57A0, CRadar::ChangeBlipBrightness, PATCH_JUMP); - InjectHook(0x4A57E0, CRadar::ChangeBlipScale, PATCH_JUMP); - InjectHook(0x4A5810, CRadar::ChangeBlipDisplay, PATCH_JUMP); - InjectHook(0x4A5840, CRadar::SetBlipSprite, PATCH_JUMP); - InjectHook(0x4A5870, CRadar::ShowRadarTrace, PATCH_JUMP); - InjectHook(0x4A59C0, CRadar::ShowRadarMarker, PATCH_JUMP); - InjectHook(0x4A5BB0, CRadar::GetRadarTraceColour, PATCH_JUMP); - InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP); - InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP); - InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP); - InjectHook(0x4A6020, ClipRadarTileCoords, PATCH_JUMP); - InjectHook(0x4A6060, RequestMapSection, PATCH_JUMP); - InjectHook(0x4A60A0, RemoveMapSection, PATCH_JUMP); - InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP); - InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP); - InjectHook(0x4A6160, IsPointInsideRadar, PATCH_JUMP); - InjectHook(0x4A61C0, GetTextureCorners, PATCH_JUMP); - InjectHook(0x4A6250, LineRadarBoxCollision, PATCH_JUMP); - InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP); - InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP); - InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP); - InjectHook(0x4A6B60, (void (*)(const CVector&))&CRadar::StreamRadarSections, PATCH_JUMP); - InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP); - InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP); - InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP); - //InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP); - //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/core/References.cpp b/src/core/References.cpp index 668ea9f1..3eb2eaf3 100644 --- a/src/core/References.cpp +++ b/src/core/References.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "World.h" #include "Vehicle.h" #include "PlayerPed.h" @@ -57,9 +57,3 @@ CReferences::PruneAllReferencesInWorld(void) e->PruneReferences(); } } - -STARTPATCHES - InjectHook(0x4A7350, CReferences::Init, PATCH_JUMP); - InjectHook(0x4A7570, CReferences::RemoveReferencesToPlayer, PATCH_JUMP); - InjectHook(0x4A75A0, CReferences::PruneAllReferencesInWorld, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 8d7a3048..ef3c0ab6 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Stats.h" #include "Text.h" #include "World.h" @@ -418,11 +418,3 @@ void CStats::LoadStats(uint8 *buf, uint32 size) assert(buf - buf_start == size); #undef CopyFromBuf } - -STARTPATCHES - InjectHook(0x48C5A3, CStats::Init, PATCH_JUMP); // CGame::ReInitGameObjectVariables - InjectHook(0x4AB3E0, CStats::SaveStats, PATCH_JUMP); - InjectHook(0x4AB670, CStats::LoadStats, PATCH_JUMP); - InjectHook(0x4AB090, CStats::FindCriminalRatingString, PATCH_JUMP); - InjectHook(0x4AB2A0, CStats::FindCriminalRatingNumber, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 56f4a862..039377f4 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Pad.h" #include "Hud.h" @@ -2439,82 +2439,3 @@ CStreaming::UpdateForAnimViewer(void) CStreaming::RetryLoadFile(CStreaming::ms_channelError); } } - -STARTPATCHES - InjectHook(0x406430, CStreaming::Init, PATCH_JUMP); - InjectHook(0x406C80, CStreaming::Shutdown, PATCH_JUMP); - InjectHook(0x4076C0, CStreaming::Update, PATCH_JUMP); - InjectHook(0x406CC0, (void (*)(void))CStreaming::LoadCdDirectory, PATCH_JUMP); - InjectHook(0x406DA0, (void (*)(const char*, int))CStreaming::LoadCdDirectory, PATCH_JUMP); - InjectHook(0x409740, CStreaming::ConvertBufferToObject, PATCH_JUMP); - InjectHook(0x409580, CStreaming::FinishLoadingLargeFile, PATCH_JUMP); - InjectHook(0x407EA0, CStreaming::RequestModel, PATCH_JUMP); - InjectHook(0x407FD0, CStreaming::RequestSubway, PATCH_JUMP); - InjectHook(0x408190, CStreaming::RequestBigBuildings, PATCH_JUMP); - InjectHook(0x408210, CStreaming::RequestIslands, PATCH_JUMP); - InjectHook(0x40A890, CStreaming::RequestSpecialModel, PATCH_JUMP); - InjectHook(0x40ADA0, CStreaming::RequestSpecialChar, PATCH_JUMP); - InjectHook(0x54A5F0, CStreaming::HasModelLoaded, PATCH_JUMP); - InjectHook(0x40ADC0, CStreaming::HasSpecialCharLoaded, PATCH_JUMP); - InjectHook(0x40ADE0, CStreaming::SetMissionDoesntRequireSpecialChar, PATCH_JUMP); - - InjectHook(0x408830, CStreaming::RemoveModel, PATCH_JUMP); - InjectHook(0x4083A0, CStreaming::RemoveUnusedBuildings, PATCH_JUMP); - InjectHook(0x4083D0, CStreaming::RemoveBuildings, PATCH_JUMP); - InjectHook(0x408640, CStreaming::RemoveUnusedBigBuildings, PATCH_JUMP); - InjectHook(0x408680, CStreaming::RemoveBigBuildings, PATCH_JUMP); - InjectHook(0x408780, CStreaming::RemoveIslandsNotUsed, PATCH_JUMP); - InjectHook(0x40B180, CStreaming::RemoveLoadedVehicle, PATCH_JUMP); - InjectHook(0x4089B0, CStreaming::RemoveLeastUsedModel, PATCH_JUMP); - InjectHook(0x408940, CStreaming::RemoveAllUnusedModels, PATCH_JUMP); - InjectHook(0x409450, CStreaming::RemoveReferencedTxds, PATCH_JUMP); - - InjectHook(0x40B160, CStreaming::GetAvailableVehicleSlot, PATCH_JUMP); - InjectHook(0x40B060, CStreaming::AddToLoadedVehiclesList, PATCH_JUMP); - InjectHook(0x4094C0, CStreaming::IsTxdUsedByRequestedModels, PATCH_JUMP); - InjectHook(0x407E70, CStreaming::IsObjectInCdImage, PATCH_JUMP); - InjectHook(0x408280, CStreaming::HaveAllBigBuildingsLoaded, PATCH_JUMP); - InjectHook(0x40A790, CStreaming::SetModelIsDeletable, PATCH_JUMP); - InjectHook(0x40A800, CStreaming::SetModelTxdIsDeletable, PATCH_JUMP); - InjectHook(0x40A820, CStreaming::SetMissionDoesntRequireModel, PATCH_JUMP); - - InjectHook(0x40AA00, CStreaming::LoadInitialPeds, PATCH_JUMP); - InjectHook(0x40ADF0, CStreaming::LoadInitialVehicles, PATCH_JUMP); - InjectHook(0x40AE60, CStreaming::StreamVehiclesAndPeds, PATCH_JUMP); - InjectHook(0x40AA30, CStreaming::StreamZoneModels, PATCH_JUMP); - InjectHook(0x40AD00, CStreaming::RemoveCurrentZonesModels, PATCH_JUMP); - - InjectHook(0x409BE0, CStreaming::ProcessLoadingChannel, PATCH_JUMP); - InjectHook(0x40A610, CStreaming::FlushChannels, PATCH_JUMP); - InjectHook(0x40A680, CStreaming::FlushRequestList, PATCH_JUMP); - InjectHook(0x409FF0, CStreaming::GetCdImageOffset, PATCH_JUMP); - InjectHook(0x409E50, CStreaming::GetNextFileOnCd, PATCH_JUMP); - InjectHook(0x40A060, CStreaming::RequestModelStream, PATCH_JUMP); - InjectHook(0x4077F0, CStreaming::RetryLoadFile, PATCH_JUMP); - InjectHook(0x40A390, CStreaming::LoadRequestedModels, PATCH_JUMP); - InjectHook(0x40A440, CStreaming::LoadAllRequestedModels, PATCH_JUMP); - - InjectHook(0x4078F0, CStreaming::AddModelsToRequestList, PATCH_JUMP); - InjectHook(0x407C50, (void (*)(CPtrList&,float,float,float,float,float,float))CStreaming::ProcessEntitiesInSectorList, PATCH_JUMP); - InjectHook(0x407DD0, (void (*)(CPtrList&))CStreaming::ProcessEntitiesInSectorList, PATCH_JUMP); - - InjectHook(0x407070, CStreaming::DeleteFarAwayRwObjects, PATCH_JUMP); - InjectHook(0x407390, CStreaming::DeleteAllRwObjects, PATCH_JUMP); - InjectHook(0x407400, CStreaming::DeleteRwObjectsAfterDeath, PATCH_JUMP); - InjectHook(0x408A60, CStreaming::DeleteRwObjectsBehindCamera, PATCH_JUMP); - InjectHook(0x407560, CStreaming::DeleteRwObjectsInSectorList, PATCH_JUMP); - InjectHook(0x4075A0, CStreaming::DeleteRwObjectsInOverlapSectorList, PATCH_JUMP); - InjectHook(0x409340, CStreaming::DeleteRwObjectsBehindCameraInSectorList, PATCH_JUMP); - InjectHook(0x4093C0, CStreaming::DeleteRwObjectsNotInFrustumInSectorList, PATCH_JUMP); - InjectHook(0x409B70, CStreaming::MakeSpaceFor, PATCH_JUMP); - InjectHook(0x40A6D0, CStreaming::LoadScene, PATCH_JUMP); - - InjectHook(0x40B210, CStreaming::MemoryCardSave, PATCH_JUMP); - InjectHook(0x40B250, CStreaming::MemoryCardLoad, PATCH_JUMP); - - InjectHook(0x4063E0, &CStreamingInfo::GetCdPosnAndSize, PATCH_JUMP); - InjectHook(0x406410, &CStreamingInfo::SetCdPosnAndSize, PATCH_JUMP); - InjectHook(0x4063D0, &CStreamingInfo::GetCdSize, PATCH_JUMP); - InjectHook(0x406380, &CStreamingInfo::AddToList, PATCH_JUMP); - InjectHook(0x4063A0, &CStreamingInfo::RemoveFromList, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index 85572fbd..7212fc65 100644 --- a/src/core/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "FileMgr.h" #include "Weather.h" @@ -141,10 +141,3 @@ CSurfaceTable::GetAdhesiveLimit(CColPoint &colpoint) { return ms_aAdhesiveLimitTable[GetAdhesionGroup(colpoint.surfaceB)][GetAdhesionGroup(colpoint.surfaceA)]; } - -STARTPATCHES - InjectHook(0x4AB8F0, CSurfaceTable::Initialise, PATCH_JUMP); - InjectHook(0x4ABA60, CSurfaceTable::GetAdhesionGroup, PATCH_JUMP); - InjectHook(0x4ABAA0, CSurfaceTable::GetWetMultiplier, PATCH_JUMP); - InjectHook(0x4ABA30, CSurfaceTable::GetAdhesiveLimit, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index 05b272ab..79d6252b 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "TempColModels.h" #include "SurfaceTable.h" @@ -287,7 +287,3 @@ CTempColModels::Initialise(void) #undef SET_COLMODEL_SPHERES } - -STARTPATCHES - InjectHook(0x412160, CTempColModels::Initialise, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp index 68b31e6f..ebd79695 100644 --- a/src/core/Timer.cpp +++ b/src/core/Timer.cpp @@ -1,6 +1,6 @@ #include #include "common.h" -#include "patcher.h" + #include "DMAudio.h" #include "Record.h" #include "Timer.h" @@ -225,18 +225,3 @@ uint32 CTimer::GetCyclesPerFrame() return 20; } -#if 1 -STARTPATCHES - InjectHook(0x4ACE60, CTimer::Initialise, PATCH_JUMP); - InjectHook(0x4ACF60, CTimer::Shutdown, PATCH_JUMP); - InjectHook(0x4ACF70, CTimer::Update, PATCH_JUMP); - InjectHook(0x4AD310, CTimer::Suspend, PATCH_JUMP); - InjectHook(0x4AD370, CTimer::Resume, PATCH_JUMP); - InjectHook(0x4AD3F0, CTimer::GetCyclesPerMillisecond, PATCH_JUMP); - InjectHook(0x4AD410, CTimer::GetCurrentTimeInCycles, PATCH_JUMP); - InjectHook(0x4AD450, CTimer::GetIsSlowMotionActive, PATCH_JUMP); - InjectHook(0x4AD480, CTimer::Stop, PATCH_JUMP); - InjectHook(0x4AD490, CTimer::StartUserPause, PATCH_JUMP); - InjectHook(0x4AD4A0, CTimer::EndUserPause, PATCH_JUMP); -ENDPATCHES -#endif diff --git a/src/core/User.cpp b/src/core/User.cpp index a1a69b2d..36f07cbd 100644 --- a/src/core/User.cpp +++ b/src/core/User.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Hud.h" #include "PlayerPed.h" @@ -120,16 +120,3 @@ CUserDisplay::Process() Pager.Process(); CurrentVehicle.Process(); } - -STARTPATCHES - InjectHook(0x4AD4C0, &CPlaceName::Init, PATCH_JUMP); - InjectHook(0x4AD4E0, &CPlaceName::Process, PATCH_JUMP); - InjectHook(0x4AD5B0, &CPlaceName::Display, PATCH_JUMP); - - InjectHook(0x4AD5F0, &CCurrentVehicle::Init, PATCH_JUMP); - InjectHook(0x4AD600, &CCurrentVehicle::Process, PATCH_JUMP); - InjectHook(0x4AD630, &CCurrentVehicle::Display, PATCH_JUMP); - - InjectHook(0x4AD660, &CUserDisplay::Init, PATCH_JUMP); - InjectHook(0x4AD690, &CUserDisplay::Process, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp index 1911ae59..ce7d217e 100644 --- a/src/core/Wanted.cpp +++ b/src/core/Wanted.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Pools.h" #include "ModelIndices.h" #include "Timer.h" @@ -456,25 +456,3 @@ CWanted::UpdateCrimesQ(void) } } } - -STARTPATCHES - InjectHook(0x4AD6E0, &CWanted::Initialise, PATCH_JUMP); - InjectHook(0x4AD790, &CWanted::Reset, PATCH_JUMP); - InjectHook(0x4AD7B0, &CWanted::Update, PATCH_JUMP); - InjectHook(0x4AD900, &CWanted::UpdateWantedLevel, PATCH_JUMP); - InjectHook(0x4AD9F0, &CWanted::RegisterCrime, PATCH_JUMP); - InjectHook(0x4ADA10, &CWanted::RegisterCrime_Immediately, PATCH_JUMP); - InjectHook(0x4ADA50, &CWanted::SetWantedLevel, PATCH_JUMP); - InjectHook(0x4ADAC0, &CWanted::SetWantedLevelNoDrop, PATCH_JUMP); - InjectHook(0x4ADAE0, &CWanted::SetMaximumWantedLevel, PATCH_JUMP); - InjectHook(0x4ADBA0, &CWanted::AreSwatRequired, PATCH_JUMP); - InjectHook(0x4ADBC0, &CWanted::AreFbiRequired, PATCH_JUMP); - InjectHook(0x4ADBE0, &CWanted::AreArmyRequired, PATCH_JUMP); - InjectHook(0x4ADC00, &CWanted::NumOfHelisRequired, PATCH_JUMP); - InjectHook(0x4ADC40, &CWanted::ResetPolicePursuit, PATCH_JUMP); - InjectHook(0x4ADD00, &CWanted::WorkOutPolicePresence, PATCH_JUMP); - InjectHook(0x4ADF20, &CWanted::ClearQdCrimes, PATCH_JUMP); - InjectHook(0x4ADFD0, &CWanted::AddCrimeToQ, PATCH_JUMP); - InjectHook(0x4AE090, &CWanted::UpdateCrimesQ, PATCH_JUMP); - InjectHook(0x4AE110, &CWanted::ReportCrimeNow, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/World.cpp b/src/core/World.cpp index c9e3c11f..eacb3404 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -27,28 +27,28 @@ #include "Vehicle.h" #include "WaterLevel.h" #include "common.h" -#include "patcher.h" + #define OBJECT_REPOSITION_OFFSET_Z 2.0f CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; -CPtrList *CWorld::ms_bigBuildingsList = (CPtrList *)0x6FAB60; -CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList *)0x8F433C; -CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector(*)[NUMSECTORS_Y])0x665608; -uint16 &CWorld::ms_nCurrentScanCode = *(uint16 *)0x95CC64; +CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60; +CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C; +CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608; +uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64; -uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61; +uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61; CPlayerInfo CWorld::Players[NUMPLAYERS]; -bool &CWorld::bNoMoreCollisionTorque = *(bool *)0x95CDCC; -CEntity *&CWorld::pIgnoreEntity = *(CEntity **)0x8F6494; -bool &CWorld::bIncludeDeadPeds = *(bool *)0x95CD8F; -bool &CWorld::bSecondShift = *(bool *)0x95CD54; -bool &CWorld::bForceProcessControl = *(bool *)0x95CD6C; -bool &CWorld::bProcessCutsceneOnly = *(bool *)0x95CD8B; +bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC; +CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494; +bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F; +bool CWorld::bSecondShift;// = *(bool*)0x95CD54; +bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C; +bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B; -bool &CWorld::bDoingCarCollisions = *(bool *)0x95CD8C; -bool &CWorld::bIncludeCarTyres = *(bool *)0x95CDAA; +bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C; +bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA; void CWorld::Initialise() @@ -2215,32 +2215,3 @@ CWorld::UseDetonator(CEntity *pEntity) } } } - -STARTPATCHES - InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP); - InjectHook(0x4AE9D0, CWorld::Remove, PATCH_JUMP); - InjectHook(0x4B1F60, CWorld::ClearScanCodes, PATCH_JUMP); - InjectHook(0x4AF970, CWorld::ProcessLineOfSight, PATCH_JUMP); - InjectHook(0x4B0A80, CWorld::ProcessLineOfSightSector, PATCH_JUMP); - InjectHook(0x4B0C70, CWorld::ProcessLineOfSightSectorList, PATCH_JUMP); - InjectHook(0x4B0DE0, CWorld::ProcessVerticalLine, PATCH_JUMP); - InjectHook(0x4B0EF0, CWorld::ProcessVerticalLineSector, PATCH_JUMP); - InjectHook(0x4B1090, CWorld::ProcessVerticalLineSectorList, PATCH_JUMP); - InjectHook(0x4AEAA0, CWorld::GetIsLineOfSightClear, PATCH_JUMP); - InjectHook(0x4B2000, CWorld::GetIsLineOfSightSectorClear, PATCH_JUMP); - InjectHook(0x4B2160, CWorld::GetIsLineOfSightSectorListClear, PATCH_JUMP); - - InjectHook(0x4B2200, CWorld::FindObjectsInRange, PATCH_JUMP); - InjectHook(0x4B2540, CWorld::FindObjectsInRangeSectorList, PATCH_JUMP); - InjectHook(0x4B4AC0, CWorld::TestSphereAgainstSectorList, PATCH_JUMP); - InjectHook(0x4B4710, CWorld::TestSphereAgainstWorld, PATCH_JUMP); - InjectHook(0x4B3A80, CWorld::FindGroundZForCoord, PATCH_JUMP); - InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP); - InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP); - - InjectHook(0x4B5BC0, CWorld::StopAllLawEnforcersInTheirTracks, PATCH_JUMP); - InjectHook(0x4B53F0, CWorld::SetAllCarsCanBeDamaged, PATCH_JUMP); - InjectHook(0x4B5460, CWorld::ExtinguishAllCarFiresInArea, PATCH_JUMP); - - InjectHook(0x4B1A60, CWorld::Process, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/World.h b/src/core/World.h index a1e2acfd..25c76531 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -54,22 +54,22 @@ struct CStoredCollPoly; class CWorld { - static CPtrList *ms_bigBuildingsList; // [4]; - static CPtrList &ms_listMovingEntityPtrs; - static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X]; - static uint16 &ms_nCurrentScanCode; + static CPtrList ms_bigBuildingsList[4]; + static CPtrList ms_listMovingEntityPtrs; + static CSector ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X]; + static uint16 ms_nCurrentScanCode; public: - static uint8 &PlayerInFocus; + static uint8 PlayerInFocus; static CPlayerInfo Players[NUMPLAYERS]; - static CEntity *&pIgnoreEntity; - static bool &bIncludeDeadPeds; - static bool &bNoMoreCollisionTorque; - static bool &bSecondShift; - static bool &bForceProcessControl; - static bool &bProcessCutsceneOnly; - static bool &bDoingCarCollisions; - static bool &bIncludeCarTyres; + static CEntity *pIgnoreEntity; + static bool bIncludeDeadPeds; + static bool bNoMoreCollisionTorque; + static bool bSecondShift; + static bool bForceProcessControl; + static bool bProcessCutsceneOnly; + static bool bDoingCarCollisions; + static bool bIncludeCarTyres; static void Remove(CEntity *entity); static void Add(CEntity *entity); diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 4cdd283e..d17a33d4 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Building.h" #include "Treadable.h" #include "Train.h" @@ -562,17 +562,3 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set) } return false; } - -STARTPATCHES - InjectHook(0x524BC0, &CCullZones::Init, PATCH_JUMP); - InjectHook(0x524EC0, &CCullZones::ResolveVisibilities, PATCH_JUMP); - InjectHook(0x524F80, &CCullZones::Update, PATCH_JUMP); - InjectHook(0x525370, &CCullZones::AddCullZone, PATCH_JUMP); - InjectHook(0x5250D0, &CCullZones::ForceCullZoneCoors, PATCH_JUMP); - InjectHook(0x525130, &CCullZones::FindCullZoneForCoors, PATCH_JUMP); - InjectHook(0x5251C0, &CCullZones::FindAttributesForCoors, PATCH_JUMP); - InjectHook(0x525290, &CCullZones::FindZoneWithStairsAttributeForPlayer, PATCH_JUMP); - - InjectHook(0x525610, &CCullZone::DoStuffLeavingZone, PATCH_JUMP); - InjectHook(0x525810, &CCullZone::DoStuffEnteringZone, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 39d4c3b5..6375de1c 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include #include "Zones.h" @@ -840,36 +840,3 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 length) TotalNumberOfMapZones = *(uint16*)(buffer); NumberOfAudioZones = *(uint16*)(buffer+2); } - - -STARTPATCHES - InjectHook(0x4B5DD0, &CZone::GetTranslatedName, PATCH_JUMP); - InjectHook(0x4B5DE0, CTheZones::Init, PATCH_JUMP); - InjectHook(0x4B61D0, CTheZones::Update, PATCH_JUMP); - InjectHook(0x4B6210, CTheZones::CreateZone, PATCH_JUMP); - InjectHook(0x4B6380, CTheZones::CreateMapZone, PATCH_JUMP); - InjectHook(0x4B64C0, CTheZones::PostZoneCreation, PATCH_JUMP); - InjectHook(0x4B6500, CTheZones::InsertZoneIntoZoneHierarchy, PATCH_JUMP); - InjectHook(0x4B6530, CTheZones::InsertZoneIntoZoneHierRecursive, PATCH_JUMP); - InjectHook(0x4B65F0, CTheZones::ZoneIsEntirelyContainedWithinOtherZone, PATCH_JUMP); - InjectHook(0x4B6710, CTheZones::PointLiesWithinZone, PATCH_JUMP); - InjectHook(0x4B6910, CTheZones::GetLevelFromPosition, PATCH_JUMP); - InjectHook(0x4B69B0, CTheZones::FindSmallestZonePosition, PATCH_JUMP); - InjectHook(0x4B6790, CTheZones::FindSmallestZonePositionType, PATCH_JUMP); - InjectHook(0x4B6890, CTheZones::FindSmallestZonePositionILN, PATCH_JUMP); - InjectHook(0x4B6800, CTheZones::FindZoneByLabelAndReturnIndex, PATCH_JUMP); - InjectHook(0x4B6FA0, CTheZones::GetZone, PATCH_JUMP); - InjectHook(0x4B84F0, CTheZones::GetPointerForZoneIndex, PATCH_JUMP); - InjectHook(0x4B6A10, CTheZones::GetZoneInfo, PATCH_JUMP); - InjectHook(0x4B6FB0, CTheZones::GetZoneInfoForTimeOfDay, PATCH_JUMP); - InjectHook(0x4B6A50, CTheZones::SetZoneCarInfo, PATCH_JUMP); - InjectHook(0x4B6DC0, CTheZones::SetZonePedInfo, PATCH_JUMP); - InjectHook(0x4B6EB0, CTheZones::SetCarDensity, PATCH_JUMP); - InjectHook(0x4B6F00, CTheZones::SetPedDensity, PATCH_JUMP); - InjectHook(0x4B6F50, CTheZones::SetPedGroup, PATCH_JUMP); - InjectHook(0x4B83E0, CTheZones::FindAudioZone, PATCH_JUMP); - InjectHook(0x4B8430, CTheZones::FindZoneForPoint, PATCH_JUMP); - InjectHook(0x4B8340, CTheZones::AddZoneToAudioZoneArray, PATCH_JUMP); - InjectHook(0x4B8510, CTheZones::SaveAllZones, PATCH_JUMP); - InjectHook(0x4B8950, CTheZones::LoadAllZones, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/main.cpp b/src/core/main.cpp index 1b46d453..d5d4065d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -2,7 +2,7 @@ #include "rpmatfx.h" #include "rphanim.h" #include "rpskin.h" -#include "patcher.h" + #include "main.h" #include "CdStream.h" #include "General.h" @@ -1838,28 +1838,3 @@ main(int argc, char *argv[]) return 0; } - -STARTPATCHES - InjectHook(0x48E480, Idle, PATCH_JUMP); - InjectHook(0x48E700, FrontendIdle, PATCH_JUMP); - - InjectHook(0x48CF10, DoRWStuffStartOfFrame, PATCH_JUMP); - InjectHook(0x48D040, DoRWStuffStartOfFrame_Horizon, PATCH_JUMP); - InjectHook(0x48E030, RenderScene, PATCH_JUMP); - InjectHook(0x48E080, RenderDebugShit, PATCH_JUMP); - InjectHook(0x48E090, RenderEffects, PATCH_JUMP); - InjectHook(0x48E0E0, Render2dStuff, PATCH_JUMP); - InjectHook(0x48E450, RenderMenus, PATCH_JUMP); - InjectHook(0x48D120, DoFade, PATCH_JUMP); - InjectHook(0x48E470, Render2dStuffAfterFade, PATCH_JUMP); - - InjectHook(0x48D550, LoadSplash, PATCH_JUMP); - InjectHook(0x48D670, DestroySplashScreen, PATCH_JUMP); - InjectHook(0x48D770, LoadingScreen, PATCH_JUMP); - InjectHook(0x48D760, ResetLoadingScreenBar, PATCH_JUMP); - - InjectHook(0x48D470, PluginAttach, PATCH_JUMP); - InjectHook(0x48D520, Initialise3D, PATCH_JUMP); - InjectHook(0x48D540, Terminate3D, PATCH_JUMP); - InjectHook(0x48E800, AppEventHandler, PATCH_JUMP); -ENDPATCHES diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 2046a7f9..e5f42696 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -29,18 +29,12 @@ #include -#ifndef RWLIBS -void **rwengine = *(void***)0x5A10E1; -#else +#ifdef RWLIBS extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList); #endif DebugMenuAPI gDebugMenuAPI; -STARTPATCHES - InjectHook(0x5A07E0, (void (*)(void*)) &operator delete, PATCH_JUMP); - InjectHook(0x5A0690, (void* (*)(size_t)) &operator new, PATCH_JUMP); -ENDPATCHES #ifdef USE_PS2_RAND unsigned __int64 myrand_seed = 1; @@ -387,7 +381,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); extern bool PrintDebugCode; - extern int16 &DebugCamMode; + extern int16 DebugCamMode; DebugMenuAddVarBool8("Cam", "Use mouse Cam", (int8*)&CCamera::m_bUseMouse3rdPerson, nil); #ifdef FREE_CAM DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&CCamera::bFreeCam, nil); @@ -494,37 +488,3 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons #ifdef VALIDATE_SAVE_SIZE int32 _saveBufCount; #endif - -void -patch() -{ - StaticPatcher::Apply(); - -// Patch(0x46BC61+6, 1.0f); // car distance - InjectHook(0x59E460, printf, PATCH_JUMP); - InjectHook(0x475E00, printf, PATCH_JUMP); // _Error - - -// InterceptCall(&open_script_orig, open_script, 0x438869); - -// InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E); -} - -BOOL WINAPI -DllMain(HINSTANCE hInst, DWORD reason, LPVOID) -{ - if(reason == DLL_PROCESS_ATTACH){ - - AllocConsole(); - freopen("CONIN$", "r", stdin); - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); - - if (*(DWORD*)0x5C1E75 == 0xB85548EC) // 1.0 - patch(); - else - return FALSE; - } - - return TRUE; -} diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp index 7813c87f..aad2d402 100644 --- a/src/entities/Building.cpp +++ b/src/entities/Building.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Building.h" #include "Streaming.h" #include "Pools.h" @@ -20,18 +20,3 @@ CBuilding::ReplaceWithNewModel(int32 id) if(m_level == LEVEL_NONE || m_level == CGame::currLevel) CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE); } - -#include - -class CBuilding_ : public CBuilding -{ -public: - CBuilding *ctor(void) { return ::new (this) CBuilding(); } - void dtor(void) { CBuilding::~CBuilding(); } -}; - -STARTPATCHES - InjectHook(0x4057D0, &CBuilding_::ctor, PATCH_JUMP); - InjectHook(0x405800, &CBuilding_::dtor, PATCH_JUMP); - InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP); -ENDPATCHES diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp index 176e5682..8a4bfd5f 100644 --- a/src/entities/Dummy.cpp +++ b/src/entities/Dummy.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Pools.h" #include "World.h" #include "Dummy.h" @@ -50,17 +50,3 @@ CDummy::Remove(void) m_entryInfoList.DeleteNode(node); } } - -class CDummy_ : public CDummy -{ -public: - void Add_(void) { CDummy::Add(); } - void Remove_(void) { CDummy::Remove(); } - void dtor(void) { CDummy::~CDummy(); } -}; - -STARTPATCHES - InjectHook(0x473810, &CDummy_::dtor, PATCH_JUMP); - InjectHook(0x473860, &CDummy_::Add_, PATCH_JUMP); - InjectHook(0x473AD0, &CDummy_::Remove_, PATCH_JUMP); -ENDPATCHES diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 0efee4e7..3dce53da 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "ModelIndices.h" #include "Timer.h" @@ -874,56 +874,3 @@ CEntity::AddSteamsFromGround(CPtrList& list) pNode = pNode->next; } } - -#include - -class CEntity_ : public CEntity -{ -public: - CEntity *ctor(void) { return ::new (this) CEntity(); } - void dtor(void) { this->CEntity::~CEntity(); } - void Add_(void) { CEntity::Add(); } - void Remove_(void) { CEntity::Remove(); } - void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); } - void CreateRwObject_(void) { CEntity::CreateRwObject(); } - void DeleteRwObject_(void) { CEntity::DeleteRwObject(); } - CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); } - void PreRender_(void) { CEntity::PreRender(); } - void Render_(void) { CEntity::Render(); } - bool SetupLighting_(void) { return CEntity::SetupLighting(); } -}; - -STARTPATCHES - InjectHook(0x473C30, &CEntity_::ctor, PATCH_JUMP); - InjectHook(0x473E40, &CEntity_::dtor, PATCH_JUMP); - InjectHook(0x473E70, &CEntity_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x475080, &CEntity_::Add_, PATCH_JUMP); - InjectHook(0x475310, &CEntity_::Remove_, PATCH_JUMP); - InjectHook(0x473EA0, &CEntity_::CreateRwObject_, PATCH_JUMP); - InjectHook(0x473F90, &CEntity_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x474000, &CEntity_::GetBoundRect_, PATCH_JUMP); - InjectHook(0x474350, &CEntity_::PreRender_, PATCH_JUMP); - InjectHook(0x474BD0, &CEntity_::Render_, PATCH_JUMP); - InjectHook(0x4A7C60, &CEntity_::SetupLighting_, PATCH_JUMP); - - InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP); - InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP); - InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP); - InjectHook(0x474CC0, &CEntity::GetIsOnScreen, PATCH_JUMP); - InjectHook(0x474D20, &CEntity::GetIsOnScreenComplex, PATCH_JUMP); - InjectHook(0x474CA0, &CEntity::IsVisible, PATCH_JUMP); - InjectHook(0x474330, &CEntity::UpdateRwFrame, PATCH_JUMP); - InjectHook(0x4755E0, &CEntity::SetupBigBuilding, PATCH_JUMP); - InjectHook(0x4A7480, &CEntity::RegisterReference, PATCH_JUMP); - InjectHook(0x4A74E0, &CEntity::ResolveReferences, PATCH_JUMP); - InjectHook(0x4A7530, &CEntity::PruneReferences, PATCH_JUMP); - - InjectHook(0x473F10, &CEntity::AttachToRwObject, PATCH_JUMP); - InjectHook(0x473F60, &CEntity::DetachFromRwObject, PATCH_JUMP); - - InjectHook(0x475A20, &CEntity::PreRenderForGlassWindow, PATCH_JUMP); - InjectHook(0x50CE40, (void (CEntity::*)(CVector*))& CEntity::AddSteamsFromGround, PATCH_JUMP); - InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP); - InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP); - InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP); -ENDPATCHES diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index bbdf68f5..445cd83f 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "World.h" #include "Timer.h" #include "ModelIndices.h" @@ -1933,58 +1933,3 @@ CPhysical::ProcessCollision(void) bIsInSafePosition = true; RemoveAndAdd(); } - -class CPhysical_ : public CPhysical -{ -public: - void dtor(void) { CPhysical::~CPhysical(); } - void Add_(void) { CPhysical::Add(); } - void Remove_(void) { CPhysical::Remove(); } - CRect GetBoundRect_(void) { return CPhysical::GetBoundRect(); } - void ProcessControl_(void) { CPhysical::ProcessControl(); } - void ProcessShift_(void) { CPhysical::ProcessShift(); } - void ProcessCollision_(void) { CPhysical::ProcessCollision(); } - int32 ProcessEntityCollision_(CEntity *ent, CColPoint *point) { return CPhysical::ProcessEntityCollision(ent, point); } -}; - -STARTPATCHES - InjectHook(0x495130, &CPhysical_::dtor, PATCH_JUMP); - InjectHook(0x4951F0, &CPhysical_::Add_, PATCH_JUMP); - InjectHook(0x4954B0, &CPhysical_::Remove_, PATCH_JUMP); - InjectHook(0x495540, &CPhysical_::RemoveAndAdd, PATCH_JUMP); - InjectHook(0x495F10, &CPhysical_::ProcessControl_, PATCH_JUMP); - InjectHook(0x496F10, &CPhysical_::ProcessShift_, PATCH_JUMP); - InjectHook(0x4961A0, &CPhysical_::ProcessCollision_, PATCH_JUMP); - InjectHook(0x49F790, &CPhysical_::ProcessEntityCollision_, PATCH_JUMP); - InjectHook(0x4958F0, &CPhysical::AddToMovingList, PATCH_JUMP); - InjectHook(0x495940, &CPhysical::RemoveFromMovingList, PATCH_JUMP); - InjectHook(0x497180, &CPhysical::AddCollisionRecord, PATCH_JUMP); - InjectHook(0x4970C0, &CPhysical::AddCollisionRecord_Treadable, PATCH_JUMP); - InjectHook(0x497240, &CPhysical::GetHasCollidedWith, PATCH_JUMP); - InjectHook(0x49F820, &CPhysical::RemoveRefsToEntity, PATCH_JUMP); - InjectHook(0x49F890, &CPhysical::PlacePhysicalRelativeToOtherPhysical, PATCH_JUMP); - -#define F3 float, float, float - InjectHook(0x495B10, &CPhysical::ApplyMoveSpeed, PATCH_JUMP); - InjectHook(0x497280, &CPhysical::ApplyTurnSpeed, PATCH_JUMP); - InjectHook(0x4959A0, (void (CPhysical::*)(F3))&CPhysical::ApplyMoveForce, PATCH_JUMP); - InjectHook(0x495A10, (void (CPhysical::*)(F3, F3))&CPhysical::ApplyTurnForce, PATCH_JUMP); - InjectHook(0x495D90, (void (CPhysical::*)(F3))&CPhysical::ApplyFrictionMoveForce, PATCH_JUMP); - InjectHook(0x495E10, (void (CPhysical::*)(F3, F3))&CPhysical::ApplyFrictionTurnForce, PATCH_JUMP); - InjectHook(0x499890, &CPhysical::ApplySpringCollision, PATCH_JUMP); - InjectHook(0x499990, &CPhysical::ApplySpringDampening, PATCH_JUMP); - InjectHook(0x495B50, &CPhysical::ApplyGravity, PATCH_JUMP); - InjectHook(0x495B80, (void (CPhysical::*)(void))&CPhysical::ApplyFriction, PATCH_JUMP); - InjectHook(0x495C20, &CPhysical::ApplyAirResistance, PATCH_JUMP); - - InjectHook(0x4973A0, &CPhysical::ApplyCollision, PATCH_JUMP); - InjectHook(0x4992A0, &CPhysical::ApplyCollisionAlt, PATCH_JUMP); - InjectHook(0x499BE0, (bool (CPhysical::*)(float, CColPoint&))&CPhysical::ApplyFriction, PATCH_JUMP); - InjectHook(0x49A180, (bool (CPhysical::*)(CPhysical*, float, CColPoint&))&CPhysical::ApplyFriction, PATCH_JUMP); - - InjectHook(0x49DA10, &CPhysical::ProcessShiftSectorList, PATCH_JUMP); - InjectHook(0x49E790, &CPhysical::ProcessCollisionSectorList_SimpleCar, PATCH_JUMP); - InjectHook(0x49B620, &CPhysical::ProcessCollisionSectorList, PATCH_JUMP); - InjectHook(0x496E50, &CPhysical::CheckCollision, PATCH_JUMP); - InjectHook(0x496EB0, &CPhysical::CheckCollision_SimpleCar, PATCH_JUMP); -ENDPATCHES diff --git a/src/entities/Treadable.cpp b/src/entities/Treadable.cpp index ea949f00..00abbe13 100644 --- a/src/entities/Treadable.cpp +++ b/src/entities/Treadable.cpp @@ -1,18 +1,8 @@ #include "common.h" -#include "patcher.h" + #include "rpworld.h" #include "Treadable.h" #include "Pools.h" void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); } void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); } - -class CTreadable_ : public CTreadable -{ -public: - void dtor(void) { CTreadable::~CTreadable(); } -}; - -STARTPATCHES - InjectHook(0x405A10, &CTreadable_::dtor, PATCH_JUMP); -ENDPATCHES diff --git a/src/math/math.cpp b/src/math/math.cpp index 4f74fac9..e11d048c 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Quaternion.h" // TODO: move more stuff into here @@ -191,8 +191,3 @@ CQuaternion::Get(RwMatrix *matrix) matrix->up.z = y_2z + w_2x; matrix->at.z = 1.0f - (x_2x + y_2y); } - -STARTPATCHES - InjectHook(0x4BA1C0, &CQuaternion::Slerp, PATCH_JUMP); - InjectHook(0x4BA0D0, &CQuaternion::Get, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index 830ead51..e8d2601f 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "templates.h" #include "TxdStore.h" #include "2dEffect.h" @@ -99,25 +99,3 @@ CBaseModelInfo::Get2dEffect(int n) else return nil; } - - -class CBaseModelInfo_ : public CBaseModelInfo -{ -public: - void Shutdown_(void) { CBaseModelInfo::Shutdown(); } -}; -STARTPATCHES - // can't easily replace ctor at 4F6A50 - InjectHook(0x4F6A90, &CBaseModelInfo_::Shutdown_, PATCH_JUMP); - - InjectHook(0x4F6AC0, &CBaseModelInfo::DeleteCollisionModel, PATCH_JUMP); - InjectHook(0x4F6B70, &CBaseModelInfo::ClearTexDictionary, PATCH_JUMP); - InjectHook(0x4F6BA0, &CBaseModelInfo::AddRef, PATCH_JUMP); - InjectHook(0x4F6BB0, &CBaseModelInfo::RemoveRef, PATCH_JUMP); - InjectHook(0x4F6B40, &CBaseModelInfo::SetTexDictionary, PATCH_JUMP); - InjectHook(0x4F6B80, &CBaseModelInfo::AddTexDictionaryRef, PATCH_JUMP); - InjectHook(0x4F6B90, &CBaseModelInfo::RemoveTexDictionaryRef, PATCH_JUMP); - InjectHook(0x4F6B20, &CBaseModelInfo::Add2dEffect, PATCH_JUMP); - InjectHook(0x4F6AF0, &CBaseModelInfo::Init2dEffects, PATCH_JUMP); - InjectHook(0x4F6B00, &CBaseModelInfo::Get2dEffect, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index c6a6d5d0..464bda61 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "NodeName.h" #include "VisibilityPlugins.h" @@ -138,30 +138,3 @@ CClumpModelInfo::GetFrameFromId(RpClump *clump, int32 id) RwFrameForAllChildren(RpClumpGetFrame(clump), FindFrameFromIdCB, &assoc); return assoc.frame; } - - -class CClumpModelInfo_ : public CClumpModelInfo -{ -public: - void DeleteRwObject_(void) { this->CClumpModelInfo::DeleteRwObject(); } - RwObject *CreateInstance_1(void) { return CClumpModelInfo::CreateInstance(); } - RwObject *CreateInstance_2(RwMatrix *m) { return CClumpModelInfo::CreateInstance(m); } - RwObject *GetRwObject_(void) { return CClumpModelInfo::GetRwObject(); } - void SetClump_(RpClump *clump) { CClumpModelInfo::SetClump(clump); } -}; - -STARTPATCHES - InjectHook(0x4F8800, &CClumpModelInfo_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x4F8920, &CClumpModelInfo_::CreateInstance_1, PATCH_JUMP); - InjectHook(0x4F88A0, &CClumpModelInfo_::CreateInstance_2, PATCH_JUMP); - InjectHook(0x50C1C0, &CClumpModelInfo_::GetRwObject_, PATCH_JUMP); - InjectHook(0x4F8830, &CClumpModelInfo_::SetClump_, PATCH_JUMP); - InjectHook(0x4F8940, &CClumpModelInfo::SetAtomicRendererCB, PATCH_JUMP); - InjectHook(0x4F8960, &CClumpModelInfo::FindFrameFromNameCB, PATCH_JUMP); - InjectHook(0x4F8A10, &CClumpModelInfo::FindFrameFromNameWithoutIdCB, PATCH_JUMP); - InjectHook(0x4F8AD0, &CClumpModelInfo::FindFrameFromIdCB, PATCH_JUMP); - InjectHook(0x4F8BB0, &CClumpModelInfo::SetFrameIds, PATCH_JUMP); - InjectHook(0x4F8B20, &CClumpModelInfo::FillFrameArrayCB, PATCH_JUMP); - InjectHook(0x4F8B90, &CClumpModelInfo::FillFrameArray, PATCH_JUMP); - InjectHook(0x4F8B50, &CClumpModelInfo::GetFrameFromId, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/MloModelInfo.cpp b/src/modelinfo/MloModelInfo.cpp index 746d9db4..7535e6c5 100644 --- a/src/modelinfo/MloModelInfo.cpp +++ b/src/modelinfo/MloModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "VisibilityPlugins.h" #include "ModelInfo.h" diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp index ec039a0b..9a6a74d0 100644 --- a/src/modelinfo/ModelIndices.cpp +++ b/src/modelinfo/ModelIndices.cpp @@ -1,9 +1,9 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "ModelIndices.h" -#define X(name, var, addr) int16 &var = *(int16*)addr; +#define X(name, var, addr) int16 var; MODELINDICES #undef X @@ -32,8 +32,3 @@ TestModelIndices(void) { ; } - -STARTPATCHES - InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP); - InjectHook(0x48F030, MatchModelString, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index cc8399e7..8e117882 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -158,7 +158,7 @@ X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ X("files", MI_FILES, 0x5F5BC4) -#define X(name, var, addr) extern int16 &var; +#define X(name, var, addr) extern int16 var; MODELINDICES #undef X diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index 58124e53..c1ae692f 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "TempColModels.h" #include "ModelIndices.h" @@ -248,15 +248,3 @@ CModelInfo::ReInit2dEffects() ms_modelInfoPtrs[i]->Init2dEffects(); } } - -STARTPATCHES - InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP); - InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP); - InjectHook(0x50B920, CModelInfo::AddSimpleModel, PATCH_JUMP); - InjectHook(0x50B9C0, CModelInfo::AddTimeModel, PATCH_JUMP); - InjectHook(0x50BA10, CModelInfo::AddClumpModel, PATCH_JUMP); - InjectHook(0x50BAD0, CModelInfo::AddPedModel, PATCH_JUMP); - InjectHook(0x50BA60, CModelInfo::AddVehicleModel, PATCH_JUMP); - InjectHook(0x50B860, (CBaseModelInfo *(*)(const char*, int*))CModelInfo::GetModelInfo, PATCH_JUMP); - InjectHook(0x50BBC0, CModelInfo::RemoveColModelsFromOtherLevels, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 015c6949..5c801a2b 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Ped.h" #include "NodeName.h" @@ -229,17 +229,3 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) return colmodel; } - -class CPedModelInfo_ : public CPedModelInfo -{ -public: - void DeleteRwObject_(void) { CPedModelInfo::DeleteRwObject(); } - void SetClump_(RpClump *clump) { CPedModelInfo::SetClump(clump); } -}; - -STARTPATCHES - InjectHook(0x510210, &CPedModelInfo_::SetClump_, PATCH_JUMP); - InjectHook(0x510280, &CPedModelInfo_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x510390, &CPedModelInfo::SetLowDetailClump, PATCH_JUMP); - InjectHook(0x5104D0, &CPedModelInfo::CreateHitColModel, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index f8742f1e..2fb2adeb 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Camera.h" #include "ModelInfo.h" @@ -154,28 +154,3 @@ CSimpleModelInfo::SetupBigBuilding(void) m_lodDistances[2] = 100.0f; } } - -class CSimpleModelInfo_ : public CSimpleModelInfo -{ -public: - void DeleteRwObject_(void) { CSimpleModelInfo::DeleteRwObject(); } - RwObject *CreateInstance_1(void) { return CSimpleModelInfo::CreateInstance(); } - RwObject *CreateInstance_2(RwMatrix *m) { return CSimpleModelInfo::CreateInstance(m); } - RwObject *GetRwObject_(void) { return CSimpleModelInfo::GetRwObject(); } -}; - -STARTPATCHES - InjectHook(0x5179B0, &CSimpleModelInfo_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x517B60, &CSimpleModelInfo_::CreateInstance_1, PATCH_JUMP); - InjectHook(0x517AC0, &CSimpleModelInfo_::CreateInstance_2, PATCH_JUMP); - InjectHook(0x4A9BA0, &CSimpleModelInfo_::GetRwObject_, PATCH_JUMP); - InjectHook(0x517990, &CSimpleModelInfo::Init, PATCH_JUMP); - InjectHook(0x517C60, &CSimpleModelInfo::IncreaseAlpha, PATCH_JUMP); - InjectHook(0x517950, &CSimpleModelInfo::SetAtomic, PATCH_JUMP); - InjectHook(0x517AA0, &CSimpleModelInfo::SetLodDistances, PATCH_JUMP); - InjectHook(0x517A90, &CSimpleModelInfo::GetNearDistance, PATCH_JUMP); - InjectHook(0x517A60, &CSimpleModelInfo::GetLargestLodDistance, PATCH_JUMP); - InjectHook(0x517A00, &CSimpleModelInfo::GetAtomicFromDistance, PATCH_JUMP); - InjectHook(0x517C00, &CSimpleModelInfo::FindRelatedModel, PATCH_JUMP); - InjectHook(0x517B90, &CSimpleModelInfo::SetupBigBuilding, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp index 3ab3e13a..fec3f6e5 100644 --- a/src/modelinfo/TimeModelInfo.cpp +++ b/src/modelinfo/TimeModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Camera.h" #include "ModelInfo.h" @@ -30,7 +30,3 @@ CTimeModelInfo::FindOtherTimeModel(void) } return nil; } - -STARTPATCHES - InjectHook(0x517C80, &CTimeModelInfo::FindOtherTimeModel, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index fb9e0358..0c3a7720 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -1,6 +1,6 @@ #include "common.h" #include -#include "patcher.h" + #include "RwHelper.h" #include "General.h" #include "NodeName.h" @@ -1104,65 +1104,3 @@ CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(int id) return n - 1; } - -class CVehicleModelInfo_ : public CVehicleModelInfo -{ -public: - void DeleteRwObject_(void) { CVehicleModelInfo::DeleteRwObject(); } - RwObject *CreateInstance_(void) { return CVehicleModelInfo::CreateInstance(); } - void SetClump_(RpClump *clump) { CVehicleModelInfo::SetClump(clump); } -}; - -STARTPATCHES - InjectHook(0x427820, &CVehicleModelInfo::SetComponentsToUse, PATCH_JUMP); - - InjectHook(0x51FDC0, &CVehicleModelInfo_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x51FCB0, &CVehicleModelInfo_::CreateInstance_, PATCH_JUMP); - InjectHook(0x51FC60, &CVehicleModelInfo_::SetClump_, PATCH_JUMP); - - InjectHook(0x51FE10, &CVehicleModelInfo::CollapseFramesCB, PATCH_JUMP); - InjectHook(0x51FE50, &CVehicleModelInfo::MoveObjectsCB, PATCH_JUMP); - InjectHook(0x51FE70, &CVehicleModelInfo::HideDamagedAtomicCB, PATCH_JUMP); - InjectHook(0x51FED0, &CVehicleModelInfo::HideAllComponentsAtomicCB, PATCH_JUMP); - InjectHook(0x51FEF0, &CVehicleModelInfo::HasAlphaMaterialCB, PATCH_JUMP); - - InjectHook(0x51FF10, &CVehicleModelInfo::SetAtomicRendererCB, PATCH_JUMP); - InjectHook(0x520030, &CVehicleModelInfo::SetAtomicRendererCB_BigVehicle, PATCH_JUMP); - InjectHook(0x520230, &CVehicleModelInfo::SetAtomicRendererCB_Train, PATCH_JUMP); - InjectHook(0x520120, &CVehicleModelInfo::SetAtomicRendererCB_Boat, PATCH_JUMP); - InjectHook(0x520210, &CVehicleModelInfo::SetAtomicRendererCB_Heli, PATCH_JUMP); - InjectHook(0x5202C0, &CVehicleModelInfo::SetAtomicRenderCallbacks, PATCH_JUMP); - - InjectHook(0x520340, &CVehicleModelInfo::SetAtomicFlagCB, PATCH_JUMP); - InjectHook(0x520360, &CVehicleModelInfo::ClearAtomicFlagCB, PATCH_JUMP); - - InjectHook(0x5204D0, &CVehicleModelInfo::PreprocessHierarchy, PATCH_JUMP); - InjectHook(0x5203C0, &CVehicleModelInfo::SetVehicleComponentFlags, PATCH_JUMP); - - InjectHook(0x520840, &CVehicleModelInfo::GetWheelPosn, PATCH_JUMP); - - InjectHook(0x520880, IsValidCompRule, PATCH_JUMP); - InjectHook(0x520990, CountCompsInRule, PATCH_JUMP); - InjectHook(0x5209C0, ChooseComponent, PATCH_JUMP); - InjectHook(0x5208C0, GetListOfComponentsNotUsedByRules, PATCH_JUMP); - InjectHook(0x520AB0, &CVehicleModelInfo::ChooseComponent, PATCH_JUMP); - InjectHook(0x520BE0, &CVehicleModelInfo::ChooseSecondComponent, PATCH_JUMP); - - InjectHook(0x520DC0, (RpAtomic *(*)(RpAtomic*, void*))CVehicleModelInfo::GetEditableMaterialListCB, PATCH_JUMP); - InjectHook(0x520D30, (RpMaterial *(*)(RpMaterial*, void*))CVehicleModelInfo::GetEditableMaterialListCB, PATCH_JUMP); - InjectHook(0x520DE0, &CVehicleModelInfo::FindEditableMaterialList, PATCH_JUMP); - InjectHook(0x520E70, &CVehicleModelInfo::SetVehicleColour, PATCH_JUMP); - InjectHook(0x520FD0, &CVehicleModelInfo::ChooseVehicleColour, PATCH_JUMP); - InjectHook(0x5210A0, &CVehicleModelInfo::AvoidSameVehicleColour, PATCH_JUMP); - InjectHook(0x521260, &CVehicleModelInfo::LoadVehicleColours, PATCH_JUMP); - InjectHook(0x521650, &CVehicleModelInfo::DeleteVehicleColourTextures, PATCH_JUMP); - - InjectHook(0x5219D0, &CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors, PATCH_JUMP); - - InjectHook(0x521820, (RpAtomic *(*)(RpAtomic*, void*))CVehicleModelInfo::SetEnvironmentMapCB, PATCH_JUMP); - InjectHook(0x5217A0, (RpMaterial *(*)(RpMaterial*, void*))CVehicleModelInfo::SetEnvironmentMapCB, PATCH_JUMP); - InjectHook(0x521770, CVehicleModelInfo::HasSpecularMaterialCB, PATCH_JUMP); - InjectHook(0x521890, &CVehicleModelInfo::SetEnvironmentMap, PATCH_JUMP); - InjectHook(0x521680, CVehicleModelInfo::LoadEnvironmentMaps, PATCH_JUMP); - InjectHook(0x521720, CVehicleModelInfo::ShutdownEnvironmentMaps, PATCH_JUMP); -ENDPATCHES diff --git a/src/objects/CutsceneHead.cpp b/src/objects/CutsceneHead.cpp index a7722b8a..b716e17e 100644 --- a/src/objects/CutsceneHead.cpp +++ b/src/objects/CutsceneHead.cpp @@ -1,6 +1,6 @@ #include "common.h" #include -#include "patcher.h" + #include "main.h" #include "RwHelper.h" #include "RpAnimBlend.h" @@ -109,20 +109,3 @@ CCutsceneHead::PlayAnimation(const char *animName) RwStreamClose(stream, nil); } } - -class CCutsceneHead_ : public CCutsceneHead -{ -public: - void CreateRwObject_(void) { CCutsceneHead::CreateRwObject(); } - void DeleteRwObject_(void) { CCutsceneHead::DeleteRwObject(); } - void ProcessControl_(void) { CCutsceneHead::ProcessControl(); } - void Render_(void) { CCutsceneHead::Render(); } -}; - -STARTPATCHES - InjectHook(0x4BA650, &CCutsceneHead_::CreateRwObject_, PATCH_JUMP); - InjectHook(0x4BA690, &CCutsceneHead_::DeleteRwObject_, PATCH_JUMP); - InjectHook(0x4BA760, &CCutsceneHead_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4BA800, &CCutsceneHead_::Render_, PATCH_JUMP); - InjectHook(0x4BA6A0, &CCutsceneHead::PlayAnimation, PATCH_JUMP); -ENDPATCHES diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 2f667a5d..cee83848 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lights.h" #include "PointLights.h" @@ -88,25 +88,3 @@ CCutsceneObject::RemoveLighting(bool reset) { CRenderer::RemoveVehiclePedLights(this, reset); } - -class CCutsceneObject_ : public CCutsceneObject -{ -public: - void dtor(void) { this->CCutsceneObject::~CCutsceneObject(); } - void SetModelIndex_(uint32 id) { CCutsceneObject::SetModelIndex(id); } - void ProcessControl_(void) { CCutsceneObject::ProcessControl(); } - void PreRender_(void) { CCutsceneObject::PreRender(); } - void Render_(void) { CCutsceneObject::Render(); } - bool SetupLighting_(void) { return CCutsceneObject::SetupLighting(); } - void RemoveLighting_(bool reset) { CCutsceneObject::RemoveLighting(reset); } -}; - -STARTPATCHES - InjectHook(0x4BA960, &CCutsceneObject_::dtor, PATCH_JUMP); - InjectHook(0x4BA980, &CCutsceneObject_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x4BA9C0, &CCutsceneObject_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4BAA40, &CCutsceneObject_::PreRender_, PATCH_JUMP); - InjectHook(0x4BAAA0, &CCutsceneObject_::Render_, PATCH_JUMP); - InjectHook(0x4A7E70, &CCutsceneObject_::SetupLighting_, PATCH_JUMP); - InjectHook(0x4A7F00, &CCutsceneObject_::RemoveLighting_, PATCH_JUMP); -ENDPATCHES diff --git a/src/objects/DummyObject.cpp b/src/objects/DummyObject.cpp index ba09ac3e..d5805073 100644 --- a/src/objects/DummyObject.cpp +++ b/src/objects/DummyObject.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "DummyObject.h" #include "Pools.h" @@ -11,19 +11,3 @@ CDummyObject::CDummyObject(CObject *obj) obj->DetachFromRwObject(); m_level = obj->m_level; } - -#include - -class CDummyObject_ : public CDummyObject -{ -public: - void dtor(void) { CDummyObject::~CDummyObject(); } - CDummyObject *ctor(void) { return ::new (this) CDummyObject(); } - CDummyObject *ctor(CObject *obj) { return ::new (this) CDummyObject(obj); } -}; - -STARTPATCHES - InjectHook(0x4BAAF0, (CDummyObject* (CDummyObject::*)(void)) &CDummyObject_::ctor, PATCH_JUMP); - InjectHook(0x4BAB10, (CDummyObject* (CDummyObject::*)(CObject*)) &CDummyObject_::ctor, PATCH_JUMP); - InjectHook(0x4BAB70, &CDummyObject_::dtor, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index c22148e9..8968c117 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lights.h" #include "Pools.h" @@ -394,37 +394,3 @@ CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius) } } } - -#include - -class CObject_ : public CObject -{ -public: - CObject *ctor(void) { return ::new (this) CObject(); } - CObject *ctor(int32 mi, bool createRW) { return ::new (this) CObject(mi, createRW); } - CObject *ctor(CDummyObject *dummy) { return ::new (this) CObject(dummy); } - void dtor(void) { CObject::~CObject(); } - void Render_(void) { CObject::Render(); } - void ProcessControl_(void) { CObject::ProcessControl(); } - bool SetupLighting_(void) { return CObject::SetupLighting(); } - void RemoveLighting_(bool reset) { CObject::RemoveLighting(reset); } -}; - -STARTPATCHES - InjectHook(0x4BABD0, (CObject* (CObject::*)(void)) &CObject_::ctor, PATCH_JUMP); - InjectHook(0x4BACE0, (CObject* (CObject::*)(int32, bool)) &CObject_::ctor, PATCH_JUMP); - InjectHook(0x4BAD50, (CObject* (CObject::*)(CDummyObject*)) &CObject_::ctor, PATCH_JUMP); - InjectHook(0x4BAE00, &CObject_::dtor, PATCH_JUMP); - InjectHook(0x4BB040, &CObject_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4BBDA0, &CObject::Teleport, PATCH_JUMP); - InjectHook(0x4BB1E0, &CObject_::Render_, PATCH_JUMP); - InjectHook(0x4A7C90, &CObject_::SetupLighting_, PATCH_JUMP); - InjectHook(0x4A7CD0, &CObject_::RemoveLighting_, PATCH_JUMP); - InjectHook(0x4BB240, &CObject::ObjectDamage, PATCH_JUMP); - InjectHook(0x4BBD80, &CObject::RefModelInfo, PATCH_JUMP); - InjectHook(0x4BAEC0, &CObject::Init, PATCH_JUMP); - InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP); - InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP); - InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP); - InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectsInArea, PATCH_JUMP); -ENDPATCHES diff --git a/src/objects/ObjectData.cpp b/src/objects/ObjectData.cpp index aa58a845..589cc3f7 100644 --- a/src/objects/ObjectData.cpp +++ b/src/objects/ObjectData.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "ModelInfo.h" #include "Object.h" @@ -96,8 +96,3 @@ CObjectData::SetObjectData(int32 modelId, CObject &object) object.bExplosionProof = true; } } - -STARTPATCHES - InjectHook(0x4BC0E0, CObjectData::Initialise, PATCH_JUMP); - InjectHook(0x4BC270, CObjectData::SetObjectData, PATCH_JUMP); -ENDPATCHES diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp index 5e4ad231..fe448966 100644 --- a/src/objects/ParticleObject.cpp +++ b/src/objects/ParticleObject.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "ParticleObject.h" #include "Timer.h" #include "General.h" @@ -1099,39 +1099,3 @@ CParticleObject::MoveToList(CParticleObject **from, CParticleObject **to, CParti if ( obj->m_pNext ) obj->m_pNext->m_pPrev = obj; } - -class CParticleObject_ : public CParticleObject -{ -public: - void ctor() { CParticleObject::CParticleObject(); } - void dtor() { CParticleObject::~CParticleObject(); } -}; - -STARTPATCHES - InjectHook(0x4BC330, CAudioHydrant::Add, PATCH_JUMP); - InjectHook(0x4BC390, CAudioHydrant::Remove, PATCH_JUMP); - - InjectHook(0x4BC3E0, &CParticleObject_::ctor, PATCH_JUMP); - InjectHook(0x4BC420, &CParticleObject_::dtor, PATCH_JUMP); - InjectHook(0x4BC440, CParticleObject::Initialise, PATCH_JUMP); - - InjectHook(0x4BC4D0, (CParticleObject *(*)(uint16, CVector const &, uint8))CParticleObject::AddObject, PATCH_JUMP); - InjectHook(0x4BC520, (CParticleObject *(*)(uint16, CVector const &, float, uint8))CParticleObject::AddObject, PATCH_JUMP); - InjectHook(0x4BC570, (CParticleObject *(*)(uint16, CVector const &, CVector const &, float, uint8))CParticleObject::AddObject, PATCH_JUMP); - InjectHook(0x4BC5B0, (CParticleObject *(*)(uint16, CVector const &, CVector const &, float, uint32, RwRGBA const &, uint8))CParticleObject::AddObject, PATCH_JUMP); - - InjectHook(0x4BC9F0, &CParticleObject::RemoveObject, PATCH_JUMP); - InjectHook(0x4BCA30, CParticleObject::UpdateAll, PATCH_JUMP); - InjectHook(0x4BCA80, &CParticleObject::UpdateClose, PATCH_JUMP); - InjectHook(0x4BF9F0, &CParticleObject::UpdateFar, PATCH_JUMP); - InjectHook(0x4BFA80, CParticleObject::SaveParticle, PATCH_JUMP); - InjectHook(0x4BFB30, CParticleObject::LoadParticle, PATCH_JUMP); - InjectHook(0x4BFC80, CParticleObject::RemoveAllParticleObjects, PATCH_JUMP); - InjectHook(0x4BFD10, CParticleObject::MoveToList, PATCH_JUMP); - //InjectHook(0x4BFD70, CParticleObject::~CParticleObject, PATCH_JUMP); // virtual - //InjectHook(0x4BFDB0, `global constructor keyed to'ParticleObject.cpp, PATCH_JUMP); - //InjectHook(0x4BFE00, CAudioHydrant::CAudioHydrant, PATCH_JUMP); - //InjectHook(0x4BFE10, sub_4BFE10, PATCH_JUMP); // destroy gPObjectArray array - - -ENDPATCHES diff --git a/src/objects/Projectile.cpp b/src/objects/Projectile.cpp index 32bc6bdb..fe8b0c68 100644 --- a/src/objects/Projectile.cpp +++ b/src/objects/Projectile.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Projectile.h" CProjectile::CProjectile(int32 model) : CObject() @@ -13,17 +13,3 @@ CProjectile::CProjectile(int32 model) : CObject() SetModelIndex(model); ObjectCreatedBy = MISSION_OBJECT; } - -#include - -class CProjectile_ : public CProjectile -{ -public: - CProjectile* ctor(int32 model) { return ::new (this) CProjectile(model); } - void dtor(void) { CProjectile::~CProjectile(); } -}; - -STARTPATCHES - InjectHook(0x4BFE30, &CProjectile_::ctor, PATCH_JUMP); - InjectHook(0x4BFED0, &CProjectile_::dtor, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp index a9e0580e..f38f5a73 100644 --- a/src/peds/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "CivilianPed.h" #include "Phones.h" #include "General.h" @@ -376,21 +376,3 @@ CCivilianPed::ProcessControl(void) if (m_moved.Magnitude() > 0.0f) Avoid(); } - -#include - -class CCivilianPed_ : public CCivilianPed -{ -public: - CCivilianPed *ctor(ePedType pedtype, uint32 mi) { return ::new (this) CCivilianPed(pedtype, mi); }; - void dtor(void) { CCivilianPed::~CCivilianPed(); } - void ProcessControl_(void) { CCivilianPed::ProcessControl(); } -}; - -STARTPATCHES - InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP); - InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP); - InjectHook(0x4BFFE0, &CCivilianPed_::ProcessControl_, PATCH_JUMP); - - InjectHook(0x4C07A0, &CCivilianPed::CivilianAI, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index b5812136..e62743de 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "World.h" #include "PlayerPed.h" #include "CopPed.h" @@ -736,25 +736,3 @@ CCopPed::ProcessControl(void) SetAttack(m_pedInObjective); } } - -#include - -class CCopPed_ : public CCopPed -{ -public: - CCopPed *ctor(eCopType type) { return ::new (this) CCopPed(type); }; - void dtor(void) { CCopPed::~CCopPed(); } - void ProcessControl_(void) { CCopPed::ProcessControl(); } -}; - -STARTPATCHES - InjectHook(0x4C11B0, &CCopPed_::ctor, PATCH_JUMP); - InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP); - InjectHook(0x4C1400, &CCopPed_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4C28C0, &CCopPed::ClearPursuit, PATCH_JUMP); - InjectHook(0x4C2B00, &CCopPed::SetArrestPlayer, PATCH_JUMP); - InjectHook(0x4C27D0, &CCopPed::SetPursuit, PATCH_JUMP); - InjectHook(0x4C2C90, &CCopPed::ArrestPlayer, PATCH_JUMP); - InjectHook(0x4C26A0, &CCopPed::ScanForCrimes, PATCH_JUMP); - InjectHook(0x4C1B50, &CCopPed::CopAI, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp index 3a5067e7..7229ed3f 100644 --- a/src/peds/EmergencyPed.cpp +++ b/src/peds/EmergencyPed.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "EmergencyPed.h" #include "DMAudio.h" #include "ModelIndices.h" @@ -413,20 +413,3 @@ CEmergencyPed::MedicAI(void) } } } - -#include - -class CEmergencyPed_ : public CEmergencyPed -{ -public: - CEmergencyPed* ctor(int pedtype) { return ::new (this) CEmergencyPed(pedtype); }; - void dtor(void) { CEmergencyPed::~CEmergencyPed(); } - void ProcessControl_(void) { CEmergencyPed::ProcessControl(); } -}; - -STARTPATCHES - InjectHook(0x4C2E40, &CEmergencyPed_::ctor, PATCH_JUMP); - InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP); - InjectHook(0x4C2F10, &CEmergencyPed_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4C3EC0, &CEmergencyPed::InRange, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/Gangs.cpp b/src/peds/Gangs.cpp index c67fe599..8859e61e 100644 --- a/src/peds/Gangs.cpp +++ b/src/peds/Gangs.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "ModelIndices.h" #include "Gangs.h" #include "Weapon.h" @@ -75,13 +75,3 @@ INITSAVEBUF Gang[i] = ReadSaveBuf(buf); VALIDATESAVEBUF(size); } - -STARTPATCHES - InjectHook(0x4C3FB0, CGangs::Initialise, PATCH_JUMP); - InjectHook(0x4C4010, CGangs::SetGangVehicleModel, PATCH_JUMP); - InjectHook(0x4C4030, CGangs::SetGangWeapons, PATCH_JUMP); - InjectHook(0x4C4050, CGangs::SetGangPedModelOverride, PATCH_JUMP); - InjectHook(0x4C4070, CGangs::GetGangPedModelOverride, PATCH_JUMP); - InjectHook(0x4C4080, CGangs::SaveAllGangData, PATCH_JUMP); - InjectHook(0x4C4100, CGangs::LoadAllGangData, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 8ea41230..4737051e 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Pools.h" #include "Particle.h" @@ -17502,240 +17502,3 @@ CPed::SetExitBoat(CVehicle *boat) // Not there in VC. CWaterLevel::FreeBoatWakeArray(); } - -#include - -class CPed_ : public CPed -{ -public: - CPed *ctor(uint32 pedType) { return ::new (this) CPed(pedType); } - void dtor(void) { CPed::~CPed(); } - - void SetModelIndex_(uint32 mi) { CPed::SetModelIndex(mi); } - void FlagToDestroyWhenNextProcessed_(void) { CPed::FlagToDestroyWhenNextProcessed(); } - bool SetupLighting_(void) { return CPed::SetupLighting(); } - void RemoveLighting_(bool reset) { CPed::RemoveLighting(reset); } - void Teleport_(CVector pos) { CPed::Teleport(pos); } - void ProcessControl_(void) { CPed::ProcessControl(); } - void Render_(void) { CPed::Render(); } - void PreRender_(void) { CPed::PreRender(); } - int32 ProcessEntityCollision_(CEntity *collidingEnt, CColPoint *collidingPoints) { return CPed::ProcessEntityCollision(collidingEnt, collidingPoints); } - void SetMoveAnim_(void) { CPed::SetMoveAnim(); } -}; - -STARTPATCHES - InjectHook(0x4C41C0, &CPed_::ctor, PATCH_JUMP); - InjectHook(0x4C50D0, &CPed_::dtor, PATCH_JUMP); - InjectHook(0x4C52A0, &CPed_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x4D6570, &CPed_::FlagToDestroyWhenNextProcessed_, PATCH_JUMP); - InjectHook(0x4A7D30, &CPed_::SetupLighting_, PATCH_JUMP); - InjectHook(0x4A7DC0, &CPed_::RemoveLighting_, PATCH_JUMP); - InjectHook(0x4D3E70, &CPed_::Teleport_, PATCH_JUMP); - InjectHook(0x4C8910, &CPed_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4D03F0, &CPed_::Render_, PATCH_JUMP); - InjectHook(0x4CBB30, &CPed_::ProcessEntityCollision_, PATCH_JUMP); - InjectHook(0x4CFDD0, &CPed_::PreRender_, PATCH_JUMP); - InjectHook(0x4C5A40, &CPed_::SetMoveAnim_, PATCH_JUMP); - - InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); - InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP); - InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP); - InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP); - InjectHook(0x4C6460, (void (CPed::*)(CEntity*, bool)) &CPed::SetLookFlag, PATCH_JUMP); - InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP); - InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP); - InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP); - InjectHook(0x4D2BB0, &CPed::Avoid, PATCH_JUMP); - InjectHook(0x4C6A50, &CPed::ClearAimFlag, PATCH_JUMP); - InjectHook(0x4C64F0, &CPed::ClearLookFlag, PATCH_JUMP); - InjectHook(0x4EB670, &CPed::IsPedHeadAbovePos, PATCH_JUMP); - InjectHook(0x4E68A0, &CPed::FinishedAttackCB, PATCH_JUMP); - InjectHook(0x4E5BD0, &CheckForPedsOnGroundToAttack, PATCH_JUMP); - InjectHook(0x4E6BA0, &CPed::Attack, PATCH_JUMP); - InjectHook(0x4CF980, &CPed::RemoveWeaponModel, PATCH_JUMP); - InjectHook(0x4CFA60, &CPed::SetCurrentWeapon, PATCH_JUMP); - InjectHook(0x4E4A10, &CPed::Duck, PATCH_JUMP); - InjectHook(0x4E4A30, &CPed::ClearDuck, PATCH_JUMP); - InjectHook(0x4E6180, &CPed::ClearPointGunAt, PATCH_JUMP); - InjectHook(0x4E07D0, &CPed::BeingDraggedFromCar, PATCH_JUMP); - InjectHook(0x4CF000, &CPed::PedSetDraggedOutCarCB, PATCH_JUMP); - InjectHook(0x4C5D80, &CPed::RestartNonPartialAnims, PATCH_JUMP); - InjectHook(0x4E4730, &CPed::GetLocalPositionToOpenCarDoor, PATCH_JUMP); - InjectHook(0x4E4660, (CVector (*)(CVehicle*, uint32, float)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP); - InjectHook(0x4E1A30, (CVector (*)(CVehicle*, uint32)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP); - InjectHook(0x4DF940, &CPed::LineUpPedWithCar, PATCH_JUMP); - InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP); - InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP); - InjectHook(0x4CF9B0, &CPed::GiveWeapon, PATCH_JUMP); - InjectHook(0x4C7EA0, &CPed::CalculateNewOrientation, PATCH_JUMP); - InjectHook(0x4C78F0, &CPed::WorkOutHeadingForMovingFirstPerson, PATCH_JUMP); - InjectHook(0x4C73F0, &CPed::CalculateNewVelocity, PATCH_JUMP); - InjectHook(0x4DD820, &CPed::CanSeeEntity, PATCH_JUMP); - InjectHook(0x4D9460, &CPed::RestorePreviousObjective, PATCH_JUMP); - InjectHook(0x4D82C0, (void (CPed::*)(eObjective)) &CPed::SetObjective, PATCH_JUMP); - InjectHook(0x4D83E0, (void (CPed::*)(eObjective, void*)) &CPed::SetObjective, PATCH_JUMP); - InjectHook(0x4D89A0, (void (CPed::*)(eObjective, int16, int16)) &CPed::SetObjective, PATCH_JUMP); - InjectHook(0x4D8A90, (void (CPed::*)(eObjective, CVector)) &CPed::SetObjective, PATCH_JUMP); - InjectHook(0x4D8770, (void (CPed::*)(eObjective, CVector, float)) &CPed::SetObjective, PATCH_JUMP); - InjectHook(0x4DDEC0, &CPed::ReactToAttack, PATCH_JUMP); - InjectHook(0x4D0600, &CPed::SetIdle, PATCH_JUMP); - InjectHook(0x4E0E00, &CPed::QuitEnteringCar, PATCH_JUMP); - InjectHook(0x4E4AD0, &CPed::InformMyGangOfAttack, PATCH_JUMP); - InjectHook(0x4D3C80, &CPed::ClearChat, PATCH_JUMP); - InjectHook(0x4D1390, &CPed::TurnBody, PATCH_JUMP); - InjectHook(0x4D3AC0, &CPed::Chat, PATCH_JUMP); - InjectHook(0x4D0490, &CPed::CheckAroundForPossibleCollisions, PATCH_JUMP); - InjectHook(0x4D3E20, &CPed::MakePhonecall, PATCH_JUMP); - InjectHook(0x4D3CC0, &CPed::FacePhone, PATCH_JUMP); - InjectHook(0x4D4860, &CPed::CheckForDeadPeds, PATCH_JUMP); - InjectHook(0x4D4650, &CPed::CheckForExplosions, PATCH_JUMP); - InjectHook(0x4D47D0, &CPed::CheckForGunShots, PATCH_JUMP); - InjectHook(0x4E6990, &CPed::CheckForPointBlankPeds, PATCH_JUMP); - InjectHook(0x4D0BE0, &CPed::CheckIfInTheAir, PATCH_JUMP); - InjectHook(0x4C7F20, &CPed::ClearAll, PATCH_JUMP); - InjectHook(0x4E6790, &CPed::ClearAttack, PATCH_JUMP); - InjectHook(0x4E67F0, &CPed::ClearAttackByRemovingAnim, PATCH_JUMP); - InjectHook(0x4D37D0, &CPed::SetDie, PATCH_JUMP); - InjectHook(0x4C5D50, &CPed::StopNonPartialAnims, PATCH_JUMP); - InjectHook(0x4C5DB0, &CPed::SetStoredState, PATCH_JUMP); - InjectHook(0x4EA420, &CPed::InflictDamage, PATCH_JUMP); - InjectHook(0x4D1EA0, &CPed::ClearFlee, PATCH_JUMP); - InjectHook(0x4D0BB0, &CPed::ClearFall, PATCH_JUMP); - InjectHook(0x4D0F20, &CPed::SetGetUp, PATCH_JUMP); - InjectHook(0x4D6550, &CPed::RestoreHeadingRateCB, PATCH_JUMP); - InjectHook(0x4C5E30, &CPed::RestorePreviousState, PATCH_JUMP); - InjectHook(0x4E5F70, &CPed::SetPointGunAt, PATCH_JUMP); - InjectHook(0x4D2750, &CPed::SetWanderPath, PATCH_JUMP); - InjectHook(0x4D30C0, &CPed::SetEvasiveStep, PATCH_JUMP); - InjectHook(0x4EA360, &CPed::ClearInvestigateEvent, PATCH_JUMP); - InjectHook(0x4D8E80, &CPed::ClearLeader, PATCH_JUMP); - InjectHook(0x4D1360, &CPed::ClearLook, PATCH_JUMP); - InjectHook(0x4D8DF0, &CPed::ClearObjective, PATCH_JUMP); - InjectHook(0x4D0970, &CPed::ClearPause, PATCH_JUMP); - InjectHook(0x4D1620, &CPed::ClearSeek, PATCH_JUMP); - InjectHook(0x4CFB70, &CPed::ClearWeapons, PATCH_JUMP); - InjectHook(0x4C6BB0, &CPed::RestoreGunPosition, PATCH_JUMP); - InjectHook(0x4D6540, &CPed::RestoreHeadingRate, PATCH_JUMP); - InjectHook(0x4C69E0, (void (CPed::*)(CEntity*)) &CPed::SetAimFlag, PATCH_JUMP); - InjectHook(0x4C6960, (void (CPed::*)(float)) &CPed::SetAimFlag, PATCH_JUMP); - InjectHook(0x4CFAD0, &CPed::GrantAmmo, PATCH_JUMP); - InjectHook(0x4CFB20, &CPed::SetAmmo, PATCH_JUMP); - InjectHook(0x4D33A0, &CPed::SetEvasiveDive, PATCH_JUMP); - InjectHook(0x4D09B0, &CPed::SetFall, PATCH_JUMP); - InjectHook(0x4E6220, &CPed::SetAttack, PATCH_JUMP); - InjectHook(0x4E7530, &CPed::StartFightAttack, PATCH_JUMP); - InjectHook(0x4E8EC0, &CPed::FightStrike, PATCH_JUMP); - InjectHook(0x4CCE20, &CPed::GetLocalDirection, PATCH_JUMP); - InjectHook(0x4E8E20, &CPed::PlayHitSound, PATCH_JUMP); - InjectHook(0x4E5A10, &CPed::Say, PATCH_JUMP); - InjectHook(0x4D58D0, &CPed::SetWaitState, PATCH_JUMP); - InjectHook(0x4D1D70, (void (CPed::*)(CEntity*, int)) &CPed::SetFlee, PATCH_JUMP); - InjectHook(0x4D1C40, (void (CPed::*)(CVector2D const &, int)) &CPed::SetFlee, PATCH_JUMP); - InjectHook(0x4EB9A0, &CPed::CollideWithPed, PATCH_JUMP); - InjectHook(0x433490, &CPed::CreateDeadPedMoney, PATCH_JUMP); - InjectHook(0x433660, &CPed::CreateDeadPedWeaponPickups, PATCH_JUMP); - InjectHook(0x4D3970, &CPed::SetDead, PATCH_JUMP); - InjectHook(0x53CDF0, &CPed::DeadPedMakesTyresBloody, PATCH_JUMP); - InjectHook(0x4E0640, &CPed::SetBeingDraggedFromCar, PATCH_JUMP); - InjectHook(0x4D1300, &CPed::SetAttackTimer, PATCH_JUMP); - InjectHook(0x4D6950, &CPed::SetBuyIceCream, PATCH_JUMP); - InjectHook(0x4D3A60, &CPed::SetChat, PATCH_JUMP); - InjectHook(0x4D14B0, (void (CPed::*)(CVector, float)) &CPed::SetSeek, PATCH_JUMP); - InjectHook(0x4D15A0, (void (CPed::*)(CEntity*, float)) &CPed::SetSeek, PATCH_JUMP); - InjectHook(0x4EB5C0, &CPed::DoesLOSBulletHitPed, PATCH_JUMP); - InjectHook(0x4E3EC0, &CPed::DuckAndCover, PATCH_JUMP); - InjectHook(0x4E8D30, &CPed::EndFight, PATCH_JUMP); - InjectHook(0x4E0D30, &CPed::EnterCar, PATCH_JUMP); - InjectHook(0x4E2E50, &CPed::GetNearestTrainPedPosition, PATCH_JUMP); - InjectHook(0x4E2D70, &CPed::GetNearestTrainDoor, PATCH_JUMP); - InjectHook(0x4E33D0, &CPed::LineUpPedWithTrain, PATCH_JUMP); - InjectHook(0x4E18D0, &CPed::ExitCar, PATCH_JUMP); - InjectHook(0x4E7EE0, &CPed::Fight, PATCH_JUMP); - InjectHook(0x4D3950, &CPed::FinishDieAnimCB, PATCH_JUMP); - InjectHook(0x4E9830, &CPed::FinishFightMoveCB, PATCH_JUMP); - InjectHook(0x4D7A80, &CPed::FinishHitHeadCB, PATCH_JUMP); - InjectHook(0x4D7A50, &CPed::FinishJumpCB, PATCH_JUMP); - InjectHook(0x4D7490, &CPed::FinishLaunchCB, PATCH_JUMP); - InjectHook(0x4D6520, &CPed::FinishedWaitCB, PATCH_JUMP); - InjectHook(0x4D5D80, &CPed::Wait, PATCH_JUMP); - InjectHook(0x4E3A90, &CPed::FindBestCoordsFromNodes, PATCH_JUMP); - InjectHook(0x4D2E70, &CPed::SeekFollowingPath, PATCH_JUMP); - InjectHook(0x4D1640, &CPed::Seek, PATCH_JUMP); - InjectHook(0x4D3020, &CPed::FollowPath, PATCH_JUMP); - InjectHook(0x4D1ED0, &CPed::Flee, PATCH_JUMP); - InjectHook(0x4E1CF0, &CPed::GetNearestDoor, PATCH_JUMP); - InjectHook(0x4DF420, &CPed::GetFormationPosition, PATCH_JUMP); - InjectHook(0x4E1F30, &CPed::GetNearestPassengerDoor, PATCH_JUMP); - InjectHook(0x4D0690, &CPed::Idle, PATCH_JUMP); - InjectHook(0x4DD720, &CPed::GetNextPointOnRoute, PATCH_JUMP); - InjectHook(0x4D7B50, &CPed::GetPedRadioCategory, PATCH_JUMP); - InjectHook(0x4CFA40, &CPed::GetWeaponSlot, PATCH_JUMP); - InjectHook(0x4E2220, &CPed::GoToNearestDoor, PATCH_JUMP); - InjectHook(0x4DD7B0, &CPed::HaveReachedNextPointOnRoute, PATCH_JUMP); - InjectHook(0x4D0D10, &CPed::InTheAir, PATCH_JUMP); - InjectHook(0x4C5270, &CPed::Initialise, PATCH_JUMP); - InjectHook(0x4D0E40, &CPed::SetLanding, PATCH_JUMP); - InjectHook(0x4E9B50, &CPed::InvestigateEvent, PATCH_JUMP); - InjectHook(0x564BB0, &CPed::IsPedDoingDriveByShooting, PATCH_JUMP); - InjectHook(0x4E4D90, &CPed::IsRoomToBeCarJacked, PATCH_JUMP); - InjectHook(0x4EC430, &CPed::KillPedWithCar, PATCH_JUMP); - InjectHook(0x4E9A80, &CPed::SetInvestigateEvent, PATCH_JUMP); - InjectHook(0x4D5040, &CPed::LookForInterestingNodes, PATCH_JUMP); - InjectHook(0x4D4F50, &CPed::LookForSexyCars, PATCH_JUMP); - InjectHook(0x4D4DF0, &CPed::LookForSexyPeds, PATCH_JUMP); - InjectHook(0x53CFD0, &CPed::MakeTyresMuddySectorList, PATCH_JUMP); - InjectHook(0x4C6580, &FinishFuckUCB, PATCH_JUMP); - InjectHook(0x4D11D0, &CPed::Mug, PATCH_JUMP); - InjectHook(0x4DE130, &CPed::PedAnimAlignCB, PATCH_JUMP); - InjectHook(0x4D0980, &CPed::Pause, PATCH_JUMP); - InjectHook(0x4C65B0, &CPed::MoveHeadToLook, PATCH_JUMP); - InjectHook(0x4DF1B0, &CPed::PedAnimDoorCloseCB, PATCH_JUMP); - InjectHook(0x4E4B90, &CPed::PedAnimDoorCloseRollingCB, PATCH_JUMP); - InjectHook(0x4DE500, &CPed::PedAnimDoorOpenCB, PATCH_JUMP); - InjectHook(0x4D73D0, &CPed::SetJump, PATCH_JUMP); - InjectHook(0x4E4E20, &CPed::RemoveInCarAnims, PATCH_JUMP); - InjectHook(0x4DEC80, &CPed::PedAnimGetInCB, PATCH_JUMP); - InjectHook(0x4DEAF0, &CPed::PedAnimPullPedOutCB, PATCH_JUMP); - InjectHook(0x4DF5C0, &CPed::PedAnimStepOutCarCB, PATCH_JUMP); - InjectHook(0x4D36E0, &CPed::PedEvadeCB, PATCH_JUMP); - InjectHook(0x4CE810, &CPed::PedGetupCB, PATCH_JUMP); - InjectHook(0x4CE8A0, &CPed::PedLandCB, PATCH_JUMP); - InjectHook(0x4E2920, &CPed::PedSetDraggedOutCarPositionCB, PATCH_JUMP); - InjectHook(0x4CF220, &CPed::PedSetInCarCB, PATCH_JUMP); - InjectHook(0x4E3290, &CPed::PedSetInTrainCB, PATCH_JUMP); - InjectHook(0x4C10C0, &CPed::RunToReportCrime, PATCH_JUMP); - InjectHook(0x4E3870, &CPed::RegisterThreatWithGangPeds, PATCH_JUMP); - InjectHook(0x4DD980, &CPed::ReactToPointGun, PATCH_JUMP); - InjectHook(0x4CE8F0, &CPed::PedSetOutCarCB, PATCH_JUMP); - InjectHook(0x4E36E0, &CPed::PedSetOutTrainCB, PATCH_JUMP); - InjectHook(0x4EB6E0, &CPed::PlacePedOnDryLand, PATCH_JUMP); - InjectHook(0x4E2480, &CPed::PedSetQuickDraggedOutCarPositionCB, PATCH_JUMP); - InjectHook(0x4E4F30, &CPed::PositionPedOutOfCollision, PATCH_JUMP); - InjectHook(0x4D6A00, &CPed::PossiblyFindBetterPosToSeekCar, PATCH_JUMP); - InjectHook(0x4D94E0, &CPed::ProcessObjective, PATCH_JUMP); - InjectHook(0x4CCEB0, &CPed::SetDirectionToWalkAroundObject, PATCH_JUMP); - InjectHook(0x4DF3E0, &CPed::SetFormation, PATCH_JUMP); - InjectHook(0x4C7340, &CPed::WillChat, PATCH_JUMP); - InjectHook(0x4E32D0, &CPed::SetEnterTrain, PATCH_JUMP); - InjectHook(0x4E4920, &CPed::SetDuck, PATCH_JUMP); - InjectHook(0x4E0920, &CPed::SetEnterCar, PATCH_JUMP); - InjectHook(0x4D7BC0, &CPed::SetRadioStation, PATCH_JUMP); - InjectHook(0x4C7FF0, &CPed::ProcessBuoyancy, PATCH_JUMP); - InjectHook(0x4D6620, &CPed::SetSolicit, PATCH_JUMP); - InjectHook(0x4D2EA0, &CPed::SetFollowPath, PATCH_JUMP); - InjectHook(0x4E1010, &CPed::SetExitCar, PATCH_JUMP); - InjectHook(0x4C5FE0, &CPed::ScanForThreats, PATCH_JUMP); - InjectHook(0x4C6C10, &CPed::ScanForInterestingStuff, PATCH_JUMP); - InjectHook(0x4D3F90, &CPed::SeekCar, PATCH_JUMP); - InjectHook(0x4E5870, &CPed::ServiceTalking, PATCH_JUMP); - InjectHook(0x4E7780, &CPed::StartFightDefend, PATCH_JUMP); - InjectHook(0x4D8F30, &CPed::UpdateFromLeader, PATCH_JUMP); - InjectHook(0x4D4970, &CPed::SetPedPositionInCar, PATCH_JUMP); - InjectHook(0x4D7D20, &CPed::WarpPedIntoCar, PATCH_JUMP); - InjectHook(0x4E0A40, &CPed::SetEnterCar_AllClear, PATCH_JUMP); - InjectHook(0x4D28D0, &CPed::WanderPath, PATCH_JUMP); - InjectHook(0x4E5570, &CPed::WarpPedToNearEntityOffScreen, PATCH_JUMP); - InjectHook(0x4E52A0, &CPed::WarpPedToNearLeaderOffScreen, PATCH_JUMP); - InjectHook(0x4E0220, &CPed::SetCarJack, PATCH_JUMP); - InjectHook(0x4D6780, &CPed::Solicit, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index 8e450ee6..1464c4e8 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Camera.h" #include "PedIK.h" #include "Ped.h" @@ -362,19 +362,3 @@ CPedIK::ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch) *pitch = Acos(f); if (mat->up.x > 0.0f) *pitch = -*pitch; } - -STARTPATCHES - InjectHook(0x4ED0F0, &CPedIK::GetComponentPosition, PATCH_JUMP); - InjectHook(0x4ED060, &CPedIK::GetWorldMatrix, PATCH_JUMP); - InjectHook(0x4EDDB0, &CPedIK::RotateTorso, PATCH_JUMP); - InjectHook(0x4ED440, &CPedIK::MoveLimb, PATCH_JUMP); - InjectHook(0x4EDD70, &CPedIK::RestoreGunPosn, PATCH_JUMP); - InjectHook(0x4ED620, &CPedIK::LookInDirection, PATCH_JUMP); - InjectHook(0x4ED590, &CPedIK::LookAtPosition, PATCH_JUMP); - InjectHook(0x4ED9B0, &CPedIK::PointGunInDirection, PATCH_JUMP); - InjectHook(0x4EDB20, &CPedIK::PointGunInDirectionUsingArm, PATCH_JUMP); - InjectHook(0x4ED920, &CPedIK::PointGunAtPosition, PATCH_JUMP); - InjectHook(0x4ED810, &CPedIK::RestoreLookAt, PATCH_JUMP); - InjectHook(0x4ED140, &CPedIK::ExtractYawAndPitchWorld, PATCH_JUMP); - InjectHook(0x4ED2C0, &CPedIK::ExtractYawAndPitchLocal, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/peds/PedPlacement.cpp b/src/peds/PedPlacement.cpp index e5f6a077..6038cf91 100644 --- a/src/peds/PedPlacement.cpp +++ b/src/peds/PedPlacement.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Ped.h" #include "PedPlacement.h" #include "World.h" @@ -49,8 +49,3 @@ CPedPlacement::IsPositionClearForPed(CVector* pos) CWorld::FindObjectsKindaColliding(*pos, 0.75f, true, &count, 2, nil, false, true, true, false, false); return count == 0; } - -STARTPATCHES - InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP); - InjectHook(0x4EE310, &CPedPlacement::IsPositionClearOfCars, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp index b6512edd..3ff080e6 100644 --- a/src/peds/PedRoutes.cpp +++ b/src/peds/PedRoutes.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "PedRoutes.h" diff --git a/src/peds/PedStats.cpp b/src/peds/PedStats.cpp index a2ccb567..06e39039 100644 --- a/src/peds/PedStats.cpp +++ b/src/peds/PedStats.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "FileMgr.h" #include "PedStats.h" @@ -116,10 +116,3 @@ CPedStats::GetPedStatType(char *name) return NUM_PEDSTATS; } - -STARTPATCHES - InjectHook(0x4EF460, &CPedStats::Initialise, PATCH_JUMP); - InjectHook(0x4EF540, &CPedStats::Shutdown, PATCH_JUMP); - InjectHook(0x4EF580, &CPedStats::LoadPedStats, PATCH_JUMP); - InjectHook(0x4EF780, &CPedStats::GetPedStatType, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp index 30af6dcc..8bf4c6e1 100644 --- a/src/peds/PedType.cpp +++ b/src/peds/PedType.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "FileMgr.h" #include "PedType.h" @@ -202,12 +202,3 @@ INITSAVEBUF *ms_apPedType[i] = ReadSaveBuf(buf); VALIDATESAVEBUF(size) } - -STARTPATCHES - InjectHook(0x4EE7E0, &CPedType::Initialise, PATCH_JUMP); - InjectHook(0x4EE890, &CPedType::Shutdown, PATCH_JUMP); - InjectHook(0x4EEC10, &CPedType::FindPedType, PATCH_JUMP); - InjectHook(0x4EEF40, &CPedType::FindPedFlag, PATCH_JUMP); - InjectHook(0x4EF320, &CPedType::Save, PATCH_JUMP); - InjectHook(0x4EF3D0, &CPedType::Load, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index dcd9486f..0a0fe6a3 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "PlayerPed.h" #include "Wanted.h" #include "Fire.h" @@ -1495,41 +1495,3 @@ CPlayerPed::ProcessControl(void) m_bSpeedTimerFlag = false; } } - -#include - -class CPlayerPed_ : public CPlayerPed -{ -public: - CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); } - void dtor(void) { CPlayerPed::~CPlayerPed(); } - void SetMoveAnim_(void) { CPlayerPed::SetMoveAnim(); } - void ProcessControl_(void) { CPlayerPed::ProcessControl(); } -}; - -STARTPATCHES - InjectHook(0x4EF7E0, &CPlayerPed_::ctor, PATCH_JUMP); - InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP); - InjectHook(0x4F3760, &CPlayerPed_::SetMoveAnim_, PATCH_JUMP); - InjectHook(0x4EFD90, &CPlayerPed_::ProcessControl_, PATCH_JUMP); - InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP); - InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP); - InjectHook(0x4F36C0, &CPlayerPed::GetPlayerInfoForThisPlayerPed, PATCH_JUMP); - InjectHook(0x4F2560, &CPlayerPed::MakeChangesForNewWeapon, PATCH_JUMP); - InjectHook(0x4F07C0, &CPlayerPed::ReApplyMoveAnims, PATCH_JUMP); - InjectHook(0x4F0880, &CPlayerPed::SetRealMoveAnim, PATCH_JUMP); - InjectHook(0x4F1810, &CPlayerPed::PlayerControlFighter, PATCH_JUMP); - InjectHook(0x4F1340, &CPlayerPed::RestoreSprintEnergy, PATCH_JUMP); - InjectHook(0x4F1380, &CPlayerPed::DoWeaponSmoothSpray, PATCH_JUMP); - InjectHook(0x4F36E0, &CPlayerPed::DoStuffToGoOnFire, PATCH_JUMP); - InjectHook(0x4F3350, &CPlayerPed::DoesTargetHaveToBeBroken, PATCH_JUMP); - InjectHook(0x4F31D0, &CPlayerPed::RunningLand, PATCH_JUMP); - InjectHook(0x4F2D00, &CPlayerPed::IsThisPedAttackingPlayer, PATCH_JUMP); - InjectHook(0x4F1CF0, &CPlayerPed::PlayerControlSniper, PATCH_JUMP); - InjectHook(0x4F2310, &CPlayerPed::ProcessWeaponSwitch, PATCH_JUMP); - InjectHook(0x4F1DF0, &CPlayerPed::PlayerControlM16, PATCH_JUMP); - InjectHook(0x4F3460, &CPlayerPed::KeepAreaAroundPlayerClear, PATCH_JUMP); - InjectHook(0x4F1970, &CPlayerPed::PlayerControl1stPersonRunAround, PATCH_JUMP); - InjectHook(0x4F1EF0, &CPlayerPed::ProcessPlayerWeapon, PATCH_JUMP); - InjectHook(0x4F2640, &CPlayerPed::ProcessAnimGroups, PATCH_JUMP); -ENDPATCHES diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index d3a67a57..681c6b1a 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Game.h" #include "General.h" #include "World.h" @@ -1180,16 +1180,3 @@ CPopulation::ManagePopulation(void) } } } - -STARTPATCHES - InjectHook(0x4F3770, &CPopulation::Initialise, PATCH_JUMP); - InjectHook(0x4F5780, &CPopulation::ChooseGangOccupation, PATCH_JUMP); - InjectHook(0x4F6200, &CPopulation::DealWithZoneChange, PATCH_JUMP); - InjectHook(0x4F6010, &CPopulation::FindCollisionZoneForCoors, PATCH_JUMP); - InjectHook(0x4F6410, &CPopulation::PedCreationDistMultiplier, PATCH_JUMP); - InjectHook(0x4F5280, &CPopulation::AddPed, PATCH_JUMP); - InjectHook(0x4F4470, &CPopulation::ConvertToRealObject, PATCH_JUMP); - InjectHook(0x4F4690, &CPopulation::TestRoomForDummyObject, PATCH_JUMP); - InjectHook(0x4F45A0, &CPopulation::ConvertToDummyObject, PATCH_JUMP); - InjectHook(0x4F4410, &CPopulation::ConvertAllObjectsToDummyObjects, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Antennas.cpp b/src/render/Antennas.cpp index d564c196..452069a0 100644 --- a/src/render/Antennas.cpp +++ b/src/render/Antennas.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Antennas.h" CAntenna CAntennas::aAntennas[NUMANTENNAS]; @@ -123,17 +123,3 @@ CAntenna::Update(CVector dir, CVector basepos) pos[i] = newpos; } } - -STARTPATCHES - InjectHook(0x4F64D0, &CAntennas::Init, PATCH_JUMP); - InjectHook(0x4F6550, &CAntennas::Update, PATCH_JUMP); - InjectHook(0x4F66C0, &CAntennas::RegisterOne, PATCH_JUMP); - InjectHook(0x4F6590, &CAntennas::Render, PATCH_JUMP); - InjectHook(0x4F6830, &CAntenna::Update, PATCH_JUMP); - - // give to cheetah for testing -// Patch(0x535B50+1, 105); -// Patch(0x535B57+7, -0.84); -// Patch(0x535B74+7, 0.78); -// Patch(0x535B69+7, 0.24); -ENDPATCHES diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 02035896..58dc3f93 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Sprite.h" #include "Sprite2d.h" #include "General.h" @@ -430,12 +430,3 @@ CClouds::RenderHorizon(void) CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2), ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); } - -STARTPATCHES - InjectHook(0x4F6C10, CClouds::Init, PATCH_JUMP); - InjectHook(0x4F6CA0, CClouds::Shutdown, PATCH_JUMP); - InjectHook(0x4F6CE0, CClouds::Update, PATCH_JUMP); - InjectHook(0x4F6D90, CClouds::Render, PATCH_JUMP); - InjectHook(0x4F7F00, CClouds::RenderBackground, PATCH_JUMP); - InjectHook(0x4F85F0, CClouds::RenderHorizon, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Console.cpp b/src/render/Console.cpp index bfdb2701..5ae5d763 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -1,6 +1,6 @@ #include "common.h" #include -#include "patcher.h" + #include "Console.h" #include "Font.h" #include "Timer.h" diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index d70f70d6..b21e087b 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "General.h" #include "TxdStore.h" @@ -572,17 +572,3 @@ CRegisteredCorona::Update(void) firstUpdate = false; registeredThisFrame = false; } - -STARTPATCHES - InjectHook(0x4F9F90, CCoronas::Init, PATCH_JUMP); - InjectHook(0x4FA050, CCoronas::Shutdown, PATCH_JUMP); - InjectHook(0x4F8EC0, CCoronas::Update, PATCH_JUMP); - InjectHook(0x4FA0E0, (void (*)(uint32, uint8, uint8, uint8, uint8, const CVector&, float, float, RwTexture*, int8, uint8, uint8, uint8, float))CCoronas::RegisterCorona, PATCH_JUMP); - InjectHook(0x4FA080, (void (*)(uint32, uint8, uint8, uint8, uint8, const CVector&, float, float, uint8, int8, uint8, uint8, uint8, float))CCoronas::RegisterCorona, PATCH_JUMP); - InjectHook(0x4FA2D0, CCoronas::UpdateCoronaCoors, PATCH_JUMP); - InjectHook(0x4F8FB0, CCoronas::Render, PATCH_JUMP); - InjectHook(0x4F9B40, CCoronas::RenderReflections, PATCH_JUMP); - InjectHook(0x4FA380, CCoronas::DoSunAndMoon, PATCH_JUMP); - - InjectHook(0x4F8C40, &CRegisteredCorona::Update, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 25f7bbcf..dc0b0252 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Timer.h" #include "Font.h" #include "Frontend.h" @@ -497,13 +497,3 @@ bool CCredits::AreCreditsDone(void) { return !bCreditsGoing; } - -STARTPATCHES - InjectHook(0x4FE7A0, CCredits::Init, PATCH_JUMP); - InjectHook(0x4FE760, CCredits::Start, PATCH_JUMP); - InjectHook(0x4FE780, CCredits::Stop, PATCH_JUMP); - InjectHook(0x4FE790, CCredits::AreCreditsDone, PATCH_JUMP); - InjectHook(0x4FADF0, CCredits::Render, PATCH_JUMP); - InjectHook(0x4FE710, CCredits::PrintCreditSpace, PATCH_JUMP); - InjectHook(0x4FE620, CCredits::PrintCreditText, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index dcbb6342..b31cc624 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Draw.h" #include "Frontend.h" #include "Camera.h" @@ -66,10 +66,3 @@ CDraw::SetFOV(float fov) ms_fFOV = fov; #endif } - -STARTPATCHES - InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP); - - Nop(0x46B618, 2); - Patch(0x5F0A64, 1.3333334f); -ENDPATCHES diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index e2899532..e068747e 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "Entity.h" #include "Fluff.h" #include "Camera.h" @@ -864,31 +864,3 @@ void CDigitalClock::Render() CSprite::FlushSpriteBuffer(); } } - -STARTPATCHES -InjectHook(0x4FF290, &CMovingThing::Update, PATCH_JUMP); -InjectHook(0x4FF320, &CMovingThing::AddToList, PATCH_JUMP); -InjectHook(0x4FF340, &CMovingThing::RemoveFromList, PATCH_JUMP); - -InjectHook(0x4FE7C0, &CMovingThings::Init, PATCH_JUMP); -InjectHook(0x4FF020, &CMovingThings::Shutdown, PATCH_JUMP); -InjectHook(0x4FF0D0, &CMovingThings::Update, PATCH_JUMP); -InjectHook(0x4FF210, &CMovingThings::Render, PATCH_JUMP); - -InjectHook(0x4FF360, &FindTunnelMessage, PATCH_JUMP); -InjectHook(0x4FF390, &FindBridgeMessage, PATCH_JUMP); -InjectHook(0x4FF3C0, &FindTimeMessage, PATCH_JUMP); -InjectHook(0x4FF450, &FindDigitalClockMessage, PATCH_JUMP); - -InjectHook(0x4FF610, &CScrollBar::Init, PATCH_JUMP); -InjectHook(0x4FF6E0, &CScrollBar::Update, PATCH_JUMP); -InjectHook(0x4FFCE0, &CScrollBar::Render, PATCH_JUMP); - -InjectHook(0x5000D0, &CTowerClock::Init, PATCH_JUMP); -InjectHook(0x500130, &CTowerClock::Update, PATCH_JUMP); -InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP); - -InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP); -InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP); -InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Font.cpp b/src/render/Font.cpp index ba4c4301..14a678b8 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Sprite2d.h" #include "TxdStore.h" #include "Font.h" @@ -589,48 +589,3 @@ CFont::character_code(uint8 c) return c; return foreign_table[c-128]; } - -STARTPATCHES - - InjectHook(0x500A40, CFont::Initialise, PATCH_JUMP); - InjectHook(0x500BA0, CFont::Shutdown, PATCH_JUMP); - InjectHook(0x500BE0, CFont::InitPerFrame, PATCH_JUMP); - InjectHook(0x500C30, CFont::PrintChar, PATCH_JUMP); - InjectHook(0x500F50, (void (*)(float, float, wchar*))CFont::PrintString, PATCH_JUMP); - InjectHook(0x501260, CFont::GetNumberLines, PATCH_JUMP); - InjectHook(0x5013B0, CFont::GetTextRect, PATCH_JUMP); - InjectHook(0x501730, (void (*)(float, float, wchar*, wchar*, float))CFont::PrintString, PATCH_JUMP); - InjectHook(0x5017E0, CFont::GetCharacterWidth, PATCH_JUMP); - InjectHook(0x501840, CFont::GetCharacterSize, PATCH_JUMP); - InjectHook(0x5018A0, CFont::GetStringWidth, PATCH_JUMP); - InjectHook(0x501960, CFont::GetNextSpace, PATCH_JUMP); - InjectHook(0x5019A0, CFont::ParseToken, PATCH_JUMP); - InjectHook(0x501B50, CFont::DrawFonts, PATCH_JUMP); - InjectHook(0x501E80, CFont::character_code, PATCH_JUMP); - - InjectHook(0x501B80, CFont::SetScale, PATCH_JUMP); - InjectHook(0x501BA0, CFont::SetSlantRefPoint, PATCH_JUMP); - InjectHook(0x501BC0, CFont::SetSlant, PATCH_JUMP); - InjectHook(0x501BD0, CFont::SetColor, PATCH_JUMP); - InjectHook(0x501C60, CFont::SetJustifyOn, PATCH_JUMP); - InjectHook(0x501C80, CFont::SetJustifyOff, PATCH_JUMP); - InjectHook(0x501C90, CFont::SetCentreOn, PATCH_JUMP); - InjectHook(0x501CB0, CFont::SetCentreOff, PATCH_JUMP); - InjectHook(0x501CC0, CFont::SetWrapx, PATCH_JUMP); - InjectHook(0x501CD0, CFont::SetCentreSize, PATCH_JUMP); - InjectHook(0x501CE0, CFont::SetBackgroundOn, PATCH_JUMP); - InjectHook(0x501CF0, CFont::SetBackgroundOff, PATCH_JUMP); - InjectHook(0x501D00, CFont::SetBackgroundColor, PATCH_JUMP); - InjectHook(0x501D30, CFont::SetBackGroundOnlyTextOn, PATCH_JUMP); - InjectHook(0x501D40, CFont::SetBackGroundOnlyTextOff, PATCH_JUMP); - InjectHook(0x501D50, CFont::SetRightJustifyOn, PATCH_JUMP); - InjectHook(0x501D70, CFont::SetRightJustifyOff, PATCH_JUMP); - InjectHook(0x501D90, CFont::SetPropOff, PATCH_JUMP); - InjectHook(0x501DA0, CFont::SetPropOn, PATCH_JUMP); - InjectHook(0x501DB0, CFont::SetFontStyle, PATCH_JUMP); - InjectHook(0x501DC0, CFont::SetRightJustifyWrap, PATCH_JUMP); - InjectHook(0x501DD0, CFont::SetAlphaFade, PATCH_JUMP); - InjectHook(0x501DE0, CFont::SetDropColor, PATCH_JUMP); - InjectHook(0x501E70, CFont::SetDropShadowPosition, PATCH_JUMP); - -ENDPATCHES diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index ac6c1728..33e22c87 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Glass.h" #include "Timer.h" #include "Object.h" @@ -708,26 +708,3 @@ CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point) object->bGlassCracked = true; } } - -STARTPATCHES - InjectHook(0x501F20, CGlass::Init, PATCH_JUMP); - InjectHook(0x502050, CGlass::Update, PATCH_JUMP); - InjectHook(0x502080, &CFallingGlassPane::Update, PATCH_JUMP); - InjectHook(0x502350, CGlass::Render, PATCH_JUMP); - InjectHook(0x502490, CGlass::FindFreePane, PATCH_JUMP); - InjectHook(0x5024C0, &CFallingGlassPane::Render, PATCH_JUMP); - InjectHook(0x502AC0, CGlass::GeneratePanesForWindow, PATCH_JUMP); - InjectHook(0x5033F0, CGlass::AskForObjectToBeRenderedInGlass, PATCH_JUMP); - InjectHook(0x503420, CGlass::RenderEntityInGlass, PATCH_JUMP); - InjectHook(0x503C90, CGlass::CalcAlphaWithNormal, PATCH_JUMP); - InjectHook(0x503D60, CGlass::RenderHiLightPolys, PATCH_JUMP); - InjectHook(0x503DE0, CGlass::RenderShatteredPolys, PATCH_JUMP); - InjectHook(0x503E70, CGlass::RenderReflectionPolys, PATCH_JUMP); - InjectHook(0x503F10, CGlass::WindowRespondsToCollision, PATCH_JUMP); - InjectHook(0x504630, CGlass::WindowRespondsToSoftCollision, PATCH_JUMP); - InjectHook(0x504670, CGlass::WasGlassHitByBullet, PATCH_JUMP); - InjectHook(0x504790, CGlass::WindowRespondsToExplosion, PATCH_JUMP); - //InjectHook(0x504880, `global constructor keyed to'glass.cpp, PATCH_JUMP); - //InjectHook(0x5048D0, CFallingGlassPane::~CFallingGlassPane, PATCH_JUMP); - //InjectHook(0x5048E0, CFallingGlassPane::CFallingGlassPane, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 5bcdd450..03ffe59a 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Camera.h" #include "DMAudio.h" #include "Clock.h" @@ -1483,18 +1483,3 @@ void CHud::Shutdown() int HudTXD = CTxdStore::FindTxdSlot("hud"); CTxdStore::RemoveTxdSlot(HudTXD); } - -STARTPATCHES - InjectHook(0x5052A0, &CHud::Draw, PATCH_JUMP); - InjectHook(0x509030, &CHud::DrawAfterFade, PATCH_JUMP); - InjectHook(0x504F90, &CHud::GetRidOfAllHudMessages, PATCH_JUMP); - InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP); - InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP); - InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP); - InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); - InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP); - InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP); - InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP); - InjectHook(0x5051D0, &CHud::SetZoneName, PATCH_JUMP); - InjectHook(0x504C50, &CHud::Shutdown, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Instance.cpp b/src/render/Instance.cpp index 775341be..be6d73d6 100644 --- a/src/render/Instance.cpp +++ b/src/render/Instance.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Instance.h" void @@ -7,14 +7,3 @@ CInstance::Shutdown() { GetMatrix().Detach(); } - -class CInstance_ : public CInstance -{ -public: - void dtor() { CInstance::~CInstance(); } -}; - -STARTPATCHES - InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP); - InjectHook(0x50B850, &CInstance::Shutdown, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Lines.cpp b/src/render/Lines.cpp index ea433048..b5c85149 100644 --- a/src/render/Lines.cpp +++ b/src/render/Lines.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lines.h" diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index d15fa422..c3a25bce 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "RwHelper.h" #include "Camera.h" #include "MBlur.h" @@ -213,11 +213,3 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); } - -STARTPATCHES - InjectHook(0x50AE40, CMBlur::MotionBlurOpen, PATCH_JUMP); - InjectHook(0x50B170, CMBlur::MotionBlurClose, PATCH_JUMP); - InjectHook(0x50A800, CMBlur::CreateImmediateModeData, PATCH_JUMP); - InjectHook(0x50AD70, CMBlur::MotionBlurRender, PATCH_JUMP); - InjectHook(0x50A9C0, CMBlur::OverlayRender, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index eb188128..0388e779 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Timer.h" #include "TxdStore.h" @@ -1849,19 +1849,3 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr 0.3f, color, 0, 0, 0, 0); } } - -STARTPATCHES - //InjectHook(0x50C410, &CParticle::ctor, PATCH_JUMP); - //InjectHook(0x50C420, &CParticle::dtor, PATCH_JUMP); - InjectHook(0x50C430, CParticle::ReloadConfig, PATCH_JUMP); - InjectHook(0x50C570, CParticle::Initialise, PATCH_JUMP); - InjectHook(0x50CF40, CParticle::Shutdown, PATCH_JUMP); - //InjectHook(0x50D140, CParticle::AddParticle, PATCH_JUMP); - InjectHook(0x50D190, (CParticle *(*)(tParticleType, CVector const&, CVector const&, CEntity*, float, RwRGBA const&, int, int, int, int))CParticle::AddParticle, PATCH_JUMP); - InjectHook(0x50DCF0, CParticle::Update, PATCH_JUMP); - InjectHook(0x50EE20, CParticle::Render, PATCH_JUMP); - InjectHook(0x50F6E0, CParticle::RemovePSystem, PATCH_JUMP); - InjectHook(0x50F720, CParticle::RemoveParticle, PATCH_JUMP); - InjectHook(0x50F760, CParticle::AddJetExplosion, PATCH_JUMP); - InjectHook(0x50FAA0, CParticle::AddYardieDoorSmoke, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index 7a1804de..4bfb6380 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "FileMgr.h" #include "ParticleMgr.h" @@ -242,9 +242,3 @@ void cParticleSystemMgr::LoadParticleData() lineEnd++; } } - -STARTPATCHES - InjectHook(0x50FCB0, &cParticleSystemMgr::ctor, PATCH_JUMP); - InjectHook(0x50FCD0, &cParticleSystemMgr::Initialise, PATCH_JUMP); - InjectHook(0x50FDF0, &cParticleSystemMgr::LoadParticleData, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/render/PlayerSkin.cpp b/src/render/PlayerSkin.cpp index 2cba45fe..94af1fd1 100644 --- a/src/render/PlayerSkin.cpp +++ b/src/render/PlayerSkin.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "PlayerSkin.h" #include "TxdStore.h" @@ -163,12 +163,3 @@ CPlayerSkin::RenderFrontendSkinEdit(void) SetAmbientColours(&AmbientColor); RpClumpRender(gpPlayerClump); } - -STARTPATCHES -InjectHook(0x59B9B0, &CPlayerSkin::Initialise, PATCH_JUMP); -InjectHook(0x59B9E0, &CPlayerSkin::Shutdown, PATCH_JUMP); -InjectHook(0x59B9F0, &CPlayerSkin::GetSkinTexture, PATCH_JUMP); -InjectHook(0x59BC70, &CPlayerSkin::BeginFrontendSkinEdit, PATCH_JUMP); -InjectHook(0x59BCB0, &CPlayerSkin::EndFrontendSkinEdit, PATCH_JUMP); -InjectHook(0x59BCE0, &CPlayerSkin::RenderFrontendSkinEdit, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp index 92a89582..55be40b2 100644 --- a/src/render/PointLights.cpp +++ b/src/render/PointLights.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lights.h" #include "Camera.h" @@ -284,10 +284,3 @@ CPointLights::RenderFogEffect(void) } } } - -STARTPATCHES - InjectHook(0x510790, CPointLights::AddLight, PATCH_JUMP); - InjectHook(0x510960, CPointLights::GenerateLightsAffectingObject, PATCH_JUMP); - InjectHook(0x510C20, CPointLights::RemoveLightsAffectingObject, PATCH_JUMP); - InjectHook(0x510C30, CPointLights::RenderFogEffect, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp index 4225619f..6120dfe2 100644 --- a/src/render/RenderBuffer.cpp +++ b/src/render/RenderBuffer.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "RenderBuffer.h" int32 TempBufferVerticesStored; @@ -50,10 +50,3 @@ RenderBuffer::RenderStuffInBuffer(void) } ClearRenderBuffer(); } - -STARTPATCHES - InjectHook(0x517620, RenderBuffer::ClearRenderBuffer, PATCH_JUMP); - InjectHook(0x517640, RenderBuffer::StartStoring, PATCH_JUMP); - InjectHook(0x5176B0, RenderBuffer::StopStoring, PATCH_JUMP); - InjectHook(0x5177C0, RenderBuffer::RenderStuffInBuffer, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 7b2f90e8..9c78853f 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Lights.h" #include "ModelInfo.h" @@ -1207,40 +1207,3 @@ CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset) if(reset) ReSetAmbientAndDirectionalColours(); } - -STARTPATCHES - InjectHook(0x4A7680, CRenderer::Init, PATCH_JUMP); - InjectHook(0x4A76A0, CRenderer::Shutdown, PATCH_JUMP); - - InjectHook(0x4A7B90, CRenderer::RenderOneRoad, PATCH_JUMP); - InjectHook(0x4A7BA0, CRenderer::RenderOneNonRoad, PATCH_JUMP); - InjectHook(0x4A7B20, CRenderer::RenderFirstPersonVehicle, PATCH_JUMP); - InjectHook(0x4A78B0, CRenderer::RenderRoads, PATCH_JUMP); - InjectHook(0x4A7930, CRenderer::RenderEverythingBarRoads, PATCH_JUMP); - InjectHook(0x4A7AA0, CRenderer::RenderVehiclesButNotBoats, PATCH_JUMP); - InjectHook(0x4A7AE0, CRenderer::RenderBoats, PATCH_JUMP); - InjectHook(0x4A7910, CRenderer::RenderFadingInEntities, PATCH_JUMP); - - InjectHook(0x4A9350, CRenderer::SetupEntityVisibility, PATCH_JUMP); - InjectHook(0x4A9920, CRenderer::SetupBigBuildingVisibility, PATCH_JUMP); - - InjectHook(0x4A76B0, CRenderer::ConstructRenderList, PATCH_JUMP); - InjectHook(0x4A7840, CRenderer::PreRender, PATCH_JUMP); - InjectHook(0x4A8970, CRenderer::ScanWorld, PATCH_JUMP); - InjectHook(0x4AA240, CRenderer::RequestObjectsInFrustum, PATCH_JUMP); - InjectHook(0x4A7F30, CRenderer::ScanSectorPoly, PATCH_JUMP); - InjectHook(0x4A9300, CRenderer::ScanBigBuildingList, PATCH_JUMP); - InjectHook(0x4A9BB0, CRenderer::ScanSectorList, PATCH_JUMP); - InjectHook(0x4A9E30, CRenderer::ScanSectorList_Priority, PATCH_JUMP); - InjectHook(0x4AA0A0, CRenderer::ScanSectorList_Subway, PATCH_JUMP); - InjectHook(0x4AA1D0, CRenderer::ScanSectorList_RequestModels, PATCH_JUMP); - - InjectHook(0x4AA940, CRenderer::SortBIGBuildings, PATCH_JUMP); - InjectHook(0x4AA990, CRenderer::SortBIGBuildingsForSectorList, PATCH_JUMP); - - InjectHook(0x4A9840, CRenderer::ShouldModelBeStreamed, PATCH_JUMP); - InjectHook(0x4AAA00, CRenderer::IsEntityCullZoneVisible, PATCH_JUMP); - InjectHook(0x4AAAA0, CRenderer::IsVehicleCullZoneVisible, PATCH_JUMP); - - InjectHook(0x4A7CF0, CRenderer::RemoveVehiclePedLights, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp index 65d8b2dd..31110046 100644 --- a/src/render/Rubbish.cpp +++ b/src/render/Rubbish.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "General.h" #include "Timer.h" #include "Weather.h" diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 56a93238..8685b93a 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "TxdStore.h" #include "Timer.h" @@ -1760,36 +1760,3 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur 0, 128, 255, 128, 2048, 0.2f, 0); } - - -STARTPATCHES - InjectHook(0x512AB0, CShadows::Init, PATCH_JUMP); - InjectHook(0x512F20, CShadows::Shutdown, PATCH_JUMP); - InjectHook(0x512FD0, CShadows::AddPermanentShadow, PATCH_JUMP); - InjectHook(0x5130A0, CShadows::StoreStaticShadow, PATCH_JUMP); - InjectHook(0x513550, (void(*)(uint8, CVector *, float, float, float, float, int16, uint8, uint8, uint8))CShadows::StoreShadowToBeRendered, PATCH_JUMP); - InjectHook(0x513750, (void(*)(uint8, RwTexture *, CVector *, float, float, float, float, int16, uint8, uint8, uint8, float, bool, float))CShadows::StoreShadowToBeRendered, PATCH_JUMP); - InjectHook(0x513830, CShadows::StoreShadowForCar, PATCH_JUMP); - InjectHook(0x513A70, CShadows::StoreCarLightShadow, PATCH_JUMP); - InjectHook(0x513C50, CShadows::StoreShadowForPed, PATCH_JUMP); - InjectHook(0x513CB0, CShadows::StoreShadowForPedObject, PATCH_JUMP); - InjectHook(0x513E00, CShadows::StoreShadowForTree, PATCH_JUMP); - InjectHook(0x513E10, CShadows::StoreShadowForPole, PATCH_JUMP); - InjectHook(0x513FC0, CShadows::SetRenderModeForShadowType, PATCH_JUMP); - InjectHook(0x514010, CShadows::RenderStoredShadows, PATCH_JUMP); - InjectHook(0x5145F0, CShadows::RenderStaticShadows, PATCH_JUMP); - InjectHook(0x514910, CShadows::GeneratePolysForStaticShadow, PATCH_JUMP); - InjectHook(0x514C90, CShadows::CastShadowSectorList, PATCH_JUMP); - InjectHook(0x514E30, CShadows::CastShadowEntity, PATCH_JUMP); - InjectHook(0x516BE0, CShadows::UpdateStaticShadows, PATCH_JUMP); - InjectHook(0x516C40, CShadows::UpdatePermanentShadows, PATCH_JUMP); - InjectHook(0x516E70, &CStaticShadow::Free, PATCH_JUMP); - InjectHook(0x516EB0, CShadows::CalcPedShadowValues, PATCH_JUMP); - InjectHook(0x516F90, CShadows::RenderExtraPlayerShadows, PATCH_JUMP); - InjectHook(0x517570, CShadows::TidyUpShadows, PATCH_JUMP); - InjectHook(0x517810, CShadows::RenderIndicatorShadow, PATCH_JUMP); - //InjectHook(0x517900, &CPermanentShadow::CPermanentShadow, PATCH_JUMP); - //InjectHook(0x517910, &CStaticShadow::CStaticShadow, PATCH_JUMP); - //InjectHook(0x517920, &CPolyBunch::CPolyBunch, PATCH_JUMP); - //InjectHook(0x517940, &CStoredShadow::CStoredShadow, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp index 41ee5d1d..0848796b 100644 --- a/src/render/Skidmarks.cpp +++ b/src/render/Skidmarks.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "TxdStore.h" #include "Timer.h" diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 9189a7c2..16057420 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "SpecialFX.h" #include "RenderBuffer.h" #include "Timer.h" @@ -1151,32 +1151,3 @@ CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix) dZ = 2.0f; } } - -STARTPATCHES - InjectHook(0x518DE0, &CBulletTraces::Init, PATCH_JUMP); - InjectHook(0x518E90, &CBulletTraces::AddTrace, PATCH_JUMP); - InjectHook(0x518F20, &CBulletTraces::Render, PATCH_JUMP); - InjectHook(0x519240, &CBulletTraces::Update, PATCH_JUMP); - - InjectHook(0x51B070, &C3dMarker::AddMarker, PATCH_JUMP); - InjectHook(0x51B170, &C3dMarker::DeleteMarkerObject, PATCH_JUMP); - InjectHook(0x51B1B0, &C3dMarker::Render, PATCH_JUMP); - InjectHook(0x51B2B0, C3dMarkers::Init, PATCH_JUMP); - InjectHook(0x51B480, C3dMarkers::PlaceMarker, PATCH_JUMP); - InjectHook(0x51BB80, C3dMarkers::PlaceMarkerSet, PATCH_JUMP); - InjectHook(0x51B400, C3dMarkers::Render, PATCH_JUMP); - InjectHook(0x51B3B0, C3dMarkers::Shutdown, PATCH_JUMP); - - InjectHook(0x5197A0, CBrightLights::Init, PATCH_JUMP); - InjectHook(0x51A410, CBrightLights::RegisterOne, PATCH_JUMP); - InjectHook(0x5197B0, CBrightLights::Render, PATCH_JUMP); - InjectHook(0x51A3B0, CBrightLights::RenderOutGeometryBuffer, PATCH_JUMP); - - InjectHook(0x51A5A0, CShinyTexts::Init, PATCH_JUMP); - InjectHook(0x51AAB0, CShinyTexts::RegisterOne, PATCH_JUMP); - InjectHook(0x51A5B0, CShinyTexts::Render, PATCH_JUMP); - InjectHook(0x51AA50, CShinyTexts::RenderOutGeometryBuffer, PATCH_JUMP); - - InjectHook(0x51AF70, CMoneyMessages::Init, PATCH_JUMP); - InjectHook(0x51B030, CMoneyMessages::Render, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 57ab8f14..30eaf840 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Draw.h" #include "Camera.h" @@ -593,19 +593,3 @@ CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w if(nSpriteBufferIndex >= SPRITEBUFFERSIZE) FlushSpriteBuffer(); } - -STARTPATCHES - InjectHook(0x51C4A0, CSprite::CalcHorizonCoors, PATCH_JUMP); - InjectHook(0x51C3A0, CSprite::CalcScreenCoors, PATCH_JUMP); - InjectHook(0x51C590, CSprite::InitSpriteBuffer, PATCH_JUMP); - InjectHook(0x51C5B0, CSprite::InitSpriteBuffer2D, PATCH_JUMP); - InjectHook(0x51C520, CSprite::FlushSpriteBuffer, PATCH_JUMP); - InjectHook(0x51C960, CSprite::RenderOneXLUSprite, PATCH_JUMP); - InjectHook(0x51D110, CSprite::RenderOneXLUSprite_Rotate_Aspect, PATCH_JUMP); - InjectHook(0x51C5D0, CSprite::RenderBufferedOneXLUSprite, PATCH_JUMP); - InjectHook(0x51D5B0, CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension, PATCH_JUMP); - InjectHook(0x51CCD0, CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect, PATCH_JUMP); - InjectHook(0x51D9E0, CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours, PATCH_JUMP); - InjectHook(0x51E3C0, CSprite::RenderBufferedOneXLUSprite2D, PATCH_JUMP); - InjectHook(0x51E490, CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index 655fd841..52b85018 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Draw.h" #include "Camera.h" @@ -474,37 +474,3 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD); } - -STARTPATCHES -#define C4 const CRGBA&, const CRGBA&, const CRGBA&, const CRGBA& -#define F8 float, float, float, float, float, float, float, float - - InjectHook(0x51EA20, CSprite2d::SetRecipNearClip, PATCH_JUMP); - InjectHook(0x51EAE0, CSprite2d::InitPerFrame, PATCH_JUMP); - InjectHook(0x51EB70, CSprite2d::GetBank, PATCH_JUMP); - InjectHook(0x51EBC0, CSprite2d::AddSpriteToBank, PATCH_JUMP); - InjectHook(0x51EC50, CSprite2d::DrawBank, PATCH_JUMP); - - InjectHook(0x51EA00, &CSprite2d::Delete, PATCH_JUMP); - InjectHook(0x51F950, &CSprite2d::SetRenderState, PATCH_JUMP); - InjectHook(0x51EA40, (void (CSprite2d::*)(const char*))&CSprite2d::SetTexture, PATCH_JUMP); - InjectHook(0x51EA70, (void (CSprite2d::*)(const char*,const char*))&CSprite2d::SetTexture, PATCH_JUMP); - InjectHook(0x51EAA0, &CSprite2d::SetAddressing, PATCH_JUMP); - - InjectHook(0x51EE90, (void (*)(const CRect&, C4, uint32))CSprite2d::SetVertices, PATCH_JUMP); - InjectHook(0x51F220, (void (*)(const CRect&, C4, F8))CSprite2d::SetVertices, PATCH_JUMP); - InjectHook(0x51F070, (void (*)(F8, C4))CSprite2d::SetVertices, PATCH_JUMP); - InjectHook(0x51F3E0, (void (*)(int, float*, float*, const CRGBA&))CSprite2d::SetVertices, PATCH_JUMP); - InjectHook(0x51F490, CSprite2d::SetMaskVertices, PATCH_JUMP); - InjectHook(0x51F720, (void (*)(RwIm2DVertex*, const CRect&, C4, F8))CSprite2d::SetVertices, PATCH_JUMP); - - InjectHook(0x51ECE0, (void (CSprite2d::*)(float, float, float, float, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP); - InjectHook(0x51ED50, (void (CSprite2d::*)(const CRect &, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP); - InjectHook(0x51ED90, (void (CSprite2d::*)(const CRect &, const CRGBA &, F8))&CSprite2d::Draw, PATCH_JUMP); - InjectHook(0x51EDF0, (void (CSprite2d::*)(const CRect &, C4))&CSprite2d::Draw, PATCH_JUMP); - InjectHook(0x51EE40, (void (CSprite2d::*)(F8, const CRGBA &))&CSprite2d::Draw, PATCH_JUMP); - - InjectHook(0x51F970, (void (*)(const CRect&, const CRGBA&))CSprite2d::DrawRect, PATCH_JUMP); - InjectHook(0x51FA00, (void (*)(const CRect&, C4))CSprite2d::DrawRect, PATCH_JUMP); - InjectHook(0x51FA80, CSprite2d::DrawRectXLU, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index 6e24a76e..e47015a0 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "Clock.h" #include "Weather.h" @@ -315,8 +315,3 @@ CTimeCycle::Update(void) else m_FogReduction = max(m_FogReduction-1, 0); } - -STARTPATCHES - InjectHook(0x4ABAE0, CTimeCycle::Initialise, PATCH_JUMP); - InjectHook(0x4ABF40, CTimeCycle::Update, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp index e848fb43..1a9b983f 100644 --- a/src/render/WaterCannon.cpp +++ b/src/render/WaterCannon.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "WaterCannon.h" #include "Vector.h" #include "General.h" @@ -304,17 +304,3 @@ void CWaterCannons::Render(void) aCannons[i].Render(); } } - -STARTPATCHES - InjectHook(0x521A30, &CWaterCannon::Init, PATCH_JUMP); - InjectHook(0x521B80, &CWaterCannon::Update_OncePerFrame, PATCH_JUMP); - InjectHook(0x521CC0, &CWaterCannon::Update_NewInput, PATCH_JUMP); - InjectHook(0x521D30, &CWaterCannon::Render, PATCH_JUMP); - InjectHook(0x5220B0, &CWaterCannon::PushPeds, PATCH_JUMP); - InjectHook(0x522440, CWaterCannons::Init, PATCH_JUMP); - InjectHook(0x522470, CWaterCannons::UpdateOne, PATCH_JUMP); - InjectHook(0x522510, CWaterCannons::Update, PATCH_JUMP); - InjectHook(0x522550, CWaterCannons::Render, PATCH_JUMP); - //InjectHook(0x522B40, `global constructor keyed to'watercannon.cpp, PATCH_JUMP); - //InjectHook(0x522B60, CWaterCannon::CWaterCannon, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index d5a54742..ad0b3ec4 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -21,7 +21,7 @@ #include "RenderBuffer.h" #include #include "WaterLevel.h" -#include "patcher.h" + float TEXTURE_ADDU; float TEXTURE_ADDV; @@ -1234,22 +1234,3 @@ CWaterLevel::FreeBoatWakeArray() nGeomUsed = 0; } - -STARTPATCHES - InjectHook(0x554EA0, &CWaterLevel::Initialise, PATCH_JUMP); - InjectHook(0x554FE0, &CWaterLevel::Shutdown, PATCH_JUMP); - InjectHook(0x555010, &CWaterLevel::CreateWavyAtomic, PATCH_JUMP); - InjectHook(0x5552A0, &CWaterLevel::DestroyWavyAtomic, PATCH_JUMP); - InjectHook(0x5552C0, (bool (*)(float,float,float,float*,bool))&CWaterLevel::GetWaterLevel, PATCH_JUMP); - InjectHook(0x555440, &CWaterLevel::GetWaterLevelNoWaves, PATCH_JUMP); - InjectHook(0x5554E0, &CWaterLevel::RenderWater, PATCH_JUMP); - InjectHook(0x556C30, &CWaterLevel::RenderOneFlatSmallWaterPoly, PATCH_JUMP); - InjectHook(0x556E80, &CWaterLevel::RenderOneFlatLargeWaterPoly, PATCH_JUMP); - InjectHook(0x5570D0, &CWaterLevel::RenderOneFlatHugeWaterPoly, PATCH_JUMP); - InjectHook(0x557320, &CWaterLevel::RenderOneFlatExtraHugeWaterPoly, PATCH_JUMP); - InjectHook(0x557570, &CWaterLevel::RenderOneWavySector, PATCH_JUMP); - InjectHook(0x557C30, &CWaterLevel::CalcDistanceToWater, PATCH_JUMP); - InjectHook(0x557EA0, &CWaterLevel::RenderAndEmptyRenderBuffer, PATCH_JUMP); - InjectHook(0x557F00, &CWaterLevel::AllocateBoatWakeArray, PATCH_JUMP); - InjectHook(0x5581C0, &CWaterLevel::FreeBoatWakeArray, PATCH_JUMP); -ENDPATCHES diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 1aa6be82..8bc544c6 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Weather.h" #include "Camera.h" diff --git a/src/rw/ClumpRead.cpp b/src/rw/ClumpRead.cpp index 0bf62f32..5f50f52d 100644 --- a/src/rw/ClumpRead.cpp +++ b/src/rw/ClumpRead.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + struct rpGeometryList { @@ -222,9 +222,3 @@ RpClumpGtaCancelStream(void) rwFrameListDeinitialize(&gFrameList); gFrameList.numFrames = 0; } - -STARTPATCHES - InjectHook(0x526060, RpClumpGtaStreamRead1, PATCH_JUMP); - InjectHook(0x526180, RpClumpGtaStreamRead2, PATCH_JUMP); - InjectHook(0x5262D0, RpClumpGtaCancelStream, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp index 6e9edbed..9c5d4f22 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -1,7 +1,7 @@ #include "common.h" #include #include -#include "patcher.h" + #include "Lights.h" #include "Timecycle.h" #include "Coronas.h" @@ -11,7 +11,7 @@ RpLight *pAmbient; RpLight *pDirect; -RpLight *pExtraDirectionals[] = { nil }; +RpLight *pExtraDirectionals[4] = { nil }; int LightStrengths[4]; int NumExtraDirLightsInWorld; @@ -312,22 +312,3 @@ SetAmbientColours(RwRGBAReal *color) { RpLightSetColor(pAmbient, color); } - - -STARTPATCHES - InjectHook(0x526510, SetLightsWithTimeOfDayColour, PATCH_JUMP); - InjectHook(0x5269A0, LightsCreate, PATCH_JUMP); - InjectHook(0x526B40, LightsDestroy, PATCH_JUMP); - InjectHook(0x526C10, WorldReplaceNormalLightsWithScorched, PATCH_JUMP); - InjectHook(0x526C50, WorldReplaceScorchedLightsWithNormal, PATCH_JUMP); - InjectHook(0x526C70, AddAnExtraDirectionalLight, PATCH_JUMP); - InjectHook(0x526DB0, RemoveExtraDirectionalLights, PATCH_JUMP); - InjectHook(0x526DE0, SetAmbientAndDirectionalColours, PATCH_JUMP); - InjectHook(0x526E60, SetBrightMarkerColours, PATCH_JUMP); - InjectHook(0x526F10, ReSetAmbientAndDirectionalColours, PATCH_JUMP); - InjectHook(0x526F40, DeActivateDirectional, PATCH_JUMP); - InjectHook(0x526F50, ActivateDirectional, PATCH_JUMP); - InjectHook(0x526F60, (void (*)(void))SetAmbientColours, PATCH_JUMP); - InjectHook(0x526F80, SetAmbientColoursForPedsCarsAndObjects, PATCH_JUMP); - InjectHook(0x526FA0, (void (*)(RwRGBAReal*))SetAmbientColours, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/NodeName.cpp b/src/rw/NodeName.cpp index b3477dba..d62884f7 100644 --- a/src/rw/NodeName.cpp +++ b/src/rw/NodeName.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "NodeName.h" static int32 gPluginOffset; diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 6bb78e7b..e5c4ceae 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -1,6 +1,6 @@ #define WITHD3D #include "common.h" -#include "patcher.h" + #include "Timecycle.h" #include "skeleton.h" #if defined(RWLIBS) && !defined(FINAL) @@ -393,11 +393,3 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer) WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); } WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); } #endif - -STARTPATCHES - //InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP); - InjectHook(0x526460, GetFirstObject, PATCH_JUMP); - InjectHook(0x527170, CameraSize, PATCH_JUMP); - InjectHook(0x527340, CameraDestroy, PATCH_JUMP); - InjectHook(0x5273B0, CameraCreate, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/RwMatFX.cpp b/src/rw/RwMatFX.cpp index c4fe0b0b..1e64c560 100644 --- a/src/rw/RwMatFX.cpp +++ b/src/rw/RwMatFX.cpp @@ -2,7 +2,9 @@ #define WITHD3D #include "common.h" +#ifdef RWLIBS #include "patcher.h" +#endif struct MatFXNothing { int pad[5]; int effect; }; @@ -216,14 +218,11 @@ _rpMatFXD3D8AtomicMatFXEnvRender_ps2(RxD3D8InstanceData *inst, int flags, int se RwD3D8SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0); } - -STARTPATCHES #ifdef RWLIBS +STARTPATCHES InjectHook((uintptr)&_rpMatFXD3D8AtomicMatFXEnvRender, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP); -#else - InjectHook(0x5CF6C0, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP); -#endif ENDPATCHES +#endif #endif diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 64fea20f..258d520d 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -6,7 +6,7 @@ #define WITHWINDOWS #include "common.h" #include "win.h" -#include "patcher.h" + #include "Timer.h" #ifdef GTA_PC #include "FileMgr.h" @@ -349,17 +349,3 @@ CreateTxdImageForVideoCard() return true; } #endif // GTA_PC - -STARTPATCHES - InjectHook(0x592380, RwTextureGtaStreamRead, PATCH_JUMP); - InjectHook(0x5924A0, RwTexDictionaryGtaStreamRead, PATCH_JUMP); - InjectHook(0x592550, RwTexDictionaryGtaStreamRead1, PATCH_JUMP); - InjectHook(0x592650, RwTexDictionaryGtaStreamRead2, PATCH_JUMP); - - InjectHook(0x5926C0, ReadVideoCardCapsFile, PATCH_JUMP); - InjectHook(0x592740, CheckVideoCardCaps, PATCH_JUMP); - InjectHook(0x5927D0, WriteVideoCardCapsFile, PATCH_JUMP); - InjectHook(0x592880, ConvertingTexturesScreen, PATCH_JUMP); - InjectHook(0x592BF0, DealWithTxdWriteError, PATCH_JUMP); - InjectHook(0x592C70, CreateTxdImageForVideoCard, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index d640d99d..51d018f6 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "templates.h" #include "General.h" #include "Streaming.h" @@ -185,25 +185,3 @@ CTxdStore::RemoveTxd(int slot) RwTexDictionaryDestroy(def->texDict); def->texDict = nil; } - -STARTPATCHES - InjectHook(0x527440, CTxdStore::Initialise, PATCH_JUMP); - InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP); - InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP); - InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP); - InjectHook(0x5275D0, CTxdStore::FindTxdSlot, PATCH_JUMP); - InjectHook(0x527590, CTxdStore::GetTxdName, PATCH_JUMP); - InjectHook(0x527900, CTxdStore::PushCurrentTxd, PATCH_JUMP); - InjectHook(0x527910, CTxdStore::PopCurrentTxd, PATCH_JUMP); - InjectHook(0x5278C0, CTxdStore::SetCurrentTxd, PATCH_JUMP); - InjectHook(0x527830, CTxdStore::Create, PATCH_JUMP); - InjectHook(0x527A00, CTxdStore::GetNumRefs, PATCH_JUMP); - InjectHook(0x527930, CTxdStore::AddRef, PATCH_JUMP); - InjectHook(0x527970, CTxdStore::RemoveRef, PATCH_JUMP); - InjectHook(0x5279C0, CTxdStore::RemoveRefWithoutDelete, PATCH_JUMP); - InjectHook(0x527700, (bool (*)(int, RwStream*))CTxdStore::LoadTxd, PATCH_JUMP); - InjectHook(0x5276B0, (bool (*)(int, const char*))CTxdStore::LoadTxd, PATCH_JUMP); - InjectHook(0x527770, CTxdStore::StartLoadTxd, PATCH_JUMP); - InjectHook(0x5277E0, CTxdStore::FinishLoadTxd, PATCH_JUMP); - InjectHook(0x527870, CTxdStore::RemoveTxd, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index b7afd751..89bd13a6 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "templates.h" #include "Entity.h" #include "ModelInfo.h" @@ -838,59 +838,3 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump) { return CLUMPEXT(clump)->alpha; } - - -STARTPATCHES - InjectHook(0x527E50, CVisibilityPlugins::Initialise, PATCH_JUMP); - InjectHook(0x527EA0, CVisibilityPlugins::Shutdown, PATCH_JUMP); - InjectHook(0x528F90, CVisibilityPlugins::InitAlphaEntityList, PATCH_JUMP); - InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP); - InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP); - InjectHook(0x528FA0, CVisibilityPlugins::InsertAtomicIntoSortedList, PATCH_JUMP); - InjectHook(0x528C50, CVisibilityPlugins::SetRenderWareCamera, PATCH_JUMP); - - InjectHook(0x527F60, SetAlphaCB, PATCH_JUMP); - InjectHook(0x529040, CVisibilityPlugins::RenderAlphaAtomics, PATCH_JUMP); - InjectHook(0x529070, CVisibilityPlugins::RenderFadingEntities, PATCH_JUMP); - - InjectHook(0x527F70, CVisibilityPlugins::RenderWheelAtomicCB, PATCH_JUMP); - InjectHook(0x528000, CVisibilityPlugins::RenderObjNormalAtomic, PATCH_JUMP); - InjectHook(0x5280B0, CVisibilityPlugins::RenderAlphaAtomic, PATCH_JUMP); - InjectHook(0x528100, CVisibilityPlugins::RenderFadingAtomic, PATCH_JUMP); - - InjectHook(0x5283E0, CVisibilityPlugins::RenderVehicleHiDetailCB, PATCH_JUMP); - InjectHook(0x5284B0, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB, PATCH_JUMP); - InjectHook(0x5288A0, CVisibilityPlugins::RenderVehicleHiDetailCB_BigVehicle, PATCH_JUMP); - InjectHook(0x528A10, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle, PATCH_JUMP); - InjectHook(0x528AD0, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat, PATCH_JUMP); - InjectHook(0x5287F0, CVisibilityPlugins::RenderVehicleLowDetailCB_BigVehicle, PATCH_JUMP); - InjectHook(0x528940, CVisibilityPlugins::RenderVehicleLowDetailAlphaCB_BigVehicle, PATCH_JUMP); - InjectHook(0x528240, CVisibilityPlugins::RenderVehicleReallyLowDetailCB, PATCH_JUMP); - InjectHook(0x5287B0, CVisibilityPlugins::RenderVehicleReallyLowDetailCB_BigVehicle, PATCH_JUMP); - InjectHook(0x5285D0, CVisibilityPlugins::RenderTrainHiDetailCB, PATCH_JUMP); - InjectHook(0x5286A0, CVisibilityPlugins::RenderTrainHiDetailAlphaCB, PATCH_JUMP); - - InjectHook(0x528BC0, CVisibilityPlugins::RenderPedHiDetailCB, PATCH_JUMP); - InjectHook(0x528B60, CVisibilityPlugins::RenderPedLowDetailCB, PATCH_JUMP); - - - InjectHook(0x527DC0, CVisibilityPlugins::PluginAttach, PATCH_JUMP); - - InjectHook(0x527EC0, CVisibilityPlugins::SetAtomicModelInfo, PATCH_JUMP); - InjectHook(0x527F00, CVisibilityPlugins::GetAtomicModelInfo, PATCH_JUMP); - InjectHook(0x527F10, CVisibilityPlugins::SetAtomicFlag, PATCH_JUMP); - InjectHook(0x527F30, CVisibilityPlugins::ClearAtomicFlag, PATCH_JUMP); - InjectHook(0x527F50, CVisibilityPlugins::GetAtomicId, PATCH_JUMP); - InjectHook(0x528C20, CVisibilityPlugins::SetAtomicRenderCallback, PATCH_JUMP); - - InjectHook(0x528D60, CVisibilityPlugins::SetFrameHierarchyId, PATCH_JUMP); - InjectHook(0x528D80, CVisibilityPlugins::GetFrameHierarchyId, PATCH_JUMP); - - InjectHook(0x528ED0, CVisibilityPlugins::SetClumpModelInfo, PATCH_JUMP); - InjectHook(0x528F50, CVisibilityPlugins::SetClumpAlpha, PATCH_JUMP); - InjectHook(0x528F70, CVisibilityPlugins::GetClumpAlpha, PATCH_JUMP); - - - InjectHook(0x529120, CVisibilityPlugins::GetDistanceSquaredFromCamera, PATCH_JUMP); - InjectHook(0x5282A0, CVisibilityPlugins::GetDotProductWithCameraVector, PATCH_JUMP); -ENDPATCHES diff --git a/src/rw/rw.cpp b/src/rw/rw.cpp index c525f49f..09cd246e 100644 --- a/src/rw/rw.cpp +++ b/src/rw/rw.cpp @@ -1,6 +1,6 @@ #ifndef LIBRW #include "common.h" -#include "patcher.h" + #include "rwcore.h" #include "rpworld.h" #include "rpmatfx.h" @@ -14,409 +14,6 @@ typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut, const RwMatrix * matrix); #ifndef RWLIBS - -WRAPPER void _rwObjectHasFrameSetFrame(void* object, RwFrame* frame) { EAXJMP(0x5BC950); } -WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { EAXJMP(0x59E690); } -WRAPPER void _rpAtomicResyncInterpolatedSphere(RpAtomic* atomic) { EAXJMP(0x59E6C0); } -WRAPPER RwSphere const* RpAtomicGetWorldBoundingSphere(RpAtomic* atomic) { EAXJMP(0x59E800); } -WRAPPER RwInt32 RpClumpGetNumAtomics(RpClump* clump) { EAXJMP(0x59ED50); } -WRAPPER RpClump* RpClumpRender(RpClump* clump) { EAXJMP(0x59ED80); } -WRAPPER RpClump* RpClumpForAllAtomics(RpClump* clump, RpAtomicCallBack callback, void* pData) { EAXJMP(0x59EDD0); } -WRAPPER RpClump* RpClumpForAllCameras(RpClump* clump, RwCameraCallBack callback, void* pData) { EAXJMP(0x59EE10); } -WRAPPER RpClump* RpClumpForAllLights(RpClump* clump, RpLightCallBack callback, void* pData) { EAXJMP(0x59EE60); } -WRAPPER RpAtomic* RpAtomicCreate() { EAXJMP(0x59EEB0); } -WRAPPER RpAtomic* RpAtomicSetGeometry(RpAtomic* atomic, RpGeometry* geometry, RwUInt32 flags) { EAXJMP(0x59EFA0); } -WRAPPER RwBool RpAtomicDestroy(RpAtomic* atomic) { EAXJMP(0x59F020); } -WRAPPER RpAtomic* RpAtomicClone(RpAtomic* atomic) { EAXJMP(0x59F0A0); } -WRAPPER RpClump* RpClumpClone(RpClump* clump) { EAXJMP(0x59F1B0); } -WRAPPER RpClump* RpClumpCreate() { EAXJMP(0x59F490); } -WRAPPER RwBool RpClumpDestroy(RpClump* clump) { EAXJMP(0x59F500); } -WRAPPER RpClump* RpClumpAddAtomic(RpClump* clump, RpAtomic* atomic) { EAXJMP(0x59F680); } -WRAPPER RpClump* RpClumpRemoveAtomic(RpClump* clump, RpAtomic* atomic) { EAXJMP(0x59F6B0); } -WRAPPER RpClump* RpClumpRemoveLight(RpClump* clump, RpLight* light) { EAXJMP(0x59F6E0); } -WRAPPER RpClump* RpClumpStreamRead(RwStream* stream) { EAXJMP(0x59FC50); } -WRAPPER RwInt32 RpAtomicRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A0510); } -WRAPPER RwInt32 RpClumpRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A0540); } -WRAPPER RwInt32 RpAtomicRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5A0570); } -WRAPPER RwInt32 RpAtomicSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB) { EAXJMP(0x5A05A0); } -WRAPPER RwInt32 RpAtomicSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB) { EAXJMP(0x5A05C0); } -WRAPPER RwInt32 RpAtomicGetPluginOffset(RwUInt32 pluginID) { EAXJMP(0x5A05E0); } -WRAPPER RpAtomic* RpAtomicSetFrame(RpAtomic* atomic, RwFrame* frame) { EAXJMP(0x5A0600); } -WRAPPER RwInt32 RwEngineRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor initCB, RwPluginObjectDestructor termCB) { EAXJMP(0x5A0DC0); } -WRAPPER RwInt32 RwEngineGetPluginOffset(RwUInt32 pluginID) { EAXJMP(0x5A0DF0); } -WRAPPER RwInt32 RwEngineGetNumSubSystems() { EAXJMP(0x5A0E10); } -WRAPPER RwSubSystemInfo* RwEngineGetSubSystemInfo(RwSubSystemInfo* subSystemInfo, RwInt32 subSystemIndex) { EAXJMP(0x5A0E40); } -WRAPPER RwInt32 RwEngineGetCurrentSubSystem() { EAXJMP(0x5A0E70); } -WRAPPER RwBool RwEngineSetSubSystem(RwInt32 subSystemIndex) { EAXJMP(0x5A0EA0); } -WRAPPER RwInt32 RwEngineGetNumVideoModes() { EAXJMP(0x5A0ED0); } -WRAPPER RwVideoMode* RwEngineGetVideoModeInfo(RwVideoMode* modeinfo, RwInt32 modeIndex) { EAXJMP(0x5A0F00); } -WRAPPER RwInt32 RwEngineGetCurrentVideoMode() { EAXJMP(0x5A0F30); } -WRAPPER RwBool RwEngineSetVideoMode(RwInt32 modeIndex) { EAXJMP(0x5A0F60); } -WRAPPER RwBool RwEngineStop() { EAXJMP(0x5A0F90); } -WRAPPER RwBool RwEngineStart() { EAXJMP(0x5A0FE0); } -WRAPPER RwBool RwEngineClose() { EAXJMP(0x5A1070); } -WRAPPER RwBool RwEngineOpen(RwEngineOpenParams* initParams) { EAXJMP(0x5A10E0); } -WRAPPER RwBool RwEngineTerm() { EAXJMP(0x5A1290); } -WRAPPER RwBool RwEngineInit(RwMemoryFunctions* memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) { EAXJMP(0x5A12D0); } -WRAPPER void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A15E0); } -WRAPPER void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A1650); } -WRAPPER RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root) { EAXJMP(0x5A1690); } -WRAPPER RwFrame* _rwFramePurgeClone(RwFrame* root) { EAXJMP(0x5A1880); } -WRAPPER RwBool RwFrameDirty(RwFrame const* frame) { EAXJMP(0x5A1930); } -WRAPPER void _rwFrameInit(RwFrame* frame) { EAXJMP(0x5A1950); } -WRAPPER RwFrame* RwFrameCreate() { EAXJMP(0x5A1A00); } -WRAPPER RwBool RwFrameDestroy(RwFrame* frame) { EAXJMP(0x5A1A30); } -WRAPPER RwBool RwFrameDestroyHierarchy(RwFrame* frame) { EAXJMP(0x5A1BF0); } -WRAPPER RwFrame* RwFrameUpdateObjects(RwFrame* frame) { EAXJMP(0x5A1C60); } -WRAPPER RwMatrix* RwFrameGetLTM(RwFrame* frame) { EAXJMP(0x5A1CE0); } -WRAPPER RwFrame* RwFrameAddChild(RwFrame* parent, RwFrame* child) { EAXJMP(0x5A1D00); } -WRAPPER RwFrame* RwFrameRemoveChild(RwFrame* child) { EAXJMP(0x5A1ED0); } -WRAPPER RwFrame* RwFrameForAllChildren(RwFrame* frame, RwFrameCallBack callBack, void* data) { EAXJMP(0x5A1FC0); } -WRAPPER RwFrame* RwFrameTranslate(RwFrame* frame, RwV3d const* v, RwOpCombineType combine) { EAXJMP(0x5A2000); } -WRAPPER RwFrame* RwFrameScale(RwFrame* frame, RwV3d const* v, RwOpCombineType combine) { EAXJMP(0x5A20A0); } -WRAPPER RwFrame* RwFrameTransform(RwFrame* frame, RwMatrix const* m, RwOpCombineType combine) { EAXJMP(0x5A2140); } -WRAPPER RwFrame* RwFrameRotate(RwFrame* frame, RwV3d const* axis, RwReal angle, RwOpCombineType combine) { EAXJMP(0x5A21E0); } -WRAPPER RwFrame* RwFrameSetIdentity(RwFrame* frame) { EAXJMP(0x5A2280); } -WRAPPER RwFrame* RwFrameForAllObjects(RwFrame* frame, RwObjectCallBack callBack, void* data) { EAXJMP(0x5A2340); } -WRAPPER RwInt32 RwFrameRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A2380); } -WRAPPER RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat) { EAXJMP(0x5A23B0); } -WRAPPER RwReal _rwMatrixDeterminant(RwMatrix const* matrix) { EAXJMP(0x5A2520); } -WRAPPER RwReal _rwMatrixOrthogonalError(RwMatrix const* matrix) { EAXJMP(0x5A2570); } -WRAPPER RwReal _rwMatrixNormalError(RwMatrix const* matrix) { EAXJMP(0x5A25D0); } -WRAPPER RwReal _rwMatrixIdentityError(RwMatrix const* matrix) { EAXJMP(0x5A2660); } -WRAPPER void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A2730); } -WRAPPER void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A2770); } -WRAPPER RwMatrix* RwMatrixOptimize(RwMatrix* matrix, RwMatrixTolerance const* tolerance) { EAXJMP(0x5A2820); } -WRAPPER RwMatrix* RwMatrixUpdate(RwMatrix* matrix) { EAXJMP(0x5A28E0); } -WRAPPER RwMatrix* RwMatrixMultiply(RwMatrix* matrixOut, RwMatrix const* MatrixIn1, RwMatrix const* matrixIn2) { EAXJMP(0x5A28F0); } -WRAPPER RwMatrix* RwMatrixRotateOneMinusCosineSine(RwMatrix* matrix, RwV3d const* unitAxis, RwReal oneMinusCosine, RwReal sine, RwOpCombineType combineOp) { EAXJMP(0x5A2960); } -WRAPPER RwMatrix* RwMatrixRotate(RwMatrix* matrix, RwV3d const* axis, RwReal angle, RwOpCombineType combineOp) { EAXJMP(0x5A2BF0); } -WRAPPER RwMatrix* RwMatrixInvert(RwMatrix* matrixOut, RwMatrix const* matrixIn) { EAXJMP(0x5A2C90); } -WRAPPER RwMatrix* RwMatrixScale(RwMatrix* matrix, RwV3d const* scale, RwOpCombineType combineOp) { EAXJMP(0x5A2EE0); } -WRAPPER RwMatrix* RwMatrixTranslate(RwMatrix* matrix, RwV3d const* translation, RwOpCombineType combineOp) { EAXJMP(0x5A3070); } -WRAPPER RwMatrix* RwMatrixTransform(RwMatrix* matrix, RwMatrix const* transform, RwOpCombineType combineOp) { EAXJMP(0x5A31C0); } -WRAPPER RwBool RwMatrixDestroy(RwMatrix* mpMat) { EAXJMP(0x5A3300); } -WRAPPER RwMatrix* RwMatrixCreate() { EAXJMP(0x5A3330); } -WRAPPER RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors) { EAXJMP(0x5A3450); } -WRAPPER RwReal _rwV3dNormalize(RwV3d* out, RwV3d const* in) { EAXJMP(0x5A3600); } -WRAPPER RwReal RwV3dLength(RwV3d const* in) { EAXJMP(0x5A36A0); } -WRAPPER RwReal _rwSqrt(RwReal const num) { EAXJMP(0x5A3710); } -WRAPPER RwReal _rwInvSqrt(RwReal const num) { EAXJMP(0x5A3770); } -WRAPPER RwV3d* RwV3dTransformPoints(RwV3d* pointsOut, RwV3d const* pointsIn, RwInt32 numPoints, RwMatrix const* matrix) { EAXJMP(0x5A37D0); } -WRAPPER RwV3d* RwV3dTransformVectors(RwV3d* vectorsOut, RwV3d const* vectorsIn, RwInt32 numPoints, RwMatrix const* matrix) { EAXJMP(0x5A37E0); } -WRAPPER void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A37F0); } -WRAPPER void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5A3860); } -WRAPPER RwUInt32 RwStreamRead(RwStream* stream, void* buffer, RwUInt32 length) { EAXJMP(0x5A3AD0); } -WRAPPER RwStream* RwStreamWrite(RwStream* stream, void const* buffer, RwUInt32 length) { EAXJMP(0x5A3C30); } -WRAPPER RwStream* RwStreamSkip(RwStream* stream, RwUInt32 offset) { EAXJMP(0x5A3DF0); } -WRAPPER RwBool RwStreamClose(RwStream* stream, void* pData) { EAXJMP(0x5A3F10); } -WRAPPER RwStream* RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, void const* pData) { EAXJMP(0x5A3FE0); } -WRAPPER RwReal RwIm2DGetNearScreenZ() { EAXJMP(0x5A43A0); } -WRAPPER RwReal RwIm2DGetFarScreenZ() { EAXJMP(0x5A43B0); } -WRAPPER RwBool RwRenderStateSet(RwRenderState state, void* value) { EAXJMP(0x5A43C0); } -WRAPPER RwBool RwRenderStateGet(RwRenderState state, void* value) { EAXJMP(0x5A4410); } -WRAPPER RwBool RwIm2DRenderLine(RwIm2DVertex* vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2) { EAXJMP(0x5A4420); } -WRAPPER RwBool RwIm2DRenderPrimitive(RwPrimitiveType primType, RwIm2DVertex* vertices, RwInt32 numVertices) { EAXJMP(0x5A4430); } -WRAPPER RwBool RwIm2DRenderIndexedPrimitive(RwPrimitiveType primType, RwIm2DVertex* vertices, RwInt32 numVertices, RwImVertexIndex* indices, RwInt32 numIndices) { EAXJMP(0x5A4440); } -WRAPPER RwCamera* RwCameraEndUpdate(RwCamera* camera) { EAXJMP(0x5A5020); } -WRAPPER RwCamera* RwCameraBeginUpdate(RwCamera* camera) { EAXJMP(0x5A5030); } -WRAPPER RwCamera* RwCameraSetViewOffset(RwCamera* camera, RwV2d const* offset) { EAXJMP(0x5A5040); } -WRAPPER RwCamera* RwCameraSetNearClipPlane(RwCamera* camera, RwReal nearClip) { EAXJMP(0x5A5070); } -WRAPPER RwCamera* RwCameraSetFarClipPlane(RwCamera* camera, RwReal farClip) { EAXJMP(0x5A5140); } -WRAPPER RwFrustumTestResult RwCameraFrustumTestSphere(RwCamera const* camera, RwSphere const* sphere) { EAXJMP(0x5A5170); } -WRAPPER RwCamera* RwCameraClear(RwCamera* camera, RwRGBA* colour, RwInt32 clearMode) { EAXJMP(0x5A51E0); } -WRAPPER RwCamera* RwCameraShowRaster(RwCamera* camera, void* pDev, RwUInt32 flags) { EAXJMP(0x5A5210); } -WRAPPER RwCamera* RwCameraSetProjection(RwCamera* camera, RwCameraProjection projection) { EAXJMP(0x5A5240); } -WRAPPER RwCamera* RwCameraSetViewWindow(RwCamera* camera, RwV2d const* viewWindow) { EAXJMP(0x5A52B0); } -WRAPPER RwInt32 RwCameraRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5A52F0); } -WRAPPER RwBool RwCameraDestroy(RwCamera* camera) { EAXJMP(0x5A5320); } -WRAPPER RwCamera* RwCameraCreate() { EAXJMP(0x5A5360); } -WRAPPER RwBool RwTextureSetMipmapping(RwBool enable) { EAXJMP(0x5A7100); } -WRAPPER RwBool RwTextureGetMipmapping() { EAXJMP(0x5A7120); } -WRAPPER RwBool RwTextureSetAutoMipmapping(RwBool enable) { EAXJMP(0x5A7130); } -WRAPPER RwBool RwTextureGetAutoMipmapping() { EAXJMP(0x5A7150); } -WRAPPER RwTexDictionary* RwTexDictionaryCreate() { EAXJMP(0x5A7160); } -WRAPPER RwBool RwTexDictionaryDestroy(RwTexDictionary* dict) { EAXJMP(0x5A7200); } -WRAPPER RwTexDictionary const* RwTexDictionaryForAllTextures(RwTexDictionary const* dict, RwTextureCallBack fpCallBack, void* pData) { EAXJMP(0x5A7290); } -WRAPPER RwTexture* RwTextureCreate(RwRaster* raster) { EAXJMP(0x5A72D0); } -WRAPPER RwBool RwTextureDestroy(RwTexture* texture) { EAXJMP(0x5A7330); } -WRAPPER RwTexture* RwTextureSetName(RwTexture* texture, RwChar const* name) { EAXJMP(0x5A73B0); } -WRAPPER RwTexture* RwTextureSetMaskName(RwTexture* texture, RwChar const* maskName) { EAXJMP(0x5A7420); } -WRAPPER RwTexture* RwTexDictionaryAddTexture(RwTexDictionary* dict, RwTexture* texture) { EAXJMP(0x5A7490); } -WRAPPER RwTexture* RwTexDictionaryFindNamedTexture(RwTexDictionary* dict, RwChar const* name) { EAXJMP(0x5A74D0); } -WRAPPER RwTexDictionary* RwTexDictionarySetCurrent(RwTexDictionary* dict) { EAXJMP(0x5A7550); } -WRAPPER RwTexDictionary* RwTexDictionaryGetCurrent() { EAXJMP(0x5A7570); } -WRAPPER RwTexture* RwTextureRead(RwChar const* name, RwChar const* maskName) { EAXJMP(0x5A7580); } -WRAPPER RwBool RwTextureRasterGenerateMipmaps(RwRaster* raster, RwImage* image) { EAXJMP(0x5A7780); } -WRAPPER RwImage* RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth) { EAXJMP(0x5A9120); } -WRAPPER RwBool RwImageDestroy(RwImage* image) { EAXJMP(0x5A9180); } -WRAPPER RwImage* RwImageAllocatePixels(RwImage* image) { EAXJMP(0x5A91E0); } -WRAPPER RwImage* RwImageFreePixels(RwImage* image) { EAXJMP(0x5A92A0); } -WRAPPER RwImage* RwImageMakeMask(RwImage* image) { EAXJMP(0x5A92D0); } -WRAPPER RwImage* RwImageApplyMask(RwImage* image, RwImage const* mask) { EAXJMP(0x5A93A0); } -WRAPPER RwChar const* RwImageSetPath(RwChar const* path) { EAXJMP(0x5A9750); } -WRAPPER RwImage* RwImageRead(RwChar const* imageName) { EAXJMP(0x5A9810); } -WRAPPER RwChar const* RwImageFindFileType(RwChar const* imageName) { EAXJMP(0x5A9B40); } -WRAPPER RwImage* RwImageReadMaskedImage(RwChar const* imageName, RwChar const* maskname) { EAXJMP(0x5A9C10); } -WRAPPER RwImage* RwImageCopy(RwImage* destImage, RwImage const* sourceImage) { EAXJMP(0x5A9F50); } -WRAPPER RwImage* RwImageGammaCorrect(RwImage* image) { EAXJMP(0x5AA130); } -WRAPPER RwBool RwImageSetGamma(RwReal gammaValue) { EAXJMP(0x5AA2C0); } -WRAPPER RwStream* _rwStreamWriteVersionedChunkHeader(RwStream* stream, RwInt32 type, RwInt32 size, RwUInt32 version, RwUInt32 buildNum) { EAXJMP(0x5AA4E0); } -WRAPPER RwBool RwStreamFindChunk(RwStream* stream, RwUInt32 type, RwUInt32* lengthOut, RwUInt32* versionOut) { EAXJMP(0x5AA540); } -WRAPPER void* RwMemLittleEndian32(void* mem, RwUInt32 size) { EAXJMP(0x5AA640); } -WRAPPER void* RwMemNative32(void* mem, RwUInt32 size) { EAXJMP(0x5AA650); } -WRAPPER void* RwMemFloat32ToReal(void* mem, RwUInt32 size) { EAXJMP(0x5AA660); } -WRAPPER RwStream* RwStreamWriteReal(RwStream* stream, RwReal const* reals, RwUInt32 numBytes) { EAXJMP(0x5AA680); } -WRAPPER RwStream* RwStreamWriteInt32(RwStream* stream, RwInt32 const* ints, RwUInt32 numBytes) { EAXJMP(0x5AA720); } -WRAPPER RwStream* RwStreamReadReal(RwStream* stream, RwReal* reals, RwUInt32 numBytes) { EAXJMP(0x5AA740); } -WRAPPER RwStream* RwStreamReadInt32(RwStream* stream, RwInt32* ints, RwUInt32 numBytes) { EAXJMP(0x5AA7B0); } -WRAPPER RwUInt32 RwTextureStreamGetSize(RwTexture const* texture) { EAXJMP(0x5AA800); } -WRAPPER RwTexture const* RwTextureStreamWrite(RwTexture const* texture, RwStream* stream) { EAXJMP(0x5AA870); } -WRAPPER RwTexture* RwTextureStreamRead(RwStream* stream) { EAXJMP(0x5AAA40); } -WRAPPER RwTexDictionary const* RwTexDictionaryStreamWrite(RwTexDictionary const* texDict, RwStream* stream) { EAXJMP(0x5AB020); } -WRAPPER RpMorphTarget const* RpMorphTargetCalcBoundingSphere(RpMorphTarget const* morphTarget, RwSphere* boundingSphere) { EAXJMP(0x5AC890); } -WRAPPER RwInt32 RpGeometryAddMorphTargets(RpGeometry* geometry, RwInt32 mtcount) { EAXJMP(0x5AC9A0); } -WRAPPER RpGeometry const* RpGeometryTriangleSetVertexIndices(RpGeometry const* geometry, RpTriangle* triangle, RwUInt16 vert1, RwUInt16 vert2, RwUInt16 vert3) { EAXJMP(0x5ACB60); } -WRAPPER RpGeometry* RpGeometryTriangleSetMaterial(RpGeometry* geometry, RpTriangle* triangle, RpMaterial* material) { EAXJMP(0x5ACB90); } -WRAPPER RpGeometry* RpGeometryForAllMaterials(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData) { EAXJMP(0x5ACBF0); } -WRAPPER RpGeometry* RpGeometryLock(RpGeometry* geometry, RwInt32 lockMode) { EAXJMP(0x5ACC30); } -WRAPPER RpGeometry* RpGeometryUnlock(RpGeometry* geometry) { EAXJMP(0x5ACC60); } -WRAPPER RpGeometry* RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format) { EAXJMP(0x5ACD10); } -WRAPPER RpGeometry* _rpGeometryAddRef(RpGeometry* geometry) { EAXJMP(0x5ACF40); } -WRAPPER RwBool RpGeometryDestroy(RpGeometry* geometry) { EAXJMP(0x5ACF50); } -WRAPPER RwInt32 RpGeometryRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5ACFF0); } -WRAPPER RwInt32 RpGeometryRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5AD020); } -WRAPPER RpGeometry* RpGeometryStreamRead(RwStream* stream) { EAXJMP(0x5AD050); } -WRAPPER RwRaster* RwRasterGetCurrentContext() { EAXJMP(0x5AD6D0); } -WRAPPER RwRaster* RwRasterUnlock(RwRaster* raster) { EAXJMP(0x5AD6F0); } -WRAPPER RwRaster* RwRasterRenderFast(RwRaster* raster, RwInt32 x, RwInt32 y) { EAXJMP(0x5AD710); } -WRAPPER RwRaster* RwRasterUnlockPalette(RwRaster* raster) { EAXJMP(0x5AD750); } -WRAPPER RwBool RwRasterDestroy(RwRaster* raster) { EAXJMP(0x5AD780); } -WRAPPER RwRaster* RwRasterPushContext(RwRaster* raster) { EAXJMP(0x5AD7C0); } -WRAPPER RwInt32 RwRasterRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5AD810); } -WRAPPER RwUInt8* RwRasterLockPalette(RwRaster* raster, RwInt32 lockMode) { EAXJMP(0x5AD840); } -WRAPPER RwRaster* RwRasterPopContext() { EAXJMP(0x5AD870); } -WRAPPER RwInt32 RwRasterGetNumLevels(RwRaster* raster) { EAXJMP(0x5AD8C0); } -WRAPPER RwRaster* RwRasterShowRaster(RwRaster* raster, void* dev, RwUInt32 flags) { EAXJMP(0x5AD900); } -WRAPPER RwRaster* RwRasterCreate(RwInt32 width, RwInt32 height, RwInt32 depth, RwInt32 flags) { EAXJMP(0x5AD930); } -WRAPPER RwUInt8* RwRasterLock(RwRaster* raster, RwUInt8 level, RwInt32 lockMode) { EAXJMP(0x5AD9D0); } -WRAPPER RpMaterial* RpMaterialCreate() { EAXJMP(0x5ADC30); } -WRAPPER RwBool RpMaterialDestroy(RpMaterial* material) { EAXJMP(0x5ADCB0); } -WRAPPER RpMaterial* RpMaterialSetTexture(RpMaterial* material, RwTexture* texture) { EAXJMP(0x5ADD10); } -WRAPPER RwInt32 RpMaterialRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5ADD40); } -WRAPPER RwInt32 RpMaterialRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5ADD70); } -WRAPPER RpMaterial* RpMaterialStreamRead(RwStream* stream) { EAXJMP(0x5ADDA0); } -WRAPPER RpWorldSector* _rpSectorDefaultRenderCallBack(RpWorldSector* sector) { EAXJMP(0x5AE0B0); } -WRAPPER RwBool _rpWorldForAllGlobalLights(RpLightCallBack callBack, void* pData) { EAXJMP(0x5AE100); } -WRAPPER RpWorldSector* _rpWorldSectorForAllLocalLights(RpWorldSector* sector, RpLightCallBack callBack, void* pData) { EAXJMP(0x5AE150); } -WRAPPER RpWorld* RpWorldUnlock(RpWorld* world) { EAXJMP(0x5AE190); } -WRAPPER RpWorld* RpWorldSectorGetWorld(RpWorldSector const* sector) { EAXJMP(0x5AE2B0); } -WRAPPER RwBool RpWorldDestroy(RpWorld* world) { EAXJMP(0x5AE340); } -WRAPPER RpWorld* RpWorldCreate(RwBBox* boundingBox) { EAXJMP(0x5AE6A0); } -WRAPPER RwInt32 RpWorldRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5AEA40); } -WRAPPER RwInt32 RpWorldRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5AEA70); } -WRAPPER RwBool RpWorldPluginAttach() { EAXJMP(0x5AEAA0); } -WRAPPER RpWorld* RpWorldAddCamera(RpWorld* world, RwCamera* camera) { EAXJMP(0x5AFB80); } -WRAPPER RpWorld* RpWorldRemoveCamera(RpWorld* world, RwCamera* camera) { EAXJMP(0x5AFBB0); } -WRAPPER RpWorld* RpAtomicGetWorld(RpAtomic const* atomic) { EAXJMP(0x5AFC10); } -WRAPPER RpWorld* RpWorldAddClump(RpWorld* world, RpClump* clump) { EAXJMP(0x5AFC20); } -WRAPPER RpWorld* RpWorldAddLight(RpWorld* world, RpLight* light) { EAXJMP(0x5AFDA0); } -WRAPPER RpWorld* RpWorldRemoveLight(RpWorld* world, RpLight* light) { EAXJMP(0x5AFDF0); } -WRAPPER RwImage* RtBMPImageRead(RwChar const* imageName) { EAXJMP(0x5AFE70); } -WRAPPER RwBool RpSkinPluginAttach() { EAXJMP(0x5B07D0); } -WRAPPER RpAtomic* RpSkinAtomicSetHAnimHierarchy(RpAtomic* atomic, RpHAnimHierarchy* hierarchy) { EAXJMP(0x5B1050); } -WRAPPER RpHAnimHierarchy* RpSkinAtomicGetHAnimHierarchy(RpAtomic const* atomic) { EAXJMP(0x5B1070); } -WRAPPER RpSkin* RpSkinGeometryGetSkin(RpGeometry* geometry) { EAXJMP(0x5B1080); } -WRAPPER RpGeometry* RpSkinGeometrySetSkin(RpGeometry* geometry, RpSkin* skin) { EAXJMP(0x5B1090); } -WRAPPER RwMatrix const* RpSkinGetSkinToBoneMatrices(RpSkin* skin) { EAXJMP(0x5B10D0); } -WRAPPER RpHAnimHierarchy* RpHAnimHierarchyCreate(RwInt32 numNodes, RwUInt32* nodeFlags, RwInt32* nodeIDs, RpHAnimHierarchyFlag flags, RwInt32 maxKeyFrameSize) { EAXJMP(0x5B10E0); } -WRAPPER RpHAnimHierarchy* RpHAnimFrameGetHierarchy(RwFrame* frame) { EAXJMP(0x5B11F0); } -WRAPPER RwBool RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy* hierarchy, RpHAnimAnimation* anim) { EAXJMP(0x5B1200); } -WRAPPER RwBool RpHAnimHierarchySubAnimTime(RpHAnimHierarchy* hierarchy, RwReal time) { EAXJMP(0x5B12B0); } -WRAPPER RwBool RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy* hierarchy, RwReal time) { EAXJMP(0x5B1480); } -WRAPPER RwBool RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy* hierarchy) { EAXJMP(0x5B1780); } -WRAPPER RpHAnimAnimation* RpHAnimAnimationStreamRead(RwStream* stream) { EAXJMP(0x5B1C10); } -WRAPPER RwBool RpHAnimPluginAttach() { EAXJMP(0x5B1D50); } -WRAPPER RwBool RpMatFXPluginAttach() { EAXJMP(0x5B2640); } -WRAPPER RpAtomic* RpMatFXAtomicEnableEffects(RpAtomic* atomic) { EAXJMP(0x5B3750); } -WRAPPER RpMaterial* RpMatFXMaterialSetEffects(RpMaterial* material, RpMatFXMaterialFlags flags) { EAXJMP(0x5B3780); } -WRAPPER RpMaterial* RpMatFXMaterialSetupEnvMap(RpMaterial* material, RwTexture* texture, RwFrame* frame, RwBool useFrameBufferAlpha, RwReal coef) { EAXJMP(0x5B38D0); } -WRAPPER RpMaterial* RpMatFXMaterialSetBumpMapTexture(RpMaterial* material, RwTexture* texture) { EAXJMP(0x5B3A40); } -WRAPPER RwBool RwD3D8SetRenderState(RwUInt32 state, RwUInt32 value) { EAXJMP(0x5B3CF0); } -WRAPPER void RwD3D8GetRenderState(RwUInt32 state, void* value) { EAXJMP(0x5B3D40); } -WRAPPER RwBool RwD3D8SetTextureStageState(RwUInt32 stage, RwUInt32 type, RwUInt32 value) { EAXJMP(0x5B3D60); } -WRAPPER RwBool RwD3D8SetTexture(RwTexture* texture, RwUInt32 stage) { EAXJMP(0x5B53A0); } -WRAPPER void* RwIm3DTransform(RwIm3DVertex* pVerts, RwUInt32 numVerts, RwMatrix* ltm, RwUInt32 flags) { EAXJMP(0x5B6720); } -WRAPPER RwBool RwIm3DEnd() { EAXJMP(0x5B67F0); } -WRAPPER RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType, RwImVertexIndex* indices, RwInt32 numIndices) { EAXJMP(0x5B6820); } -WRAPPER RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) { EAXJMP(0x5B6980); } -WRAPPER RxPipeline* RwIm3DSetTransformPipeline(RxPipeline* pipeline) { EAXJMP(0x5B6A50); } -WRAPPER RxPipeline* RwIm3DSetRenderPipeline(RxPipeline* pipeline, RwPrimitiveType primType) { EAXJMP(0x5B6AC0); } -WRAPPER void RwD3D8EngineSetRefreshRate(RwUInt32 refreshRate) { EAXJMP(0x5B95D0); } -WRAPPER RwBool RwD3D8CameraAttachWindow(void* camera, void* hwnd) { EAXJMP(0x5B9640); } -WRAPPER RwBool RwD3D8DeviceSupportsDXTTexture() { EAXJMP(0x5BAEB0); } -WRAPPER RwBool RwD3D8SetVertexShader(RwUInt32 handle) { EAXJMP(0x5BAF90); } -WRAPPER RwBool RwD3D8SetPixelShader(RwUInt32 handle) { EAXJMP(0x5BAFD0); } -WRAPPER RwBool RwD3D8SetStreamSource(RwUInt32 streamNumber, void* streamData, RwUInt32 stride) { EAXJMP(0x5BB010); } -WRAPPER RwBool RwD3D8SetIndices(void* indexData, RwUInt32 baseVertexIndex) { EAXJMP(0x5BB060); } -WRAPPER RwBool RwD3D8DrawIndexedPrimitive(RwUInt32 primitiveType, RwUInt32 minIndex, RwUInt32 numVertices, RwUInt32 startIndex, RwUInt32 numIndices) { EAXJMP(0x5BB0B0); } -WRAPPER RwBool RwD3D8DrawPrimitive(RwUInt32 primitiveType, RwUInt32 startVertex, RwUInt32 numVertices) { EAXJMP(0x5BB140); } -WRAPPER RwBool RwD3D8SetTransform(RwUInt32 state, void const* matrix) { EAXJMP(0x5BB1D0); } -WRAPPER void RwD3D8GetTransform(RwUInt32 state, void* matrix) { EAXJMP(0x5BB310); } -WRAPPER RwBool RwD3D8SetTransformWorld(RwMatrix const* matrix) { EAXJMP(0x5BB340); } -WRAPPER RwBool RwD3D8SetSurfaceProperties(RwRGBA const* color, RwSurfaceProperties const* surfaceProps, RwBool modulate) { EAXJMP(0x5BB490); } -WRAPPER RwBool RwD3D8SetLight(RwInt32 index, void const* light) { EAXJMP(0x5BB7A0); } -WRAPPER RwBool RwD3D8EnableLight(RwInt32 index, RwBool enable) { EAXJMP(0x5BB890); } -WRAPPER RwBool RwD3D8DynamicVertexBufferCreate(RwUInt32 fvf, RwUInt32 size, void** vertexBuffer) { EAXJMP(0x5BB9F0); } -WRAPPER void RwD3D8DynamicVertexBufferDestroy(void* vertexBuffer) { EAXJMP(0x5BBAE0); } -WRAPPER RwBool RwD3D8IndexBufferCreate(RwUInt32 numIndices, void** indexBuffer) { EAXJMP(0x5BBB10); } -WRAPPER RwBool RwD3D8CreatePixelShader(RwUInt32 const* function, RwUInt32* handle) { EAXJMP(0x5BBB40); } -WRAPPER void RwD3D8DeletePixelShader(RwUInt32 handle) { EAXJMP(0x5BBB90); } -WRAPPER RwBool RwD3D8SetPixelShaderConstant(RwUInt32 registerAddress, void const* antData, RwUInt32 antCount) { EAXJMP(0x5BBC00); } -WRAPPER void const* RwD3D8GetCaps() { EAXJMP(0x5BBC30); } -WRAPPER RwBool RwD3D8CameraIsSphereFullyInsideFrustum(void const* camera, void const* sphere) { EAXJMP(0x5BBC40); } -WRAPPER RwBool RwD3D8CameraIsBBoxFullyInsideFrustum(void const* camera, void const* boundingBox) { EAXJMP(0x5BBCA0); } -WRAPPER RwBool RwD3D8DynamicVertexBufferLock(RwUInt32 vertexSize, RwUInt32 numVertex, void** vertexBufferOut, void** vertexDataOut, RwUInt32* baseIndexOut) { EAXJMP(0x5BBD30); } -WRAPPER RwBool RwD3D8DynamicVertexBufferUnlock(void* vertexBuffer) { EAXJMP(0x5BBEB0); } -WRAPPER RwBool _rwIntelSSEsupported() { EAXJMP(0x5BBED0); } -WRAPPER RwImage* RwImageSetFromRaster(RwImage* image, RwRaster* raster) { EAXJMP(0x5BBF10); } -WRAPPER RwRaster* RwRasterSetFromImage(RwRaster* raster, RwImage* image) { EAXJMP(0x5BBF50); } -WRAPPER RwImage* RwImageFindRasterFormat(RwImage* ipImage, RwInt32 nRasterType, RwInt32* npWidth, RwInt32* npHeight, RwInt32* npDepth, RwInt32* npFormat) { EAXJMP(0x5BBF80); } -WRAPPER RwInt32 RwFrameRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5BBFF0); } -WRAPPER rwFrameList* _rwFrameListDeinitialize(rwFrameList* frameList) { EAXJMP(0x5BC020); } -WRAPPER rwFrameList* _rwFrameListStreamRead(RwStream* stream, rwFrameList* fl) { EAXJMP(0x5BC050); } -WRAPPER RpLight* RpLightSetRadius(RpLight* light, RwReal radius) { EAXJMP(0x5BC300); } -WRAPPER RpLight* RpLightSetColor(RpLight* light, RwRGBAReal const* color) { EAXJMP(0x5BC320); } -WRAPPER RwReal RpLightGetConeAngle(RpLight const* light) { EAXJMP(0x5BC370); } -WRAPPER RwInt32 RpLightRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5BC5B0); } -WRAPPER RpLight* RpLightStreamRead(RwStream* stream) { EAXJMP(0x5BC5E0); } -WRAPPER RwBool RpLightDestroy(RpLight* light) { EAXJMP(0x5BC780); } -WRAPPER RpLight* RpLightCreate(RwInt32 type) { EAXJMP(0x5BC7C0); } -WRAPPER void _rwD3D8TexDictionaryEnableRasterFormatConversion(RwBool enable) { EAXJMP(0x5BE280); } -WRAPPER RwFileFunctions* RwOsGetFileInterface() { EAXJMP(0x5BF110); } -WRAPPER RwBool RwFreeListDestroy(RwFreeList* freelist) { EAXJMP(0x5C1720); } -WRAPPER RwFreeList* RwFreeListCreate(RwInt32 entrySize, RwInt32 entriesPerBlock, RwInt32 alignment) { EAXJMP(0x5C1790); } -WRAPPER RwInt32 RwFreeListPurge(RwFreeList* freelist) { EAXJMP(0x5C19F0); } -WRAPPER RwInt32 RwFreeListPurgeAllFreeLists() { EAXJMP(0x5C1B90); } -WRAPPER RwFreeList* RwFreeListForAllUsed(RwFreeList* freelist, RwFreeListCallBack fpCallBack, void* pData) { EAXJMP(0x5C1D40); } -WRAPPER RwBool _rxPipelineClose() { EAXJMP(0x5C2780); } -WRAPPER RwBool _rxPipelineOpen() { EAXJMP(0x5C27E0); } -WRAPPER RxHeap* RxHeapGetGlobalHeap() { EAXJMP(0x5C2AD0); } -WRAPPER RxPacket* RxPacketCreate(RxPipelineNode* node) { EAXJMP(0x5C2AE0); } -WRAPPER RxCluster* RxClusterSetExternalData(RxCluster* cluster, void* data, RwInt32 stride, RwInt32 numElements) { EAXJMP(0x5C2B10); } -WRAPPER RxCluster* RxClusterSetData(RxCluster* cluster, void* data, RwInt32 stride, RwInt32 numElements) { EAXJMP(0x5C2B70); } -WRAPPER RxCluster* RxClusterInitializeData(RxCluster* cluster, RwUInt32 numElements, RwUInt16 stride) { EAXJMP(0x5C2BD0); } -WRAPPER RxCluster* RxClusterResizeData(RxCluster* CurrentCluster, RwUInt32 NumElements) { EAXJMP(0x5C2C40); } -WRAPPER RxCluster* RxClusterLockWrite(RxPacket* packet, RwUInt32 clusterIndex, RxPipelineNode* node) { EAXJMP(0x5C2C90); } -WRAPPER RxPipeline* RxPipelineExecute(RxPipeline* pipeline, void* data, RwBool heapReset) { EAXJMP(0x5C2D60); } -WRAPPER RxPipeline* RxPipelineCreate() { EAXJMP(0x5C2E00); } -WRAPPER void _rxPipelineDestroy(RxPipeline* Pipeline) { EAXJMP(0x5C2E70); } -WRAPPER RwBool RwResourcesFreeResEntry(RwResEntry* entry) { EAXJMP(0x5C3080); } -WRAPPER void _rwResourcesPurge() { EAXJMP(0x5C30F0); } -WRAPPER RwResEntry* RwResourcesAllocateResEntry(void* owner, RwResEntry** ownerRef, RwInt32 size, RwResEntryDestroyNotify destroyNotify) { EAXJMP(0x5C3170); } -WRAPPER RwBool RwResourcesEmptyArena() { EAXJMP(0x5C3360); } -WRAPPER RwBool _rwPluginRegistryOpen() { EAXJMP(0x5C3450); } -WRAPPER RwBool _rwPluginRegistryClose() { EAXJMP(0x5C3480); } -WRAPPER RwInt32 _rwPluginRegistryGetPluginOffset(RwPluginRegistry const* reg, RwUInt32 pluginID) { EAXJMP(0x5C3590); } -WRAPPER RwInt32 _rwPluginRegistryAddPlugin(RwPluginRegistry* reg, RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5C35C0); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryInitObject(RwPluginRegistry const* reg, void* object) { EAXJMP(0x5C37F0); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryDeInitObject(RwPluginRegistry const* reg, void* object) { EAXJMP(0x5C3850); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryCopyObject(RwPluginRegistry const* reg, void* dstObject, void const* srcObject) { EAXJMP(0x5C3880); } -WRAPPER RwError* RwErrorSet(RwError* code) { EAXJMP(0x5C3910); } -WRAPPER RwInt32 _rwerror(RwInt32 code, ...) { EAXJMP(0x5C3970); } -WRAPPER RwInt32 _rwPluginRegistryAddPluginStream(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5C3980); } -WRAPPER RwInt32 _rwPluginRegistryAddPlgnStrmlwysCB(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB) { EAXJMP(0x5C39C0); } -WRAPPER RwInt32 _rwPluginRegistryAddPlgnStrmRightsCB(RwPluginRegistry* reg, RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB) { EAXJMP(0x5C39F0); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryReadDataChunks(RwPluginRegistry const* reg, RwStream* stream, void* object) { EAXJMP(0x5C3A20); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryInvokeRights(RwPluginRegistry const* reg, RwUInt32 id, void* obj, RwUInt32 extraData) { EAXJMP(0x5C3B50); } -WRAPPER RwInt32 _rwPluginRegistryGetSize(RwPluginRegistry const* reg, void const* object) { EAXJMP(0x5C3BA0); } -WRAPPER RwPluginRegistry const* _rwPluginRegistryWriteDataChunks(RwPluginRegistry const* reg, RwStream* stream, void const* object) { EAXJMP(0x5C3BE0); } -WRAPPER RwPluginRegistry const* _rwPluginRegistrySkipDataChunks(RwPluginRegistry const* reg, RwStream* stream) { EAXJMP(0x5C3CB0); } -WRAPPER RwCamera* RwCameraStreamRead(RwStream* stream) { EAXJMP(0x5C3D30); } -WRAPPER RwBBox* RwBBoxCalculate(RwBBox* boundBox, RwV3d const* verts, RwInt32 numVerts) { EAXJMP(0x5C5570); } -WRAPPER RwImage* RwImageResample(RwImage* dstImage, RwImage const* srcImage) { EAXJMP(0x5C72B0); } -WRAPPER RwImage* RwImageCreateResample(RwImage const* srcImage, RwInt32 width, RwInt32 height) { EAXJMP(0x5C7B30); } -WRAPPER RxRenderStateVector* RxRenderStateVectorSetDefaultRenderStateVector(RxRenderStateVector* rsvp) { EAXJMP(0x5D9240); } -WRAPPER RxRenderStateVector* RxRenderStateVectorCreate(RwBool current) { EAXJMP(0x5D9340); } -WRAPPER void RxRenderStateVectorDestroy(RxRenderStateVector* rsvp) { EAXJMP(0x5D9410); } -WRAPPER RxRenderStateVector* RxRenderStateVectorLoadDriverState(RxRenderStateVector* rsvp) { EAXJMP(0x5D9460); } -WRAPPER void _rxEmbeddedPacketBetweenPipelines(RxPipeline* fromPipeline, RxPipeline* toPipeline) { EAXJMP(0x5D95D0); } -WRAPPER RxPipelineNode* _rxEmbeddedPacketBetweenNodes(RxPipeline* pipeline, RxPipelineNode* nodeFrom, RwUInt32 whichOutput) { EAXJMP(0x5D9740); } -WRAPPER void _rxPacketDestroy(RxPacket* Packet) { EAXJMP(0x5D9810); } -WRAPPER RpMaterialList* _rpMaterialListDeinitialize(RpMaterialList* matList) { EAXJMP(0x5C8B10); } -WRAPPER RpMaterialList* _rpMaterialListInitialize(RpMaterialList* matList) { EAXJMP(0x5C8B70); } -WRAPPER RpMaterial* _rpMaterialListGetMaterial(RpMaterialList const* matList, RwInt32 matIndex) { EAXJMP(0x5C8B80); } -WRAPPER RwInt32 _rpMaterialListAppendMaterial(RpMaterialList* matList, RpMaterial* material) { EAXJMP(0x5C8B90); } -WRAPPER RwInt32 _rpMaterialListFindMaterialIndex(RpMaterialList const* matList, RpMaterial const* material) { EAXJMP(0x5C8C50); } -WRAPPER RpMaterialList* _rpMaterialListStreamRead(RwStream* stream, RpMaterialList* matList) { EAXJMP(0x5C8C80); } -WRAPPER RpMeshHeader* _rpMeshHeaderCreate(RwUInt32 size) { EAXJMP(0x5C8FE0); } -WRAPPER void* _rpMeshClose(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5C8FF0); } -WRAPPER void* _rpMeshOpen(void* instance, RwInt32 offset, RwInt32 size) { EAXJMP(0x5C9020); } -WRAPPER RpBuildMesh* _rpBuildMeshCreate(RwUInt32 bufferSize) { EAXJMP(0x5C9140); } -WRAPPER RwBool _rpBuildMeshDestroy(RpBuildMesh* mesh) { EAXJMP(0x5C9220); } -WRAPPER RwBool _rpMeshDestroy(RpMeshHeader* mesh) { EAXJMP(0x5C9260); } -WRAPPER RpBuildMesh* _rpBuildMeshAddTriangle(RpBuildMesh* mesh, RpMaterial* material, RwInt32 vert1, RwInt32 vert2, RwInt32 vert3) { EAXJMP(0x5C92A0); } -WRAPPER RpMeshHeader* _rpMeshHeaderForAllMeshes(RpMeshHeader* meshHeader, RpMeshCallBack fpCallBack, void* pData) { EAXJMP(0x5C9380); } -WRAPPER RwStream* _rpMeshWrite(RpMeshHeader const* meshHeader, void const* object, RwStream* stream, RpMaterialList const* matList) { EAXJMP(0x5C93C0); } -WRAPPER RpMeshHeader* _rpMeshRead(RwStream* stream, void const* object, RpMaterialList const* matList) { EAXJMP(0x5C9510); } -WRAPPER RwInt32 _rpMeshSize(RpMeshHeader const* meshHeader, void const* object) { EAXJMP(0x5C96E0); } -WRAPPER RpMeshHeader* RpBuildMeshGenerateDefaultTriStrip(RpBuildMesh* buildmesh, void* data) { EAXJMP(0x5C9730); } -WRAPPER RpMeshHeader* _rpTriListMeshGenerate(RpBuildMesh* buildMesh, void* data) { EAXJMP(0x5CAE10); } -WRAPPER RpMeshHeader* _rpMeshOptimise(RpBuildMesh* buildmesh, RwUInt32 flags) { EAXJMP(0x5CB230); } -WRAPPER RwInt32 RpWorldSectorRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor ructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB) { EAXJMP(0x5CB2B0); } -WRAPPER RwInt32 RpWorldSectorRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB) { EAXJMP(0x5CB2E0); } -WRAPPER RxPipeline* RpWorldSetDefaultSectorPipeline(RxPipeline* pipeline) { EAXJMP(0x5CB630); } -WRAPPER RxPipeline* RpAtomicSetDefaultPipeline(RxPipeline* pipeline) { EAXJMP(0x5CB670); } -WRAPPER void RpHAnimStdKeyFrameToMatrix(RwMatrix* matrix, void* voidIFrame) { EAXJMP(0x5CDEE0); } -WRAPPER void RpHAnimStdKeyFrameInterpolate(void* voidOut, void* voidIn1, void* voidIn2, RwReal time) { EAXJMP(0x5CE000); } -WRAPPER void RpHAnimStdKeyFrameBlend(void* voidOut, void* voidIn1, void* voidIn2, RwReal alpha) { EAXJMP(0x5CE420); } -WRAPPER RpHAnimAnimation* RpHAnimStdKeyFrameStreamRead(RwStream* stream, RpHAnimAnimation* animation) { EAXJMP(0x5CE820); } -WRAPPER RwBool RpHAnimStdKeyFrameStreamWrite(RpHAnimAnimation* animation, RwStream* stream) { EAXJMP(0x5CE8C0); } -WRAPPER RwInt32 RpHAnimStdKeyFrameStreamGetSize(RpHAnimAnimation* animation) { EAXJMP(0x5CE930); } -WRAPPER void RpHAnimStdKeyFrameMulRecip(void* voidFrame, void* voidStart) { EAXJMP(0x5CE950); } -WRAPPER void RpHAnimStdKeyFrameAdd(void* voidOut, void* voidIn1, void* voidIn2) { EAXJMP(0x5CEAB0); } -WRAPPER void RxHeapFree(RxHeap* heap, void* block) { EAXJMP(0x5D1070); } -WRAPPER void* RxHeapAlloc(RxHeap* heap, RwUInt32 size) { EAXJMP(0x5D1260); } -WRAPPER void* RxHeapRealloc(RxHeap* heap, void* block, RwUInt32 newSize, RwBool allowCopy) { EAXJMP(0x5D14D0); } -WRAPPER RwBool _rxHeapReset(RxHeap* heap) { EAXJMP(0x5D1680); } -WRAPPER void RxHeapDestroy(RxHeap* heap) { EAXJMP(0x5D16F0); } -WRAPPER RxHeap* RxHeapCreate(RwUInt32 size) { EAXJMP(0x5D1750); } -WRAPPER RxNodeOutput RxPipelineNodeFindOutputByName(RxPipelineNode* node, RwChar const* outputname) { EAXJMP(0x5D1EC0); } -WRAPPER RxNodeInput RxPipelineNodeFindInput(RxPipelineNode* node) { EAXJMP(0x5D1F20); } -WRAPPER RxPipeline* RxPipelineNodeRequestCluster(RxPipeline* pipeline, RxPipelineNode* node, RxClusterDefinition* clusterDef) { EAXJMP(0x5D1F30); } -WRAPPER RxPipeline* RxLockedPipeUnlock(RxLockedPipe* pipeline) { EAXJMP(0x5D1FA0); } -WRAPPER RxLockedPipe* RxPipelineLock(RxPipeline* pipeline) { EAXJMP(0x5D29F0); } -WRAPPER RxPipelineNode* RxPipelineFindNodeByName(RxPipeline* pipeline, RwChar const* name, RxPipelineNode* start, RwInt32* nodeIndex) { EAXJMP(0x5D2B10); } -WRAPPER RxLockedPipe* RxLockedPipeAddFragment(RxLockedPipe *pipeline, RwUInt32 *firstIndex, RxNodeDefinition *nodeDef0, ...) { EAXJMP(0x5D2BA0); } -WRAPPER RxPipeline* RxLockedPipeAddPath(RxLockedPipe* pipeline, RxNodeOutput out, RxNodeInput in) { EAXJMP(0x5D2EE0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmRenderSetup() { EAXJMP(0x5D31C0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmMangleTriangleIndices() { EAXJMP(0x5D35C0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetCullTriangle() { EAXJMP(0x5D3C60); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetClipTriangle() { EAXJMP(0x5D4F80); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetSubmitTriangle() { EAXJMP(0x5D51C0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmInstance() { EAXJMP(0x5D5400); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetTransform() { EAXJMP(0x5D6000); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmStash() { EAXJMP(0x5D61C0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetImmMangleLineIndices() { EAXJMP(0x5D6470); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetClipLine() { EAXJMP(0x5D7230); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetSubmitLine() { EAXJMP(0x5D74C0); } -WRAPPER RwBool _rwD3D8LightsOpen() { EAXJMP(0x5D9C90); } -WRAPPER void _rwD3D8LightsClose() { EAXJMP(0x5D9EF0); } -WRAPPER RwBool _rwD3D8LightsGlobalEnable(RpLightFlag flags) { EAXJMP(0x5D9F80); } -WRAPPER RwBool _rwD3D8LightLocalEnable(RpLight* light) { EAXJMP(0x5DA210); } -WRAPPER void _rwD3D8LightsEnable(RwBool enable, RwUInt32 type) { EAXJMP(0x5DA450); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetD3D8WorldSectorAllInOne() { EAXJMP(0x5DAAC0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetD3D8AtomicAllInOne() { EAXJMP(0x5DC500); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetWorldSectorInstance() { EAXJMP(0x5DCC50); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetWorldSectorEnumerateLights() { EAXJMP(0x5DCD80); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicInstance() { EAXJMP(0x5DD800); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicEnumerateLights() { EAXJMP(0x5DD9B0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); } -WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); } -WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } - -WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); } #else @@ -439,408 +36,5 @@ extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); } - -STARTPATCHES -InjectHook(0x5BC950, &_rwObjectHasFrameSetFrame, PATCH_JUMP); -InjectHook(0x59E690, &AtomicDefaultRenderCallBack, PATCH_JUMP); -InjectHook(0x59E6C0, &_rpAtomicResyncInterpolatedSphere, PATCH_JUMP); -InjectHook(0x59E800, &RpAtomicGetWorldBoundingSphere, PATCH_JUMP); -InjectHook(0x59ED50, &RpClumpGetNumAtomics, PATCH_JUMP); -InjectHook(0x59ED80, &RpClumpRender, PATCH_JUMP); -InjectHook(0x59EDD0, &RpClumpForAllAtomics, PATCH_JUMP); -InjectHook(0x59EE10, &RpClumpForAllCameras, PATCH_JUMP); -InjectHook(0x59EE60, &RpClumpForAllLights, PATCH_JUMP); -InjectHook(0x59EEB0, &RpAtomicCreate, PATCH_JUMP); -InjectHook(0x59EFA0, &RpAtomicSetGeometry, PATCH_JUMP); -InjectHook(0x59F020, &RpAtomicDestroy, PATCH_JUMP); -InjectHook(0x59F0A0, &RpAtomicClone, PATCH_JUMP); -InjectHook(0x59F1B0, &RpClumpClone, PATCH_JUMP); -InjectHook(0x59F490, &RpClumpCreate, PATCH_JUMP); -InjectHook(0x59F500, &RpClumpDestroy, PATCH_JUMP); -InjectHook(0x59F680, &RpClumpAddAtomic, PATCH_JUMP); -InjectHook(0x59F6B0, &RpClumpRemoveAtomic, PATCH_JUMP); -InjectHook(0x59F6E0, &RpClumpRemoveLight, PATCH_JUMP); -InjectHook(0x59FC50, &RpClumpStreamRead, PATCH_JUMP); -InjectHook(0x5A0510, &RpAtomicRegisterPlugin, PATCH_JUMP); -InjectHook(0x5A0540, &RpClumpRegisterPlugin, PATCH_JUMP); -InjectHook(0x5A0570, &RpAtomicRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5A05A0, &RpAtomicSetStreamAlwaysCallBack, PATCH_JUMP); -InjectHook(0x5A05C0, &RpAtomicSetStreamRightsCallBack, PATCH_JUMP); -InjectHook(0x5A05E0, &RpAtomicGetPluginOffset, PATCH_JUMP); -InjectHook(0x5A0600, &RpAtomicSetFrame, PATCH_JUMP); -InjectHook(0x5A0DC0, &RwEngineRegisterPlugin, PATCH_JUMP); -InjectHook(0x5A0DF0, &RwEngineGetPluginOffset, PATCH_JUMP); -InjectHook(0x5A0E10, &RwEngineGetNumSubSystems, PATCH_JUMP); -InjectHook(0x5A0E40, &RwEngineGetSubSystemInfo, PATCH_JUMP); -InjectHook(0x5A0E70, &RwEngineGetCurrentSubSystem, PATCH_JUMP); -InjectHook(0x5A0EA0, &RwEngineSetSubSystem, PATCH_JUMP); -InjectHook(0x5A0ED0, &RwEngineGetNumVideoModes, PATCH_JUMP); -InjectHook(0x5A0F00, &RwEngineGetVideoModeInfo, PATCH_JUMP); -InjectHook(0x5A0F30, &RwEngineGetCurrentVideoMode, PATCH_JUMP); -InjectHook(0x5A0F60, &RwEngineSetVideoMode, PATCH_JUMP); -InjectHook(0x5A0F90, &RwEngineStop, PATCH_JUMP); -InjectHook(0x5A0FE0, &RwEngineStart, PATCH_JUMP); -InjectHook(0x5A1070, &RwEngineClose, PATCH_JUMP); -InjectHook(0x5A10E0, &RwEngineOpen, PATCH_JUMP); -InjectHook(0x5A1290, &RwEngineTerm, PATCH_JUMP); -InjectHook(0x5A12D0, &RwEngineInit, PATCH_JUMP); -InjectHook(0x5A15E0, &_rwFrameOpen, PATCH_JUMP); -InjectHook(0x5A1650, &_rwFrameClose, PATCH_JUMP); -InjectHook(0x5A1690, &_rwFrameCloneAndLinkClones, PATCH_JUMP); -InjectHook(0x5A1880, &_rwFramePurgeClone, PATCH_JUMP); -InjectHook(0x5A1930, &RwFrameDirty, PATCH_JUMP); -InjectHook(0x5A1950, &_rwFrameInit, PATCH_JUMP); -InjectHook(0x5A1A00, &RwFrameCreate, PATCH_JUMP); -InjectHook(0x5A1A30, &RwFrameDestroy, PATCH_JUMP); -InjectHook(0x5A1BF0, &RwFrameDestroyHierarchy, PATCH_JUMP); -InjectHook(0x5A1C60, &RwFrameUpdateObjects, PATCH_JUMP); -InjectHook(0x5A1CE0, &RwFrameGetLTM, PATCH_JUMP); -InjectHook(0x5A1D00, &RwFrameAddChild, PATCH_JUMP); -InjectHook(0x5A1ED0, &RwFrameRemoveChild, PATCH_JUMP); -InjectHook(0x5A1FC0, &RwFrameForAllChildren, PATCH_JUMP); -InjectHook(0x5A2000, &RwFrameTranslate, PATCH_JUMP); -InjectHook(0x5A20A0, &RwFrameScale, PATCH_JUMP); -InjectHook(0x5A2140, &RwFrameTransform, PATCH_JUMP); -InjectHook(0x5A21E0, &RwFrameRotate, PATCH_JUMP); -InjectHook(0x5A2280, &RwFrameSetIdentity, PATCH_JUMP); -InjectHook(0x5A2340, &RwFrameForAllObjects, PATCH_JUMP); -InjectHook(0x5A2380, &RwFrameRegisterPlugin, PATCH_JUMP); -InjectHook(0x5A23B0, &_rwMatrixSetMultFn, PATCH_JUMP); -InjectHook(0x5A2520, &_rwMatrixDeterminant, PATCH_JUMP); -InjectHook(0x5A2570, &_rwMatrixOrthogonalError, PATCH_JUMP); -InjectHook(0x5A25D0, &_rwMatrixNormalError, PATCH_JUMP); -InjectHook(0x5A2660, &_rwMatrixIdentityError, PATCH_JUMP); -InjectHook(0x5A2730, &_rwMatrixClose, PATCH_JUMP); -InjectHook(0x5A2770, &_rwMatrixOpen, PATCH_JUMP); -InjectHook(0x5A2820, &RwMatrixOptimize, PATCH_JUMP); -InjectHook(0x5A28E0, &RwMatrixUpdate, PATCH_JUMP); -InjectHook(0x5A28F0, &RwMatrixMultiply, PATCH_JUMP); -InjectHook(0x5A2960, &RwMatrixRotateOneMinusCosineSine, PATCH_JUMP); -InjectHook(0x5A2BF0, &RwMatrixRotate, PATCH_JUMP); -InjectHook(0x5A2C90, &RwMatrixInvert, PATCH_JUMP); -InjectHook(0x5A2EE0, &RwMatrixScale, PATCH_JUMP); -InjectHook(0x5A3070, &RwMatrixTranslate, PATCH_JUMP); -InjectHook(0x5A31C0, &RwMatrixTransform, PATCH_JUMP); -InjectHook(0x5A3300, &RwMatrixDestroy, PATCH_JUMP); -InjectHook(0x5A3330, &RwMatrixCreate, PATCH_JUMP); -InjectHook(0x5A3450, &_rwVectorSetMultFn, PATCH_JUMP); -InjectHook(0x5A3600, &_rwV3dNormalize, PATCH_JUMP); -InjectHook(0x5A36A0, &RwV3dLength, PATCH_JUMP); -InjectHook(0x5A3710, &_rwSqrt, PATCH_JUMP); -InjectHook(0x5A3770, &_rwInvSqrt, PATCH_JUMP); -InjectHook(0x5A37D0, &RwV3dTransformPoints, PATCH_JUMP); -InjectHook(0x5A37E0, &RwV3dTransformVectors, PATCH_JUMP); -InjectHook(0x5A37F0, &_rwVectorClose, PATCH_JUMP); -InjectHook(0x5A3860, &_rwVectorOpen, PATCH_JUMP); -InjectHook(0x5A3AD0, &RwStreamRead, PATCH_JUMP); -InjectHook(0x5A3C30, &RwStreamWrite, PATCH_JUMP); -InjectHook(0x5A3DF0, &RwStreamSkip, PATCH_JUMP); -InjectHook(0x5A3F10, &RwStreamClose, PATCH_JUMP); -InjectHook(0x5A3FE0, &RwStreamOpen, PATCH_JUMP); -InjectHook(0x5A43A0, &RwIm2DGetNearScreenZ, PATCH_JUMP); -InjectHook(0x5A43B0, &RwIm2DGetFarScreenZ, PATCH_JUMP); -InjectHook(0x5A43C0, &RwRenderStateSet, PATCH_JUMP); -InjectHook(0x5A4410, &RwRenderStateGet, PATCH_JUMP); -InjectHook(0x5A4420, &RwIm2DRenderLine, PATCH_JUMP); -InjectHook(0x5A4430, &RwIm2DRenderPrimitive, PATCH_JUMP); -InjectHook(0x5A4440, &RwIm2DRenderIndexedPrimitive, PATCH_JUMP); -InjectHook(0x5A5020, &RwCameraEndUpdate, PATCH_JUMP); -InjectHook(0x5A5030, &RwCameraBeginUpdate, PATCH_JUMP); -InjectHook(0x5A5040, &RwCameraSetViewOffset, PATCH_JUMP); -InjectHook(0x5A5070, &RwCameraSetNearClipPlane, PATCH_JUMP); -InjectHook(0x5A5140, &RwCameraSetFarClipPlane, PATCH_JUMP); -InjectHook(0x5A5170, &RwCameraFrustumTestSphere, PATCH_JUMP); -InjectHook(0x5A51E0, &RwCameraClear, PATCH_JUMP); -InjectHook(0x5A5210, &RwCameraShowRaster, PATCH_JUMP); -InjectHook(0x5A5240, &RwCameraSetProjection, PATCH_JUMP); -InjectHook(0x5A52B0, &RwCameraSetViewWindow, PATCH_JUMP); -InjectHook(0x5A52F0, &RwCameraRegisterPlugin, PATCH_JUMP); -InjectHook(0x5A5320, &RwCameraDestroy, PATCH_JUMP); -InjectHook(0x5A5360, &RwCameraCreate, PATCH_JUMP); -InjectHook(0x5A7100, &RwTextureSetMipmapping, PATCH_JUMP); -InjectHook(0x5A7120, &RwTextureGetMipmapping, PATCH_JUMP); -InjectHook(0x5A7130, &RwTextureSetAutoMipmapping, PATCH_JUMP); -InjectHook(0x5A7150, &RwTextureGetAutoMipmapping, PATCH_JUMP); -InjectHook(0x5A7160, &RwTexDictionaryCreate, PATCH_JUMP); -InjectHook(0x5A7200, &RwTexDictionaryDestroy, PATCH_JUMP); -InjectHook(0x5A7290, &RwTexDictionaryForAllTextures, PATCH_JUMP); -InjectHook(0x5A72D0, &RwTextureCreate, PATCH_JUMP); -InjectHook(0x5A7330, &RwTextureDestroy, PATCH_JUMP); -InjectHook(0x5A73B0, &RwTextureSetName, PATCH_JUMP); -InjectHook(0x5A7420, &RwTextureSetMaskName, PATCH_JUMP); -InjectHook(0x5A7490, &RwTexDictionaryAddTexture, PATCH_JUMP); -InjectHook(0x5A74D0, &RwTexDictionaryFindNamedTexture, PATCH_JUMP); -InjectHook(0x5A7550, &RwTexDictionarySetCurrent, PATCH_JUMP); -InjectHook(0x5A7570, &RwTexDictionaryGetCurrent, PATCH_JUMP); -InjectHook(0x5A7580, &RwTextureRead, PATCH_JUMP); -InjectHook(0x5A7780, &RwTextureRasterGenerateMipmaps, PATCH_JUMP); -InjectHook(0x5A9120, &RwImageCreate, PATCH_JUMP); -InjectHook(0x5A9180, &RwImageDestroy, PATCH_JUMP); -InjectHook(0x5A91E0, &RwImageAllocatePixels, PATCH_JUMP); -InjectHook(0x5A92A0, &RwImageFreePixels, PATCH_JUMP); -InjectHook(0x5A92D0, &RwImageMakeMask, PATCH_JUMP); -InjectHook(0x5A93A0, &RwImageApplyMask, PATCH_JUMP); -InjectHook(0x5A9750, &RwImageSetPath, PATCH_JUMP); -InjectHook(0x5A9810, &RwImageRead, PATCH_JUMP); -InjectHook(0x5A9B40, &RwImageFindFileType, PATCH_JUMP); -InjectHook(0x5A9C10, &RwImageReadMaskedImage, PATCH_JUMP); -InjectHook(0x5A9F50, &RwImageCopy, PATCH_JUMP); -InjectHook(0x5AA130, &RwImageGammaCorrect, PATCH_JUMP); -InjectHook(0x5AA2C0, &RwImageSetGamma, PATCH_JUMP); -InjectHook(0x5AA4E0, &_rwStreamWriteVersionedChunkHeader, PATCH_JUMP); -InjectHook(0x5AA540, &RwStreamFindChunk, PATCH_JUMP); -InjectHook(0x5AA640, &RwMemLittleEndian32, PATCH_JUMP); -InjectHook(0x5AA650, &RwMemNative32, PATCH_JUMP); -InjectHook(0x5AA660, &RwMemFloat32ToReal, PATCH_JUMP); -InjectHook(0x5AA680, &RwStreamWriteReal, PATCH_JUMP); -InjectHook(0x5AA720, &RwStreamWriteInt32, PATCH_JUMP); -InjectHook(0x5AA740, &RwStreamReadReal, PATCH_JUMP); -InjectHook(0x5AA7B0, &RwStreamReadInt32, PATCH_JUMP); -InjectHook(0x5AA800, &RwTextureStreamGetSize, PATCH_JUMP); -InjectHook(0x5AA870, &RwTextureStreamWrite, PATCH_JUMP); -InjectHook(0x5AAA40, &RwTextureStreamRead, PATCH_JUMP); -InjectHook(0x5AB020, &RwTexDictionaryStreamWrite, PATCH_JUMP); -InjectHook(0x5AC890, &RpMorphTargetCalcBoundingSphere, PATCH_JUMP); -InjectHook(0x5AC9A0, &RpGeometryAddMorphTargets, PATCH_JUMP); -InjectHook(0x5ACB60, &RpGeometryTriangleSetVertexIndices, PATCH_JUMP); -InjectHook(0x5ACB90, &RpGeometryTriangleSetMaterial, PATCH_JUMP); -InjectHook(0x5ACBF0, &RpGeometryForAllMaterials, PATCH_JUMP); -InjectHook(0x5ACC30, &RpGeometryLock, PATCH_JUMP); -InjectHook(0x5ACC60, &RpGeometryUnlock, PATCH_JUMP); -InjectHook(0x5ACD10, &RpGeometryCreate, PATCH_JUMP); -InjectHook(0x5ACF40, &_rpGeometryAddRef, PATCH_JUMP); -InjectHook(0x5ACF50, &RpGeometryDestroy, PATCH_JUMP); -InjectHook(0x5ACFF0, &RpGeometryRegisterPlugin, PATCH_JUMP); -InjectHook(0x5AD020, &RpGeometryRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5AD050, &RpGeometryStreamRead, PATCH_JUMP); -InjectHook(0x5AD6D0, &RwRasterGetCurrentContext, PATCH_JUMP); -InjectHook(0x5AD6F0, &RwRasterUnlock, PATCH_JUMP); -InjectHook(0x5AD710, &RwRasterRenderFast, PATCH_JUMP); -InjectHook(0x5AD750, &RwRasterUnlockPalette, PATCH_JUMP); -InjectHook(0x5AD780, &RwRasterDestroy, PATCH_JUMP); -InjectHook(0x5AD7C0, &RwRasterPushContext, PATCH_JUMP); -InjectHook(0x5AD810, &RwRasterRegisterPlugin, PATCH_JUMP); -InjectHook(0x5AD840, &RwRasterLockPalette, PATCH_JUMP); -InjectHook(0x5AD870, &RwRasterPopContext, PATCH_JUMP); -InjectHook(0x5AD8C0, &RwRasterGetNumLevels, PATCH_JUMP); -InjectHook(0x5AD900, &RwRasterShowRaster, PATCH_JUMP); -InjectHook(0x5AD930, &RwRasterCreate, PATCH_JUMP); -InjectHook(0x5AD9D0, &RwRasterLock, PATCH_JUMP); -InjectHook(0x5ADC30, &RpMaterialCreate, PATCH_JUMP); -InjectHook(0x5ADCB0, &RpMaterialDestroy, PATCH_JUMP); -InjectHook(0x5ADD10, &RpMaterialSetTexture, PATCH_JUMP); -InjectHook(0x5ADD40, &RpMaterialRegisterPlugin, PATCH_JUMP); -InjectHook(0x5ADD70, &RpMaterialRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5ADDA0, &RpMaterialStreamRead, PATCH_JUMP); -InjectHook(0x5AE0B0, &_rpSectorDefaultRenderCallBack, PATCH_JUMP); -InjectHook(0x5AE100, &_rpWorldForAllGlobalLights, PATCH_JUMP); -InjectHook(0x5AE150, &_rpWorldSectorForAllLocalLights, PATCH_JUMP); -InjectHook(0x5AE190, &RpWorldUnlock, PATCH_JUMP); -InjectHook(0x5AE2B0, &RpWorldSectorGetWorld, PATCH_JUMP); -InjectHook(0x5AE340, &RpWorldDestroy, PATCH_JUMP); -InjectHook(0x5AE6A0, &RpWorldCreate, PATCH_JUMP); -InjectHook(0x5AEA40, &RpWorldRegisterPlugin, PATCH_JUMP); -InjectHook(0x5AEA70, &RpWorldRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5AEAA0, &RpWorldPluginAttach, PATCH_JUMP); -InjectHook(0x5AFB80, &RpWorldAddCamera, PATCH_JUMP); -InjectHook(0x5AFBB0, &RpWorldRemoveCamera, PATCH_JUMP); -InjectHook(0x5AFC10, &RpAtomicGetWorld, PATCH_JUMP); -InjectHook(0x5AFC20, &RpWorldAddClump, PATCH_JUMP); -InjectHook(0x5AFDA0, &RpWorldAddLight, PATCH_JUMP); -InjectHook(0x5AFDF0, &RpWorldRemoveLight, PATCH_JUMP); -InjectHook(0x5AFE70, &RtBMPImageRead, PATCH_JUMP); -InjectHook(0x5B07D0, &RpSkinPluginAttach, PATCH_JUMP); -InjectHook(0x5B1050, &RpSkinAtomicSetHAnimHierarchy, PATCH_JUMP); -InjectHook(0x5B1070, &RpSkinAtomicGetHAnimHierarchy, PATCH_JUMP); -InjectHook(0x5B1080, &RpSkinGeometryGetSkin, PATCH_JUMP); -InjectHook(0x5B1090, &RpSkinGeometrySetSkin, PATCH_JUMP); -InjectHook(0x5B10D0, &RpSkinGetSkinToBoneMatrices, PATCH_JUMP); -InjectHook(0x5B10E0, &RpHAnimHierarchyCreate, PATCH_JUMP); -InjectHook(0x5B11F0, &RpHAnimFrameGetHierarchy, PATCH_JUMP); -InjectHook(0x5B1200, &RpHAnimHierarchySetCurrentAnim, PATCH_JUMP); -InjectHook(0x5B12B0, &RpHAnimHierarchySubAnimTime, PATCH_JUMP); -InjectHook(0x5B1480, &RpHAnimHierarchyAddAnimTime, PATCH_JUMP); -InjectHook(0x5B1780, &RpHAnimHierarchyUpdateMatrices, PATCH_JUMP); -InjectHook(0x5B1C10, &RpHAnimAnimationStreamRead, PATCH_JUMP); -InjectHook(0x5B1D50, &RpHAnimPluginAttach, PATCH_JUMP); -InjectHook(0x5B2640, &RpMatFXPluginAttach, PATCH_JUMP); -InjectHook(0x5B3750, &RpMatFXAtomicEnableEffects, PATCH_JUMP); -InjectHook(0x5B3780, &RpMatFXMaterialSetEffects, PATCH_JUMP); -InjectHook(0x5B38D0, &RpMatFXMaterialSetupEnvMap, PATCH_JUMP); -InjectHook(0x5B3A40, &RpMatFXMaterialSetBumpMapTexture, PATCH_JUMP); -InjectHook(0x5B3CF0, &RwD3D8SetRenderState, PATCH_JUMP); -InjectHook(0x5B3D40, &RwD3D8GetRenderState, PATCH_JUMP); -InjectHook(0x5B3D60, &RwD3D8SetTextureStageState, PATCH_JUMP); -InjectHook(0x5B53A0, &RwD3D8SetTexture, PATCH_JUMP); -InjectHook(0x5B6720, &RwIm3DTransform, PATCH_JUMP); -InjectHook(0x5B67F0, &RwIm3DEnd, PATCH_JUMP); -InjectHook(0x5B6820, &RwIm3DRenderIndexedPrimitive, PATCH_JUMP); -InjectHook(0x5B6980, &RwIm3DRenderLine, PATCH_JUMP); -InjectHook(0x5B6A50, &RwIm3DSetTransformPipeline, PATCH_JUMP); -InjectHook(0x5B6AC0, &RwIm3DSetRenderPipeline, PATCH_JUMP); -InjectHook(0x5B95D0, &RwD3D8EngineSetRefreshRate, PATCH_JUMP); -InjectHook(0x5B9640, &RwD3D8CameraAttachWindow, PATCH_JUMP); -InjectHook(0x5BAEB0, &RwD3D8DeviceSupportsDXTTexture, PATCH_JUMP); -InjectHook(0x5BAF90, &RwD3D8SetVertexShader, PATCH_JUMP); -InjectHook(0x5BAFD0, &RwD3D8SetPixelShader, PATCH_JUMP); -InjectHook(0x5BB010, &RwD3D8SetStreamSource, PATCH_JUMP); -InjectHook(0x5BB060, &RwD3D8SetIndices, PATCH_JUMP); -InjectHook(0x5BB0B0, &RwD3D8DrawIndexedPrimitive, PATCH_JUMP); -InjectHook(0x5BB140, &RwD3D8DrawPrimitive, PATCH_JUMP); -InjectHook(0x5BB1D0, &RwD3D8SetTransform, PATCH_JUMP); -InjectHook(0x5BB310, &RwD3D8GetTransform, PATCH_JUMP); -InjectHook(0x5BB340, &RwD3D8SetTransformWorld, PATCH_JUMP); -InjectHook(0x5BB490, &RwD3D8SetSurfaceProperties, PATCH_JUMP); -InjectHook(0x5BB7A0, &RwD3D8SetLight, PATCH_JUMP); -InjectHook(0x5BB890, &RwD3D8EnableLight, PATCH_JUMP); -InjectHook(0x5BB9F0, &RwD3D8DynamicVertexBufferCreate, PATCH_JUMP); -InjectHook(0x5BBAE0, &RwD3D8DynamicVertexBufferDestroy, PATCH_JUMP); -InjectHook(0x5BBB10, &RwD3D8IndexBufferCreate, PATCH_JUMP); -InjectHook(0x5BBB40, &RwD3D8CreatePixelShader, PATCH_JUMP); -InjectHook(0x5BBB90, &RwD3D8DeletePixelShader, PATCH_JUMP); -InjectHook(0x5BBC00, &RwD3D8SetPixelShaderConstant, PATCH_JUMP); -InjectHook(0x5BBC30, &RwD3D8GetCaps, PATCH_JUMP); -InjectHook(0x5BBC40, &RwD3D8CameraIsSphereFullyInsideFrustum, PATCH_JUMP); -InjectHook(0x5BBCA0, &RwD3D8CameraIsBBoxFullyInsideFrustum, PATCH_JUMP); -InjectHook(0x5BBD30, &RwD3D8DynamicVertexBufferLock, PATCH_JUMP); -InjectHook(0x5BBEB0, &RwD3D8DynamicVertexBufferUnlock, PATCH_JUMP); -InjectHook(0x5BBED0, &_rwIntelSSEsupported, PATCH_JUMP); -InjectHook(0x5BBF10, &RwImageSetFromRaster, PATCH_JUMP); -InjectHook(0x5BBF50, &RwRasterSetFromImage, PATCH_JUMP); -InjectHook(0x5BBF80, &RwImageFindRasterFormat, PATCH_JUMP); -InjectHook(0x5BBFF0, &RwFrameRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5BC020, &_rwFrameListDeinitialize, PATCH_JUMP); -InjectHook(0x5BC050, &_rwFrameListStreamRead, PATCH_JUMP); -InjectHook(0x5BC300, &RpLightSetRadius, PATCH_JUMP); -InjectHook(0x5BC320, &RpLightSetColor, PATCH_JUMP); -InjectHook(0x5BC370, &RpLightGetConeAngle, PATCH_JUMP); -InjectHook(0x5BC5B0, &RpLightRegisterPlugin, PATCH_JUMP); -InjectHook(0x5BC5E0, &RpLightStreamRead, PATCH_JUMP); -InjectHook(0x5BC780, &RpLightDestroy, PATCH_JUMP); -InjectHook(0x5BC7C0, &RpLightCreate, PATCH_JUMP); -InjectHook(0x5BE280, &_rwD3D8TexDictionaryEnableRasterFormatConversion, PATCH_JUMP); -InjectHook(0x5BF110, &RwOsGetFileInterface, PATCH_JUMP); -InjectHook(0x5C1720, &RwFreeListDestroy, PATCH_JUMP); -InjectHook(0x5C1790, &RwFreeListCreate, PATCH_JUMP); -InjectHook(0x5C19F0, &RwFreeListPurge, PATCH_JUMP); -InjectHook(0x5C1B90, &RwFreeListPurgeAllFreeLists, PATCH_JUMP); -InjectHook(0x5C1D40, &RwFreeListForAllUsed, PATCH_JUMP); -InjectHook(0x5C2780, &_rxPipelineClose, PATCH_JUMP); -InjectHook(0x5C27E0, &_rxPipelineOpen, PATCH_JUMP); -InjectHook(0x5C2AD0, &RxHeapGetGlobalHeap, PATCH_JUMP); -InjectHook(0x5C2AE0, &RxPacketCreate, PATCH_JUMP); -InjectHook(0x5C2B10, &RxClusterSetExternalData, PATCH_JUMP); -InjectHook(0x5C2B70, &RxClusterSetData, PATCH_JUMP); -InjectHook(0x5C2BD0, &RxClusterInitializeData, PATCH_JUMP); -InjectHook(0x5C2C40, &RxClusterResizeData, PATCH_JUMP); -InjectHook(0x5C2C90, &RxClusterLockWrite, PATCH_JUMP); -InjectHook(0x5C2D60, &RxPipelineExecute, PATCH_JUMP); -InjectHook(0x5C2E00, &RxPipelineCreate, PATCH_JUMP); -InjectHook(0x5C2E70, &_rxPipelineDestroy, PATCH_JUMP); -InjectHook(0x5C3080, &RwResourcesFreeResEntry, PATCH_JUMP); -InjectHook(0x5C30F0, &_rwResourcesPurge, PATCH_JUMP); -InjectHook(0x5C3170, &RwResourcesAllocateResEntry, PATCH_JUMP); -InjectHook(0x5C3360, &RwResourcesEmptyArena, PATCH_JUMP); -InjectHook(0x5C3450, &_rwPluginRegistryOpen, PATCH_JUMP); -InjectHook(0x5C3480, &_rwPluginRegistryClose, PATCH_JUMP); -InjectHook(0x5C3590, &_rwPluginRegistryGetPluginOffset, PATCH_JUMP); -InjectHook(0x5C35C0, &_rwPluginRegistryAddPlugin, PATCH_JUMP); -InjectHook(0x5C37F0, &_rwPluginRegistryInitObject, PATCH_JUMP); -InjectHook(0x5C3850, &_rwPluginRegistryDeInitObject, PATCH_JUMP); -InjectHook(0x5C3880, &_rwPluginRegistryCopyObject, PATCH_JUMP); -InjectHook(0x5C3910, &RwErrorSet, PATCH_JUMP); -InjectHook(0x5C3970, &_rwerror, PATCH_JUMP); -InjectHook(0x5C3980, &_rwPluginRegistryAddPluginStream, PATCH_JUMP); -InjectHook(0x5C39C0, &_rwPluginRegistryAddPlgnStrmlwysCB, PATCH_JUMP); -InjectHook(0x5C39F0, &_rwPluginRegistryAddPlgnStrmRightsCB, PATCH_JUMP); -InjectHook(0x5C3A20, & _rwPluginRegistryReadDataChunks, PATCH_JUMP); -InjectHook(0x5C3B50, & _rwPluginRegistryInvokeRights, PATCH_JUMP); -InjectHook(0x5C3BA0, &_rwPluginRegistryGetSize, PATCH_JUMP); -InjectHook(0x5C3BE0, &_rwPluginRegistryWriteDataChunks, PATCH_JUMP); -InjectHook(0x5C3CB0, &_rwPluginRegistrySkipDataChunks, PATCH_JUMP); -InjectHook(0x5C3D30, &RwCameraStreamRead, PATCH_JUMP); -InjectHook(0x5C5570, &RwBBoxCalculate, PATCH_JUMP); -InjectHook(0x5C72B0, &RwImageResample, PATCH_JUMP); -InjectHook(0x5C7B30, &RwImageCreateResample, PATCH_JUMP); -InjectHook(0x5D9240, &RxRenderStateVectorSetDefaultRenderStateVector, PATCH_JUMP); -InjectHook(0x5D9340, &RxRenderStateVectorCreate, PATCH_JUMP); -InjectHook(0x5D9410, &RxRenderStateVectorDestroy, PATCH_JUMP); -InjectHook(0x5D9460, &RxRenderStateVectorLoadDriverState, PATCH_JUMP); -InjectHook(0x5D95D0, &_rxEmbeddedPacketBetweenPipelines, PATCH_JUMP); -InjectHook(0x5D9740, &_rxEmbeddedPacketBetweenNodes, PATCH_JUMP); -InjectHook(0x5D9810, &_rxPacketDestroy, PATCH_JUMP); -InjectHook(0x5C8B10, &_rpMaterialListDeinitialize, PATCH_JUMP); -InjectHook(0x5C8B70, &_rpMaterialListInitialize, PATCH_JUMP); -InjectHook(0x5C8B80, &_rpMaterialListGetMaterial, PATCH_JUMP); -InjectHook(0x5C8B90, &_rpMaterialListAppendMaterial, PATCH_JUMP); -InjectHook(0x5C8C50, &_rpMaterialListFindMaterialIndex, PATCH_JUMP); -InjectHook(0x5C8C80, &_rpMaterialListStreamRead, PATCH_JUMP); -InjectHook(0x5C8FE0, &_rpMeshHeaderCreate, PATCH_JUMP); -InjectHook(0x5C8FF0, &_rpMeshClose, PATCH_JUMP); -InjectHook(0x5C9020, &_rpMeshOpen, PATCH_JUMP); -InjectHook(0x5C9140, &_rpBuildMeshCreate, PATCH_JUMP); -InjectHook(0x5C9220, &_rpBuildMeshDestroy, PATCH_JUMP); -InjectHook(0x5C9260, &_rpMeshDestroy, PATCH_JUMP); -InjectHook(0x5C92A0, &_rpBuildMeshAddTriangle, PATCH_JUMP); -InjectHook(0x5C9380, &_rpMeshHeaderForAllMeshes, PATCH_JUMP); -InjectHook(0x5C93C0, &_rpMeshWrite, PATCH_JUMP); -InjectHook(0x5C9510, &_rpMeshRead, PATCH_JUMP); -InjectHook(0x5C96E0, &_rpMeshSize, PATCH_JUMP); -InjectHook(0x5C9730, &RpBuildMeshGenerateDefaultTriStrip, PATCH_JUMP); -InjectHook(0x5CAE10, &_rpTriListMeshGenerate, PATCH_JUMP); -InjectHook(0x5CB230, &_rpMeshOptimise, PATCH_JUMP); -InjectHook(0x5CB2B0, &RpWorldSectorRegisterPlugin, PATCH_JUMP); -InjectHook(0x5CB2E0, &RpWorldSectorRegisterPluginStream, PATCH_JUMP); -InjectHook(0x5CB630, &RpWorldSetDefaultSectorPipeline, PATCH_JUMP); -InjectHook(0x5CB670, &RpAtomicSetDefaultPipeline, PATCH_JUMP); -InjectHook(0x5CDEE0, &RpHAnimStdKeyFrameToMatrix, PATCH_JUMP); -InjectHook(0x5CE000, &RpHAnimStdKeyFrameInterpolate, PATCH_JUMP); -InjectHook(0x5CE420, &RpHAnimStdKeyFrameBlend, PATCH_JUMP); -InjectHook(0x5CE820, &RpHAnimStdKeyFrameStreamRead, PATCH_JUMP); -InjectHook(0x5CE8C0, &RpHAnimStdKeyFrameStreamWrite, PATCH_JUMP); -InjectHook(0x5CE930, &RpHAnimStdKeyFrameStreamGetSize, PATCH_JUMP); -InjectHook(0x5CE950, &RpHAnimStdKeyFrameMulRecip, PATCH_JUMP); -InjectHook(0x5CEAB0, &RpHAnimStdKeyFrameAdd, PATCH_JUMP); -InjectHook(0x5D1070, &RxHeapFree, PATCH_JUMP); -InjectHook(0x5D1260, &RxHeapAlloc, PATCH_JUMP); -InjectHook(0x5D14D0, &RxHeapRealloc, PATCH_JUMP); -InjectHook(0x5D1680, &_rxHeapReset, PATCH_JUMP); -InjectHook(0x5D16F0, &RxHeapDestroy, PATCH_JUMP); -InjectHook(0x5D1750, &RxHeapCreate, PATCH_JUMP); -InjectHook(0x5D1EC0, &RxPipelineNodeFindOutputByName, PATCH_JUMP); -InjectHook(0x5D1F20, &RxPipelineNodeFindInput, PATCH_JUMP); -InjectHook(0x5D1F30, &RxPipelineNodeRequestCluster, PATCH_JUMP); -InjectHook(0x5D1FA0, &RxLockedPipeUnlock, PATCH_JUMP); -InjectHook(0x5D29F0, &RxPipelineLock, PATCH_JUMP); -InjectHook(0x5D2B10, &RxPipelineFindNodeByName, PATCH_JUMP); -InjectHook(0x5D2BA0, &RxLockedPipeAddFragment, PATCH_JUMP); -InjectHook(0x5D2EE0, &RxLockedPipeAddPath, PATCH_JUMP); -InjectHook(0x5D31C0, &RxNodeDefinitionGetImmRenderSetup, PATCH_JUMP); -InjectHook(0x5D35C0, &RxNodeDefinitionGetImmMangleTriangleIndices, PATCH_JUMP); -InjectHook(0x5D3C60, &RxNodeDefinitionGetCullTriangle, PATCH_JUMP); -InjectHook(0x5D4F80, &RxNodeDefinitionGetClipTriangle, PATCH_JUMP); -InjectHook(0x5D51C0, &RxNodeDefinitionGetSubmitTriangle, PATCH_JUMP); -InjectHook(0x5D5400, &RxNodeDefinitionGetImmInstance, PATCH_JUMP); -InjectHook(0x5D6000, &RxNodeDefinitionGetTransform, PATCH_JUMP); -InjectHook(0x5D61C0, &RxNodeDefinitionGetImmStash, PATCH_JUMP); -InjectHook(0x5D6470, &RxNodeDefinitionGetImmMangleLineIndices, PATCH_JUMP); -InjectHook(0x5D7230, &RxNodeDefinitionGetClipLine, PATCH_JUMP); -InjectHook(0x5D74C0, &RxNodeDefinitionGetSubmitLine, PATCH_JUMP); -InjectHook(0x5D9C90, &_rwD3D8LightsOpen, PATCH_JUMP); -InjectHook(0x5D9EF0, &_rwD3D8LightsClose, PATCH_JUMP); -InjectHook(0x5D9F80, &_rwD3D8LightsGlobalEnable, PATCH_JUMP); -InjectHook(0x5DA210, &_rwD3D8LightLocalEnable, PATCH_JUMP); -InjectHook(0x5DA450, &_rwD3D8LightsEnable, PATCH_JUMP); -InjectHook(0x5DAAC0, &RxNodeDefinitionGetD3D8WorldSectorAllInOne, PATCH_JUMP); -InjectHook(0x5DC500, &RxNodeDefinitionGetD3D8AtomicAllInOne, PATCH_JUMP); -InjectHook(0x5DCC50, &RxNodeDefinitionGetWorldSectorInstance, PATCH_JUMP); -InjectHook(0x5DCD80, &RxNodeDefinitionGetWorldSectorEnumerateLights, PATCH_JUMP); -InjectHook(0x5DD800, &RxNodeDefinitionGetAtomicInstance, PATCH_JUMP); -InjectHook(0x5DD9B0, &RxNodeDefinitionGetAtomicEnumerateLights, PATCH_JUMP); -InjectHook(0x5DDAA0, &RxNodeDefinitionGetMaterialScatter, PATCH_JUMP); -InjectHook(0x5DF040, &RxNodeDefinitionGetLight, PATCH_JUMP); -InjectHook(0x5DF560, &RxNodeDefinitionGetPostLight, PATCH_JUMP); -InjectHook(0x5DFC60, &RxD3D8AllInOneSetRenderCallBack, PATCH_JUMP); -ENDPATCHES #endif #endif \ No newline at end of file diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 88f32c33..763f516a 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -1,7 +1,7 @@ #define WITHWINDOWS #include "common.h" #include "main.h" -#include "patcher.h" + #include "AudioScriptObject.h" #include "Camera.h" #include "CarGen.h" @@ -553,22 +553,3 @@ align4bytes(int32 size) { return (size + 3) & 0xFFFFFFFC; } - -STARTPATCHES - InjectHook(0x58F8D0, GenericSave, PATCH_JUMP); - InjectHook(0x590A00, GenericLoad, PATCH_JUMP); - InjectHook(0x591910, ReadInSizeofSaveFileBuffer, PATCH_JUMP); - InjectHook(0x591990, ReadDataFromFile, PATCH_JUMP); - InjectHook(0x591A00, CloseFile, PATCH_JUMP); - InjectHook(0x591A20, DoGameSpecificStuffAfterSucessLoad, PATCH_JUMP); - InjectHook(0x591A40, CheckSlotDataValid, PATCH_JUMP); - InjectHook(0x591A80, MakeSpaceForSizeInBufferPointer, PATCH_JUMP); - InjectHook(0x591AA0, CopySizeAndPreparePointer, PATCH_JUMP); - InjectHook(0x591AE0, DoGameSpecificStuffBeforeSave, PATCH_JUMP); - InjectHook(0x591B10, MakeValidSaveName, PATCH_JUMP); - InjectHook(0x591B50, GetSavedGameDateAndTime, PATCH_JUMP); - InjectHook(0x591B60, GetNameOfSavedGame, PATCH_JUMP); - InjectHook(0x591B70, CheckDataNotCorrupt, PATCH_JUMP); - InjectHook(0x591D60, RestoreForStartLoad, PATCH_JUMP); - InjectHook(0x591E80, align4bytes, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp index 06024e04..3794ba88 100644 --- a/src/save/PCSave.cpp +++ b/src/save/PCSave.cpp @@ -1,6 +1,6 @@ #define WITHWINDOWS #include "common.h" -#include "patcher.h" + #include "FileMgr.h" #include "GenericGameStorage.h" #include "Messages.h" @@ -136,11 +136,3 @@ C_PcSave::PopulateSlotInfo() } } } - -STARTPATCHES - InjectHook(0x591EA0, C_PcSave::SetSaveDirectory, PATCH_JUMP); - InjectHook(0x5922F0, &C_PcSave::DeleteSlot, PATCH_JUMP); - InjectHook(0x591EC0, &C_PcSave::SaveSlot, PATCH_JUMP); - InjectHook(0x591F80, &C_PcSave::PcClassSaveRoutine, PATCH_JUMP); - InjectHook(0x592090, &C_PcSave::PopulateSlotInfo, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/skel/events.cpp b/src/skel/events.cpp index 60e1482e..5d16d5b0 100644 --- a/src/skel/events.cpp +++ b/src/skel/events.cpp @@ -12,7 +12,7 @@ #include "Camera.h" -#include "patcher.h" + /* ***************************************************************************** @@ -832,14 +832,3 @@ AttachInputDevices(void) return TRUE; } - - -STARTPATCHES - InjectHook(0x583F10, HandleKeyDown, PATCH_JUMP); - InjectHook(0x5842F0, HandleKeyUp, PATCH_JUMP); - InjectHook(0x5846C0, KeyboardHandler, PATCH_JUMP); - InjectHook(0x5846F0, HandlePadButtonDown, PATCH_JUMP); - InjectHook(0x584770, HandlePadButtonUp, PATCH_JUMP); - InjectHook(0x584830, PadHandler, PATCH_JUMP); - InjectHook(0x584860, AttachInputDevices, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index a02d7e0b..f48089cb 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include #include @@ -415,26 +415,3 @@ RsInitialise(void) return result; } - - - - -STARTPATCHES - InjectHook(0x584890, RsTimer, PATCH_JUMP); - InjectHook(0x5848A0, RsCameraShowRaster, PATCH_JUMP); - InjectHook(0x5848B0, RsCameraBeginUpdate, PATCH_JUMP); - InjectHook(0x5848C0, RsRegisterImageLoader, PATCH_JUMP); - InjectHook(0x5848D0, RsSetDebug, PATCH_JUMP); - InjectHook(0x5848E0, RsMouseSetPos, PATCH_JUMP); - InjectHook(0x5848F0, RsSelectDevice, PATCH_JUMP); - InjectHook(0x584900, RsInputDeviceAttach, PATCH_JUMP); - InjectHook(0x584960, rsCommandLine, PATCH_JUMP); - InjectHook(0x584980, rsPreInitCommandLine, PATCH_JUMP); - InjectHook(0x5849C0, RsKeyboardEventHandler, PATCH_JUMP); - InjectHook(0x5849F0, RsPadEventHandler, PATCH_JUMP); - InjectHook(0x584A20, RsEventHandler, PATCH_JUMP); - InjectHook(0x584B30, RsRwTerminate, PATCH_JUMP); - InjectHook(0x584B40, RsRwInitialise, PATCH_JUMP); - InjectHook(0x584C30, RsTerminate, PATCH_JUMP); - InjectHook(0x584C40, RsInitialise, PATCH_JUMP); -ENDPATCHES \ No newline at end of file diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 351b7247..a534e903 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1366,7 +1366,7 @@ psSelectDevice() { return FALSE; } - + if (vm.flags & rwVIDEOMODEEXCLUSIVE) { debug("%dx%dx%d", vm.width, vm.height, vm.depth); @@ -1754,7 +1754,7 @@ void HandleExit() ***************************************************************************** */ int PASCAL -_WinMain(HINSTANCE instance, +WinMain(HINSTANCE instance, HINSTANCE prevInstance __RWUNUSED__, CMDSTR cmdLine, int cmdShow) @@ -1763,7 +1763,7 @@ _WinMain(HINSTANCE instance, RwV2d pos; RwInt32 argc, i; RwChar **argv; - + StaticPatcher::Apply(); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); /* @@ -3025,60 +3025,3 @@ int strcasecmp(const char *str1, const char *str2) return _strcmpi(str1, str2); } #endif - - -STARTPATCHES - //InjectHook(0x580B30, &CJoySticks::CJoySticks, PATCH_JUMP); - //InjectHook(0x580B50, &CJoySticks::ClearJoyInfo, PATCH_JUMP); - InjectHook(0x580B70, _psCreateFolder, PATCH_JUMP); - InjectHook(0x580BB0, _psGetUserFilesFolder, PATCH_JUMP); - InjectHook(0x580C70, psCameraBeginUpdate, PATCH_JUMP); - InjectHook(0x580CA0, psCameraShowRaster, PATCH_JUMP); - InjectHook(0x580CE0, psTimer, PATCH_JUMP); - InjectHook(0x580D20, psMouseSetPos, PATCH_JUMP); - InjectHook(0x580E10, psGetMemoryFunctions, PATCH_JUMP); - InjectHook(0x580E20, psInstallFileSystem, PATCH_JUMP); - InjectHook(0x580E30, psNativeTextureSupport, PATCH_JUMP); - InjectHook(0x580E40, InitApplication, PATCH_JUMP); - InjectHook(0x580EB0, InitInstance, PATCH_JUMP); - InjectHook(0x580F30, _GetVideoMemInfo, PATCH_JUMP); - InjectHook(0x580FA0, GetDXVersion, PATCH_JUMP); - InjectHook(0x5810C0, _psGetCpuVendr, PATCH_JUMP); - InjectHook(0x5810E0, _psGetCpuFeatures, PATCH_JUMP); - InjectHook(0x5810F0, _psGetCpuFeaturesEx, PATCH_JUMP); - InjectHook(0x581120, _psPrintCpuInfo, PATCH_JUMP); - InjectHook(0x581180, psInitialise, PATCH_JUMP); - InjectHook(0x581460, psTerminate, PATCH_JUMP); - InjectHook(0x581470, _psGetNumVideModes, PATCH_JUMP); - InjectHook(0x581480, _psFreeVideoModeList, PATCH_JUMP); - InjectHook(0x5814F0, _psGetVideoModeList, PATCH_JUMP); - InjectHook(0x581630, _psSelectScreenVM, PATCH_JUMP); - InjectHook(0x5816B0, WaitForState, PATCH_JUMP); - InjectHook(0x5816E0, HandleGraphEvent, PATCH_JUMP); - InjectHook(0x581790, MainWndProc, PATCH_JUMP); - InjectHook(0x581C90, IsForegroundApp, PATCH_JUMP); - InjectHook(0x581CB0, GetBestRefreshRate, PATCH_JUMP); - InjectHook(0x581D80, psSelectDevice, PATCH_JUMP); - InjectHook(0x581F90, _psSetVideoMode, PATCH_JUMP); - InjectHook(0x582030, CommandLineToArgv, PATCH_JUMP); - InjectHook(0x582160, InitialiseLanguage, PATCH_JUMP); - InjectHook(0x5822F0, CenterVideo, PATCH_JUMP); - InjectHook(0x582380, PlayMovieInWindow, PATCH_JUMP); - InjectHook(0x5825E0, CloseInterfaces, PATCH_JUMP); - InjectHook(0x582680, CloseClip, PATCH_JUMP); - InjectHook(0x5826A0, HandleExit, PATCH_JUMP); - InjectHook(0x582710, _WinMain, PATCH_JUMP); - InjectHook(0x5830D0, _InputInitialise, PATCH_JUMP); - InjectHook(0x583110, _InputInitialiseMouse, PATCH_JUMP); - InjectHook(0x583190, CapturePad, PATCH_JUMP); - InjectHook(0x583580, _InputInitialiseJoys, PATCH_JUMP); - InjectHook(0x583670, _InputAddJoyStick, PATCH_JUMP); - InjectHook(0x583810, _InputAddJoys, PATCH_JUMP); - InjectHook(0x583870, _InputGetMouseState, PATCH_JUMP); - InjectHook(0x583910, _InputShutdown, PATCH_JUMP); - InjectHook(0x583940, _InputEnumDevicesCallback, PATCH_JUMP); - InjectHook(0x583A20, _InputTranslateKey, PATCH_JUMP); - InjectHook(0x583DC0, _InputTranslateShiftKeyUpDown, PATCH_JUMP); - InjectHook(0x583E50, _InputTranslateShiftKey, PATCH_JUMP); - InjectHook(0x583EE0, _InputIsExtended, PATCH_JUMP); -ENDPATCHES diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp index 67a7bab4..3233ebc4 100644 --- a/src/text/Messages.cpp +++ b/src/text/Messages.cpp @@ -2,7 +2,7 @@ #include "dinput.h" #include "common.h" -#include "patcher.h" + #include "Messages.h" #include "RwHelper.h" #include "Hud.h" @@ -803,33 +803,3 @@ CMessages::ClearAllMessagesDisplayedByGame() CHud::GetRidOfAllHudMessages(); CUserDisplay::Pager.ClearMessages(); } - -STARTPATCHES - InjectHook(0x529310, CMessages::Init, PATCH_JUMP); - InjectHook(0x529490, CMessages::GetWideStringLength, PATCH_JUMP); - InjectHook(0x5294B0, CMessages::WideStringCopy, PATCH_JUMP); - InjectHook(0x529510, CMessages::WideStringCompare, PATCH_JUMP); - InjectHook(0x529580, CMessages::Process, PATCH_JUMP); - InjectHook(0x529800, CMessages::Display, PATCH_JUMP); - InjectHook(0x529900, CMessages::AddMessage, PATCH_JUMP); - InjectHook(0x529A10, CMessages::AddMessageJumpQ, PATCH_JUMP); - InjectHook(0x529AF0, CMessages::AddMessageSoon, PATCH_JUMP); - InjectHook(0x529CE0, CMessages::ClearMessages, PATCH_JUMP); - InjectHook(0x529E00, CMessages::ClearSmallMessagesOnly, PATCH_JUMP); - InjectHook(0x529EB0, CMessages::AddBigMessage, PATCH_JUMP); - InjectHook(0x529F60, CMessages::AddBigMessageQ, PATCH_JUMP); - InjectHook(0x52A040, CMessages::AddToPreviousBriefArray, PATCH_JUMP); - InjectHook(0x52A1A0, CMessages::InsertNumberInString, PATCH_JUMP); - InjectHook(0x52A300, CMessages::InsertStringInString, PATCH_JUMP); - InjectHook(0x52A490, CMessages::InsertPlayerControlKeysInString, PATCH_JUMP); - InjectHook(0x52A850, CMessages::AddMessageWithNumber, PATCH_JUMP); - InjectHook(0x52A9A0, CMessages::AddMessageJumpQWithNumber, PATCH_JUMP); - InjectHook(0x52AAC0, CMessages::AddMessageSoonWithNumber, PATCH_JUMP); - InjectHook(0x52AD10, CMessages::AddBigMessageWithNumber, PATCH_JUMP); - InjectHook(0x52AE00, CMessages::AddBigMessageWithNumberQ, PATCH_JUMP); - InjectHook(0x52AF30, CMessages::AddMessageWithString, PATCH_JUMP); - InjectHook(0x52B050, CMessages::AddMessageJumpQWithString, PATCH_JUMP); - InjectHook(0x52B140, CMessages::ClearThisPrint, PATCH_JUMP); - InjectHook(0x52B3C0, CMessages::ClearThisBigPrint, PATCH_JUMP); - InjectHook(0x52B670, CMessages::ClearAllMessagesDisplayedByGame, PATCH_JUMP); -ENDPATCHES diff --git a/src/text/Pager.cpp b/src/text/Pager.cpp index 5c6b3ee2..565f2c20 100644 --- a/src/text/Pager.cpp +++ b/src/text/Pager.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Pager.h" #include "Timer.h" #include "Messages.h" @@ -181,14 +181,4 @@ CPager::RestartCurrentMessage() m_messages[0].m_nCurrentPosition = -(m_nNumDisplayLetters + 10); m_messages[0].m_nTimeToChangePosition = CTimer::GetTimeInMilliseconds() + m_messages[0].m_nSpeedMs; } -} - -STARTPATCHES - InjectHook(0x52B6F0, &CPager::Init, PATCH_JUMP); - InjectHook(0x52B740, &CPager::Process, PATCH_JUMP); - InjectHook(0x52B890, &CPager::Display, PATCH_JUMP); - InjectHook(0x52B940, &CPager::AddMessage, PATCH_JUMP); - InjectHook(0x52BB50, &CPager::AddMessageWithNumber, PATCH_JUMP); - InjectHook(0x52BE50, &CPager::RestartCurrentMessage, PATCH_JUMP); - InjectHook(0x52BE00, &CPager::ClearMessages, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +} \ No newline at end of file diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 144dfed1..69025df1 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "FileMgr.h" #include "Frontend.h" #include "Messages.h" @@ -304,21 +304,3 @@ TextCopy(wchar *dst, const wchar *src) { while((*dst++ = *src++) != '\0'); } - - -STARTPATCHES - InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); - InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); - InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP); - InjectHook(0x52C220, &CText::GetUpperCase, PATCH_JUMP); - InjectHook(0x52C2C0, &CText::UpperCase, PATCH_JUMP); - - InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP); - InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP); - InjectHook(0x52BF80, &CKeyArray::Update, PATCH_JUMP); - InjectHook(0x52C060, &CKeyArray::BinarySearch, PATCH_JUMP); - InjectHook(0x52BFB0, &CKeyArray::Search, PATCH_JUMP); - - InjectHook(0x52C120, &CData::Load, PATCH_JUMP); - InjectHook(0x52C200, &CData::Unload, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 0a0bc7a6..c2a664a6 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "General.h" #include "RwHelper.h" #include "Pad.h" @@ -4492,88 +4492,3 @@ CAutomobile::SetAllTaxiLights(bool set) { m_sAllTaxiLights = set; } - -#include - -class CAutomobile_ : public CAutomobile -{ -public: - void ctor(int32 id, uint8 CreatedBy) { ::new (this) CAutomobile(id, CreatedBy); } - void dtor() { CAutomobile::~CAutomobile(); } - void SetModelIndex_(uint32 id) { CAutomobile::SetModelIndex(id); } - void ProcessControl_(void) { CAutomobile::ProcessControl(); } - void Teleport_(CVector v) { CAutomobile::Teleport(v); } - void PreRender_(void) { CAutomobile::PreRender(); } - void Render_(void) { CAutomobile::Render(); } - - int32 ProcessEntityCollision_(CEntity *ent, CColPoint *colpoints){ return CAutomobile::ProcessEntityCollision(ent, colpoints); } - - void ProcessControlInputs_(uint8 pad) { CAutomobile::ProcessControlInputs(pad); } - void GetComponentWorldPosition_(int32 component, CVector &pos) { CAutomobile::GetComponentWorldPosition(component, pos); } - bool IsComponentPresent_(int32 component) { return CAutomobile::IsComponentPresent(component); } - void SetComponentRotation_(int32 component, CVector rotation) { CAutomobile::SetComponentRotation(component, rotation); } - void OpenDoor_(int32 component, eDoors door, float ratio) { CAutomobile::OpenDoor(component, door, ratio); } - void ProcessOpenDoor_(uint32 component, uint32 anim, float time) { CAutomobile::ProcessOpenDoor(component, anim, time); } - bool IsDoorReady_(eDoors door) { return CAutomobile::IsDoorReady(door); } - bool IsDoorFullyOpen_(eDoors door) { return CAutomobile::IsDoorFullyOpen(door); } - bool IsDoorClosed_(eDoors door) { return CAutomobile::IsDoorClosed(door); } - bool IsDoorMissing_(eDoors door) { return CAutomobile::IsDoorMissing(door); } - void RemoveRefsToVehicle_(CEntity *ent) { CAutomobile::RemoveRefsToVehicle(ent); } - void BlowUpCar_(CEntity *ent) { CAutomobile::BlowUpCar(ent); } - bool SetUpWheelColModel_(CColModel *colModel) { return CAutomobile::SetUpWheelColModel(colModel); } - void BurstTyre_(uint8 tyre) { CAutomobile::BurstTyre(tyre); } - bool IsRoomForPedToLeaveCar_(uint32 door, CVector *pos) { return CAutomobile::IsRoomForPedToLeaveCar(door, pos); } - float GetHeightAboveRoad_(void) { return CAutomobile::GetHeightAboveRoad(); } - void PlayCarHorn_(void) { CAutomobile::PlayCarHorn(); } -}; - -STARTPATCHES - InjectHook(0x52C6B0, &CAutomobile_::ctor, PATCH_JUMP); - InjectHook(0x52D170, &CAutomobile_::dtor, PATCH_JUMP); - InjectHook(0x52D190, &CAutomobile_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x531470, &CAutomobile_::ProcessControl_, PATCH_JUMP); - InjectHook(0x535180, &CAutomobile_::Teleport_, PATCH_JUMP); - InjectHook(0x539EA0, &CAutomobile_::Render_, PATCH_JUMP); - InjectHook(0x535B40, &CAutomobile_::PreRender_, PATCH_JUMP); - InjectHook(0x53B270, &CAutomobile_::ProcessEntityCollision_, PATCH_JUMP); - InjectHook(0x53B660, &CAutomobile_::ProcessControlInputs_, PATCH_JUMP); - InjectHook(0x52E5F0, &CAutomobile_::GetComponentWorldPosition_, PATCH_JUMP); - InjectHook(0x52E660, &CAutomobile_::IsComponentPresent_, PATCH_JUMP); - InjectHook(0x52E680, &CAutomobile_::SetComponentRotation_, PATCH_JUMP); - InjectHook(0x52E750, &CAutomobile_::OpenDoor_, PATCH_JUMP); - InjectHook(0x52EF10, &CAutomobile_::IsDoorReady_, PATCH_JUMP); - InjectHook(0x52EF90, &CAutomobile_::IsDoorFullyOpen_, PATCH_JUMP); - InjectHook(0x52EFD0, &CAutomobile_::IsDoorClosed_, PATCH_JUMP); - InjectHook(0x52F000, &CAutomobile_::IsDoorMissing_, PATCH_JUMP); - InjectHook(0x53BF40, &CAutomobile_::RemoveRefsToVehicle_, PATCH_JUMP); - InjectHook(0x53BC60, &CAutomobile_::BlowUpCar_, PATCH_JUMP); - InjectHook(0x53BF70, &CAutomobile_::SetUpWheelColModel_, PATCH_JUMP); - InjectHook(0x53C0E0, &CAutomobile_::BurstTyre_, PATCH_JUMP); - InjectHook(0x53C5B0, &CAutomobile_::IsRoomForPedToLeaveCar_, PATCH_JUMP); - InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP); - InjectHook(0x53C450, &CAutomobile_::PlayCarHorn_, PATCH_JUMP); - InjectHook(0x53E090, &CAutomobile::PlaceOnRoadProperly, PATCH_JUMP); - InjectHook(0x52F030, &CAutomobile::dmgDrawCarCollidingParticles, PATCH_JUMP); - InjectHook(0x535450, &CAutomobile::AddDamagedVehicleParticles, PATCH_JUMP); - InjectHook(0x5357D0, &CAutomobile::AddWheelDirtAndWater, PATCH_JUMP); - InjectHook(0x5353A0, &CAutomobile::ResetSuspension, PATCH_JUMP); - InjectHook(0x52D210, &CAutomobile::SetupSuspensionLines, PATCH_JUMP); - InjectHook(0x53E000, &CAutomobile::BlowUpCarsInPath, PATCH_JUMP); - InjectHook(0x42E220, &CAutomobile::HasCarStoppedBecauseOfLight, PATCH_JUMP); - InjectHook(0x53D320, &CAutomobile::SetBusDoorTimer, PATCH_JUMP); - InjectHook(0x53D370, &CAutomobile::ProcessAutoBusDoors, PATCH_JUMP); - InjectHook(0x535250, &CAutomobile::ProcessSwingingDoor, PATCH_JUMP); - InjectHook(0x53C240, &CAutomobile::Fix, PATCH_JUMP); - InjectHook(0x53C310, &CAutomobile::SetupDamageAfterLoad, PATCH_JUMP); - InjectHook(0x530300, &CAutomobile::SpawnFlyingComponent, PATCH_JUMP); - InjectHook(0x535320, &CAutomobile::RemoveBonnetInPedCollision, PATCH_JUMP); - InjectHook(0x5301A0, &CAutomobile::SetPanelDamage, PATCH_JUMP); - InjectHook(0x530120, &CAutomobile::SetBumperDamage, PATCH_JUMP); - InjectHook(0x530200, &CAutomobile::SetDoorDamage, PATCH_JUMP); - InjectHook(0x5300E0, &CAutomobile::SetComponentVisibility, PATCH_JUMP); - InjectHook(0x52D1B0, &CAutomobile::SetupModelNodes, PATCH_JUMP); - InjectHook(0x53C420, &CAutomobile::SetTaxiLight, PATCH_JUMP); - InjectHook(0x53BC40, &CAutomobile::GetAllWheelsOffGround, PATCH_JUMP); - InjectHook(0x5308C0, &CAutomobile::ReduceHornCounter, PATCH_JUMP); - InjectHook(0x53C440, &CAutomobile::SetAllTaxiLights, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 478257b6..ed38bafd 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Timecycle.h" #include "HandlingMgr.h" @@ -850,24 +850,3 @@ CBoat::AddWakePoint(CVector point) m_nNumWakePoints = 1; } } - -#include - -class CBoat_ : public CBoat -{ -public: - CBoat* ctor(int32 id, uint8 CreatedBy) { return ::new (this) CBoat(id, CreatedBy); } - void dtor() { CBoat::~CBoat(); }; -}; - -STARTPATCHES - InjectHook(0x53E3E0, &CBoat_::ctor, PATCH_JUMP); - InjectHook(0x53E790, &CBoat_::dtor, PATCH_JUMP); - InjectHook(0x53E7D0, &CBoat::SetupModelNodes, PATCH_JUMP); - InjectHook(0x542370, CBoat::IsSectorAffectedByWake, PATCH_JUMP); - InjectHook(0x5424A0, CBoat::IsVertexAffectedByWake, PATCH_JUMP); - InjectHook(0x542250, CBoat::FillBoatList, PATCH_JUMP); - InjectHook(0x542140, &CBoat::AddWakePoint, PATCH_JUMP); - InjectHook(0x5420D0, &CBoat::PruneWakeTrail, PATCH_JUMP); - InjectHook(0x541A30, &CBoat::ApplyWaterResistance, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index c35005a1..4156ec2a 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "CarGen.h" #include "Automobile.h" @@ -249,10 +249,3 @@ INITSAVEBUF CarGeneratorArray[i] = ReadSaveBuf(buffer); VALIDATESAVEBUF(size) } - -STARTPATCHES -InjectHook(0x543020, CTheCarGenerators::Init, PATCH_JUMP); -InjectHook(0x542F40, CTheCarGenerators::Process, PATCH_JUMP); -InjectHook(0x543050, CTheCarGenerators::SaveAllCarGenerators, PATCH_JUMP); -InjectHook(0x5431E0, CTheCarGenerators::LoadAllCarGenerators, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index dbc3c340..ef19873c 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Cranes.h" #include "Camera.h" diff --git a/src/vehicles/DamageManager.cpp b/src/vehicles/DamageManager.cpp index 9a697b6b..03ccfe77 100644 --- a/src/vehicles/DamageManager.cpp +++ b/src/vehicles/DamageManager.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Vehicle.h" #include "DamageManager.h" @@ -228,24 +228,3 @@ CDamageManager::ProgressEngineDamage(void) SetEngineStatus(newstatus); return true; } - -STARTPATCHES - InjectHook(0x545850, &CDamageManager::ResetDamageStatus, PATCH_JUMP); - InjectHook(0x545B70, &CDamageManager::FuckCarCompletely, PATCH_JUMP); - InjectHook(0x545790, &CDamageManager::GetComponentGroup, PATCH_JUMP); - InjectHook(0x545A80, &CDamageManager::ApplyDamage, PATCH_JUMP); - InjectHook(0x545920, &CDamageManager::SetDoorStatus, PATCH_JUMP); - InjectHook(0x545930, &CDamageManager::GetDoorStatus, PATCH_JUMP); - InjectHook(0x545970, &CDamageManager::ProgressDoorDamage, PATCH_JUMP); - InjectHook(0x5458B0, &CDamageManager::SetPanelStatus, PATCH_JUMP); - InjectHook(0x5458E0, (int32 (CDamageManager::*)(int32))&CDamageManager::GetPanelStatus, PATCH_JUMP); - InjectHook(0x545A00, &CDamageManager::ProgressPanelDamage, PATCH_JUMP); - InjectHook(0x545860, &CDamageManager::SetLightStatus, PATCH_JUMP); - InjectHook(0x545890, &CDamageManager::GetLightStatus, PATCH_JUMP); - InjectHook(0x545900, &CDamageManager::SetWheelStatus, PATCH_JUMP); - InjectHook(0x545910, &CDamageManager::GetWheelStatus, PATCH_JUMP); - InjectHook(0x545A40, &CDamageManager::ProgressWheelDamage, PATCH_JUMP); - InjectHook(0x545940, &CDamageManager::SetEngineStatus, PATCH_JUMP); - InjectHook(0x545960, &CDamageManager::GetEngineStatus, PATCH_JUMP); - InjectHook(0x5459B0, &CDamageManager::ProgressEngineDamage, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Door.cpp b/src/vehicles/Door.cpp index c569be59..c80965aa 100644 --- a/src/vehicles/Door.cpp +++ b/src/vehicles/Door.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Vehicle.h" #include "Door.h" @@ -168,19 +168,3 @@ CTrainDoor::IsClosed(void) { return m_fPosn == RetTranslationWhenClosed(); } - -STARTPATCHES - InjectHook(0x545EF0, &CDoor::Open, PATCH_JUMP); - InjectHook(0x545BD0, &CDoor::Process, PATCH_JUMP); - InjectHook(0x545FE0, &CDoor::RetAngleWhenClosed, PATCH_JUMP); - InjectHook(0x546020, &CDoor::RetAngleWhenOpen, PATCH_JUMP); - InjectHook(0x545F80, &CDoor::GetAngleOpenRatio, PATCH_JUMP); - InjectHook(0x546090, &CDoor::IsFullyOpen, PATCH_JUMP); - InjectHook(0x546060, &CDoor::IsClosed, PATCH_JUMP); - - InjectHook(0x546200, &CTrainDoor::Open, PATCH_JUMP); - InjectHook(0x546180, &CTrainDoor::RetTranslationWhenClosed, PATCH_JUMP); - InjectHook(0x5461C0, &CTrainDoor::RetTranslationWhenOpen, PATCH_JUMP); - InjectHook(0x546120, &CTrainDoor::IsFullyOpen, PATCH_JUMP); - InjectHook(0x5460F0, &CTrainDoor::IsClosed, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp index 8b5e1e0a..1ae1c5c3 100644 --- a/src/vehicles/Floater.cpp +++ b/src/vehicles/Floater.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Timer.h" #include "WaterLevel.h" #include "ModelIndices.h" @@ -183,12 +183,3 @@ cBuoyancy::CalcBuoyancyForce(CPhysical *phys, CVector *point, CVector *impulse) *impulse = CVector(0.0f, 0.0f, m_volumeUnderWater*m_buoyancy*CTimer::GetTimeStep()); return true; } - -STARTPATCHES - InjectHook(0x546270, &cBuoyancy::ProcessBuoyancy, PATCH_JUMP); - InjectHook(0x546360, &cBuoyancy::PreCalcSetup, PATCH_JUMP); - InjectHook(0x5466F0, &cBuoyancy::SimpleCalcBuoyancy, PATCH_JUMP); - InjectHook(0x546820, &cBuoyancy::SimpleSumBuoyancyData, PATCH_JUMP); - InjectHook(0x546620, &cBuoyancy::FindWaterLevel, PATCH_JUMP); - InjectHook(0x5465A0, &cBuoyancy::CalcBuoyancyForce, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index b33015ab..3ac0da38 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "FileMgr.h" #include "HandlingMgr.h" @@ -237,11 +237,3 @@ cHandlingDataMgr::GetHandlingId(const char *name) break; return i; } - -STARTPATCHES - InjectHook(0x546D80, &cHandlingDataMgr::Initialise, PATCH_JUMP); - InjectHook(0x546DB0, &cHandlingDataMgr::LoadHandlingData, PATCH_JUMP); - InjectHook(0x546BB0, &cHandlingDataMgr::ConvertDataToGameUnits, PATCH_JUMP); - InjectHook(0x546AA0, &cHandlingDataMgr::FindExactWord, PATCH_JUMP); - InjectHook(0x546B70, &cHandlingDataMgr::GetHandlingId, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 81ac9bd3..1f92b678 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "General.h" #include "Darkel.h" #include "Stats.h" @@ -1043,24 +1043,3 @@ void CHeli::MakeCatalinaHeliFlyAway(void) { pHelis[HELI_CATALINA]->m_pathState = bool CHeli::HasCatalinaBeenShotDown(void) { return CatalinaHasBeenShotDown; } void CHeli::ActivateHeli(bool activate) { ScriptHeliOn = activate; } - -#include - -class CHeli_ : public CHeli -{ -public: - void ctor(int32 id, uint8 CreatedBy) { ::new (this) CHeli(id, CreatedBy); } - void dtor(void) { CHeli::~CHeli(); } -}; - -STARTPATCHES - InjectHook(0x547220, &CHeli_::ctor, PATCH_JUMP); - InjectHook(0x5474A0, &CHeli_::dtor, PATCH_JUMP); - InjectHook(0x54AE50, &CHeli::SpawnFlyingComponent, PATCH_JUMP); - InjectHook(0x549970, CHeli::InitHelis, PATCH_JUMP); - InjectHook(0x5499F0, CHeli::UpdateHelis, PATCH_JUMP); - InjectHook(0x54AE10, CHeli::SpecialHeliPreRender, PATCH_JUMP); - InjectHook(0x54AA30, CHeli::TestRocketCollision, PATCH_JUMP); - InjectHook(0x54AB30, CHeli::TestBulletCollision, PATCH_JUMP); - InjectHook(0x54A640, GenerateHeli, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index 892bc0d5..273ac54a 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "General.h" #include "ModelIndices.h" #include "FileMgr.h" @@ -965,24 +965,3 @@ const CVector CPlane::FindDropOffCesnaCoordinates(void) { return pDropOffCesna-> bool CPlane::HasCesnaLanded(void) { return CesnaMissionStatus == CESNA_STATUS_LANDED; } bool CPlane::HasCesnaBeenDestroyed(void) { return CesnaMissionStatus == CESNA_STATUS_DESTROYED; } bool CPlane::HasDropOffCesnaBeenShotDown(void) { return DropOffCesnaMissionStatus == CESNA_STATUS_DESTROYED; } - -#include - -class CPlane_ : public CPlane -{ -public: - void ctor(int32 id, uint8 CreatedBy) { ::new (this) CPlane(id, CreatedBy); } - void dtor(void) { CPlane::~CPlane(); } -}; - -STARTPATCHES - InjectHook(0x54B170, &CPlane_::ctor, PATCH_JUMP); - InjectHook(0x54B270, &CPlane_::dtor, PATCH_JUMP); - InjectHook(0x54B820, CPlane::InitPlanes, PATCH_JUMP); - InjectHook(0x54BCD0, CPlane::Shutdown, PATCH_JUMP); - InjectHook(0x54BD50, CPlane::LoadPath, PATCH_JUMP); - InjectHook(0x54BEC0, CPlane::UpdatePlanes, PATCH_JUMP); - InjectHook(0x54DE90, CPlane::TestRocketCollision, PATCH_JUMP); - InjectHook(0x54E000, CPlane::CreateIncomingCesna, PATCH_JUMP); - InjectHook(0x54E160, CPlane::CreateDropOffCesna, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 25be193c..0d1ff9b0 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "Timer.h" #include "ModelIndices.h" #include "FileMgr.h" @@ -691,32 +691,3 @@ CTrain::UpdateTrains(void) time += 0x40000/4; } } - -#include - -class CTrain_ : public CTrain -{ -public: - void ctor(int32 id, uint8 CreatedBy) { ::new (this) CTrain(id, CreatedBy); } - void SetModelIndex_(uint32 id) { CTrain::SetModelIndex(id); } - void ProcessControl_(void) { CTrain::ProcessControl(); } - void PreRender_(void) { CTrain::PreRender(); } - void Render_(void) { CTrain::Render(); } - void dtor(void) { CTrain::~CTrain(); } -}; - -STARTPATCHES - InjectHook(0x54E470, &CTrain_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x54E4C0, &CTrain_::PreRender_, PATCH_JUMP); - InjectHook(0x54EAA0, &CTrain_::Render_, PATCH_JUMP); - InjectHook(0x54E450, &CTrain_::dtor, PATCH_JUMP); - InjectHook(0x54E2A0, &CTrain_::ctor, PATCH_JUMP); - InjectHook(0x550300, &CTrain::TrainHitStuff, PATCH_JUMP); - InjectHook(0x5504A0, &CTrain::AddPassenger, PATCH_JUMP); - InjectHook(0x550360, &CTrain::OpenTrainDoor, PATCH_JUMP); - - InjectHook(0x54F000, CTrain::InitTrains, PATCH_JUMP); - InjectHook(0x54F360, CTrain::Shutdown, PATCH_JUMP); - InjectHook(0x54EAB0, CTrain::ReadAndInterpretTrackFile, PATCH_JUMP); - InjectHook(0x54F3A0, CTrain::UpdateTrains, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp index d500d004..5287055d 100644 --- a/src/vehicles/Transmission.cpp +++ b/src/vehicles/Transmission.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Timer.h" #include "HandlingMgr.h" #include "Transmission.h" @@ -136,8 +136,3 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl } return fAcceleration; } - -STARTPATCHES - InjectHook(0x550A00, &cTransmission::CalculateGearForSimpleCar, PATCH_JUMP); - InjectHook(0x5506B0, &cTransmission::CalculateDriveAcceleration, PATCH_JUMP); -ENDPATCHES diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index ed8f4221..48c836f8 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "main.h" -#include "patcher.h" + #include "General.h" #include "Timer.h" #include "Pad.h" @@ -1015,49 +1015,4 @@ DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle) } CWorld::Remove(pVehicle); delete pVehicle; -} - - -class CVehicle_ : public CVehicle -{ -public: - void dtor(void) { CVehicle::~CVehicle(); } - void SetModelIndex_(uint32 id) { CVehicle::SetModelIndex(id); } - bool SetupLighting_(void) { return CVehicle::SetupLighting(); } - void RemoveLighting_(bool reset) { CVehicle::RemoveLighting(reset); } - float GetHeightAboveRoad_(void) { return CVehicle::GetHeightAboveRoad(); } -}; - -STARTPATCHES - InjectHook(0x551170, &CVehicle_::SetModelIndex_, PATCH_JUMP); - InjectHook(0x4A7DD0, &CVehicle_::SetupLighting_, PATCH_JUMP); - InjectHook(0x4A7E60, &CVehicle_::RemoveLighting_, PATCH_JUMP); - InjectHook(0x417E60, &CVehicle_::GetHeightAboveRoad_, PATCH_JUMP); - - InjectHook(0x552BB0, &CVehicle::FlyingControl, PATCH_JUMP); - InjectHook(0x5512E0, &CVehicle::ProcessWheel, PATCH_JUMP); - InjectHook(0x551280, &CVehicle::ProcessWheelRotation, PATCH_JUMP); - InjectHook(0x552AF0, &CVehicle::ExtinguishCarFire, PATCH_JUMP); - InjectHook(0x551C90, &CVehicle::ProcessDelayedExplosion, PATCH_JUMP); - InjectHook(0x552880, &CVehicle::IsLawEnforcementVehicle, PATCH_JUMP); - InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP); - InjectHook(0x552200, &CVehicle::UsesSiren, PATCH_JUMP); - InjectHook(0x5527E0, &CVehicle::IsVehicleNormal, PATCH_JUMP); - InjectHook(0x552B70, &CVehicle::CarHasRoof, PATCH_JUMP); - InjectHook(0x552230, &CVehicle::IsUpsideDown, PATCH_JUMP); - InjectHook(0x552260, &CVehicle::IsOnItsSide, PATCH_JUMP); - InjectHook(0x5511B0, &CVehicle::CanBeDeleted, PATCH_JUMP); - InjectHook(0x5522A0, &CVehicle::CanPedOpenLocks, PATCH_JUMP); - InjectHook(0x5522F0, &CVehicle::CanPedEnterCar, PATCH_JUMP); - InjectHook(0x5523C0, &CVehicle::CanPedExitCar, PATCH_JUMP); - InjectHook(0x5520C0, &CVehicle::SetUpDriver, PATCH_JUMP); - InjectHook(0x552160, &CVehicle::SetupPassenger, PATCH_JUMP); - InjectHook(0x551F20, &CVehicle::SetDriver, PATCH_JUMP); - InjectHook(0x551D90, (bool (CVehicle::*)(CPed*))&CVehicle::AddPassenger, PATCH_JUMP); - InjectHook(0x551E10, (bool (CVehicle::*)(CPed*,uint8))&CVehicle::AddPassenger, PATCH_JUMP); - InjectHook(0x5520A0, &CVehicle::RemoveDriver, PATCH_JUMP); - InjectHook(0x551EB0, &CVehicle::RemovePassenger, PATCH_JUMP); - InjectHook(0x5525A0, &CVehicle::ProcessCarAlarm, PATCH_JUMP); - InjectHook(0x552620, &CVehicle::IsSphereTouchingVehicle, PATCH_JUMP); - InjectHook(0x551950, &CVehicle::InflictDamage, PATCH_JUMP); -ENDPATCHES +} \ No newline at end of file diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp index 9e83a4ec..abf5c061 100644 --- a/src/weapons/BulletInfo.cpp +++ b/src/weapons/BulletInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "BulletInfo.h" #include "AnimBlendAssociation.h" diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp index 02243702..d0a68279 100644 --- a/src/weapons/Explosion.cpp +++ b/src/weapons/Explosion.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Automobile.h" #include "Bike.h" #include "Camera.h" @@ -457,17 +457,4 @@ CExplosion::RemoveAllExplosionsInArea(CVector pos, float radius) gaExplosion[i].m_nIteration = 0; } } -} - -STARTPATCHES - InjectHook(0x559030, &CExplosion::Initialise, PATCH_JUMP); - InjectHook(0x559100, &CExplosion::Shutdown, PATCH_JUMP); - InjectHook(0x559140, &CExplosion::GetExplosionActiveCounter, PATCH_JUMP); - InjectHook(0x559160, &CExplosion::ResetExplosionActiveCounter, PATCH_JUMP); - InjectHook(0x559180, &CExplosion::GetExplosionType, PATCH_JUMP); - InjectHook(0x5591A0, &CExplosion::GetExplosionPosition, PATCH_JUMP); - InjectHook(0x5591C0, &CExplosion::AddExplosion, PATCH_JUMP); - InjectHook(0x55A0C0, &CExplosion::Update, PATCH_JUMP); - InjectHook(0x55AC80, &CExplosion::TestForExplosionInArea, PATCH_JUMP); - InjectHook(0x55AD40, &CExplosion::RemoveAllExplosionsInArea, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +} \ No newline at end of file diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp index 8f04278c..c174305c 100644 --- a/src/weapons/ProjectileInfo.cpp +++ b/src/weapons/ProjectileInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Camera.h" #include "General.h" #include "Heli.h" @@ -287,16 +287,3 @@ CProjectileInfo::RemoveIfThisIsAProjectile(CObject *object) ms_apProjectile[i] = nil; return true; } - -STARTPATCHES - InjectHook(0x55ADF0, CProjectileInfo::Initialise, PATCH_JUMP); - InjectHook(0x55AFF0, CProjectileInfo::Shutdown, PATCH_JUMP); - InjectHook(0x55B010, CProjectileInfo::GetProjectileInfo, PATCH_JUMP); - InjectHook(0x55B030, CProjectileInfo::AddProjectile, PATCH_JUMP); - InjectHook(0x55B700, CProjectileInfo::RemoveProjectile, PATCH_JUMP); - InjectHook(0x55B770, CProjectileInfo::RemoveNotAdd, PATCH_JUMP); - InjectHook(0x55B7C0, CProjectileInfo::Update, PATCH_JUMP); - InjectHook(0x55BA50, CProjectileInfo::IsProjectileInRange, PATCH_JUMP); - InjectHook(0x55BB80, CProjectileInfo::RemoveAllProjectiles, PATCH_JUMP); - InjectHook(0x55BBD0, CProjectileInfo::RemoveIfThisIsAProjectile, PATCH_JUMP); -ENDPATCHES diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp index 1eae5e87..83ce2a02 100644 --- a/src/weapons/ShotInfo.cpp +++ b/src/weapons/ShotInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "ShotInfo.h" #include "Entity.h" #include "Weapon.h" @@ -128,11 +128,4 @@ CShotInfo::Update() if (!((CTimer::GetFrameCounter() + slot) & 3)) CWorld::SetCarsOnFire(shot.m_startPos.x, shot.m_startPos.y, shot.m_startPos.z, 4.0f, shot.m_sourceEntity); } -} - -STARTPATCHES - InjectHook(0x55BFF0, &CShotInfo::Update, PATCH_JUMP); - InjectHook(0x55BD70, &CShotInfo::AddShot, PATCH_JUMP); - InjectHook(0x55BC60, &CShotInfo::Initialise, PATCH_JUMP); - InjectHook(0x55BD50, &CShotInfo::Shutdown, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +} \ No newline at end of file diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 98154e93..276693e8 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Weapon.h" #include "AnimBlendAssociation.h" #include "AudioManager.h" @@ -2255,38 +2255,4 @@ bool CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects) { return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects); -} - -STARTPATCHES - - InjectHook(0x55C2D0, CWeapon::InitialiseWeapons, PATCH_JUMP); - InjectHook(0x55C2F0, CWeapon::ShutdownWeapons, PATCH_JUMP); - InjectHook(0x55C310, CWeapon::UpdateWeapons, PATCH_JUMP); - InjectHook(0x55C330, &CWeapon::Initialise, PATCH_JUMP); - InjectHook(0x55C380, &CWeapon::Fire, PATCH_JUMP); - InjectHook(0x55C940, &CWeapon::FireFromCar, PATCH_JUMP); - InjectHook(0x55CA20, &CWeapon::FireMelee, PATCH_JUMP); - InjectHook(0x55D2E0, &CWeapon::FireInstantHit, PATCH_JUMP); - InjectHook(0x55F770, &CWeapon::AddGunshell, PATCH_JUMP); - InjectHook(0x55F950, &CWeapon::DoBulletImpact, PATCH_JUMP); - InjectHook(0x560620, &CWeapon::FireShotgun, PATCH_JUMP); - InjectHook(0x561900, &CWeapon::FireProjectile, PATCH_JUMP); - InjectHook(0x561C70, CWeapon::GenerateFlameThrowerParticles, PATCH_JUMP); - InjectHook(0x561E00, &CWeapon::FireAreaEffect, PATCH_JUMP); - InjectHook(0x561FE0, &CWeapon::FireSniper, PATCH_JUMP); - InjectHook(0x562180, &CWeapon::FireM16_1stPerson, PATCH_JUMP); - InjectHook(0x5624D0, &CWeapon::FireInstantHitFromCar, PATCH_JUMP); - InjectHook(0x562EB0, CWeapon::DoDoomAiming, PATCH_JUMP); - InjectHook(0x563200, CWeapon::DoTankDoomAiming, PATCH_JUMP); - InjectHook(0x563660, CWeapon::DoDriveByAutoAiming, PATCH_JUMP); - InjectHook(0x5639D0, &CWeapon::Reload, PATCH_JUMP); - InjectHook(0x563A10, &CWeapon::Update, PATCH_JUMP); - InjectHook(0x563FB0, &CWeapon::IsTypeMelee, PATCH_JUMP); - InjectHook(0x563FD0, &CWeapon::IsType2Handed, PATCH_JUMP); - InjectHook(0x564680, CWeapon::MakePedsJumpAtShot, PATCH_JUMP); - InjectHook(0x564890, &CWeapon::HitsGround, PATCH_JUMP); - InjectHook(0x564A60, CWeapon::BlowUpExplosiveThings, PATCH_JUMP); - InjectHook(0x564B80, &CWeapon::HasWeaponAmmoToBeUsed, PATCH_JUMP); - InjectHook(0x564C00, CWeapon::ProcessLineOfSight, PATCH_JUMP); - -ENDPATCHES +} \ No newline at end of file diff --git a/src/weapons/WeaponEffects.cpp b/src/weapons/WeaponEffects.cpp index 2ed9e662..f7e50f78 100644 --- a/src/weapons/WeaponEffects.cpp +++ b/src/weapons/WeaponEffects.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "WeaponEffects.h" #include "TxdStore.h" #include "Sprite.h" @@ -93,14 +93,4 @@ CWeaponEffects::Render(void) RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA); } -} - -STARTPATCHES - //InjectHook(0x564C40, CWeaponEffects::CWeaponEffects, PATCH_JUMP); - //InjectHook(0x564C50, CWeaponEffects::~CWeaponEffects, PATCH_JUMP); - InjectHook(0x564C60, CWeaponEffects::Init, PATCH_JUMP); - InjectHook(0x564CF0, CWeaponEffects::Shutdown, PATCH_JUMP); - InjectHook(0x564D00, CWeaponEffects::MarkTarget, PATCH_JUMP); - InjectHook(0x564D60, CWeaponEffects::ClearCrossHair, PATCH_JUMP); - InjectHook(0x564D70, CWeaponEffects::Render, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +} \ No newline at end of file diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index dca120a3..aec9c69a 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "main.h" #include "FileMgr.h" #include "WeaponInfo.h" @@ -201,13 +201,4 @@ CWeaponInfo::Shutdown(void) { debug("Shutting down CWeaponInfo...\n"); debug("CWeaponInfo shut down\n"); -} - -STARTPATCHES - InjectHook(0x564EA0, &CWeaponInfo::Initialise, PATCH_JUMP); - InjectHook(0x564FD0, &CWeaponInfo::GetWeaponInfo, PATCH_JUMP); - InjectHook(0x5653E0, &CWeaponInfo::FindWeaponType, PATCH_JUMP); - InjectHook(0x5653B0, &CWeaponInfo::FindWeaponFireType, PATCH_JUMP); - InjectHook(0x564FE0, &CWeaponInfo::LoadWeaponData, PATCH_JUMP); - InjectHook(0x564FB0, &CWeaponInfo::Shutdown, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3 From 49a5df77be4383c00b154188317f8fb576502565 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 17 Apr 2020 16:46:34 +0300 Subject: appveyor setup --- .appveyor.yml | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 41ada399..a1b526be 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,38 +10,17 @@ install: - cmd: >- git submodule update --init --recursive - premake-vs2019.cmd -build: - project: build/re3.sln - verbosity: minimal -after_build: -# downloading latest release of UAL to make release with UAL and ASI. -- ps: >- - $releases = "https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases" - - $name = "Ultimate-ASI-Loader.zip" - - $latestRelease = Invoke-WebRequest $releases/latest -Headers @{"Accept"="application/json"} - - $json = $latestRelease.Content | ConvertFrom-Json - - $latestVersion = $json.tag_name + copy premake5.exe "librw/premake5.exe" - $url = "$releases/download/$latestVersion/$name" + cd "librw" && premake5 vs2019 && msbuild "build/librw.sln" /property:Configuration=%CONFIGURATION% /property:Platform="win-x86-d3d9" - Start-FileDownload $url -FileName 'C:\Ultimate-ASI-Loader.zip' + cd "%APPVEYOR_BUILD_FOLDER%" && premake5 vs2019 - 7z e c:\Ultimate-ASI-Loader.zip -oc:\Projects\re3\bin\${env:CONFIGURATION} - - cd "bin\${env:CONFIGURATION}" - - copy re3.dll re3.asi - - 7z u "RE3_${env:CONFIGURATION}+UAL.zip" re3.asi dinput8.dll - - Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } +build: + project: build/re3.sln + verbosity: minimal artifacts: -- path: bin/%CONFIGURATION%/re3.dll - name: re3.dll +- path: bin/%CONFIGURATION%/re3.exe + name: re3.exe - path: bin/%CONFIGURATION%/re3.pdb name: re3.pdb -- cgit v1.2.3