CarGen, Cranes, Gangs: cleanup, fixes, r* visioned placement

This commit is contained in:
Sergeanur 2020-04-14 13:08:03 +03:00
parent 7f8a4b4867
commit a19fa8764f
7 changed files with 69 additions and 136 deletions

View File

@ -4,7 +4,6 @@
#include "Gangs.h" #include "Gangs.h"
#include "Weapon.h" #include "Weapon.h"
//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
CGangInfo CGangs::Gang[NUM_GANGS]; CGangInfo CGangs::Gang[NUM_GANGS];
CGangInfo::CGangInfo() : CGangInfo::CGangInfo() :
@ -70,7 +69,6 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
Initialise(); Initialise();
INITSAVEBUF INITSAVEBUF
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
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++)

View File

@ -283,7 +283,7 @@ GenericLoad()
LoadSaveDataBlock(); LoadSaveDataBlock();
ReadDataFromBlock("Loading Paths \n", ThePaths.Load); ReadDataFromBlock("Loading Paths \n", ThePaths.Load);
LoadSaveDataBlock(); LoadSaveDataBlock();
ReadDataFromBlock("Loading Cranes \n", CranesLoad); ReadDataFromBlock("Loading Cranes \n", CCranes::Load);
LoadSaveDataBlock(); LoadSaveDataBlock();
ReadDataFromBlock("Loading Pickups \n", CPickups::Load); ReadDataFromBlock("Loading Pickups \n", CPickups::Load);
LoadSaveDataBlock(); LoadSaveDataBlock();

View File

