summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-02 22:48:17 +0200
committerGitHub <noreply@github.com>2020-05-02 22:48:17 +0200
commit4448156e29c1c2dc6db476bbde53926efdba7331 (patch)
tree4be7e31e00dacbdfb2a6fadfd414aab0eaf64c39 /src/peds/Ped.cpp
parentCeil health and armor values in hud (fix 99 health) (diff)
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-4448156e29c1c2dc6db476bbde53926efdba7331.tar
re3-4448156e29c1c2dc6db476bbde53926efdba7331.tar.gz
re3-4448156e29c1c2dc6db476bbde53926efdba7331.tar.bz2
re3-4448156e29c1c2dc6db476bbde53926efdba7331.tar.lz
re3-4448156e29c1c2dc6db476bbde53926efdba7331.tar.xz
re3-4448156e29c1c2dc6db476bbde53926efdba7331.tar.zst
re3-4448156e29c1c2dc6db476bbde53926efdba7331.zip
Diffstat (limited to 'src/peds/Ped.cpp')
-rw-r--r--src/peds/Ped.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 20fa93da..e7972541 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -17732,3 +17732,45 @@ CPed::SetExitBoat(CVehicle *boat)
// Not there in VC.
CWaterLevel::FreeBoatWakeArray();
}
+
+#ifdef COMPATIBLE_SAVES
+void
+CPed::Save(uint8*& buf)
+{
+ SkipSaveBuf(buf, 52);
+ WriteSaveBuf<float>(buf, GetPosition().x);
+ WriteSaveBuf<float>(buf, GetPosition().y);
+ WriteSaveBuf<float>(buf, GetPosition().z);
+ SkipSaveBuf(buf, 288);
+ WriteSaveBuf<uint8>(buf, CharCreatedBy);
+ SkipSaveBuf(buf, 351);
+ WriteSaveBuf<float>(buf, m_fHealth);
+ WriteSaveBuf<float>(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);
+ SkipSaveBuf(buf, 162);
+}
+
+void
+CPed::Load(uint8*& buf)
+{
+ SkipSaveBuf(buf, 52);
+ GetPosition().x = ReadSaveBuf<float>(buf);
+ GetPosition().y = ReadSaveBuf<float>(buf);
+ GetPosition().z = ReadSaveBuf<float>(buf);
+ SkipSaveBuf(buf, 288);
+ CharCreatedBy = ReadSaveBuf<uint8>(buf);
+ SkipSaveBuf(buf, 351);
+ m_fHealth = ReadSaveBuf<float>(buf);
+ m_fArmour = ReadSaveBuf<float>(buf);
+ 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);
+ SkipSaveBuf(buf, 162);
+}
+#endif