mirror of
https://github.com/halpz/re3.git
synced 2024-12-24 17:55:29 +00:00
Redo ReadSaveBuf + common.h cleanup
This commit is contained in:
parent
3587cb029e
commit
f8297df9c5
|
@ -3,6 +3,7 @@
|
||||||
#include "AudioScriptObject.h"
|
#include "AudioScriptObject.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
cAudioScriptObject::cAudioScriptObject()
|
cAudioScriptObject::cAudioScriptObject()
|
||||||
{
|
{
|
||||||
|
@ -53,12 +54,14 @@ cAudioScriptObject::LoadAllAudioScriptObjects(uint8 *buf, uint32 size)
|
||||||
|
|
||||||
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
int32 pool_size = ReadSaveBuf<int32>(buf);
|
int32 pool_size;
|
||||||
|
ReadSaveBuf(&pool_size, buf);
|
||||||
for (int32 i = 0; i < pool_size; i++) {
|
for (int32 i = 0; i < pool_size; i++) {
|
||||||
int handle = ReadSaveBuf<int32>(buf);
|
int32 handle;
|
||||||
|
ReadSaveBuf(&handle, buf);
|
||||||
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
||||||
assert(p != nil);
|
assert(p != nil);
|
||||||
*p = ReadSaveBuf<cAudioScriptObject>(buf);
|
ReadSaveBuf(p, buf);
|
||||||
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "Curves.h"
|
#include "Curves.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
void CAutoPilot::ModifySpeed(float speed)
|
void CAutoPilot::ModifySpeed(float speed)
|
||||||
{
|
{
|
||||||
|
@ -92,43 +93,44 @@ void CAutoPilot::Save(uint8*& buf)
|
||||||
|
|
||||||
void CAutoPilot::Load(uint8*& buf)
|
void CAutoPilot::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nCurrentRouteNode, buf);
|
||||||
m_nNextRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nNextRouteNode, buf);
|
||||||
m_nPrevRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nPrevRouteNode, buf);
|
||||||
m_nTimeEnteredCurve = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nTimeEnteredCurve, buf);
|
||||||
m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nTimeToSpendOnCurrentCurve, buf);
|
||||||
m_nCurrentPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nCurrentPathNodeInfo, buf);
|
||||||
m_nNextPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nNextPathNodeInfo, buf);
|
||||||
m_nPreviousPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nPreviousPathNodeInfo, buf);
|
||||||
m_nAntiReverseTimer = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nAntiReverseTimer, buf);
|
||||||
m_nTimeToStartMission = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeToStartMission, buf);
|
||||||
m_nPreviousDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nPreviousDirection, buf);
|
||||||
m_nCurrentDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nCurrentDirection, buf);
|
||||||
m_nNextDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nNextDirection, buf);
|
||||||
m_nCurrentLane = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nCurrentLane, buf);
|
||||||
m_nNextLane = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nNextLane, buf);
|
||||||
m_nDrivingStyle = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nDrivingStyle, buf);
|
||||||
m_nCarMission = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCarMission, buf);
|
||||||
m_nTempAction = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nTempAction, buf);
|
||||||
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeTempAction, buf);
|
||||||
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fMaxTrafficSpeed, buf);
|
||||||
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCruiseSpeed, buf);
|
||||||
m_nCruiseSpeedMultiplierType = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCruiseSpeedMultiplierType, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_fCruiseSpeedMultiplier = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fCruiseSpeedMultiplier, buf);
|
||||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
uint8 flags;
|
||||||
|
ReadSaveBuf(&flags, buf);
|
||||||
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
||||||
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
||||||
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
||||||
m_bStayInFastLane = !!(flags & BIT(3));
|
m_bStayInFastLane = !!(flags & BIT(3));
|
||||||
m_bIgnorePathfinding = !!(flags & BIT(4));
|
m_bIgnorePathfinding = !!(flags & BIT(4));
|
||||||
m_nSwitchDistance = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nSwitchDistance, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.x, buf);
|
||||||
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.y, buf);
|
||||||
m_vecDestinationCoors.z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.z, buf);
|
||||||
SkipSaveBuf(buf, 32);
|
SkipSaveBuf(buf, 32);
|
||||||
m_nPathFindNodesCount = ReadSaveBuf<int16>(buf);
|
ReadSaveBuf(&m_nPathFindNodesCount, buf);
|
||||||
SkipSaveBuf(buf, 6);
|
SkipSaveBuf(buf, 6);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -30,6 +30,7 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "MBlur.h"
|
#include "MBlur.h"
|
||||||
#include "screendroplets.h"
|
#include "screendroplets.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
uint8 CGameLogic::ActivePlayers;
|
uint8 CGameLogic::ActivePlayers;
|
||||||
uint8 CGameLogic::ShortCutState;
|
uint8 CGameLogic::ShortCutState;
|
||||||
|
@ -611,12 +612,12 @@ void
|
||||||
CGameLogic::Load(uint8* buf, uint32 size)
|
CGameLogic::Load(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
NumAfterDeathStartPoints = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&NumAfterDeathStartPoints, buf);
|
||||||
for (int i = 0; i < NUM_SHORTCUT_START_POINTS; i++) {
|
for (int i = 0; i < NUM_SHORTCUT_START_POINTS; i++) {
|
||||||
AfterDeathStartPoints[i].x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&AfterDeathStartPoints[i].x, buf);
|
||||||
AfterDeathStartPoints[i].y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&AfterDeathStartPoints[i].y, buf);
|
||||||
AfterDeathStartPoints[i].z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&AfterDeathStartPoints[i].z, buf);
|
||||||
AfterDeathStartPointOrientation[i] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&AfterDeathStartPointOrientation[i], buf);
|
||||||
}
|
}
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "VarConsole.h"
|
#include "VarConsole.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
#define CRUSHER_GARAGE_X1 (1135.5f)
|
#define CRUSHER_GARAGE_X1 (1135.5f)
|
||||||
#define CRUSHER_GARAGE_Y1 (57.0f)
|
#define CRUSHER_GARAGE_Y1 (57.0f)
|
||||||
|
@ -2309,22 +2310,25 @@ void CGarages::Load(uint8* buf, uint32 size)
|
||||||
assert(size = 7876);
|
assert(size = 7876);
|
||||||
//assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
//assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
||||||
CloseHideOutGaragesBeforeSave();
|
CloseHideOutGaragesBeforeSave();
|
||||||
NumGarages = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&NumGarages, buf);
|
||||||
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
int32 tempInt;
|
||||||
RespraysAreFree = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&tempInt, buf);
|
||||||
CarsCollected = ReadSaveBuf<int32>(buf);
|
BombsAreFree = tempInt ? true : false;
|
||||||
BankVansCollected = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&tempInt, buf);
|
||||||
PoliceCarsCollected = ReadSaveBuf<int32>(buf);
|
RespraysAreFree = tempInt ? true : false;
|
||||||
|
ReadSaveBuf(&CarsCollected, buf);
|
||||||
|
ReadSaveBuf(&BankVansCollected, buf);
|
||||||
|
ReadSaveBuf(&PoliceCarsCollected, buf);
|
||||||
for (int i = 0; i < TOTAL_COLLECTCARS_GARAGES; i++)
|
for (int i = 0; i < TOTAL_COLLECTCARS_GARAGES; i++)
|
||||||
CarTypesCollected[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&CarTypesCollected[i], buf);
|
||||||
LastTimeHelpMessage = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&LastTimeHelpMessage, buf);
|
||||||
for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) {
|
for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) {
|
||||||
for (int j = 0; j < TOTAL_HIDEOUT_GARAGES; j++) {
|
for (int j = 0; j < TOTAL_HIDEOUT_GARAGES; j++) {
|
||||||
aCarsInSafeHouses[j][i] = ReadSaveBuf<CStoredCar>(buf);
|
ReadSaveBuf(&aCarsInSafeHouses[j][i], buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_GARAGES; i++) {
|
for (int i = 0; i < NUM_GARAGES; i++) {
|
||||||
aGarages[i] = ReadSaveBuf<CGarage>(buf);
|
ReadSaveBuf(&aGarages[i], buf);
|
||||||
aGarages[i].m_pDoor1 = nil;
|
aGarages[i].m_pDoor1 = nil;
|
||||||
aGarages[i].m_pDoor2 = nil;
|
aGarages[i].m_pDoor2 = nil;
|
||||||
aGarages[i].m_pTarget = nil;
|
aGarages[i].m_pTarget = nil;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "AnimBlendAssociation.h"
|
#include "AnimBlendAssociation.h"
|
||||||
#include "soundlist.h"
|
#include "soundlist.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -197,10 +198,10 @@ void
|
||||||
CPhoneInfo::Load(uint8 *buf, uint32 size)
|
CPhoneInfo::Load(uint8 *buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
m_nMax = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nMax, buf);
|
||||||
m_nScriptPhonesMax = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nScriptPhonesMax, buf);
|
||||||
for (int i = 0; i < NUMPHONES; i++) {
|
for (int i = 0; i < NUMPHONES; i++) {
|
||||||
m_aPhones[i] = ReadSaveBuf<CPhone>(buf);
|
ReadSaveBuf(&m_aPhones[i], buf);
|
||||||
// It's saved as building pool index in save file, convert it to true entity
|
// It's saved as building pool index in save file, convert it to true entity
|
||||||
if (m_aPhones[i].m_pEntity) {
|
if (m_aPhones[i].m_pEntity) {
|
||||||
m_aPhones[i].m_pEntity = CPools::GetBuildingPool()->GetSlot((uintptr)m_aPhones[i].m_pEntity - 1);
|
m_aPhones[i].m_pEntity = CPools::GetBuildingPool()->GetSlot((uintptr)m_aPhones[i].m_pEntity - 1);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CPickup CPickups::aPickUps[NUMPICKUPS];
|
CPickup CPickups::aPickUps[NUMPICKUPS];
|
||||||
int16 CPickups::NumMessages;
|
int16 CPickups::NumMessages;
|
||||||
|
@ -1441,7 +1442,7 @@ CPickups::Load(uint8 *buf, uint32 size)
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
|
|
||||||
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
||||||
aPickUps[i] = ReadSaveBuf<CPickup>(buf);
|
ReadSaveBuf(&aPickUps[i], buf);
|
||||||
|
|
||||||
if (aPickUps[i].m_eType != PICKUP_NONE) {
|
if (aPickUps[i].m_eType != PICKUP_NONE) {
|
||||||
if (aPickUps[i].m_pObject != nil)
|
if (aPickUps[i].m_pObject != nil)
|
||||||
|
@ -1452,12 +1453,12 @@ INITSAVEBUF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectedPickUpIndex = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&CollectedPickUpIndex, buf);
|
||||||
ReadSaveBuf<uint16>(buf);
|
SkipSaveBuf(buf, 2);
|
||||||
NumMessages = 0;
|
NumMessages = 0;
|
||||||
|
|
||||||
for (uint16 i = 0; i < NUMCOLLECTEDPICKUPS; i++)
|
for (uint16 i = 0; i < NUMCOLLECTEDPICKUPS; i++)
|
||||||
aPickUpsCollected[i] = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&aPickUpsCollected[i], buf);
|
||||||
|
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Restart.h"
|
#include "Restart.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
uint8 CRestart::OverrideHospitalLevel;
|
uint8 CRestart::OverrideHospitalLevel;
|
||||||
uint8 CRestart::OverridePoliceStationLevel;
|
uint8 CRestart::OverridePoliceStationLevel;
|
||||||
|
@ -173,29 +174,28 @@ INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||||
HospitalRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&HospitalRestartPoints[i], buf);
|
||||||
HospitalRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&HospitalRestartHeadings[i], buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||||
PoliceRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&PoliceRestartPoints[i], buf);
|
||||||
PoliceRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&PoliceRestartHeadings[i], buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberOfHospitalRestarts = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&NumberOfHospitalRestarts, buf);
|
||||||
NumberOfPoliceRestarts = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&NumberOfPoliceRestarts, buf);
|
||||||
bOverrideRestart = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bOverrideRestart, buf);
|
||||||
|
|
||||||
// skip something unused
|
// skip something unused
|
||||||
ReadSaveBuf<uint8>(buf);
|
SkipSaveBuf(buf, 3);
|
||||||
ReadSaveBuf<uint16>(buf);
|
|
||||||
|
|
||||||
OverridePosition = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&OverridePosition, buf);
|
||||||
OverrideHeading = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&OverrideHeading, buf);
|
||||||
bFadeInAfterNextDeath = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bFadeInAfterNextDeath, buf);
|
||||||
bFadeInAfterNextArrest = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bFadeInAfterNextArrest, buf);
|
||||||
OverrideHospitalLevel = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&OverrideHospitalLevel, buf);
|
||||||
OverridePoliceStationLevel = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&OverridePoliceStationLevel, buf);
|
||||||
VALIDATESAVEBUF(size);
|
VALIDATESAVEBUF(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
void CRunningScript::UpdateCompareFlag(bool flag)
|
void CRunningScript::UpdateCompareFlag(bool flag)
|
||||||
{
|
{
|
||||||
|
@ -2184,15 +2185,19 @@ void CTheScripts::LoadAllScripts(uint8* buf, uint32 size)
|
||||||
Init();
|
Init();
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
|
||||||
uint32 varSpace = ReadSaveBuf<uint32>(buf);
|
uint32 varSpace, type, handle;
|
||||||
|
uint32 tmp;
|
||||||
|
|
||||||
|
ReadSaveBuf(&varSpace, buf);
|
||||||
for (uint32 i = 0; i < varSpace; i++)
|
for (uint32 i = 0; i < varSpace; i++)
|
||||||
ScriptSpace[i] = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&ScriptSpace[i], buf);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == SCRIPT_DATA_SIZE);
|
ReadSaveBuf(&tmp, buf);
|
||||||
OnAMissionFlag = ReadSaveBuf<uint32>(buf);
|
script_assert(tmp == SCRIPT_DATA_SIZE);
|
||||||
LastMissionPassedTime = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&OnAMissionFlag, buf);
|
||||||
|
ReadSaveBuf(&LastMissionPassedTime, buf);
|
||||||
for (uint32 i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
|
for (uint32 i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&type, buf);
|
||||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&handle, buf);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
BuildingSwapArray[i].m_pBuilding = nil;
|
BuildingSwapArray[i].m_pBuilding = nil;
|
||||||
|
@ -2206,14 +2211,14 @@ INITSAVEBUF
|
||||||
default:
|
default:
|
||||||
script_assert(false);
|
script_assert(false);
|
||||||
}
|
}
|
||||||
BuildingSwapArray[i].m_nNewModel = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&BuildingSwapArray[i].m_nNewModel, buf);
|
||||||
BuildingSwapArray[i].m_nOldModel = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&BuildingSwapArray[i].m_nOldModel, buf);
|
||||||
if (BuildingSwapArray[i].m_pBuilding)
|
if (BuildingSwapArray[i].m_pBuilding)
|
||||||
BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nNewModel);
|
BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nNewModel);
|
||||||
}
|
}
|
||||||
for (uint32 i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
|
for (uint32 i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&type, buf);
|
||||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&handle, buf);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
InvisibilitySettingArray[i] = nil;
|
InvisibilitySettingArray[i] = nil;
|
||||||
|
@ -2236,14 +2241,22 @@ INITSAVEBUF
|
||||||
if (InvisibilitySettingArray[i])
|
if (InvisibilitySettingArray[i])
|
||||||
InvisibilitySettingArray[i]->bIsVisible = false;
|
InvisibilitySettingArray[i]->bIsVisible = false;
|
||||||
}
|
}
|
||||||
script_assert(ReadSaveBuf<bool>(buf) == bUsingAMultiScriptFile);
|
bool tmpBool;
|
||||||
bPlayerHasMetDebbieHarry = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&tmpBool, buf);
|
||||||
ReadSaveBuf<uint16>(buf);
|
script_assert(tmpBool == bUsingAMultiScriptFile);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == MainScriptSize);
|
ReadSaveBuf(&bPlayerHasMetDebbieHarry, buf);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == LargestMissionScriptSize);
|
SkipSaveBuf(buf, 2);
|
||||||
script_assert(ReadSaveBuf<uint16>(buf) == NumberOfMissionScripts);
|
ReadSaveBuf(&tmp, buf);
|
||||||
script_assert(ReadSaveBuf<uint16>(buf) == NumberOfExclusiveMissionScripts);
|
script_assert(tmp == MainScriptSize);
|
||||||
uint32 runningScripts = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&tmp, buf);
|
||||||
|
script_assert(tmp == LargestMissionScriptSize);
|
||||||
|
uint16 tmp16;
|
||||||
|
ReadSaveBuf(&tmp16, buf);
|
||||||
|
script_assert(tmp16 == NumberOfMissionScripts);
|
||||||
|
ReadSaveBuf(&tmp16, buf);
|
||||||
|
script_assert(tmp16 == NumberOfExclusiveMissionScripts);
|
||||||
|
uint32 runningScripts;
|
||||||
|
ReadSaveBuf(&runningScripts, buf);
|
||||||
for (uint32 i = 0; i < runningScripts; i++)
|
for (uint32 i = 0; i < runningScripts; i++)
|
||||||
StartNewScript(0)->Load(buf);
|
StartNewScript(0)->Load(buf);
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
|
@ -2291,35 +2304,35 @@ void CRunningScript::Load(uint8*& buf)
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
SkipSaveBuf(buf, 8);
|
SkipSaveBuf(buf, 8);
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
ReadSaveBuf(&m_abScriptName[i], buf);
|
||||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nIp, buf);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_anStack[i], buf);
|
||||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&m_nStackPointer, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_anLocalVariables[i], buf);
|
||||||
m_bIsActive = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bIsActive, buf);
|
||||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bCondResult, buf);
|
||||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bIsMissionScript, buf);
|
||||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bSkipWakeTime, buf);
|
||||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nWakeTime, buf);
|
||||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&m_nAndOrState, buf);
|
||||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bNotFlag, buf);
|
||||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bDeatharrestEnabled, buf);
|
||||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bDeatharrestExecuted, buf);
|
||||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bMissionFlag, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
#else
|
#else
|
||||||
CRunningScript* n = next;
|
CRunningScript* n = next;
|
||||||
CRunningScript* p = prev;
|
CRunningScript* p = prev;
|
||||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
ReadSaveBuf(this, buf);
|
||||||
next = n;
|
next = n;
|
||||||
prev = p;
|
prev = p;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "VarConsole.h"
|
#include "VarConsole.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000
|
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000
|
||||||
|
|
||||||
|
@ -67,9 +68,9 @@ VALIDATESAVEBUF(*size)
|
||||||
void CSetPieces::Load(uint8* buf, uint32 size)
|
void CSetPieces::Load(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
NumSetPieces = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&NumSetPieces, buf);
|
||||||
for (int i = 0; i < NUM_SETPIECES; i++)
|
for (int i = 0; i < NUM_SETPIECES; i++)
|
||||||
aSetPieces[i] = ReadSaveBuf<CSetPiece>(buf);
|
ReadSaveBuf(&aSetPieces[i], buf);
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "MemoryHeap.h"
|
#include "MemoryHeap.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
CCPtrNodePool *CPools::ms_pPtrNodePool;
|
||||||
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
|
||||||
|
@ -137,15 +138,20 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
||||||
void CPools::LoadVehiclePool(uint8* buf, uint32 size)
|
void CPools::LoadVehiclePool(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int nNumCars = ReadSaveBuf<int>(buf);
|
int nNumCars, nNumBoats, nNumBikes;
|
||||||
int nNumBoats = ReadSaveBuf<int>(buf);
|
ReadSaveBuf(&nNumCars, buf);
|
||||||
int nNumBikes = ReadSaveBuf<int>(buf);
|
ReadSaveBuf(&nNumBoats, buf);
|
||||||
|
ReadSaveBuf(&nNumBikes, buf);
|
||||||
for (int i = 0; i < nNumCars + nNumBoats + nNumBikes; i++) {
|
for (int i = 0; i < nNumCars + nNumBoats + nNumBikes; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
uint32 type;
|
||||||
int16 model = ReadSaveBuf<int16>(buf);
|
int16 model;
|
||||||
|
int32 slot;
|
||||||
|
|
||||||
|
ReadSaveBuf(&type, buf);
|
||||||
|
ReadSaveBuf(&model, buf);
|
||||||
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
int32 slot = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&slot, buf);
|
||||||
CVehicle* pVehicle;
|
CVehicle* pVehicle;
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
if (type == VEHICLE_TYPE_BOAT)
|
if (type == VEHICLE_TYPE_BOAT)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
float CRadar::m_radarRange;
|
float CRadar::m_radarRange;
|
||||||
sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
|
sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
|
||||||
|
@ -973,21 +974,21 @@ INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
||||||
ms_RadarTrace[i].m_nColor = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_nColor, buf);
|
||||||
ms_RadarTrace[i].m_Radius = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_Radius, buf);
|
||||||
ms_RadarTrace[i].m_eBlipType = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_eBlipType, buf);
|
||||||
ms_RadarTrace[i].m_nEntityHandle = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_nEntityHandle, buf);
|
||||||
ms_RadarTrace[i].m_vec2DPos.x = ReadSaveBuf<float>(buf); // CVector2D
|
ReadSaveBuf(&ms_RadarTrace[i].m_vec2DPos.x, buf);
|
||||||
ms_RadarTrace[i].m_vec2DPos.y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_vec2DPos.y, buf);
|
||||||
ms_RadarTrace[i].m_vecPos = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_vecPos, buf);
|
||||||
ms_RadarTrace[i].m_BlipIndex = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_BlipIndex, buf);
|
||||||
ms_RadarTrace[i].m_bDim = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_bDim, buf);
|
||||||
ms_RadarTrace[i].m_bInUse = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_bInUse, buf);
|
||||||
ms_RadarTrace[i].m_bShortRange = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_bShortRange, buf);
|
||||||
ms_RadarTrace[i].m_unused = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_unused, buf);
|
||||||
ms_RadarTrace[i].m_wScale = ReadSaveBuf<int16>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_wScale, buf);
|
||||||
ms_RadarTrace[i].m_eBlipDisplay = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_eBlipDisplay, buf);
|
||||||
ms_RadarTrace[i].m_eRadarSprite = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&ms_RadarTrace[i].m_eRadarSprite, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALIDATESAVEBUF(size);
|
VALIDATESAVEBUF(size);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
eLevelName CTheZones::m_CurrLevel;
|
eLevelName CTheZones::m_CurrLevel;
|
||||||
int16 CTheZones::FindIndex;
|
int16 CTheZones::FindIndex;
|
||||||
|
@ -714,11 +715,11 @@ CTheZones::SaveOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zo
|
||||||
WriteSaveBuf(*buffer, *length, zone->zoneinfoNight);
|
WriteSaveBuf(*buffer, *length, zone->zoneinfoNight);
|
||||||
|
|
||||||
int32 zoneId;
|
int32 zoneId;
|
||||||
zoneId = GetIndexForZonePointer(zone->child);
|
zoneId = GetIndexForNavigationZonePointer(zone->child);
|
||||||
WriteSaveBuf(*buffer, *length, zoneId);
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
zoneId = GetIndexForZonePointer(zone->parent);
|
zoneId = GetIndexForNavigationZonePointer(zone->parent);
|
||||||
WriteSaveBuf(*buffer, *length, zoneId);
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
zoneId = GetIndexForZonePointer(zone->next);
|
zoneId = GetIndexForNavigationZonePointer(zone->next);
|
||||||
WriteSaveBuf(*buffer, *length, zoneId);
|
WriteSaveBuf(*buffer, *length, zoneId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,9 +732,9 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||||
uint32 length = 0;
|
uint32 length = 0;
|
||||||
CheckSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeaderWithLength(buffer, length, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
m_CurrLevel = ReadSaveBuf<eLevelName>(buffer, length);
|
ReadSaveBuf(&m_CurrLevel, buffer);
|
||||||
FindIndex = ReadSaveBuf<int16>(buffer, length);
|
ReadSaveBuf(&FindIndex, buffer);
|
||||||
ReadSaveBuf<int16>(buffer, length);
|
SkipSaveBuf(buffer, 2);
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++)
|
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++)
|
||||||
LoadOneZone(&NavigationZoneArray[i], &buffer, &length, ZONE_NAVIG);
|
LoadOneZone(&NavigationZoneArray[i], &buffer, &length, ZONE_NAVIG);
|
||||||
|
@ -742,21 +743,21 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||||
LoadOneZone(&InfoZoneArray[i], &buffer, &length, ZONE_INFO);
|
LoadOneZone(&InfoZoneArray[i], &buffer, &length, ZONE_INFO);
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
|
||||||
ZoneInfoArray[i] = ReadSaveBuf<CZoneInfo>(buffer, length);
|
ReadSaveBuf(&ZoneInfoArray[i], buffer);
|
||||||
|
|
||||||
TotalNumberOfNavigationZones = ReadSaveBuf<int16>(buffer, length);
|
ReadSaveBuf(&TotalNumberOfNavigationZones, buffer);
|
||||||
TotalNumberOfInfoZones = ReadSaveBuf<int16>(buffer, length);
|
ReadSaveBuf(&TotalNumberOfInfoZones, buffer);
|
||||||
TotalNumberOfZoneInfos = ReadSaveBuf<int16>(buffer, length);
|
ReadSaveBuf(&TotalNumberOfZoneInfos, buffer);
|
||||||
ReadSaveBuf<int16>(buffer, length);
|
SkipSaveBuf(buffer, 2);
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++)
|
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++)
|
||||||
LoadOneZone(&MapZoneArray[i], &buffer, &length, ZONE_MAPZONE);
|
LoadOneZone(&MapZoneArray[i], &buffer, &length, ZONE_MAPZONE);
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
|
||||||
AudioZoneArray[i] = ReadSaveBuf<int16>(buffer, length);
|
ReadSaveBuf(&AudioZoneArray[i], buffer);
|
||||||
|
|
||||||
TotalNumberOfMapZones = ReadSaveBuf<uint16>(buffer, length);
|
ReadSaveBuf(&TotalNumberOfMapZones, buffer);
|
||||||
NumberOfAudioZones = ReadSaveBuf<uint16>(buffer, length);
|
ReadSaveBuf(&NumberOfAudioZones, buffer);
|
||||||
|
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
@ -764,26 +765,36 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||||
void
|
void
|
||||||
CTheZones::LoadOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType)
|
CTheZones::LoadOneZone(CZone *zone, uint8 **buffer, uint32 *length, eZoneType zoneType)
|
||||||
{
|
{
|
||||||
*(uint32*)&zone->name[0] = ReadSaveBuf<uint32>(*buffer, *length);
|
#ifdef THIS_IS_STUPID
|
||||||
*(uint32*)&zone->name[4] = ReadSaveBuf<uint32>(*buffer, *length);
|
uint32 part1, part2;
|
||||||
|
ReadSaveBuf(&part1, *buffer, *length);
|
||||||
|
ReadSaveBuf(&part2, *buffer, *length);
|
||||||
|
|
||||||
zone->minx = ReadSaveBuf<float>(*buffer, *length);
|
*(uint64 *)&zone->name[0] = (uint64)part2;
|
||||||
zone->miny = ReadSaveBuf<float>(*buffer, *length);
|
*(uint64 *)&zone->name[0] <<= 32;
|
||||||
zone->minz = ReadSaveBuf<float>(*buffer, *length);
|
*(uint64 *)&zone->name[0] |= (uint64)part1;
|
||||||
zone->maxx = ReadSaveBuf<float>(*buffer, *length);
|
#else
|
||||||
zone->maxy = ReadSaveBuf<float>(*buffer, *length);
|
for(int i = 0; i < sizeof(zone->name); i++)
|
||||||
zone->maxz = ReadSaveBuf<float>(*buffer, *length);
|
ReadSaveBuf(&zone->name[i], *buffer, *length);
|
||||||
|
#endif
|
||||||
|
|
||||||
zone->type = ReadSaveBuf<eZoneType>(*buffer, *length);
|
ReadSaveBuf(&zone->minx, *buffer, *length);
|
||||||
zone->level = ReadSaveBuf<eLevelName>(*buffer, *length);
|
ReadSaveBuf(&zone->miny, *buffer, *length);
|
||||||
zone->zoneinfoDay = ReadSaveBuf<int16>(*buffer, *length);
|
ReadSaveBuf(&zone->minz, *buffer, *length);
|
||||||
zone->zoneinfoNight = ReadSaveBuf<int16>(*buffer, *length);
|
ReadSaveBuf(&zone->maxx, *buffer, *length);
|
||||||
|
ReadSaveBuf(&zone->maxy, *buffer, *length);
|
||||||
|
ReadSaveBuf(&zone->maxz, *buffer, *length);
|
||||||
|
|
||||||
|
ReadSaveBuf(&zone->type, *buffer, *length);
|
||||||
|
ReadSaveBuf(&zone->level, *buffer, *length);
|
||||||
|
ReadSaveBuf(&zone->zoneinfoDay, *buffer, *length);
|
||||||
|
ReadSaveBuf(&zone->zoneinfoNight, *buffer, *length);
|
||||||
|
|
||||||
int32 zoneId;
|
int32 zoneId;
|
||||||
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
ReadSaveBuf(&zoneId, *buffer, *length);
|
||||||
zone->child = GetPointerForZoneIndex(zoneId);
|
zone->child = GetPointerForNavigationZoneIndex(zoneId);
|
||||||
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
ReadSaveBuf(&zoneId, *buffer, *length);
|
||||||
zone->parent = GetPointerForZoneIndex(zoneId);
|
zone->parent = GetPointerForNavigationZoneIndex(zoneId);
|
||||||
zoneId = ReadSaveBuf<int32>(*buffer, *length);
|
ReadSaveBuf(&zoneId, *buffer, *length);
|
||||||
zone->next = GetPointerForZoneIndex(zoneId);
|
zone->next = GetPointerForNavigationZoneIndex(zoneId);
|
||||||
}
|
}
|
|
@ -103,8 +103,8 @@ public:
|
||||||
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
|
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
|
||||||
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
||||||
static int16 FindAudioZone(CVector *pos);
|
static int16 FindAudioZone(CVector *pos);
|
||||||
static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
|
static CZone *GetPointerForNavigationZoneIndex(ssize_t i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
|
||||||
static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
|
static ssize_t GetIndexForNavigationZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
|
||||||
static void AddZoneToAudioZoneArray(CZone *zone);
|
static void AddZoneToAudioZoneArray(CZone *zone);
|
||||||
static void InitialiseAudioZoneArray(void);
|
static void InitialiseAudioZoneArray(void);
|
||||||
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
||||||
|
|
|
@ -392,212 +392,3 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
||||||
#define CONCAT_(x,y) x##y
|
#define CONCAT_(x,y) x##y
|
||||||
#define CONCAT(x,y) CONCAT_(x,y)
|
#define CONCAT(x,y) CONCAT_(x,y)
|
||||||
|
|
||||||
#ifdef DEBUGMENU
|
|
||||||
// Tweaking stuff for debugmenu
|
|
||||||
#define TWEAKPATH ___tw___TWEAKPATH
|
|
||||||
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
|
||||||
#define TWEAKFUNC(v) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
|
||||||
#define TWEAKFUNCN(v, name) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
|
||||||
#define TWEAKBOOL(v) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
|
||||||
#define TWEAKBOOLN(v, name) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
|
||||||
#define TWEAKINT32(v, lower, upper, step) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKINT32N(v, lower, upper, step, name) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT32(v, lower, upper, step) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT32N(v, lower, upper, step, name) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKINT16(v, lower, upper, step) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKINT16N(v, lower, upper, step, name) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT16(v, lower, upper, step) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT16N(v, lower, upper, step, name) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKINT8(v, lower, upper, step) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKINT8N(v, lower, upper, step, name) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT8(v, lower, upper, step) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKUINT8N(v, lower, upper, step, name) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKFLOAT(v, lower, upper, step) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKFLOATN(v, lower, upper, step, name) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
|
||||||
#define TWEAKSWITCH(v, lower, upper, str, f) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, str, f, TWEAKPATH);
|
|
||||||
#define TWEAKSWITCHN(v, lower, upper, str, f, name) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, str, f, TWEAKPATH);
|
|
||||||
|
|
||||||
// interface
|
|
||||||
class CTweakVar
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void AddDBG(const char *path) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CTweakVars
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void Add(CTweakVar *var);
|
|
||||||
static void AddDBG(const char *path);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CTweakFunc : public CTweakVar
|
|
||||||
{
|
|
||||||
const char *m_pPath, *m_pVarName;
|
|
||||||
void (*m_pFunc)();
|
|
||||||
public:
|
|
||||||
CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) :
|
|
||||||
m_pPath(strPath), m_pVarName(strName), m_pFunc(pFunc)
|
|
||||||
{
|
|
||||||
CTweakVars::Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddDBG(const char *path);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CTweakBool : public CTweakVar
|
|
||||||
{
|
|
||||||
const char *m_pPath, *m_pVarName;
|
|
||||||
bool *m_pBoolVar;
|
|
||||||
public:
|
|
||||||
CTweakBool(bool *pBool, const char *strName, const char *strPath) :
|
|
||||||
m_pPath(strPath), m_pVarName(strName), m_pBoolVar(pBool)
|
|
||||||
{
|
|
||||||
CTweakVars::Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddDBG(const char *path);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CTweakSwitch : public CTweakVar
|
|
||||||
{
|
|
||||||
const char *m_pPath, *m_pVarName;
|
|
||||||
void *m_pIntVar;
|
|
||||||
int32 m_nMin, m_nMax;
|
|
||||||
const char **m_aStr;
|
|
||||||
void (*m_pFunc)();
|
|
||||||
public:
|
|
||||||
CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr,
|
|
||||||
void (*pFunc)(), const char *strPath)
|
|
||||||
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax),
|
|
||||||
m_aStr(aStr)
|
|
||||||
{
|
|
||||||
CTweakVars::Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddDBG(const char *path);
|
|
||||||
};
|
|
||||||
|
|
||||||
#define _TWEEKCLASS(name, type) \
|
|
||||||
class name : public CTweakVar \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
const char *m_pPath, *m_pVarName; \
|
|
||||||
type *m_pIntVar, m_nLoawerBound, m_nUpperBound, m_nStep; \
|
|
||||||
\
|
|
||||||
name(type *pInt, const char *strName, type nLower, type nUpper, type nStep, \
|
|
||||||
const char *strPath) \
|
|
||||||
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), \
|
|
||||||
m_nLoawerBound(nLower), m_nUpperBound(nUpper), m_nStep(nStep) \
|
|
||||||
\
|
|
||||||
{ \
|
|
||||||
CTweakVars::Add(this); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void AddDBG(const char *path); \
|
|
||||||
};
|
|
||||||
|
|
||||||
_TWEEKCLASS(CTweakInt8, int8);
|
|
||||||
_TWEEKCLASS(CTweakUInt8, uint8);
|
|
||||||
_TWEEKCLASS(CTweakInt16, int16);
|
|
||||||
_TWEEKCLASS(CTweakUInt16, uint16);
|
|
||||||
_TWEEKCLASS(CTweakInt32, int32);
|
|
||||||
_TWEEKCLASS(CTweakUInt32, uint32);
|
|
||||||
_TWEEKCLASS(CTweakFloat, float);
|
|
||||||
|
|
||||||
#undef _TWEEKCLASS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VALIDATE_SAVE_SIZE
|
|
||||||
extern int32 _saveBufCount;
|
|
||||||
#define INITSAVEBUF _saveBufCount = 0;
|
|
||||||
#define VALIDATESAVEBUF(b) assert(_saveBufCount == b);
|
|
||||||
#else
|
|
||||||
#define INITSAVEBUF
|
|
||||||
#define VALIDATESAVEBUF(b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline void SkipSaveBuf(uint8 *&buf, int32 skip)
|
|
||||||
{
|
|
||||||
buf += skip;
|
|
||||||
#ifdef VALIDATE_SAVE_SIZE
|
|
||||||
_saveBufCount += skip;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SkipSaveBuf(uint8*& buf, uint32 &length, int32 skip)
|
|
||||||
{
|
|
||||||
buf += skip;
|
|
||||||
length += skip;
|
|
||||||
#ifdef VALIDATE_SAVE_SIZE
|
|
||||||
_saveBufCount += skip;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline const T ReadSaveBuf(uint8 *&buf)
|
|
||||||
{
|
|
||||||
T &value = *(T*)buf;
|
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline const T ReadSaveBuf(uint8 *&buf, uint32 &length)
|
|
||||||
{
|
|
||||||
T &value = *(T*)buf;
|
|
||||||
SkipSaveBuf(buf, length, sizeof(T));
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline T *WriteSaveBuf(uint8 *&buf, const T &value)
|
|
||||||
{
|
|
||||||
T *p = (T*)buf;
|
|
||||||
*p = value;
|
|
||||||
SkipSaveBuf(buf, sizeof(T));
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline T *WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
|
|
||||||
{
|
|
||||||
T *p = (T*)buf;
|
|
||||||
*p = value;
|
|
||||||
SkipSaveBuf(buf, length, sizeof(T));
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
|
|
||||||
|
|
||||||
#define WriteSaveHeader(buf,a,b,c,d,size) \
|
|
||||||
WriteSaveBuf(buf, a);\
|
|
||||||
WriteSaveBuf(buf, b);\
|
|
||||||
WriteSaveBuf(buf, c);\
|
|
||||||
WriteSaveBuf(buf, d);\
|
|
||||||
WriteSaveBuf<uint32>(buf, size);
|
|
||||||
|
|
||||||
#define WriteSaveHeaderWithLength(buf,len,a,b,c,d,size) \
|
|
||||||
WriteSaveBuf(buf, len, a);\
|
|
||||||
WriteSaveBuf(buf, len, b);\
|
|
||||||
WriteSaveBuf(buf, len, c);\
|
|
||||||
WriteSaveBuf(buf, len, d);\
|
|
||||||
WriteSaveBuf<uint32>(buf, len, size);
|
|
||||||
|
|
||||||
#define CheckSaveHeader(buf,a,b,c,d,size)\
|
|
||||||
assert(ReadSaveBuf<char>(buf) == a);\
|
|
||||||
assert(ReadSaveBuf<char>(buf) == b);\
|
|
||||||
assert(ReadSaveBuf<char>(buf) == c);\
|
|
||||||
assert(ReadSaveBuf<char>(buf) == d);\
|
|
||||||
assert(ReadSaveBuf<uint32>(buf) == size);
|
|
||||||
|
|
||||||
#define CheckSaveHeaderWithLength(buf,len,a,b,c,d,size)\
|
|
||||||
assert(ReadSaveBuf<char>(buf,len) == a);\
|
|
||||||
assert(ReadSaveBuf<char>(buf,len) == b);\
|
|
||||||
assert(ReadSaveBuf<char>(buf,len) == c);\
|
|
||||||
assert(ReadSaveBuf<char>(buf,len) == d);\
|
|
||||||
assert(ReadSaveBuf<uint32>(buf,len) == size);
|
|
||||||
|
|
||||||
|
|
||||||
void cprintf(char*, ...);
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "Dummy.h"
|
#include "Dummy.h"
|
||||||
#include "WindModifiers.h"
|
#include "WindModifiers.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
int gBuildings;
|
int gBuildings;
|
||||||
|
|
||||||
|
@ -850,7 +851,8 @@ CEntity::SaveEntityFlags(uint8*& buf)
|
||||||
void
|
void
|
||||||
CEntity::LoadEntityFlags(uint8*& buf)
|
CEntity::LoadEntityFlags(uint8*& buf)
|
||||||
{
|
{
|
||||||
uint32 tmp = ReadSaveBuf<uint32>(buf);
|
uint32 tmp;
|
||||||
|
ReadSaveBuf(&tmp, buf);
|
||||||
m_type = (tmp & ((BIT(3) - 1)));
|
m_type = (tmp & ((BIT(3) - 1)));
|
||||||
m_status = ((tmp >> 3) & (BIT(5) - 1));
|
m_status = ((tmp >> 3) & (BIT(5) - 1));
|
||||||
|
|
||||||
|
@ -881,7 +883,7 @@ CEntity::LoadEntityFlags(uint8*& buf)
|
||||||
bStreamingDontDelete = !!(tmp & BIT(30));
|
bStreamingDontDelete = !!(tmp & BIT(30));
|
||||||
bRemoveFromWorld = !!(tmp & BIT(31));
|
bRemoveFromWorld = !!(tmp & BIT(31));
|
||||||
|
|
||||||
tmp = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&tmp, buf);
|
||||||
|
|
||||||
bHasHitWall = !!(tmp & BIT(0));
|
bHasHitWall = !!(tmp & BIT(0));
|
||||||
bImBeingRendered = !!(tmp & BIT(1));
|
bImBeingRendered = !!(tmp & BIT(1));
|
||||||
|
|
|
@ -2,6 +2,120 @@
|
||||||
|
|
||||||
#ifdef DEBUGMENU
|
#ifdef DEBUGMENU
|
||||||
|
|
||||||
|
// Tweaking stuff for debugmenu
|
||||||
|
#define TWEAKPATH ___tw___TWEAKPATH
|
||||||
|
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
||||||
|
#define TWEAKFUNC(v) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
||||||
|
#define TWEAKFUNCN(v, name) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
||||||
|
#define TWEAKBOOL(v) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
||||||
|
#define TWEAKBOOLN(v, name) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
||||||
|
#define TWEAKINT32(v, lower, upper, step) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKINT32N(v, lower, upper, step, name) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT32(v, lower, upper, step) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT32N(v, lower, upper, step, name) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKINT16(v, lower, upper, step) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKINT16N(v, lower, upper, step, name) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT16(v, lower, upper, step) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT16N(v, lower, upper, step, name) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKINT8(v, lower, upper, step) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKINT8N(v, lower, upper, step, name) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT8(v, lower, upper, step) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKUINT8N(v, lower, upper, step, name) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKFLOAT(v, lower, upper, step) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKFLOATN(v, lower, upper, step, name) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||||
|
#define TWEAKSWITCH(v, lower, upper, str, f) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, str, f, TWEAKPATH);
|
||||||
|
#define TWEAKSWITCHN(v, lower, upper, str, f, name) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, str, f, TWEAKPATH);
|
||||||
|
|
||||||
|
// interface
|
||||||
|
class CTweakVar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void AddDBG(const char *path) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CTweakVars
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void Add(CTweakVar *var);
|
||||||
|
static void AddDBG(const char *path);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CTweakFunc : public CTweakVar
|
||||||
|
{
|
||||||
|
const char *m_pPath, *m_pVarName;
|
||||||
|
void (*m_pFunc)();
|
||||||
|
public:
|
||||||
|
CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) :
|
||||||
|
m_pPath(strPath), m_pVarName(strName), m_pFunc(pFunc)
|
||||||
|
{
|
||||||
|
CTweakVars::Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddDBG(const char *path);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CTweakBool : public CTweakVar
|
||||||
|
{
|
||||||
|
const char *m_pPath, *m_pVarName;
|
||||||
|
bool *m_pBoolVar;
|
||||||
|
public:
|
||||||
|
CTweakBool(bool *pBool, const char *strName, const char *strPath) :
|
||||||
|
m_pPath(strPath), m_pVarName(strName), m_pBoolVar(pBool)
|
||||||
|
{
|
||||||
|
CTweakVars::Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddDBG(const char *path);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CTweakSwitch : public CTweakVar
|
||||||
|
{
|
||||||
|
const char *m_pPath, *m_pVarName;
|
||||||
|
void *m_pIntVar;
|
||||||
|
int32 m_nMin, m_nMax;
|
||||||
|
const char **m_aStr;
|
||||||
|
void (*m_pFunc)();
|
||||||
|
public:
|
||||||
|
CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr,
|
||||||
|
void (*pFunc)(), const char *strPath)
|
||||||
|
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax),
|
||||||
|
m_aStr(aStr)
|
||||||
|
{
|
||||||
|
CTweakVars::Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddDBG(const char *path);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define _TWEEKCLASS(name, type) \
|
||||||
|
class name : public CTweakVar \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
const char *m_pPath, *m_pVarName; \
|
||||||
|
type *m_pIntVar, m_nLoawerBound, m_nUpperBound, m_nStep; \
|
||||||
|
\
|
||||||
|
name(type *pInt, const char *strName, type nLower, type nUpper, type nStep, \
|
||||||
|
const char *strPath) \
|
||||||
|
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), \
|
||||||
|
m_nLoawerBound(nLower), m_nUpperBound(nUpper), m_nStep(nStep) \
|
||||||
|
\
|
||||||
|
{ \
|
||||||
|
CTweakVars::Add(this); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void AddDBG(const char *path); \
|
||||||
|
};
|
||||||
|
|
||||||
|
_TWEEKCLASS(CTweakInt8, int8);
|
||||||
|
_TWEEKCLASS(CTweakUInt8, uint8);
|
||||||
|
_TWEEKCLASS(CTweakInt16, int16);
|
||||||
|
_TWEEKCLASS(CTweakUInt16, uint16);
|
||||||
|
_TWEEKCLASS(CTweakInt32, int32);
|
||||||
|
_TWEEKCLASS(CTweakUInt32, uint32);
|
||||||
|
_TWEEKCLASS(CTweakFloat, float);
|
||||||
|
|
||||||
|
#undef _TWEEKCLASS
|
||||||
|
|
||||||
typedef void (*TriggerFunc)(void);
|
typedef void (*TriggerFunc)(void);
|
||||||
|
|
||||||
struct Menu;
|
struct Menu;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CGangInfo CGangs::Gang[NUM_GANGS];
|
CGangInfo CGangs::Gang[NUM_GANGS];
|
||||||
bool CGangs::GangAttackWithCops[NUM_GANGS];
|
bool CGangs::GangAttackWithCops[NUM_GANGS];
|
||||||
|
@ -119,6 +120,6 @@ INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_GANGS; i++)
|
for (int i = 0; i < NUM_GANGS; i++)
|
||||||
Gang[i] = ReadSaveBuf<CGangInfo>(buf);
|
ReadSaveBuf(&Gang[i], buf);
|
||||||
VALIDATESAVEBUF(size);
|
VALIDATESAVEBUF(size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "CutsceneShadow.h"
|
#include "CutsceneShadow.h"
|
||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CPed *gapTempPedList[50];
|
CPed *gapTempPedList[50];
|
||||||
uint16 gnNumTempPedList;
|
uint16 gnNumTempPedList;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
#include "PedType.h"
|
#include "PedType.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CPedType *CPedType::ms_apPedType[NUM_PEDTYPES];
|
CPedType *CPedType::ms_apPedType[NUM_PEDTYPES];
|
||||||
CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS];
|
CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS];
|
||||||
|
@ -201,7 +202,7 @@ INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
for(int i = 0; i < NUM_PEDTYPES; i++)
|
for(int i = 0; i < NUM_PEDTYPES; i++)
|
||||||
*ms_apPedType[i] = ReadSaveBuf<CPedType>(buf);
|
ReadSaveBuf(ms_apPedType[i], buf);
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "PedPlacement.h"
|
#include "PedPlacement.h"
|
||||||
#include "VarConsole.h"
|
#include "VarConsole.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
|
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
|
||||||
|
|
||||||
|
|
|
@ -23,3 +23,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CConsole TheConsole;
|
extern CConsole TheConsole;
|
||||||
|
|
||||||
|
void cprintf(char*, ...);
|
|
@ -23,6 +23,7 @@
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "Coronas.h"
|
#include "Coronas.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
CPlaneTrail CPlaneTrails::aArray[6];
|
CPlaneTrail CPlaneTrails::aArray[6];
|
||||||
RwImVertexIndex TrailIndices[32] = {
|
RwImVertexIndex TrailIndices[32] = {
|
||||||
|
@ -1267,7 +1268,7 @@ INITSAVEBUF
|
||||||
aArray[i].Clear();
|
aArray[i].Clear();
|
||||||
|
|
||||||
for (int32 i = 0; i < 3; i++) {
|
for (int32 i = 0; i < 3; i++) {
|
||||||
aArray[i] = ReadSaveBuf<CScriptPath>(buf);
|
ReadSaveBuf(&aArray[i], buf);
|
||||||
|
|
||||||
for (int32 j = 0; j < 6; j++) {
|
for (int32 j = 0; j < 6; j++) {
|
||||||
CScriptPath *pPath = &aArray[i];
|
CScriptPath *pPath = &aArray[i];
|
||||||
|
@ -1279,7 +1280,7 @@ INITSAVEBUF
|
||||||
|
|
||||||
aArray[i].m_pNode = new CPlaneNode[aArray[i].m_numNodes];
|
aArray[i].m_pNode = new CPlaneNode[aArray[i].m_numNodes];
|
||||||
for (int32 j = 0; j < aArray[i].m_numNodes; j++) {
|
for (int32 j = 0; j < aArray[i].m_numNodes; j++) {
|
||||||
aArray[i].m_pNode[j] = ReadSaveBuf<CPlaneNode>(buf);
|
ReadSaveBuf(&aArray[i].m_pNode[j], buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
#include "ParticleObject.h"
|
#include "ParticleObject.h"
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
#include "soundlist.h"
|
#include "soundlist.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
#include "debugmenu.h"
|
||||||
|
|
||||||
#define MAX_PARTICLES_ON_SCREEN (750)
|
#define MAX_PARTICLES_ON_SCREEN (750)
|
||||||
|
|
||||||
|
|
115
src/save/SaveBuf.h
Normal file
115
src/save/SaveBuf.h
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
|
extern int32 _saveBufCount;
|
||||||
|
#define INITSAVEBUF _saveBufCount = 0;
|
||||||
|
#define VALIDATESAVEBUF(b) assert(_saveBufCount == b);
|
||||||
|
#else
|
||||||
|
#define INITSAVEBUF
|
||||||
|
#define VALIDATESAVEBUF(b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline void
|
||||||
|
SkipSaveBuf(uint8 *&buf, int32 skip)
|
||||||
|
{
|
||||||
|
buf += skip;
|
||||||
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
|
_saveBufCount += skip;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
SkipSaveBuf(uint8*& buf, uint32 &length, int32 skip)
|
||||||
|
{
|
||||||
|
buf += skip;
|
||||||
|
length += skip;
|
||||||
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
|
_saveBufCount += skip;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline void
|
||||||
|
ReadSaveBuf(T *out, uint8 *&buf)
|
||||||
|
{
|
||||||
|
*out = *(T *)buf;
|
||||||
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline void
|
||||||
|
ReadSaveBuf(T *out, uint8 *&buf, uint32 &length)
|
||||||
|
{
|
||||||
|
*out = *(T *)buf;
|
||||||
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T *
|
||||||
|
WriteSaveBuf(uint8 *&buf, const T &value)
|
||||||
|
{
|
||||||
|
T *p = (T*)buf;
|
||||||
|
*p = value;
|
||||||
|
SkipSaveBuf(buf, sizeof(T));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T *
|
||||||
|
WriteSaveBuf(uint8 *&buf, uint32 &length, const T &value)
|
||||||
|
{
|
||||||
|
T *p = (T*)buf;
|
||||||
|
*p = value;
|
||||||
|
SkipSaveBuf(buf, length, sizeof(T));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define SAVE_HEADER_SIZE (4*sizeof(char)+sizeof(uint32))
|
||||||
|
|
||||||
|
#define WriteSaveHeader(buf,a,b,c,d,size) \
|
||||||
|
WriteSaveBuf(buf, a);\
|
||||||
|
WriteSaveBuf(buf, b);\
|
||||||
|
WriteSaveBuf(buf, c);\
|
||||||
|
WriteSaveBuf(buf, d);\
|
||||||
|
WriteSaveBuf<uint32>(buf, size);
|
||||||
|
|
||||||
|
#define WriteSaveHeaderWithLength(buf,len,a,b,c,d,size) \
|
||||||
|
WriteSaveBuf(buf, len, a);\
|
||||||
|
WriteSaveBuf(buf, len, b);\
|
||||||
|
WriteSaveBuf(buf, len, c);\
|
||||||
|
WriteSaveBuf(buf, len, d);\
|
||||||
|
WriteSaveBuf(buf, len, (uint32)(size));
|
||||||
|
|
||||||
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
|
#define CheckSaveHeader(buf, a, b, c, d, size) do { \
|
||||||
|
char _C; uint32 _size;\
|
||||||
|
ReadSaveBuf(&_C, buf);\
|
||||||
|
assert(_C == a);\
|
||||||
|
ReadSaveBuf(&_C, buf);\
|
||||||
|
assert(_C == b);\
|
||||||
|
ReadSaveBuf(&_C, buf);\
|
||||||
|
assert(_C == c);\
|
||||||
|
ReadSaveBuf(&_C, buf);\
|
||||||
|
assert(_C == d);\
|
||||||
|
ReadSaveBuf(&_size, buf);\
|
||||||
|
assert(_size == size);\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define CheckSaveHeaderWithLength(buf,len,a,b,c,d,size) do { \
|
||||||
|
char _C; uint32 _size;\
|
||||||
|
ReadSaveBuf(&_C, buf, len);\
|
||||||
|
assert(_C == a);\
|
||||||
|
ReadSaveBuf(&_C, buf, len);\
|
||||||
|
assert(_C == b);\
|
||||||
|
ReadSaveBuf(&_C, buf, len);\
|
||||||
|
assert(_C == c);\
|
||||||
|
ReadSaveBuf(&_C, buf, len);\
|
||||||
|
assert(_C == d);\
|
||||||
|
ReadSaveBuf(&_size, buf, len);\
|
||||||
|
assert(_size == size);\
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define CheckSaveHeader(buf, a, b, c, d, size) SkipSaveBuf(buf, 8);
|
||||||
|
#define CheckSaveHeaderWithLength(buf, a, b, c, d, size) SkipSaveBuf(buf, 8);
|
||||||
|
#endif
|
|
@ -50,6 +50,7 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "Bike.h"
|
#include "Bike.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
bool bAllCarCheat;
|
bool bAllCarCheat;
|
||||||
|
|
||||||
|
@ -5869,7 +5870,7 @@ void
|
||||||
CAutomobile::Save(uint8*& buf)
|
CAutomobile::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Save(buf);
|
CVehicle::Save(buf);
|
||||||
WriteSaveBuf<CDamageManager>(buf, Damage);
|
WriteSaveBuf(buf, Damage);
|
||||||
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5877,7 +5878,7 @@ void
|
||||||
CAutomobile::Load(uint8*& buf)
|
CAutomobile::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
CVehicle::Load(buf);
|
CVehicle::Load(buf);
|
||||||
Damage = ReadSaveBuf<CDamageManager>(buf);
|
ReadSaveBuf(&Damage, buf);
|
||||||
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
SkipSaveBuf(buf, 1500 - 672 - sizeof(CDamageManager));
|
||||||
SetupDamageAfterLoad();
|
SetupDamageAfterLoad();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "Bike.h"
|
#include "Bike.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
const uint32 CBike::nSaveStructSize =
|
const uint32 CBike::nSaveStructSize =
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "Record.h"
|
#include "Record.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
#define INVALID_ORIENTATION (-9999.99f)
|
#define INVALID_ORIENTATION (-9999.99f)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "Occlusion.h"
|
#include "Occlusion.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
uint8 CTheCarGenerators::ProcessCounter;
|
uint8 CTheCarGenerators::ProcessCounter;
|
||||||
uint32 CTheCarGenerators::NumOfCarGenerators;
|
uint32 CTheCarGenerators::NumOfCarGenerators;
|
||||||
|
@ -292,14 +293,17 @@ void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size)
|
||||||
Init();
|
Init();
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE);
|
||||||
assert(ReadSaveBuf<uint32>(buffer) == nGeneralDataSize);
|
uint32 tmp;
|
||||||
NumOfCarGenerators = ReadSaveBuf<uint32>(buffer);
|
ReadSaveBuf(&tmp, buffer);
|
||||||
CurrentActiveCount = ReadSaveBuf<uint32>(buffer);
|
assert(tmp == nGeneralDataSize);
|
||||||
ProcessCounter = ReadSaveBuf<uint8>(buffer);
|
ReadSaveBuf(&NumOfCarGenerators, buffer);
|
||||||
GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer);
|
ReadSaveBuf(&CurrentActiveCount, buffer);
|
||||||
ReadSaveBuf<int16>(buffer); // alignment
|
ReadSaveBuf(&ProcessCounter, buffer);
|
||||||
assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray));
|
ReadSaveBuf(&GenerateEvenIfPlayerIsCloseCounter, buffer);
|
||||||
|
SkipSaveBuf(buffer, 2);
|
||||||
|
ReadSaveBuf(&tmp, buffer);
|
||||||
|
assert(tmp == sizeof(CarGeneratorArray));
|
||||||
for (int i = 0; i < NUM_CARGENS; i++)
|
for (int i = 0; i < NUM_CARGENS; i++)
|
||||||
CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer);
|
ReadSaveBuf(&CarGeneratorArray[i], buffer);
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
#define MAX_DISTANCE_TO_FIND_CRANE (10.0f)
|
#define MAX_DISTANCE_TO_FIND_CRANE (10.0f)
|
||||||
#define CRANE_UPDATE_RADIUS (300.0f)
|
#define CRANE_UPDATE_RADIUS (300.0f)
|
||||||
|
@ -641,10 +642,10 @@ void CCranes::Load(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
|
|
||||||
NumCranes = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&NumCranes, buf);
|
||||||
CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&CarsCollectedMilitaryCrane, buf);
|
||||||
for (int i = 0; i < NUM_CRANES; i++)
|
for (int i = 0; i < NUM_CRANES; i++)
|
||||||
aCranes[i] = ReadSaveBuf<CCrane>(buf);
|
ReadSaveBuf(&aCranes[i], buf);
|
||||||
for (int i = 0; i < NUM_CRANES; i++) {
|
for (int i = 0; i < NUM_CRANES; i++) {
|
||||||
CCrane *pCrane = &aCranes[i];
|
CCrane *pCrane = &aCranes[i];
|
||||||
if (pCrane->m_pCraneEntity != nil)
|
if (pCrane->m_pCraneEntity != nil)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "Coronas.h"
|
#include "Coronas.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
bool CVehicle::bWheelsOnlyCheat;
|
bool CVehicle::bWheelsOnlyCheat;
|
||||||
bool CVehicle::bAllDodosCheat;
|
bool CVehicle::bAllDodosCheat;
|
||||||
|
@ -2426,43 +2427,44 @@ CVehicle::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
CMatrix tmp;
|
CMatrix tmp;
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 4);
|
||||||
tmp.GetRight().x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetRight().x, buf);
|
||||||
tmp.GetRight().y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetRight().y, buf);
|
||||||
tmp.GetRight().z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetRight().z, buf);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 4);
|
||||||
tmp.GetForward().x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetForward().x, buf);
|
||||||
tmp.GetForward().y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetForward().y, buf);
|
||||||
tmp.GetForward().z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetForward().z, buf);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 4);
|
||||||
tmp.GetUp().x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetUp().x, buf);
|
||||||
tmp.GetUp().y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetUp().y, buf);
|
||||||
tmp.GetUp().z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetUp().z, buf);
|
||||||
SkipSaveBuf(buf, 4);
|
SkipSaveBuf(buf, 4);
|
||||||
tmp.GetPosition().x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetPosition().x, buf);
|
||||||
tmp.GetPosition().y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetPosition().y, buf);
|
||||||
tmp.GetPosition().z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&tmp.GetPosition().z, buf);
|
||||||
m_matrix = tmp;
|
m_matrix = tmp;
|
||||||
SkipSaveBuf(buf, 16);
|
SkipSaveBuf(buf, 16);
|
||||||
LoadEntityFlags(buf);
|
LoadEntityFlags(buf);
|
||||||
SkipSaveBuf(buf, 208);
|
SkipSaveBuf(buf, 208);
|
||||||
AutoPilot.Load(buf);
|
AutoPilot.Load(buf);
|
||||||
m_currentColour1 = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_currentColour1, buf);
|
||||||
m_currentColour2 = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_currentColour2, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nAlarmState = ReadSaveBuf<int16>(buf);
|
ReadSaveBuf(&m_nAlarmState, buf);
|
||||||
SkipSaveBuf(buf, 42);
|
SkipSaveBuf(buf, 42);
|
||||||
m_nNumMaxPassengers = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nNumMaxPassengers, buf);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
field_1D0[0] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&field_1D0[0], buf);
|
||||||
field_1D0[1] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&field_1D0[1], buf);
|
||||||
field_1D0[2] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&field_1D0[2], buf);
|
||||||
field_1D0[3] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&field_1D0[3], buf);
|
||||||
SkipSaveBuf(buf, 8);
|
SkipSaveBuf(buf, 8);
|
||||||
m_fSteerAngle = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fSteerAngle, buf);
|
||||||
m_fGasPedal = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fGasPedal, buf);
|
||||||
m_fBrakePedal = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fBrakePedal, buf);
|
||||||
VehicleCreatedBy = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&VehicleCreatedBy, buf);
|
||||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
uint8 flags;
|
||||||
|
ReadSaveBuf(&flags, buf);
|
||||||
bIsLawEnforcer = !!(flags & BIT(0));
|
bIsLawEnforcer = !!(flags & BIT(0));
|
||||||
bIsLocked = !!(flags & BIT(3));
|
bIsLocked = !!(flags & BIT(3));
|
||||||
bEngineOn = !!(flags & BIT(4));
|
bEngineOn = !!(flags & BIT(4));
|
||||||
|
@ -2470,16 +2472,17 @@ CVehicle::Load(uint8*& buf)
|
||||||
bLightsOn = !!(flags & BIT(6));
|
bLightsOn = !!(flags & BIT(6));
|
||||||
bFreebies = !!(flags & BIT(7));
|
bFreebies = !!(flags & BIT(7));
|
||||||
SkipSaveBuf(buf, 10);
|
SkipSaveBuf(buf, 10);
|
||||||
m_fHealth = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fHealth, buf);
|
||||||
m_nCurrentGear = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCurrentGear, buf);
|
||||||
SkipSaveBuf(buf, 3);
|
SkipSaveBuf(buf, 3);
|
||||||
m_fChangeGearTime = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fChangeGearTime, buf);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nTimeOfDeath = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeOfDeath, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_nBombTimer = ReadSaveBuf<int16>(buf);
|
ReadSaveBuf(&m_nBombTimer, buf);
|
||||||
SkipSaveBuf(buf, 12);
|
SkipSaveBuf(buf, 12);
|
||||||
m_nDoorLock = (eCarLock)ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&flags, buf);
|
||||||
|
m_nDoorLock = (eCarLock)flags;
|
||||||
SkipSaveBuf(buf, 111);
|
SkipSaveBuf(buf, 111);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "Glass.h"
|
#include "Glass.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "Pickups.h"
|
#include "Pickups.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
float fReloadAnimSampleFraction[5] = { 0.5f, 0.7f, 0.75f, 0.75f, 0.7f };
|
float fReloadAnimSampleFraction[5] = { 0.5f, 0.7f, 0.75f, 0.75f, 0.7f };
|
||||||
float fSeaSparrowAimingAngle = 10.0f;
|
float fSeaSparrowAimingAngle = 10.0f;
|
||||||
|
|
Loading…
Reference in a new issue