@ -14,11 +14,11 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "World.h" #include "World.h"
uint8 &CTheCarGenerators::ProcessCounter = *(uint8*)0x95CDAF; uint8 CTheCarGenerators::ProcessCounter;
uint32 &CTheCarGenerators::NumOfCarGenerators = *(uint32*)0x8E2C1C; uint32 CTheCarGenerators::NumOfCarGenerators;
CCarGenerator (&CTheCarGenerators::CarGeneratorArray)[NUM_CARGENS] = *(CCarGenerator(*)[NUM_CARGENS])*(uintptr*)0x87CB18; CCarGenerator CTheCarGenerators::CarGeneratorArray[NUM_CARGENS];
uint8 &CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter = *(uint8*)0x95CDC6; uint8 CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter;
uint32 &CTheCarGenerators::CurrentActiveCount = *(uint32*)0x8F2C5C; uint32 CTheCarGenerators::CurrentActiveCount;
void CCarGenerator::SwitchOff() void CCarGenerator::SwitchOff()
{ {
@ -187,59 +187,6 @@ bool CCarGenerator::CheckIfWithinRangeOfAnyPlayer()
return DotProduct2D(direction, FindPlayerSpeed()) <= 0; return DotProduct2D(direction, FindPlayerSpeed()) <= 0;
} }
void CCarGenerator::Save(uint8 *&buffer)
{
WriteSaveBuf(buffer, m_nModelIndex);
WriteSaveBuf(buffer, m_vecPos);
WriteSaveBuf(buffer, m_fAngle);
WriteSaveBuf(buffer, m_nColor1);
WriteSaveBuf(buffer, m_nColor2);
WriteSaveBuf(buffer, m_bForceSpawn);
WriteSaveBuf(buffer, m_nAlarm);
WriteSaveBuf(buffer, m_nDoorlock);
WriteSaveBuf(buffer, (uint8)0);
WriteSaveBuf(buffer, m_nMinDelay);
WriteSaveBuf(buffer, m_nMaxDelay);
WriteSaveBuf(buffer, m_nTimer);
WriteSaveBuf(buffer, m_nVehicleHandle);
WriteSaveBuf(buffer, m_nUsesRemaining);
WriteSaveBuf(buffer, m_bIsBlocking);
WriteSaveBuf(buffer, (uint8)0);
WriteSaveBuf(buffer, m_vecInf);
WriteSaveBuf(buffer, m_vecSup);
WriteSaveBuf(buffer, m_fSize);
// or
//WriteSaveBuf(buffer, *this);
}
void CCarGenerator::Load(uint8 *&buffer)
{
m_nModelIndex = ReadSaveBuf<uint32>(buffer);
m_vecPos = ReadSaveBuf<CVector>(buffer);
m_fAngle = ReadSaveBuf<float>(buffer);
m_nColor1 = ReadSaveBuf<int16>(buffer);
m_nColor2 = ReadSaveBuf<int16>(buffer);
m_bForceSpawn = ReadSaveBuf<uint8>(buffer);
m_nAlarm = ReadSaveBuf<uint8>(buffer);
m_nDoorlock = ReadSaveBuf<uint8>(buffer);
ReadSaveBuf<uint8>(buffer);
m_nMinDelay = ReadSaveBuf<uint16>(buffer);
m_nMaxDelay = ReadSaveBuf<uint16>(buffer);
m_nTimer = ReadSaveBuf<uint32>(buffer);
m_nVehicleHandle = ReadSaveBuf<int32>(buffer);
m_nUsesRemaining = ReadSaveBuf<uint16>(buffer);
m_bIsBlocking = ReadSaveBuf<bool>(buffer);
ReadSaveBuf<uint8>(buffer);
m_vecInf = ReadSaveBuf<CVector>(buffer);
m_vecSup = ReadSaveBuf<CVector>(buffer);
m_fSize = ReadSaveBuf<float>(buffer);
// or
//*this = ReadSaveBuf<CCarGenerator>(buffer);
}
void CTheCarGenerators::Process() void CTheCarGenerators::Process()
{ {
if (FindPlayerTrain() || CCutsceneMgr::IsCutsceneProcessing()) if (FindPlayerTrain() || CCutsceneMgr::IsCutsceneProcessing())
@ -268,39 +215,38 @@ void CTheCarGenerators::Init()
void CTheCarGenerators::SaveAllCarGenerators(uint8 *buffer, uint32 *size) void CTheCarGenerators::SaveAllCarGenerators(uint8 *buffer, uint32 *size)
{ {
*size = 20 + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE; const uint32 nGeneralDataSize = sizeof(NumOfCarGenerators) + sizeof(CurrentActiveCount) + sizeof(ProcessCounter) + sizeof(GenerateEvenIfPlayerIsCloseCounter) + sizeof(int16);
*size = sizeof(int) + nGeneralDataSize + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE;
INITSAVEBUF INITSAVEBUF
WriteSaveHeader(buffer, 'C','G','N','\0', *size - SAVE_HEADER_SIZE); WriteSaveHeader(buffer, 'C','G','N','\0', *size - SAVE_HEADER_SIZE);
WriteSaveBuf(buffer, 12); /* what is this? */ WriteSaveBuf(buffer, nGeneralDataSize);
WriteSaveBuf(buffer, NumOfCarGenerators); WriteSaveBuf(buffer, NumOfCarGenerators);
WriteSaveBuf(buffer, CurrentActiveCount); WriteSaveBuf(buffer, CurrentActiveCount);
WriteSaveBuf(buffer, ProcessCounter); WriteSaveBuf(buffer, ProcessCounter);
WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter); WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter);
WriteSaveBuf(buffer, (int16)0); WriteSaveBuf(buffer, (int16)0); // alignment
WriteSaveBuf(buffer, sizeof(CarGeneratorArray)); WriteSaveBuf(buffer, sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++){ for (int i = 0; i < NUM_CARGENS; i++)
CarGeneratorArray[i].Save(buffer); WriteSaveBuf(buffer, CarGeneratorArray[i]);
}
VALIDATESAVEBUF(*size) VALIDATESAVEBUF(*size)
} }
void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size) void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size)
{ {
const int32 nGeneralDataSize = sizeof(NumOfCarGenerators) + sizeof(CurrentActiveCount) + sizeof(ProcessCounter) + sizeof(GenerateEvenIfPlayerIsCloseCounter) + sizeof(int16);
Init(); Init();
INITSAVEBUF INITSAVEBUF
assert(size == 20 + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE);
CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE); CheckSaveHeader(buffer, 'C','G','N','\0', size - SAVE_HEADER_SIZE);
ReadSaveBuf<uint32>(buffer); assert(ReadSaveBuf<uint32>(buffer) == nGeneralDataSize);
NumOfCarGenerators = ReadSaveBuf<uint32>(buffer); NumOfCarGenerators = ReadSaveBuf<uint32>(buffer);
CurrentActiveCount = ReadSaveBuf<uint32>(buffer); CurrentActiveCount = ReadSaveBuf<uint32>(buffer);
ProcessCounter = ReadSaveBuf<uint8>(buffer); ProcessCounter = ReadSaveBuf<uint8>(buffer);
GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer); GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer);
ReadSaveBuf<int16>(buffer); ReadSaveBuf<int16>(buffer); // alignment
assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray)); assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++) { for (int i = 0; i < NUM_CARGENS; i++)
CarGeneratorArray[i].Load(buffer); CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer);
}
VALIDATESAVEBUF(size) VALIDATESAVEBUF(size)
} }

View File

