diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-06-25 23:25:59 +0200 |
---|---|---|
committer | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-06-25 23:25:59 +0200 |
commit | af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f (patch) | |
tree | 75a719bb1ab82b354f464562ecc1fae9c55f64d0 /src/vehicles | |
parent | Merge pull request #1147 from withmorten/githash (diff) | |
download | re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.gz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.bz2 re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.lz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.xz re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.tar.zst re3-af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f.zip |
Diffstat (limited to 'src/vehicles')
-rw-r--r-- | src/vehicles/Automobile.cpp | 3 | ||||
-rw-r--r-- | src/vehicles/Boat.cpp | 1 | ||||
-rw-r--r-- | src/vehicles/CarGen.cpp | 20 | ||||
-rw-r--r-- | src/vehicles/Cranes.cpp | 7 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 65 |
5 files changed, 43 insertions, 53 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 7be6ed0b..c29c0536 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -45,7 +45,6 @@ #include "Object.h" #include "Automobile.h" #include "Wanted.h" -#include "SaveBuf.h" bool bAllCarCheat; // unused @@ -4725,7 +4724,7 @@ void CAutomobile::Load(uint8*& buf) { CVehicle::Load(buf); - ReadSaveBuf(&Damage, buf); + Damage = ReadSaveBuf<CDamageManager>(buf); SkipSaveBuf(buf, 800 - sizeof(CDamageManager)); SetupDamageAfterLoad(); } diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index bbe17f0b..4bbbadbd 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -19,7 +19,6 @@ #include "Pools.h" #include "Pad.h" #include "Boat.h" -#include "SaveBuf.h" #define INVALID_ORIENTATION (-9999.99f) diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 22b2fc60..7524444b 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -13,7 +13,6 @@ #include "Timer.h" #include "Vehicle.h" #include "World.h" -#include "SaveBuf.h" uint8 CTheCarGenerators::ProcessCounter; uint32 CTheCarGenerators::NumOfCarGenerators; @@ -255,17 +254,14 @@ void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size) Init(); INITSAVEBUF CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE); - uint32 tmp; - ReadSaveBuf(&tmp, buffer); - assert(tmp == nGeneralDataSize); - ReadSaveBuf(&NumOfCarGenerators, buffer); - ReadSaveBuf(&CurrentActiveCount, buffer); - ReadSaveBuf(&ProcessCounter, buffer); - ReadSaveBuf(&GenerateEvenIfPlayerIsCloseCounter, buffer); - SkipSaveBuf(buffer, 2); - ReadSaveBuf(&tmp, buffer); - assert(tmp == sizeof(CarGeneratorArray)); + assert(ReadSaveBuf<uint32>(buffer) == nGeneralDataSize); + NumOfCarGenerators = ReadSaveBuf<uint32>(buffer); + CurrentActiveCount = ReadSaveBuf<uint32>(buffer); + ProcessCounter = ReadSaveBuf<uint8>(buffer); + GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer); + ReadSaveBuf<int16>(buffer); // alignment + assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray)); for (int i = 0; i < NUM_CARGENS; i++) - ReadSaveBuf(&CarGeneratorArray[i], buffer); + CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer); VALIDATESAVEBUF(size) } diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 0f1b8b4c..0c7913af 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -11,7 +11,6 @@ #include "Replay.h" #include "Object.h" #include "World.h" -#include "SaveBuf.h" #define MAX_DISTANCE_TO_FIND_CRANE (10.0f) #define CRANE_UPDATE_RADIUS (300.0f) @@ -654,10 +653,10 @@ void CCranes::Load(uint8* buf, uint32 size) { INITSAVEBUF - ReadSaveBuf(&NumCranes, buf); - ReadSaveBuf(&CarsCollectedMilitaryCrane, buf); + NumCranes = ReadSaveBuf<int32>(buf); + CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf); for (int i = 0; i < NUM_CRANES; i++) - ReadSaveBuf(&aCranes[i], buf); + aCranes[i] = ReadSaveBuf<CCrane>(buf); for (int i = 0; i < NUM_CRANES; i++) { CCrane *pCrane = &aCranes[i]; if (pCrane->m_pCraneEntity != nil) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 8112f0fe..8885485d 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -18,7 +18,6 @@ #include "Radar.h" #include "Fire.h" #include "Darkel.h" -#include "SaveBuf.h" bool CVehicle::bWheelsOnlyCheat; bool CVehicle::bAllDodosCheat; @@ -1324,44 +1323,43 @@ CVehicle::Load(uint8*& buf) { CMatrix tmp; SkipSaveBuf(buf, 4); - ReadSaveBuf(&tmp.GetRight().x, buf); - ReadSaveBuf(&tmp.GetRight().y, buf); - ReadSaveBuf(&tmp.GetRight().z, buf); + tmp.GetRight().x = ReadSaveBuf<float>(buf); + tmp.GetRight().y = ReadSaveBuf<float>(buf); + tmp.GetRight().z = ReadSaveBuf<float>(buf); SkipSaveBuf(buf, 4); - ReadSaveBuf(&tmp.GetForward().x, buf); - ReadSaveBuf(&tmp.GetForward().y, buf); - ReadSaveBuf(&tmp.GetForward().z, buf); + tmp.GetForward().x = ReadSaveBuf<float>(buf); + tmp.GetForward().y = ReadSaveBuf<float>(buf); + tmp.GetForward().z = ReadSaveBuf<float>(buf); SkipSaveBuf(buf, 4); - ReadSaveBuf(&tmp.GetUp().x, buf); - ReadSaveBuf(&tmp.GetUp().y, buf); - ReadSaveBuf(&tmp.GetUp().z, buf); + tmp.GetUp().x = ReadSaveBuf<float>(buf); + tmp.GetUp().y = ReadSaveBuf<float>(buf); + tmp.GetUp().z = ReadSaveBuf<float>(buf); SkipSaveBuf(buf, 4); - ReadSaveBuf(&tmp.GetPosition().x, buf); - ReadSaveBuf(&tmp.GetPosition().y, buf); - ReadSaveBuf(&tmp.GetPosition().z, buf); + tmp.GetPosition().x = ReadSaveBuf<float>(buf); + tmp.GetPosition().y = ReadSaveBuf<float>(buf); + tmp.GetPosition().z = ReadSaveBuf<float>(buf); m_matrix = tmp; SkipSaveBuf(buf, 16); LoadEntityFlags(buf); SkipSaveBuf(buf, 212); AutoPilot.Load(buf); - ReadSaveBuf(&m_currentColour1, buf); - ReadSaveBuf(&m_currentColour2, buf); + m_currentColour1 = ReadSaveBuf<int8>(buf); + m_currentColour2 = ReadSaveBuf<int8>(buf); SkipSaveBuf(buf, 2); - ReadSaveBuf(&m_nAlarmState, buf); + m_nAlarmState = ReadSaveBuf<int16>(buf); SkipSaveBuf(buf, 43); - ReadSaveBuf(&m_nNumMaxPassengers, buf); + m_nNumMaxPassengers = ReadSaveBuf<int8>(buf); SkipSaveBuf(buf, 2); - ReadSaveBuf(&field_1D0[0], buf); - ReadSaveBuf(&field_1D0[1], buf); - ReadSaveBuf(&field_1D0[2], buf); - ReadSaveBuf(&field_1D0[3], buf); + field_1D0[0] = ReadSaveBuf<float>(buf); + field_1D0[1] = ReadSaveBuf<float>(buf); + field_1D0[2] = ReadSaveBuf<float>(buf); + field_1D0[3] = ReadSaveBuf<float>(buf); SkipSaveBuf(buf, 8); - ReadSaveBuf(&m_fSteerAngle, buf); - ReadSaveBuf(&m_fGasPedal, buf); - ReadSaveBuf(&m_fBrakePedal, buf); - ReadSaveBuf(&VehicleCreatedBy, buf); - uint8 flags; - ReadSaveBuf(&flags, buf); + m_fSteerAngle = ReadSaveBuf<float>(buf); + m_fGasPedal = ReadSaveBuf<float>(buf); + m_fBrakePedal = ReadSaveBuf<float>(buf); + VehicleCreatedBy = ReadSaveBuf<uint8>(buf); + uint8 flags = ReadSaveBuf<uint8>(buf); bIsLawEnforcer = !!(flags & BIT(0)); bIsLocked = !!(flags & BIT(3)); bEngineOn = !!(flags & BIT(4)); @@ -1369,17 +1367,16 @@ CVehicle::Load(uint8*& buf) bLightsOn = !!(flags & BIT(6)); bFreebies = !!(flags & BIT(7)); SkipSaveBuf(buf, 10); - ReadSaveBuf(&m_fHealth, buf); - ReadSaveBuf(&m_nCurrentGear, buf); + m_fHealth = ReadSaveBuf<float>(buf); + m_nCurrentGear = ReadSaveBuf<uint8>(buf); SkipSaveBuf(buf, 3); - ReadSaveBuf(&m_fChangeGearTime, buf); + m_fChangeGearTime = ReadSaveBuf<float>(buf); SkipSaveBuf(buf, 4); - ReadSaveBuf(&m_nTimeOfDeath, buf); + m_nTimeOfDeath = ReadSaveBuf<uint32>(buf); SkipSaveBuf(buf, 2); - ReadSaveBuf(&m_nBombTimer, buf); + m_nBombTimer = ReadSaveBuf<int16>(buf); SkipSaveBuf(buf, 12); - ReadSaveBuf(&flags, buf); - m_nDoorLock = (eCarLock)flags; + m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf); SkipSaveBuf(buf, 99); } #endif |