diff options
author | withmorten <morten.with@gmail.com> | 2021-06-26 19:14:46 +0200 |
---|---|---|
committer | withmorten <morten.with@gmail.com> | 2021-06-26 19:14:46 +0200 |
commit | f3a931e1c99372ae4bc224ef482d4052a09580cb (patch) | |
tree | 13992380234e68b8f1a32030b4df6aa3d6ebbaca /src/vehicles/Vehicle.cpp | |
parent | 090fa619b472301f5a6be1a1ab54c09870b210ce (diff) |
Revert "Revert "Redo ReadSaveBuf + common.h cleanup""
This reverts commit af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.
Diffstat (limited to 'src/vehicles/Vehicle.cpp')
-rw-r--r-- | src/vehicles/Vehicle.cpp | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index fee2eb10..86159c4e 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -18,6 +18,7 @@ #include "Radar.h" #include "Fire.h" #include "Darkel.h" +#include "SaveBuf.h" bool CVehicle::bWheelsOnlyCheat; bool CVehicle::bAllDodosCheat; @@ -1323,43 +1324,44 @@ CVehicle::Load(uint8*& buf) { CMatrix tmp; SkipSaveBuf(buf, 4); - tmp.GetRight().x = ReadSaveBuf<float>(buf); - tmp.GetRight().y = ReadSaveBuf<float>(buf); - tmp.GetRight().z = ReadSaveBuf<float>(buf); + ReadSaveBuf(&tmp.GetRight().x, buf); + ReadSaveBuf(&tmp.GetRight().y, buf); + ReadSaveBuf(&tmp.GetRight().z, buf); SkipSaveBuf(buf, 4); - tmp.GetForward().x = ReadSaveBuf<float>(buf); - tmp.GetForward().y = ReadSaveBuf<float>(buf); - tmp.GetForward().z = ReadSaveBuf<float>(buf); + ReadSaveBuf(&tmp.GetForward().x, buf); + ReadSaveBuf(&tmp.GetForward().y, buf); + ReadSaveBuf(&tmp.GetForward().z, buf); SkipSaveBuf(buf, 4); - tmp.GetUp().x = ReadSaveBuf<float>(buf); - tmp.GetUp().y = ReadSaveBuf<float>(buf); - tmp.GetUp().z = ReadSaveBuf<float>(buf); + ReadSaveBuf(&tmp.GetUp().x, buf); + ReadSaveBuf(&tmp.GetUp().y, buf); + ReadSaveBuf(&tmp.GetUp().z, buf); SkipSaveBuf(buf, 4); - tmp.GetPosition().x = ReadSaveBuf<float>(buf); - tmp.GetPosition().y = ReadSaveBuf<float>(buf); - tmp.GetPosition().z = ReadSaveBuf<float>(buf); + ReadSaveBuf(&tmp.GetPosition().x, buf); + ReadSaveBuf(&tmp.GetPosition().y, buf); + ReadSaveBuf(&tmp.GetPosition().z, buf); m_matrix = tmp; SkipSaveBuf(buf, 16); LoadEntityFlags(buf); SkipSaveBuf(buf, 212); AutoPilot.Load(buf); - m_currentColour1 = ReadSaveBuf<int8>(buf); - m_currentColour2 = ReadSaveBuf<int8>(buf); + ReadSaveBuf(&m_currentColour1, buf); + ReadSaveBuf(&m_currentColour2, buf); SkipSaveBuf(buf, 2); - m_nAlarmState = ReadSaveBuf<int16>(buf); + ReadSaveBuf(&m_nAlarmState, buf); SkipSaveBuf(buf, 43); - m_nNumMaxPassengers = ReadSaveBuf<int8>(buf); + ReadSaveBuf(&m_nNumMaxPassengers, buf); SkipSaveBuf(buf, 2); - field_1D0[0] = ReadSaveBuf<float>(buf); - field_1D0[1] = ReadSaveBuf<float>(buf); - field_1D0[2] = ReadSaveBuf<float>(buf); - field_1D0[3] = ReadSaveBuf<float>(buf); + ReadSaveBuf(&field_1D0[0], buf); + ReadSaveBuf(&field_1D0[1], buf); + ReadSaveBuf(&field_1D0[2], buf); + ReadSaveBuf(&field_1D0[3], buf); SkipSaveBuf(buf, 8); - m_fSteerAngle = ReadSaveBuf<float>(buf); - m_fGasPedal = ReadSaveBuf<float>(buf); - m_fBrakePedal = ReadSaveBuf<float>(buf); - VehicleCreatedBy = ReadSaveBuf<uint8>(buf); - uint8 flags = ReadSaveBuf<uint8>(buf); + ReadSaveBuf(&m_fSteerAngle, buf); + ReadSaveBuf(&m_fGasPedal, buf); + ReadSaveBuf(&m_fBrakePedal, buf); + ReadSaveBuf(&VehicleCreatedBy, buf); + uint8 flags; + ReadSaveBuf(&flags, buf); bIsLawEnforcer = !!(flags & BIT(0)); bIsLocked = !!(flags & BIT(3)); bEngineOn = !!(flags & BIT(4)); @@ -1367,16 +1369,17 @@ CVehicle::Load(uint8*& buf) bLightsOn = !!(flags & BIT(6)); bFreebies = !!(flags & BIT(7)); SkipSaveBuf(buf, 10); - m_fHealth = ReadSaveBuf<float>(buf); - m_nCurrentGear = ReadSaveBuf<uint8>(buf); + ReadSaveBuf(&m_fHealth, buf); + ReadSaveBuf(&m_nCurrentGear, buf); SkipSaveBuf(buf, 3); - m_fChangeGearTime = ReadSaveBuf<float>(buf); + ReadSaveBuf(&m_fChangeGearTime, buf); SkipSaveBuf(buf, 4); - m_nTimeOfDeath = ReadSaveBuf<uint32>(buf); + ReadSaveBuf(&m_nTimeOfDeath, buf); SkipSaveBuf(buf, 2); - m_nBombTimer = ReadSaveBuf<int16>(buf); + ReadSaveBuf(&m_nBombTimer, buf); SkipSaveBuf(buf, 12); - m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf); + ReadSaveBuf(&flags, buf); + m_nDoorLock = (eCarLock)flags; SkipSaveBuf(buf, 99); } #endif |