summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-12-12 21:05:12 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-12-12 21:05:12 +0100
commit01c95378e1cffe7ef09f44d992a0144d9a5691a4 (patch)
tree6e797ece1b38c9e86f9d7af6b97cc39fa897347c /src
parentfixed a bug (diff)
downloadre3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar.gz
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar.bz2
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar.lz
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar.xz
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.tar.zst
re3-01c95378e1cffe7ef09f44d992a0144d9a5691a4.zip
Diffstat (limited to 'src')
-rw-r--r--src/control/Garages.h3
-rw-r--r--src/control/Replay.cpp42
-rw-r--r--src/control/Replay.h5
-rw-r--r--src/core/Fire.cpp6
-rw-r--r--src/peds/PedAI.cpp8
5 files changed, 61 insertions, 3 deletions
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 79cef36e..34b74fb6 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -251,4 +251,7 @@ private:
friend class cAudioManager;
friend class CGarage;
+#ifdef FIX_BUGS
+ friend class CReplay;
+#endif
};
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 757af0a9..4732ba2f 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -10,6 +10,10 @@
#include "DMAudio.h"
#include "Draw.h"
#include "FileMgr.h"
+#ifdef FIX_BUGS
+#include "Fire.h"
+#include "Garages.h"
+#endif
#include "Heli.h"
#include "main.h"
#include "Matrix.h"
@@ -22,6 +26,10 @@
#include "Plane.h"
#include "Pools.h"
#include "Population.h"
+#ifdef FIX_BUGS
+#include "Projectile.h"
+#include "ProjectileInfo.h"
+#endif
#include "Replay.h"
#include "References.h"
#include "Pools.h"
@@ -102,6 +110,11 @@ float CReplay::fDistanceLookAroundCam;
float CReplay::fBetaAngleLookAroundCam;
float CReplay::fAlphaAngleLookAroundCam;
#ifdef FIX_BUGS
+uint8* CReplay::pGarages;
+CFire* CReplay::FireArray;
+uint32 CReplay::NumOfFires;
+uint8* CReplay::paProjectileInfo;
+uint8* CReplay::paProjectiles;
int CReplay::nHandleOfPlayerPed[NUMPLAYERS];
#endif
@@ -1156,6 +1169,17 @@ void CReplay::StoreStuffInMem(void)
if (ped)
StoreDetailedPedAnimation(ped, &pPedAnims[i]);
}
+#ifdef FIX_BUGS
+ pGarages = new uint8[sizeof(CGarages::aGarages)];
+ memcpy(pGarages, CGarages::aGarages, sizeof(CGarages::aGarages));
+ FireArray = new CFire[NUM_FIRES];
+ memcpy(FireArray, gFireManager.m_aFires, sizeof(gFireManager.m_aFires));
+ NumOfFires = gFireManager.m_nTotalFires;
+ paProjectileInfo = new uint8[sizeof(gaProjectileInfo)];
+ memcpy(paProjectileInfo, gaProjectileInfo, sizeof(gaProjectileInfo));
+ paProjectiles = new uint8[sizeof(CProjectileInfo::ms_apProjectile)];
+ memcpy(paProjectiles, CProjectileInfo::ms_apProjectile, sizeof(CProjectileInfo::ms_apProjectile));
+#endif
}
void CReplay::RestoreStuffFromMem(void)
@@ -1206,7 +1230,7 @@ void CReplay::RestoreStuffFromMem(void)
ped->m_rwObject = nil;
ped->m_modelIndex = -1;
ped->SetModelIndex(mi);
- ped->m_pVehicleAnim = 0;
+ ped->m_pVehicleAnim = nil;
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
@@ -1322,6 +1346,22 @@ void CReplay::RestoreStuffFromMem(void)
}
delete[] pPedAnims;
pPedAnims = nil;
+#ifdef FIX_BUGS
+ memcpy(CGarages::aGarages, pGarages, sizeof(CGarages::aGarages));
+ delete[] pGarages;
+ pGarages = nil;
+ memcpy(gFireManager.m_aFires, FireArray, sizeof(gFireManager.m_aFires));
+ delete[] FireArray;
+ FireArray = nil;
+ gFireManager.m_nTotalFires = NumOfFires;
+ memcpy(gaProjectileInfo, paProjectileInfo, sizeof(gaProjectileInfo));
+ delete[] paProjectileInfo;
+ paProjectileInfo = nil;
+ memcpy(CProjectileInfo::ms_apProjectile, paProjectiles, sizeof(CProjectileInfo::ms_apProjectile));
+ delete[] paProjectiles;
+ paProjectiles = nil;
+ //CExplosion::ClearAllExplosions(); not in III
+#endif
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.SetRadioInCar(OldRadioStation);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
diff --git a/src/control/Replay.h b/src/control/Replay.h
index cb58a602..aa2ecd86 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -275,6 +275,11 @@ private:
static float fAlphaAngleLookAroundCam;
static float fBetaAngleLookAroundCam;
#ifdef FIX_BUGS
+ static uint8* pGarages;
+ static CFire* FireArray;
+ static uint32 NumOfFires;
+ static uint8* paProjectileInfo;
+ static uint8* paProjectiles;
static int nHandleOfPlayerPed[NUMPLAYERS];
#endif
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index c6dece6a..e1be4194 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -90,7 +90,11 @@ CFire::ProcessFire(void)
}
}
}
- if (!FindPlayerVehicle() && !FindPlayerPed()->m_pFire && !(FindPlayerPed()->bFireProof)
+ if (!FindPlayerVehicle() &&
+#ifdef FIX_BUGS
+ FindPlayerPed() &&
+#endif
+ !FindPlayerPed()->m_pFire && !(FindPlayerPed()->bFireProof)
&& ((FindPlayerPed()->GetPosition() - m_vecPos).MagnitudeSqr() < 2.0f)) {
FindPlayerPed()->DoStuffToGoOnFire();
gFireManager.StartFire(FindPlayerPed(), m_pSource, 0.8f, 1);
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index 62b27134..367c876c 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -2990,9 +2990,15 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
}
if (ped->bFleeAfterExitingCar || ped->bGonnaKillTheCarJacker) {
- // POTENTIAL BUG? Why DOOR_FRONT_LEFT instead of door variable? or vice versa?
+#ifdef FIX_BUGS
+ if (!veh->IsDoorMissing(door))
+ ((CAutomobile*)veh)->Damage.SetDoorStatus(door, DOOR_STATUS_SWINGING);
+ PedSetOutCarCB(nil, ped);
+ return;
+#else
if (!veh->IsDoorMissing(door))
((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_LEFT, DOOR_STATUS_SWINGING);
+#endif
} else {
switch (door) {
case DOOR_FRONT_LEFT: