mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
saves part 1
This commit is contained in:
parent
0cf2c8505e
commit
1195f3db7b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
|
||||||
|
#include "Bike.h"
|
||||||
#include "Boat.h"
|
#include "Boat.h"
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
@ -13,6 +14,8 @@
|
|||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
||||||
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
||||||
CPedPool *CPools::ms_pPedPool;
|
CPedPool *CPools::ms_pPedPool;
|
||||||
@ -24,7 +27,6 @@ CDummyPool *CPools::ms_pDummyPool;
|
|||||||
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
||||||
CColModelPool *CPools::ms_pColModelPool;
|
CColModelPool *CPools::ms_pColModelPool;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPools::Initialise(void)
|
CPools::Initialise(void)
|
||||||
{
|
{
|
||||||
@ -40,7 +42,6 @@ CPools::Initialise(void)
|
|||||||
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPools::ShutDown(void)
|
CPools::ShutDown(void)
|
||||||
{
|
{
|
||||||
@ -119,7 +120,8 @@ void CPools::LoadVehiclePool(uint8* buf, uint32 size)
|
|||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int nNumCars = ReadSaveBuf<int>(buf);
|
int nNumCars = ReadSaveBuf<int>(buf);
|
||||||
int nNumBoats = ReadSaveBuf<int>(buf);
|
int nNumBoats = ReadSaveBuf<int>(buf);
|
||||||
for (int i = 0; i < nNumCars + nNumBoats; i++) {
|
int nNumBikes = ReadSaveBuf<int>(buf);
|
||||||
|
for (int i = 0; i < nNumCars + nNumBoats + nNumBikes; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
uint32 type = ReadSaveBuf<uint32>(buf);
|
||||||
int16 model = ReadSaveBuf<int16>(buf);
|
int16 model = ReadSaveBuf<int16>(buf);
|
||||||
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
||||||
@ -131,13 +133,15 @@ INITSAVEBUF
|
|||||||
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
|
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
|
||||||
else if (type == VEHICLE_TYPE_CAR)
|
else if (type == VEHICLE_TYPE_CAR)
|
||||||
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
|
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
|
||||||
|
else if (type == VEHICLE_TYPE_BIKE)
|
||||||
|
pVehicle = new(slot) CBike(model, RANDOM_VEHICLE);
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
--CCarCtrl::NumRandomCars;
|
--CCarCtrl::NumRandomCars;
|
||||||
pVehicle->Load(buf);
|
pVehicle->Load(buf);
|
||||||
CWorld::Add(pVehicle);
|
CWorld::Add(pVehicle);
|
||||||
#else
|
#else
|
||||||
char* vbuf = new char[Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize)];
|
char* vbuf = new char[Max(CBike::nSaveStructSize, Max(CAutomobile::nSaveStructSize, CBoat::nSaveStructSize))];
|
||||||
if (type == VEHICLE_TYPE_BOAT) {
|
if (type == VEHICLE_TYPE_BOAT) {
|
||||||
memcpy(vbuf, buf, sizeof(CBoat));
|
memcpy(vbuf, buf, sizeof(CBoat));
|
||||||
SkipSaveBuf(buf, sizeof(CBoat));
|
SkipSaveBuf(buf, sizeof(CBoat));
|
||||||
@ -156,6 +160,17 @@ INITSAVEBUF
|
|||||||
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
|
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
|
||||||
pAutomobile->SetupDamageAfterLoad();
|
pAutomobile->SetupDamageAfterLoad();
|
||||||
}
|
}
|
||||||
|
else if (type == VEHICLE_TYPE_BIKE) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
memcpy(vbuf, buf, sizeof(CBike));
|
||||||
|
#else
|
||||||
|
memcpy(vbuf, buf, sizeof(CAutomobile));
|
||||||
|
#endif
|
||||||
|
SkipSaveBuf(buf, sizeof(CBike));
|
||||||
|
CBike* pBike = new(slot) CBike(model, RANDOM_VEHICLE);
|
||||||
|
pVehicle = pBike;
|
||||||
|
--CCarCtrl::NumRandomCars;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
|
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
|
||||||
@ -193,6 +208,7 @@ INITSAVEBUF
|
|||||||
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
|
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
|
||||||
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
|
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
|
||||||
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
|
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
|
||||||
|
CCarCtrl::UpdateCarCount(pVehicle, false);
|
||||||
CWorld::Add(pVehicle);
|
CWorld::Add(pVehicle);
|
||||||
delete[] vbuf;
|
delete[] vbuf;
|
||||||
#endif
|
#endif
|
||||||
@ -205,6 +221,7 @@ void CPools::SaveVehiclePool(uint8* buf, uint32* size)
|
|||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int nNumCars = 0;
|
int nNumCars = 0;
|
||||||
int nNumBoats = 0;
|
int nNumBoats = 0;
|
||||||
|
int nNumBikes = 0;
|
||||||
int nPoolSize = GetVehiclePool()->GetSize();
|
int nPoolSize = GetVehiclePool()->GetSize();
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||||
@ -226,19 +243,25 @@ INITSAVEBUF
|
|||||||
++nNumCars;
|
++nNumCars;
|
||||||
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
||||||
++nNumBoats;
|
++nNumBoats;
|
||||||
|
if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
|
||||||
|
++nNumBoats;
|
||||||
#else
|
#else
|
||||||
if (!pVehicle->pDriver && !bHasPassenger) {
|
if (!pVehicle->pDriver && !bHasPassenger) {
|
||||||
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
++nNumCars;
|
++nNumCars;
|
||||||
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
++nNumBoats;
|
++nNumBoats;
|
||||||
|
if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||||
|
++nNumBoats;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
|
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
|
||||||
nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int);
|
nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBoat::nSaveStructSize) + sizeof(int) +
|
||||||
|
nNumBikes * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CBike::nSaveStructSize) + sizeof(int);
|
||||||
WriteSaveBuf(buf, nNumCars);
|
WriteSaveBuf(buf, nNumCars);
|
||||||
WriteSaveBuf(buf, nNumBoats);
|
WriteSaveBuf(buf, nNumBoats);
|
||||||
|
WriteSaveBuf(buf, nNumBikes);
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||||
if (!pVehicle)
|
if (!pVehicle)
|
||||||
@ -258,9 +281,9 @@ INITSAVEBUF
|
|||||||
#endif
|
#endif
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
||||||
#else
|
#else
|
||||||
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
if ((pVehicle->IsCar() || pVehicle->IsBoat() || pVehicle->IsBike()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||||
#endif
|
#endif
|
||||||
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
|
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
|
||||||
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
|
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
|
||||||
@ -290,6 +313,17 @@ INITSAVEBUF
|
|||||||
memcpy(buf, pVehicle, sizeof(CBoat));
|
memcpy(buf, pVehicle, sizeof(CBoat));
|
||||||
SkipSaveBuf(buf, sizeof(CBoat));
|
SkipSaveBuf(buf, sizeof(CBoat));
|
||||||
}
|
}
|
||||||
|
#ifdef MISSION_REPLAY
|
||||||
|
if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
|
||||||
|
#else
|
||||||
|
if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||||
|
#endif
|
||||||
|
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
|
||||||
|
WriteSaveBuf(buf, pVehicle->GetModelIndex());
|
||||||
|
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
|
||||||
|
memcpy(buf, pVehicle, sizeof(CBike));
|
||||||
|
SkipSaveBuf(buf, sizeof(CBike));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,6 +370,7 @@ INITSAVEBUF
|
|||||||
tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
|
tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
|
||||||
CopyToBuf(buf, tmp);
|
CopyToBuf(buf, tmp);
|
||||||
CopyToBuf(buf, pObject->ObjectCreatedBy);
|
CopyToBuf(buf, pObject->ObjectCreatedBy);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
CopyToBuf(buf, bIsPickup);
|
CopyToBuf(buf, bIsPickup);
|
||||||
CopyToBuf(buf, bPickupObjWithMessage);
|
CopyToBuf(buf, bPickupObjWithMessage);
|
||||||
CopyToBuf(buf, bOutOfStock);
|
CopyToBuf(buf, bOutOfStock);
|
||||||
@ -343,6 +378,8 @@ INITSAVEBUF
|
|||||||
CopyToBuf(buf, bGlassBroken);
|
CopyToBuf(buf, bGlassBroken);
|
||||||
CopyToBuf(buf, bHasBeenDamaged);
|
CopyToBuf(buf, bHasBeenDamaged);
|
||||||
CopyToBuf(buf, bUseVehicleColours);
|
CopyToBuf(buf, bUseVehicleColours);
|
||||||
|
CopyToBuf(buf, pObject->m_unk);
|
||||||
|
CopyToBuf(buf, pObject->m_nBonusValue);
|
||||||
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
||||||
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
||||||
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
||||||
@ -392,6 +429,9 @@ INITSAVEBUF
|
|||||||
pBufferObject->bHasBeenDamaged = bitFlag;
|
pBufferObject->bHasBeenDamaged = bitFlag;
|
||||||
CopyFromBuf(buf, bitFlag);
|
CopyFromBuf(buf, bitFlag);
|
||||||
pBufferObject->bUseVehicleColours = bitFlag;
|
pBufferObject->bUseVehicleColours = bitFlag;
|
||||||
|
CopyFromBuf(buf, pBufferObject->m_unk);
|
||||||
|
CopyFromBuf(buf, pBufferObject->m_nBonusValue);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
CopyFromBuf(buf, pBufferObject->m_fCollisionDamageMultiplier);
|
CopyFromBuf(buf, pBufferObject->m_fCollisionDamageMultiplier);
|
||||||
CopyFromBuf(buf, pBufferObject->m_nCollisionDamageEffect);
|
CopyFromBuf(buf, pBufferObject->m_nCollisionDamageEffect);
|
||||||
CopyFromBuf(buf, pBufferObject->m_nSpecialCollisionResponseCases);
|
CopyFromBuf(buf, pBufferObject->m_nSpecialCollisionResponseCases);
|
||||||
@ -426,6 +466,8 @@ INITSAVEBUF
|
|||||||
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
|
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
|
||||||
#endif
|
#endif
|
||||||
pObject->bHasCollided = false;
|
pObject->bHasCollided = false;
|
||||||
|
pObject->m_unk = pBufferObject->m_unk;
|
||||||
|
pObject->m_nBonusValue = pBufferObject->m_nBonusValue;
|
||||||
CWorld::Add(pObject);
|
CWorld::Add(pObject);
|
||||||
delete[] obuf;
|
delete[] obuf;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,8 @@ public:
|
|||||||
uint8 bUseVehicleColours : 1;
|
uint8 bUseVehicleColours : 1;
|
||||||
uint8 bIsWeapon : 1;
|
uint8 bIsWeapon : 1;
|
||||||
uint8 bIsStreetLight : 1;
|
uint8 bIsStreetLight : 1;
|
||||||
int8 m_nBonusValue;
|
int8 m_nBonusValue;
|
||||||
|
uint16 m_unk; // TODO(MIAMI)
|
||||||
float m_fCollisionDamageMultiplier;
|
float m_fCollisionDamageMultiplier;
|
||||||
uint8 m_nCollisionDamageEffect;
|
uint8 m_nCollisionDamageEffect;
|
||||||
uint8 m_nSpecialCollisionResponseCases;
|
uint8 m_nSpecialCollisionResponseCases;
|
||||||
|
@ -20037,15 +20037,13 @@ CPed::Save(uint8*& buf)
|
|||||||
CopyToBuf(buf, GetPosition().z);
|
CopyToBuf(buf, GetPosition().z);
|
||||||
SkipSaveBuf(buf, 288);
|
SkipSaveBuf(buf, 288);
|
||||||
CopyToBuf(buf, CharCreatedBy);
|
CopyToBuf(buf, CharCreatedBy);
|
||||||
SkipSaveBuf(buf, 351);
|
SkipSaveBuf(buf, 499);
|
||||||
CopyToBuf(buf, m_fHealth);
|
CopyToBuf(buf, m_fHealth);
|
||||||
CopyToBuf(buf, m_fArmour);
|
CopyToBuf(buf, m_fArmour);
|
||||||
SkipSaveBuf(buf, 148);
|
SkipSaveBuf(buf, 172);
|
||||||
for (int i = 0; i < 13; i++) // has to be hardcoded
|
for (int i = 0; i < 10; i++) // has to be hardcoded
|
||||||
m_weapons[i].Save(buf);
|
m_weapons[i].Save(buf);
|
||||||
SkipSaveBuf(buf, 5);
|
SkipSaveBuf(buf, 252);
|
||||||
CopyToBuf(buf, m_maxWeaponTypeAllowed);
|
|
||||||
SkipSaveBuf(buf, 162);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -20057,16 +20055,15 @@ CPed::Load(uint8*& buf)
|
|||||||
CopyFromBuf(buf, GetMatrix().GetPosition().z);
|
CopyFromBuf(buf, GetMatrix().GetPosition().z);
|
||||||
SkipSaveBuf(buf, 288);
|
SkipSaveBuf(buf, 288);
|
||||||
CopyFromBuf(buf, CharCreatedBy);
|
CopyFromBuf(buf, CharCreatedBy);
|
||||||
SkipSaveBuf(buf, 351);
|
SkipSaveBuf(buf, 499);
|
||||||
CopyFromBuf(buf, m_fHealth);
|
CopyFromBuf(buf, m_fHealth);
|
||||||
CopyFromBuf(buf, m_fArmour);
|
CopyFromBuf(buf, m_fArmour);
|
||||||
SkipSaveBuf(buf, 148);
|
SkipSaveBuf(buf, 172);
|
||||||
|
m_currentWeapon = WEAPONTYPE_UNARMED;
|
||||||
|
|
||||||
CWeapon bufWeapon;
|
CWeapon bufWeapon;
|
||||||
for (int i = 0; i < 13; i++) { // has to be hardcoded
|
for (int i = 0; i < 10; i++) { // has to be hardcoded
|
||||||
bufWeapon.Load(buf);
|
bufWeapon.Load(buf);
|
||||||
if (i >= 10)
|
|
||||||
continue; // tmp hack before we fix save/load
|
|
||||||
|
|
||||||
if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) {
|
if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) {
|
||||||
int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId;
|
int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId;
|
||||||
@ -20081,9 +20078,7 @@ CPed::Load(uint8*& buf)
|
|||||||
GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal);
|
GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SkipSaveBuf(buf, 5);
|
SkipSaveBuf(buf, 252);
|
||||||
CopyFromBuf(buf, m_maxWeaponTypeAllowed);
|
|
||||||
SkipSaveBuf(buf, 162);
|
|
||||||
}
|
}
|
||||||
#undef CopyFromBuf
|
#undef CopyFromBuf
|
||||||
#undef CopyToBuf
|
#undef CopyToBuf
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
const uint32 CPlayerPed::nSaveStructSize =
|
const uint32 CPlayerPed::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1520;
|
1752;
|
||||||
#else
|
#else
|
||||||
sizeof(CPlayerPed);
|
sizeof(CPlayerPed);
|
||||||
#endif
|
#endif
|
||||||
@ -1949,7 +1949,7 @@ CPlayerPed::Load(uint8*& buf)
|
|||||||
CopyFromBuf(buf, m_nTargettableObjects[1]);
|
CopyFromBuf(buf, m_nTargettableObjects[1]);
|
||||||
CopyFromBuf(buf, m_nTargettableObjects[2]);
|
CopyFromBuf(buf, m_nTargettableObjects[2]);
|
||||||
CopyFromBuf(buf, m_nTargettableObjects[3]);
|
CopyFromBuf(buf, m_nTargettableObjects[3]);
|
||||||
SkipSaveBuf(buf, 116);
|
SkipSaveBuf(buf, 164);
|
||||||
}
|
}
|
||||||
#undef CopyFromBuf
|
#undef CopyFromBuf
|
||||||
#undef CopyToBuf
|
#undef CopyToBuf
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
|
|
||||||
#define BLOCK_COUNT 20
|
#define BLOCK_COUNT 20
|
||||||
#define SIZE_OF_SIMPLEVARS 0xFC
|
#define SIZE_OF_SIMPLEVARS 0xE4
|
||||||
|
|
||||||
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
||||||
|
|
||||||
@ -194,12 +194,6 @@ GenericSave(int file)
|
|||||||
WriteDataToBufferPointer(buf, CWeather::NewWeatherType);
|
WriteDataToBufferPointer(buf, CWeather::NewWeatherType);
|
||||||
WriteDataToBufferPointer(buf, CWeather::ForcedWeatherType);
|
WriteDataToBufferPointer(buf, CWeather::ForcedWeatherType);
|
||||||
WriteDataToBufferPointer(buf, CWeather::InterpolationValue);
|
WriteDataToBufferPointer(buf, CWeather::InterpolationValue);
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nSecond);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMinute);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nHour);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nDay);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMonth);
|
|
||||||
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nYear);
|
|
||||||
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
|
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
// converted to float for compatibility with original format
|
// converted to float for compatibility with original format
|
||||||
@ -331,12 +325,6 @@ GenericLoad()
|
|||||||
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
|
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
|
||||||
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
|
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
|
||||||
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
|
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nSecond);
|
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMinute);
|
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nHour);
|
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nDay);
|
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMonth);
|
|
||||||
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nYear);
|
|
||||||
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
|
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
// converted to float for compatibility with original format
|
// converted to float for compatibility with original format
|
||||||
|
@ -59,7 +59,7 @@ bool CAutomobile::m_sAllTaxiLights;
|
|||||||
|
|
||||||
const uint32 CAutomobile::nSaveStructSize =
|
const uint32 CAutomobile::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1448;
|
1500;
|
||||||
#else
|
#else
|
||||||
sizeof(CAutomobile);
|
sizeof(CAutomobile);
|
||||||
#endif
|
#endif
|
||||||
@ -5713,7 +5713,7 @@ CAutomobile::Save(uint8*& buf)
|
|||||||
{
|
{
|
||||||
CVehicle::Save(buf);
|
CVehicle::Save(buf);
|
||||||
WriteSaveBuf<CDamageManager>(buf, Damage);
|
WriteSaveBuf<CDamageManager>(buf, Damage);
|
||||||
SkipSaveBuf(buf, 800 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -5721,7 +5721,7 @@ CAutomobile::Load(uint8*& buf)
|
|||||||
{
|
{
|
||||||
CVehicle::Load(buf);
|
CVehicle::Load(buf);
|
||||||
Damage = ReadSaveBuf<CDamageManager>(buf);
|
Damage = ReadSaveBuf<CDamageManager>(buf);
|
||||||
SkipSaveBuf(buf, 800 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
SetupDamageAfterLoad();
|
SetupDamageAfterLoad();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,6 +39,14 @@
|
|||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
|
||||||
|
const uint32 CBike::nSaveStructSize =
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
1260;
|
||||||
|
#else
|
||||||
|
sizeof(CBoat);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// TODO: maybe put this somewhere else
|
// TODO: maybe put this somewhere else
|
||||||
inline void
|
inline void
|
||||||
GetRelativeMatrix(RwMatrix *mat, RwFrame *frm, RwFrame *end)
|
GetRelativeMatrix(RwMatrix *mat, RwFrame *frm, RwFrame *end)
|
||||||
@ -2922,3 +2930,19 @@ CBike::ReduceHornCounter(void)
|
|||||||
if(m_nCarHornTimer != 0)
|
if(m_nCarHornTimer != 0)
|
||||||
m_nCarHornTimer--;
|
m_nCarHornTimer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
void
|
||||||
|
CBike::Save(uint8*& buf)
|
||||||
|
{
|
||||||
|
CVehicle::Save(buf);
|
||||||
|
SkipSaveBuf(buf, 1260 - 672);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CBike::Load(uint8*& buf)
|
||||||
|
{
|
||||||
|
CVehicle::Load(buf);
|
||||||
|
SkipSaveBuf(buf, 1260 - 672);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -132,6 +132,12 @@ public:
|
|||||||
void Fix(void);
|
void Fix(void);
|
||||||
void SetupModelNodes(void);
|
void SetupModelNodes(void);
|
||||||
void ReduceHornCounter(void);
|
void ReduceHornCounter(void);
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
virtual void Save(uint8*& buf);
|
||||||
|
virtual void Load(uint8*& buf);
|
||||||
|
#endif
|
||||||
|
static const uint32 nSaveStructSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
// These functions and function names are made up
|
// These functions and function names are made up
|
||||||
|
@ -43,7 +43,7 @@ CBoat *CBoat::apFrameWakeGeneratingBoats[4];
|
|||||||
|
|
||||||
const uint32 CBoat::nSaveStructSize =
|
const uint32 CBoat::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
1156;
|
1216;
|
||||||
#else
|
#else
|
||||||
sizeof(CBoat);
|
sizeof(CBoat);
|
||||||
#endif
|
#endif
|
||||||
@ -1449,13 +1449,13 @@ void
|
|||||||
CBoat::Save(uint8*& buf)
|
CBoat::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Save(buf);
|
CVehicle::Save(buf);
|
||||||
SkipSaveBuf(buf, 1156 - 648);
|
SkipSaveBuf(buf, 1216 - 672);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CBoat::Load(uint8*& buf)
|
CBoat::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Load(buf);
|
CVehicle::Load(buf);
|
||||||
SkipSaveBuf(buf, 1156 - 648);
|
SkipSaveBuf(buf, 1216 - 672);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,7 +26,6 @@ public:
|
|||||||
};
|
};
|
||||||
CBuilding *m_pCraneEntity;
|
CBuilding *m_pCraneEntity;
|
||||||
CObject *m_pHook;
|
CObject *m_pHook;
|
||||||
int32 m_nAudioEntity;
|
|
||||||
float m_fPickupX1;
|
float m_fPickupX1;
|
||||||
float m_fPickupX2;
|
float m_fPickupX2;
|
||||||
float m_fPickupY1;
|
float m_fPickupY1;
|
||||||
|
@ -2367,15 +2367,15 @@ CVehicle::Save(uint8*& buf)
|
|||||||
WriteSaveBuf<float>(buf, GetPosition().z);
|
WriteSaveBuf<float>(buf, GetPosition().z);
|
||||||
SkipSaveBuf(buf, 16);
|
SkipSaveBuf(buf, 16);
|
||||||
SaveEntityFlags(buf);
|
SaveEntityFlags(buf);
|
||||||
SkipSaveBuf(buf, 212);
|
SkipSaveBuf(buf, 208);
|
||||||
AutoPilot.Save(buf);
|
AutoPilot.Save(buf);
|
||||||
WriteSaveBuf<int8>(buf, m_currentColour1);
|
WriteSaveBuf<int8>(buf, m_currentColour1);
|
||||||
WriteSaveBuf<int8>(buf, m_currentColour2);
|
WriteSaveBuf<int8>(buf, m_currentColour2);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<int16>(buf, m_nAlarmState);
|
WriteSaveBuf<int16>(buf, m_nAlarmState);
|
||||||
SkipSaveBuf(buf, 43);
|
SkipSaveBuf(buf, 42);
|
||||||
WriteSaveBuf<uint8>(buf, m_nNumMaxPassengers);
|
WriteSaveBuf<uint8>(buf, m_nNumMaxPassengers);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 3);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[0]);
|
WriteSaveBuf<float>(buf, field_1D0[0]);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[1]);
|
WriteSaveBuf<float>(buf, field_1D0[1]);
|
||||||
WriteSaveBuf<float>(buf, field_1D0[2]);
|
WriteSaveBuf<float>(buf, field_1D0[2]);
|
||||||
@ -2398,13 +2398,13 @@ CVehicle::Save(uint8*& buf)
|
|||||||
WriteSaveBuf<uint8>(buf, m_nCurrentGear);
|
WriteSaveBuf<uint8>(buf, m_nCurrentGear);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
WriteSaveBuf<float>(buf, m_fChangeGearTime);
|
WriteSaveBuf<float>(buf, m_fChangeGearTime);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 12);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeOfDeath);
|
WriteSaveBuf<uint32>(buf, m_nTimeOfDeath);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<int16>(buf, m_nBombTimer);
|
WriteSaveBuf<int16>(buf, m_nBombTimer);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
WriteSaveBuf<int8>(buf, m_nDoorLock);
|
WriteSaveBuf<int8>(buf, m_nDoorLock);
|
||||||
SkipSaveBuf(buf, 99);
|
SkipSaveBuf(buf, 111);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2430,15 +2430,15 @@ CVehicle::Load(uint8*& buf)
|
|||||||
m_matrix = tmp;
|
m_matrix = tmp;
|
||||||
SkipSaveBuf(buf, 16);
|
SkipSaveBuf(buf, 16);
|
||||||
LoadEntityFlags(buf);
|
LoadEntityFlags(buf);
|
||||||
SkipSaveBuf(buf, 212);
|
SkipSaveBuf(buf, 208);
|
||||||
AutoPilot.Load(buf);
|
AutoPilot.Load(buf);
|
||||||
m_currentColour1 = ReadSaveBuf<int8>(buf);
|
m_currentColour1 = ReadSaveBuf<int8>(buf);
|
||||||
m_currentColour2 = ReadSaveBuf<int8>(buf);
|
m_currentColour2 = ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nAlarmState = ReadSaveBuf<int16>(buf);
|
m_nAlarmState = ReadSaveBuf<int16>(buf);
|
||||||
SkipSaveBuf(buf, 43);
|
SkipSaveBuf(buf, 42);
|
||||||
m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
|
m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 3);
|
||||||
field_1D0[0] = ReadSaveBuf<float>(buf);
|
field_1D0[0] = ReadSaveBuf<float>(buf);
|
||||||
field_1D0[1] = ReadSaveBuf<float>(buf);
|
field_1D0[1] = ReadSaveBuf<float>(buf);
|
||||||
field_1D0[2] = ReadSaveBuf<float>(buf);
|
field_1D0[2] = ReadSaveBuf<float>(buf);
|
||||||
@ -2460,13 +2460,13 @@ CVehicle::Load(uint8*& buf)
|
|||||||
m_nCurrentGear = ReadSaveBuf<uint8>(buf);
|
m_nCurrentGear = ReadSaveBuf<uint8>(buf);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
m_fChangeGearTime = ReadSaveBuf<float>(buf);
|
m_fChangeGearTime = ReadSaveBuf<float>(buf);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
|
m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nBombTimer = ReadSaveBuf<int16>(buf);
|
m_nBombTimer = ReadSaveBuf<int16>(buf);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
|
m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
|
||||||
SkipSaveBuf(buf, 99);
|
SkipSaveBuf(buf, 111);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user