summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-14 21:29:23 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-14 21:29:23 +0200
commit09a0207e55ac8a69639c85997c330ec0f7caf4a6 (patch)
treef7784f9199ee39054ca94a1f6cf5de880c7c243f /src/peds
parentmore pedattractor (diff)
parentFix compilation (diff)
downloadre3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.gz
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.bz2
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.lz
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.xz
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.tar.zst
re3-09a0207e55ac8a69639c85997c330ec0f7caf4a6.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/Ped.cpp36
-rw-r--r--src/peds/PedIK.cpp2
-rw-r--r--src/peds/PlayerPed.cpp24
3 files changed, 37 insertions, 25 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 4c3727cf..1441e1d5 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -16337,7 +16337,11 @@ CPed::SeekCar(void)
}
if (dest.x == 0.0f && dest.y == 0.0f) {
+#ifdef FIX_BUGS
+ if ((!IsPlayer() && CharCreatedBy != MISSION_CHAR) || vehToSeek->VehicleCreatedBy != MISSION_VEHICLE || vehToSeek->pDriver || !vehToSeek->CanPedOpenLocks(this)) {
+#else
if ((!IsPlayer() && CharCreatedBy != MISSION_CHAR) || vehToSeek->VehicleCreatedBy != MISSION_VEHICLE || vehToSeek->pDriver) {
+#endif
RestorePreviousState();
if (IsPlayer()) {
ClearObjective();
@@ -18020,23 +18024,25 @@ CPed::ClearWaitState(void)
}
#ifdef COMPATIBLE_SAVES
+#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
+#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
void
CPed::Save(uint8*& buf)
{
SkipSaveBuf(buf, 52);
- WriteSaveBuf<float>(buf, GetPosition().x);
- WriteSaveBuf<float>(buf, GetPosition().y);
- WriteSaveBuf<float>(buf, GetPosition().z);
+ CopyToBuf(buf, GetPosition().x);
+ CopyToBuf(buf, GetPosition().y);
+ CopyToBuf(buf, GetPosition().z);
SkipSaveBuf(buf, 288);
- WriteSaveBuf<uint8>(buf, CharCreatedBy);
+ CopyToBuf(buf, CharCreatedBy);
SkipSaveBuf(buf, 351);
- WriteSaveBuf<float>(buf, m_fHealth);
- WriteSaveBuf<float>(buf, m_fArmour);
+ CopyToBuf(buf, m_fHealth);
+ CopyToBuf(buf, m_fArmour);
SkipSaveBuf(buf, 148);
for (int i = 0; i < 13; i++) // has to be hardcoded
m_weapons[i].Save(buf);
SkipSaveBuf(buf, 5);
- WriteSaveBuf<uint8>(buf, m_maxWeaponTypeAllowed);
+ CopyToBuf(buf, m_maxWeaponTypeAllowed);
SkipSaveBuf(buf, 162);
}
@@ -18044,19 +18050,21 @@ void
CPed::Load(uint8*& buf)
{
SkipSaveBuf(buf, 52);
- GetMatrix().GetPosition().x = ReadSaveBuf<float>(buf);
- GetMatrix().GetPosition().y = ReadSaveBuf<float>(buf);
- GetMatrix().GetPosition().z = ReadSaveBuf<float>(buf);
+ CopyFromBuf(buf, GetMatrix().GetPosition().x);
+ CopyFromBuf(buf, GetMatrix().GetPosition().y);
+ CopyFromBuf(buf, GetMatrix().GetPosition().z);
SkipSaveBuf(buf, 288);
- CharCreatedBy = ReadSaveBuf<uint8>(buf);
+ CopyFromBuf(buf, CharCreatedBy);
SkipSaveBuf(buf, 351);
- m_fHealth = ReadSaveBuf<float>(buf);
- m_fArmour = ReadSaveBuf<float>(buf);
+ CopyFromBuf(buf, m_fHealth);
+ CopyFromBuf(buf, m_fArmour);
SkipSaveBuf(buf, 148);
for (int i = 0; i < 13; i++) // has to be hardcoded
m_weapons[i].Load(buf);
SkipSaveBuf(buf, 5);
- m_maxWeaponTypeAllowed = ReadSaveBuf<uint8>(buf);
+ CopyFromBuf(buf, m_maxWeaponTypeAllowed);
SkipSaveBuf(buf, 162);
}
+#undef CopyFromBuf
+#undef CopyToBuf
#endif
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index 0c7509eb..9dae5ff1 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -65,7 +65,7 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
// this function is always called with PED_MID, so we know the parent frame.
// Trouble is that PED_MID is "Smid" on PS2/PC but BONE_torso on mobile/xbox...
// so this doesn't exactly do what we'd like anyway
- RwMatrix *mat = GetComponentMatrix(m_ped, PED_MID);
+ RwMatrix* mat = GetComponentMatrix(m_ped, PED_MID);
RwV3d vec1, vec2;
vec1.x = mat->right.z;
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 92e3d358..3c6fad57 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1513,17 +1513,19 @@ CPlayerPed::ProcessControl(void)
}
#ifdef COMPATIBLE_SAVES
+#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
+#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
void
CPlayerPed::Save(uint8*& buf)
{
CPed::Save(buf);
SkipSaveBuf(buf, 16);
- WriteSaveBuf<float>(buf, m_fMaxStamina);
+ CopyToBuf(buf, m_fMaxStamina);
SkipSaveBuf(buf, 28);
- WriteSaveBuf<int32>(buf, m_nTargettableObjects[0]);
- WriteSaveBuf<int32>(buf, m_nTargettableObjects[1]);
- WriteSaveBuf<int32>(buf, m_nTargettableObjects[2]);
- WriteSaveBuf<int32>(buf, m_nTargettableObjects[3]);
+ CopyToBuf(buf, m_nTargettableObjects[0]);
+ CopyToBuf(buf, m_nTargettableObjects[1]);
+ CopyToBuf(buf, m_nTargettableObjects[2]);
+ CopyToBuf(buf, m_nTargettableObjects[3]);
SkipSaveBuf(buf, 116);
}
@@ -1532,12 +1534,14 @@ CPlayerPed::Load(uint8*& buf)
{
CPed::Load(buf);
SkipSaveBuf(buf, 16);
- m_fMaxStamina = ReadSaveBuf<float>(buf);
+ CopyFromBuf(buf, m_fMaxStamina);
SkipSaveBuf(buf, 28);
- m_nTargettableObjects[0] = ReadSaveBuf<int32>(buf);
- m_nTargettableObjects[1] = ReadSaveBuf<int32>(buf);
- m_nTargettableObjects[2] = ReadSaveBuf<int32>(buf);
- m_nTargettableObjects[3] = ReadSaveBuf<int32>(buf);
+ CopyFromBuf(buf, m_nTargettableObjects[0]);
+ CopyFromBuf(buf, m_nTargettableObjects[1]);
+ CopyFromBuf(buf, m_nTargettableObjects[2]);
+ CopyFromBuf(buf, m_nTargettableObjects[3]);
SkipSaveBuf(buf, 116);
}
+#undef CopyFromBuf
+#undef CopyToBuf
#endif