From f372ce156d76350ef4705ecbf488b43484878ca2 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 2 May 2020 18:02:17 +0300 Subject: changed saving compatibility --- src/peds/Ped.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/peds/Ped.cpp') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index f81ffb71..d2fa72c3 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(buf, GetPosition().x); + WriteSaveBuf(buf, GetPosition().y); + WriteSaveBuf(buf, GetPosition().z); + SkipSaveBuf(buf, 288); + WriteSaveBuf(buf, CharCreatedBy); + SkipSaveBuf(buf, 351); + WriteSaveBuf(buf, m_fHealth); + WriteSaveBuf(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(buf, m_maxWeaponTypeAllowed); + SkipSaveBuf(buf, 162); +} + +void +CPed::Load(uint8*& buf) +{ + SkipSaveBuf(buf, 52); + GetPosition().x = ReadSaveBuf(buf); + GetPosition().y = ReadSaveBuf(buf); + GetPosition().z = ReadSaveBuf(buf); + SkipSaveBuf(buf, 288); + CharCreatedBy = ReadSaveBuf(buf); + SkipSaveBuf(buf, 351); + m_fHealth = ReadSaveBuf(buf); + m_fArmour = ReadSaveBuf(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(buf); + SkipSaveBuf(buf, 162); +} +#endif -- cgit v1.2.3