Merge remote-tracking branch 'samler/world' into Standalone

This commit is contained in:
Sergeanur 2020-04-17 10:16:30 +03:00
commit 881d61f811
9 changed files with 1010 additions and 39 deletions

View File

@ -28,6 +28,7 @@ public:
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; } static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
static bool IsRunning(void) { return ms_running; } static bool IsRunning(void) { return ms_running; }
static bool HasLoaded(void) { return ms_loaded; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; } static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; } static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; } static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }

View File

@ -1087,7 +1087,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
Playback.m_bSlot = first; Playback.m_bSlot = first;
Playback.m_nOffset = 0; Playback.m_nOffset = 0;
Playback.m_pBase = Buffers[first]; 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(); StoreStuffInMem();
EmptyPedsAndVehiclePools(); EmptyPedsAndVehiclePools();
SlowMotion = 1; SlowMotion = 1;

File diff suppressed because it is too large Load Diff

View File

@ -85,7 +85,7 @@ public:
} }
} }
static void ClearScanCodes(void); 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); static bool CameraToIgnoreThisObject(CEntity *ent);
@ -103,19 +103,26 @@ public:
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool); static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**); 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 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 FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); 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 FindGroundZForCoord(float x, float y);
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found); static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(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 RemoveReferencesToDeletedObject(CEntity*);
static void FindObjectsKindaColliding(const CVector &, float, bool, 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 FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool); 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 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 FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void ClearCarsFromArea(float, float, float, float, float, float); static void FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects);
static void ClearPedsFromArea(float, float, float, float, float, float); static void FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList);
static void CallOffChaseForArea(float, float, float, float);
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 GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); } static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
@ -131,19 +138,20 @@ public:
static void StopAllLawEnforcersInTheirTracks(); static void StopAllLawEnforcersInTheirTracks();
static void SetAllCarsCanBeDamaged(bool); static void SetAllCarsCanBeDamaged(bool);
static void ExtinguishAllCarFiresInArea(CVector, float); static void ExtinguishAllCarFiresInArea(CVector, float);
static void SetCarsOnFire(float, float, float, float, CEntity*); static void SetCarsOnFire(float x, float y, float z, float radius, CEntity* reason);
static void SetPedsOnFire(float, float, float, float, CEntity*); static void SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason);
static void Initialise(); static void Initialise();
static void AddParticles(); static void AddParticles();
static void ShutDown(); static void ShutDown();
static void ClearForRestart(void); static void ClearForRestart(void);
static void RepositionCertainDynamicObjects(); static void RepositionCertainDynamicObjects();
static void RepositionOneObject(CEntity* pEntity);
static void RemoveStaticObjects(); static void RemoveStaticObjects();
static void Process(); 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);
static void UseDetonator(CEntity *); static void UseDetonator(CEntity *pEntity);
}; };
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];

View File

@ -865,6 +865,16 @@ CEntity::ModifyMatrixForBannerInWind(void)
UpdateRwFrame(); UpdateRwFrame();
} }
void
CEntity::AddSteamsFromGround(CPtrList& list)
{
CPtrNode *pNode = list.first;
while (pNode) {
((CEntity*)pNode->item)->AddSteamsFromGround(nil);
pNode = pNode->next;
}
}
#include <new> #include <new>
class CEntity_ : public CEntity class CEntity_ : public CEntity
@ -912,7 +922,7 @@ STARTPATCHES
InjectHook(0x473F60, &CEntity::DetachFromRwObject, PATCH_JUMP); InjectHook(0x473F60, &CEntity::DetachFromRwObject, PATCH_JUMP);
InjectHook(0x475A20, &CEntity::PreRenderForGlassWindow, 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(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP);
InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP); InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP);
InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP); InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP);

View File

@ -4,6 +4,7 @@
#include "Placeable.h" #include "Placeable.h"
struct CReference; struct CReference;
class CPtrList;
enum eEntityType enum eEntityType
{ {
@ -152,5 +153,7 @@ public:
void ModifyMatrixForTreeInWind(void); void ModifyMatrixForTreeInWind(void);
void ModifyMatrixForBannerInWind(void); void ModifyMatrixForBannerInWind(void);
void ProcessLightsForEntity(void); void ProcessLightsForEntity(void);
static void AddSteamsFromGround(CPtrList& list);
}; };
static_assert(sizeof(CEntity) == 0x64, "CEntity: error"); static_assert(sizeof(CEntity) == 0x64, "CEntity: error");

View File

@ -497,3 +497,10 @@ IsExplosiveThingModel(int16 id)
return id == MI_EXPLODINGBARREL || return id == MI_EXPLODINGBARREL ||
id == MI_PETROLPUMP; id == MI_PETROLPUMP;
} }
inline bool
IsFence(int16 id)
{
return id == MI_FENCE ||
id == MI_FENCE2;
}

View File

@ -383,7 +383,7 @@ CObject::DeleteAllTempObjects()
} }
void void
CObject::DeleteAllTempObjectInArea(CVector point, float fRadius) CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius)
{ {
CObjectPool *objectPool = CPools::GetObjectPool(); CObjectPool *objectPool = CPools::GetObjectPool();
for (int32 i = 0; i < objectPool->GetSize(); i++) { for (int32 i = 0; i < objectPool->GetSize(); i++) {
@ -426,5 +426,5 @@ STARTPATCHES
InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP); InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP);
InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP); InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP);
InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP); InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP);
InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP); InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectsInArea, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -99,6 +99,6 @@ public:
static void DeleteAllMissionObjects(); static void DeleteAllMissionObjects();
static void DeleteAllTempObjects(); static void DeleteAllTempObjects();
static void DeleteAllTempObjectInArea(CVector point, float fRadius); static void DeleteAllTempObjectsInArea(CVector point, float fRadius);
}; };
static_assert(sizeof(CObject) == 0x198, "CObject: error"); static_assert(sizeof(CObject) == 0x198, "CObject: error");