@ -34,19 +34,17 @@ public:
void Setup(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay); void Setup(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay);
bool CheckForBlockage(); bool CheckForBlockage();
bool CheckIfWithinRangeOfAnyPlayer(); bool CheckIfWithinRangeOfAnyPlayer();
void Save(uint8*&);
void Load(uint8*&);
void SetUsesRemaining(uint16 uses) { m_nUsesRemaining = uses; } void SetUsesRemaining(uint16 uses) { m_nUsesRemaining = uses; }
}; };
class CTheCarGenerators class CTheCarGenerators
{ {
public: public:
static uint8 &ProcessCounter; static uint8 ProcessCounter;
static uint32 &NumOfCarGenerators; static uint32 NumOfCarGenerators;
static CCarGenerator (&CarGeneratorArray)[NUM_CARGENS]; static CCarGenerator CarGeneratorArray[NUM_CARGENS];
static uint8 &GenerateEvenIfPlayerIsCloseCounter; static uint8 GenerateEvenIfPlayerIsCloseCounter;
static uint32 &CurrentActiveCount; static uint32 CurrentActiveCount;
static void Process(); static void Process();
static int32 CreateCarGenerator(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay); static int32 CreateCarGenerator(float x, float y, float z, float angle, int32 mi, int16 color1, int16 color2, uint8 force, uint8 alarm, uint8 lock, uint16 min_delay, uint16 max_delay);

View File

@ -38,9 +38,9 @@
uint32 TimerForCamInterpolation; uint32 TimerForCamInterpolation;
uint32& CCranes::CarsCollectedMilitaryCrane = *(uint32*)0x8F6248; uint32 CCranes::CarsCollectedMilitaryCrane;
int32& CCranes::NumCranes = *(int32*)0x8E28AC; int32 CCranes::NumCranes;
CCrane(&CCranes::aCranes)[NUM_CRANES] = *(CCrane(*)[NUM_CRANES])*(uintptr*)0x6FA4E0; CCrane CCranes::aCranes[NUM_CRANES];
void CCranes::InitCranes(void) void CCranes::InitCranes(void)
{ {
@ -466,13 +466,13 @@ bool CCrane::DoesCranePickUpThisCarType(uint32 mi)
bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi) bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi)
{ {
switch (mi) { switch (mi) {
case MI_FIRETRUCK: return (CCranes::CarsCollectedMilitaryCrane & 1); case MI_FIRETRUCK: return (CarsCollectedMilitaryCrane & 1);
case MI_AMBULAN: return (CCranes::CarsCollectedMilitaryCrane & 2); case MI_AMBULAN: return (CarsCollectedMilitaryCrane & 2);
case MI_ENFORCER: return (CCranes::CarsCollectedMilitaryCrane & 4); case MI_ENFORCER: return (CarsCollectedMilitaryCrane & 4);
case MI_FBICAR: return (CCranes::CarsCollectedMilitaryCrane & 8); case MI_FBICAR: return (CarsCollectedMilitaryCrane & 8);
case MI_RHINO: return (CCranes::CarsCollectedMilitaryCrane & 0x10); case MI_RHINO: return (CarsCollectedMilitaryCrane & 0x10);
case MI_BARRACKS: return (CCranes::CarsCollectedMilitaryCrane & 0x20); case MI_BARRACKS: return (CarsCollectedMilitaryCrane & 0x20);
case MI_POLICE: return (CCranes::CarsCollectedMilitaryCrane & 0x40); case MI_POLICE: return (CarsCollectedMilitaryCrane & 0x40);
default: break; default: break;
} }
return false; return false;
@ -481,20 +481,20 @@ bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi)
void CCranes::RegisterCarForMilitaryCrane(uint32 mi) void CCranes::RegisterCarForMilitaryCrane(uint32 mi)
{ {
switch (mi) { switch (mi) {
case MI_FIRETRUCK: CCranes::CarsCollectedMilitaryCrane |= 1; break; case MI_FIRETRUCK: CarsCollectedMilitaryCrane |= 1; break;
case MI_AMBULAN: CCranes::CarsCollectedMilitaryCrane |= 2; break; case MI_AMBULAN: CarsCollectedMilitaryCrane |= 2; break;
case MI_ENFORCER: CCranes::CarsCollectedMilitaryCrane |= 4; break; case MI_ENFORCER: CarsCollectedMilitaryCrane |= 4; break;
case MI_FBICAR: CCranes::CarsCollectedMilitaryCrane |= 8; break; case MI_FBICAR: CarsCollectedMilitaryCrane |= 8; break;
case MI_RHINO: CCranes::CarsCollectedMilitaryCrane |= 0x10; break; case MI_RHINO: CarsCollectedMilitaryCrane |= 0x10; break;
case MI_BARRACKS: CCranes::CarsCollectedMilitaryCrane |= 0x20; break; case MI_BARRACKS: CarsCollectedMilitaryCrane |= 0x20; break;
case MI_POLICE: CCranes::CarsCollectedMilitaryCrane |= 0x40; break; case MI_POLICE: CarsCollectedMilitaryCrane |= 0x40; break;
default: break; default: break;
} }
} }
bool CCranes::HaveAllCarsBeenCollectedByMilitaryCrane() bool CCranes::HaveAllCarsBeenCollectedByMilitaryCrane()
{ {
return (CCranes::CarsCollectedMilitaryCrane & 0x7F) == 0x7F; return (CarsCollectedMilitaryCrane & 0x7F) == 0x7F;
} }
bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, float fTargetHeight, float fSpeedMultiplier) bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, float fTargetHeight, float fSpeedMultiplier)
@ -509,8 +509,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookAngleDelta) < fHookAngleChangeThisFrame) { if (Abs(fHookAngleDelta) < fHookAngleChangeThisFrame) {
m_fHookAngle = fAngleToTarget; m_fHookAngle = fAngleToTarget;
bAngleMovementFinished = true; bAngleMovementFinished = true;
} } else {
else {
if (fHookAngleDelta < 0.0f) { if (fHookAngleDelta < 0.0f) {
m_fHookAngle -= fHookAngleChangeThisFrame; m_fHookAngle -= fHookAngleChangeThisFrame;
if (m_fHookAngle < 0.0f) if (m_fHookAngle < 0.0f)
@ -528,8 +527,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookOffsetDelta) < fHookOffsetChangeThisFrame) { if (Abs(fHookOffsetDelta) < fHookOffsetChangeThisFrame) {
m_fHookOffset = fDistanceToTarget; m_fHookOffset = fDistanceToTarget;
bOffsetMovementFinished = true; bOffsetMovementFinished = true;
} } else {
else {
if (fHookOffsetDelta < 0.0f) if (fHookOffsetDelta < 0.0f)
m_fHookOffset -= fHookOffsetChangeThisFrame; m_fHookOffset -= fHookOffsetChangeThisFrame;
else else
@ -541,8 +539,7 @@ bool CCrane::GoTowardsTarget(float fAngleToTarget, float fDistanceToTarget, floa
if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) { if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) {
m_fHookHeight = fTargetHeight; m_fHookHeight = fTargetHeight;
bHeightMovementFinished = true; bHeightMovementFinished = true;
} } else {
else {
if (fHookHeightDelta < 0.0f) if (fHookHeightDelta < 0.0f)
m_fHookHeight -= fHookHeightChangeThisFrame; m_fHookHeight -= fHookHeightChangeThisFrame;
else else
@ -560,8 +557,7 @@ bool CCrane::GoTowardsHeightTarget(float fTargetHeight, float fSpeedMultiplier)
if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) { if (Abs(fHookHeightDelta) < fHookHeightChangeThisFrame) {
m_fHookHeight = fTargetHeight; m_fHookHeight = fTargetHeight;
bHeightMovementFinished = true; bHeightMovementFinished = true;
} } else {
else {
if (fHookHeightDelta < 0.0f) if (fHookHeightDelta < 0.0f)
m_fHookHeight -= fHookHeightChangeThisFrame; m_fHookHeight -= fHookHeightChangeThisFrame;
else else
@ -587,7 +583,7 @@ void CCrane::CalcHookCoordinates(float* pX, float* pY, float* pZ)
void CCrane::SetHookMatrix() void CCrane::SetHookMatrix()
{ {
if (!m_pHook) if (m_pHook == nil)
return; return;
m_pHook->GetPosition() = m_vecHookCurPos; m_pHook->GetPosition() = m_vecHookCurPos;
CVector up(m_vecHookInitPos.x - m_vecHookCurPos.x, m_vecHookInitPos.y - m_vecHookCurPos.y, 20.0f); CVector up(m_vecHookInitPos.x - m_vecHookCurPos.x, m_vecHookInitPos.y - m_vecHookCurPos.y, 20.0f);
@ -632,48 +628,44 @@ void CCranes::Save(uint8* buf, uint32* size)
{ {
INITSAVEBUF INITSAVEBUF
*size = 2 * sizeof(uint32) + NUM_CRANES * sizeof(CCrane); *size = 2 * sizeof(uint32) + sizeof(aCranes);
WriteSaveBuf(buf, NumCranes); WriteSaveBuf(buf, NumCranes);
WriteSaveBuf(buf, CarsCollectedMilitaryCrane); WriteSaveBuf(buf, CarsCollectedMilitaryCrane);
for (int i = 0; i < NUM_CRANES; i++) { for (int i = 0; i < NUM_CRANES; i++) {
CCrane* pCrane = WriteSaveBuf(buf, aCranes[i]); CCrane *pCrane = WriteSaveBuf(buf, aCranes[i]);
if (pCrane->m_pCraneEntity) if (pCrane->m_pCraneEntity != nil)
pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex((CBuilding*)pCrane->m_pCraneEntity) + 1); pCrane->m_pCraneEntity = (CBuilding*)(CPools::GetBuildingPool()->GetJustIndex(pCrane->m_pCraneEntity) + 1);
if (pCrane->m_pHook) if (pCrane->m_pHook != nil)
pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex((CObject*)pCrane->m_pHook) + 1); pCrane->m_pHook = (CObject*)(CPools::GetObjectPool()->GetJustIndex(pCrane->m_pHook) + 1);
if (pCrane->m_pVehiclePickedUp) if (pCrane->m_pVehiclePickedUp != nil)
pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex((CVehicle*)pCrane->m_pVehiclePickedUp) + 1); pCrane->m_pVehiclePickedUp = (CVehicle*)(CPools::GetVehiclePool()->GetJustIndex(pCrane->m_pVehiclePickedUp) + 1);
} }
VALIDATESAVEBUF(*size); VALIDATESAVEBUF(*size);
} }
void CranesLoad(uint8* buf, uint32 size) void CCranes::Load(uint8* buf, uint32 size)
{ {
INITSAVEBUF INITSAVEBUF
CCranes::NumCranes = ReadSaveBuf<int32>(buf); NumCranes = ReadSaveBuf<int32>(buf);
CCranes::CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf); CarsCollectedMilitaryCrane = ReadSaveBuf<uint32>(buf);
for (int i = 0; i < NUM_CRANES; i++) for (int i = 0; i < NUM_CRANES; i++)
CCranes::aCranes[i] = ReadSaveBuf<CCrane>(buf); aCranes[i] = ReadSaveBuf<CCrane>(buf);
for (int i = 0; i < NUM_CRANES; i++) { for (int i = 0; i < NUM_CRANES; i++) {
CCrane* pCrane = &CCranes::aCranes[i]; CCrane *pCrane = &aCranes[i];
if (pCrane->m_pCraneEntity) if (pCrane->m_pCraneEntity != nil)
pCrane->m_pCraneEntity = CPools::GetBuildingPool()->GetSlot((uint32)pCrane->m_pCraneEntity - 1); pCrane->m_pCraneEntity = CPools::GetBuildingPool()->GetSlot((uint32)pCrane->m_pCraneEntity - 1);
if (pCrane->m_pHook) if (pCrane->m_pHook != nil)
pCrane->m_pHook = CPools::GetObjectPool()->GetSlot((uint32)pCrane->m_pHook - 1); pCrane->m_pHook = CPools::GetObjectPool()->GetSlot((uint32)pCrane->m_pHook - 1);
if (pCrane->m_pVehiclePickedUp) if (pCrane->m_pVehiclePickedUp != nil)
pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uint32)pCrane->m_pVehiclePickedUp + 1); pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uint32)pCrane->m_pVehiclePickedUp - 1);
} }
for (int i = 0; i < NUM_CRANES; i++) { for (int i = 0; i < NUM_CRANES; i++) {
CCranes::aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &CCranes::aCranes[i]); aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[i]);
if (CCranes::aCranes[i].m_nAudioEntity) if (aCranes[i].m_nAudioEntity != 0)
DMAudio.SetEntityStatus(CCranes::aCranes[i].m_nAudioEntity, 1); DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, 1);
} }
VALIDATESAVEBUF(size); VALIDATESAVEBUF(size);
} }
STARTPATCHES
InjectHook(0x5454D0, CranesLoad, PATCH_JUMP); // GenericLoad
ENDPATCHES

View File

@ -89,10 +89,9 @@ public:
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle);
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle);
static void Save(uint8* buf, uint32* size); static void Save(uint8* buf, uint32* size);
static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class
static uint32& CarsCollectedMilitaryCrane; static uint32 CarsCollectedMilitaryCrane;
static int32& NumCranes; static int32 NumCranes;
static CCrane(&aCranes)[NUM_CRANES]; static CCrane aCranes[NUM_CRANES];
}; };
void CranesLoad(uint8*, uint32); // is this really outside CCranes?