Merge branch 'master' into game_dev

This commit is contained in:
Nikolay Korolev 2020-04-14 20:10:39 +03:00
commit f2c78e4bfb
21 changed files with 3359 additions and 1918 deletions

View File

@ -32,7 +32,6 @@ to reverse at the time, calling the original functions is acceptable.
### Unreversed / incomplete classes (at least the ones we know)
```
cAudioManager - WIP
CBulletInfo
CPedPath
CWeapon

View File

@ -10,6 +10,22 @@
const int CollisionSoundIntensity = 60;
cAudioCollisionManager::cAudioCollisionManager()
{
m_sQueue.m_pEntity1 = nil;
m_sQueue.m_pEntity2 = nil;
m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
m_sQueue.m_fIntensity2 = 0.0f;
m_sQueue.m_fIntensity1 = 0.0f;
m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
m_bCollisionsInQueue = 0;
}
void
cAudioCollisionManager::AddCollisionToRequestedQueue()
{

View File

@ -29,8 +29,8 @@ public:
uint8 m_bCollisionsInQueue;
cAudioCollision m_sQueue;
// reversed all methods
void AddCollisionToRequestedQueue(); /// ok
cAudioCollisionManager();
void AddCollisionToRequestedQueue();
};
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,14 @@
#pragma once
#include "DMAudio.h"
#include "common.h"
#include "config.h"
#include "DMAudio.h"
#include "AudioCollision.h"
#include "PoliceRadio.h"
enum eScriptSounds : int16
{
enum eScriptSounds : int16 {
SCRIPT_SOUND_0 = 0,
SCRIPT_SOUND_1 = 1,
SCRIPT_SOUND_2 = 2,
@ -142,28 +143,28 @@ public:
int32 m_nSampleIndex;
uint8 m_bBankIndex;
bool m_bIs2D;
uint8 field_14;
uint8 field_15;
uint8 field_14; // unused
uint8 field_15; // unused
int32 m_nReleasingVolumeModificator;
int32 m_nFrequency;
uint8 m_bVolume;
uint8 field_25;
uint8 field_26;
uint8 field_27;
uint8 field_25; // unused
uint8 field_26; // unused
uint8 field_27; // unused
float m_fDistance;
int32 m_nLoopCount;
int32 m_nLoopStart;
int32 m_nLoopEnd;
uint8 m_bEmittingVolume;
uint8 field_45;
uint8 field_46;
uint8 field_47;
uint8 field_45; // unused
uint8 field_46; // unused
uint8 field_47; // unused
float m_fSpeedMultiplier;
float m_fSoundIntensity;
bool m_bReleasingSoundFlag;
uint8 field_57;
uint8 field_58;
uint8 field_59;
uint8 field_57; // unused
uint8 field_58; // unused
uint8 field_59; // unused
CVector m_vecPos;
bool m_bReverbFlag;
uint8 m_bLoopsRemaining;
@ -172,13 +173,13 @@ public:
int32 m_nReleasingVolumeDivider;
bool m_bIsProcessed;
bool m_bLoopEnded;
uint8 field_82;
uint8 field_83;
int32 calculatedVolume;
uint8 field_82; // unused
uint8 field_83; // unused
int32 m_nCalculatedVolume;
int8 m_nVolumeChange;
uint8 field_89;
uint8 field_90;
uint8 field_91;
uint8 field_89; // unused
uint8 field_90; // unused
uint8 field_91; // unused
// no methods
};
@ -196,7 +197,7 @@ public:
bool m_bIsUsed;
uint8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
uint8 gap_18[2];
//uint8 gap_18[2];
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents;
uint8 field_25[3];
@ -214,8 +215,7 @@ public:
CVector m_vecPos;
float m_fDistance;
uint8 m_bVolume;
int8 field_25; // allocated time?
uint8 gap_26[2];
int8 m_nProcess;
// no methods
};
@ -229,11 +229,10 @@ public:
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank;
uint8 gap_1163[1];
// reversed all methods
void Add(tPedComment *com); /// ok
void Process(); /// ok
cPedComments();
void Add(tPedComment *com);
void Process();
};
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
@ -245,22 +244,34 @@ class cMissionAudio
public:
CVector m_vecPos;
bool m_bPredefinedProperties;
uint8 gap_13[3];
//uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
uint8 field_22;
uint8 field_23;
uint8 field_22; // todo find a name
uint8 field_23; // unused
int32 m_nMissionAudioCounter;
bool m_bIsPlayed;
uint8 field_29;
uint8 field_30;
uint8 field_31;
// no methods
uint8 field_29; // unused
uint8 field_30; // unused
uint8 field_31; // unused
// no methods
};
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
// name made up
class cAudioScriptObjectManager
{
public:
int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
int32 m_nScriptObjectEntityTotal;
cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
~cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
};
class cVehicleParams;
class CPlane;
class CVehicle;
@ -314,8 +325,7 @@ public:
int32 m_nAudioEntitiesTotal;
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
int32 m_nScriptObjectEntityTotal;
cAudioScriptObjectManager m_sAudioScriptObjectManager;
cPedComments m_sPedComments;
int32 m_nFireAudioEntity;
int32 m_nWaterCannonEntity;
@ -334,6 +344,9 @@ public:
uint8 field_19195; // unused
uint32 m_FrameCounter;
cAudioManager();
~cAudioManager();
// getters
uint32 GetFrameCounter() const { return m_FrameCounter; }
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
@ -341,29 +354,29 @@ public:
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_bPlayStatus == 1; }
// "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample); /// ok (check once more)
void AddDetailsToRequestedOrderList(uint8 sample);
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
uint8 counter, bool notLooping); /// ok
void AddReflectionsToRequestedQueue(); /// ok (check value)
void AddReleasingSounds(); /// ok (check)
void AddSampleToRequestedQueue(); /// ok
void AgeCrimes(); /// ok
uint8 counter, bool notLooping);
void AddReflectionsToRequestedQueue();
void AddReleasingSounds();
void AddSampleToRequestedQueue();
void AgeCrimes();
void CalculateDistance(bool &condition, float dist); /// ok
bool CheckForAnAudioFileOnCD() const; /// ok
void ClearActiveSamples(); /// ok
void ClearMissionAudio(); /// ok
void ClearRequestedQueue(); /// ok
void CalculateDistance(bool &condition, float dist);
bool CheckForAnAudioFileOnCD() const;
void ClearActiveSamples();
void ClearMissionAudio();
void ClearRequestedQueue();
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
float speedMultiplier) const; /// ok
int32 ComputePan(float, CVector *); /// ok
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; /// ok
int32 CreateEntity(int32 type, void *entity); /// ok
float speedMultiplier) const;
int32 ComputePan(float, CVector *);
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
int32 CreateEntity(int32 type, void *entity);
void DestroyAllGameCreatedEntities(); /// ok
void DestroyEntity(int32 id); /// ok
void DoJumboVolOffset() const; /// ok
void DoPoliceRadioCrackle(); /// ok
void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id);
void DoJumboVolOffset() const;
void DoPoliceRadioCrackle();
// functions returning talk sfx,
// order from GetPedCommentSfx
@ -445,154 +458,151 @@ public:
uint32 GetGenericFemaleTalkSfx(int16 sound);
// end of functions returning talk sfx
void GenerateIntegerRandomNumberTable(); /// ok
void GenerateIntegerRandomNumberTable();
char *Get3DProviderName(uint8 id) const;
uint8 GetCDAudioDriveLetter() const;
int8 GetCurrent3DProviderIndex() const; /// ok
int8 GetCurrent3DProviderIndex() const;
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
float GetCollisionOneShotRatio(int32 a, float b) const; /// ok
float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
float GetDistanceSquared(CVector *v) const; /// ok
int32 GetJumboTaxiFreq() const; /// ok
bool GetMissionAudioLoadingStatus() const; /// ok
int8 GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
float GetCollisionOneShotRatio(int32 a, float b) const;
float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(CVector *v) const;
int32 GetJumboTaxiFreq() const;
bool GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound);
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
cTransmission *transmission,
float velocityChange); /// ok
cTransmission *transmission, float velocityChange);
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
cTransmission *transmission,
float velocityChange); /// ok
cTransmission *transmission, float velocityChange);
bool HasAirBrakes(int32 model) const; /// ok
bool HasAirBrakes(int32 model) const;
void Initialise(); /// ok
void InitialisePoliceRadio(); /// ok
void InitialisePoliceRadioZones(); /// ok
void InterrogateAudioEntities(); /// ok
bool IsAudioInitialised() const; /// ok
bool IsMissionAudioSampleFinished(); /// ok
void Initialise();
void InitialisePoliceRadio();
void InitialisePoliceRadioZones();
void InterrogateAudioEntities();
bool IsAudioInitialised() const;
bool IsMissionAudioSampleFinished();
bool IsMP3RadioChannelAvailable() const;
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
void PlayLoadedMissionAudio(); /// ok
void PlayOneShot(int32 index, int16 sound, float vol); /// ok
void PlaySuspectLastSeen(float x, float y, float z); /// ok
void PlayerJustGotInCar() const; /// ok
void PlayerJustLeftCar() const; /// ok
void PostInitialiseGameSpecificSetup(); /// ok
void PostTerminateGameSpecificShutdown(); /// ok
void PreInitialiseGameSpecificSetup() const; /// ok
void PreloadMissionAudio(const char *name); /// ok
void PreTerminateGameSpecificShutdown(); /// ok
void PlayLoadedMissionAudio();
void PlayOneShot(int32 index, int16 sound, float vol);
void PlaySuspectLastSeen(float x, float y, float z);
void PlayerJustGotInCar() const;
void PlayerJustLeftCar() const;
void PostInitialiseGameSpecificSetup();
void PostTerminateGameSpecificShutdown();
void PreInitialiseGameSpecificSetup() const;
void PreloadMissionAudio(const char *name);
void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds
void ProcessActiveQueues(); /// ok
bool ProcessAirBrakes(cVehicleParams *params); /// ok
void ProcessAirportScriptObject(uint8 sound); /// ok
bool ProcessBoatEngine(cVehicleParams *params); /// ok
bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
void ProcessBridge(); /// ok
void ProcessBridgeMotor(); /// ok
void ProcessBridgeOneShots(); /// ok
void ProcessBridgeWarning(); /// ok
bool ProcessCarBombTick(cVehicleParams *params); /// ok
void ProcessCesna(cVehicleParams *params); /// ok
void ProcessCinemaScriptObject(uint8 sound); /// ok
void ProcessCrane(); /// ok
void ProcessDocksScriptObject(uint8 sound); /// ok
bool ProcessEngineDamage(cVehicleParams *params); /// ok
void ProcessEntity(int32 sound); /// ok
void ProcessExplosions(int32 explosion); /// ok
void ProcessFireHydrant(); /// ok
void ProcessFires(int32 entity); /// ok
void ProcessFrontEnd(); /// ok
void ProcessGarages(); /// ok
bool ProcessHelicopter(cVehicleParams *params); /// ok
void ProcessHomeScriptObject(uint8 sound); /// ok
void ProcessJumbo(cVehicleParams *); /// ok
void ProcessJumboAccel(CPlane *plane); /// ok
void ProcessJumboDecel(CPlane *plane); /// ok
void ProcessJumboFlying(); /// ok
void ProcessJumboLanding(CPlane *plane); /// ok
void ProcessJumboTakeOff(CPlane *plane); /// ok
void ProcessJumboTaxi(); /// ok
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
void ProcessLoopingScriptObject(uint8 sound); /// ok
void ProcessMissionAudio(); /// ok
void ProcessModelCarEngine(cVehicleParams *params); /// ok
void ProcessOneShotScriptObject(uint8 sound); /// ok
void ProcessPed(CPhysical *ped); /// ok
void ProcessPedHeadphones(cPedParams *params); /// ok
void ProcessPedOneShots(cPedParams *params); // todo later (weird)
void ProcessPhysical(int32 id); /// ok
void ProcessPlane(cVehicleParams *params); /// ok
void ProcessPlayersVehicleEngine(cVehicleParams *params,
CAutomobile *automobile); /// ok
void ProcessPoliceCellBeatingScriptObject(uint8 sound); /// ok
void ProcessPornCinema(uint8 sound); /// ok
void ProcessProjectiles(); /// ok
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
void ProcessReverb() const; /// ok
bool ProcessReverseGear(cVehicleParams *params); /// ok
void ProcessSawMillScriptObject(uint8 sound); /// ok
void ProcessScriptObject(int32 id); /// ok
void ProcessShopScriptObject(uint8 sound); /// ok
void ProcessSpecial(); /// ok
bool ProcessTrainNoise(cVehicleParams *params); /// ok
void ProcessVehicle(CVehicle *vehicle); /// ok
bool ProcessVehicleDoors(cVehicleParams *params); /// ok
void ProcessVehicleEngine(cVehicleParams *params); /// ok
void ProcessVehicleHorn(cVehicleParams *params); /// ok
void ProcessVehicleOneShots(void *); // todo
bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok
bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok
void ProcessVehicleSirenOrAlarm(cVehicleParams *params); /// ok
void ProcessVehicleSkidding(cVehicleParams *params); /// ok
void ProcessWaterCannon(int32); /// ok
void ProcessWeather(int32 id); /// ok
bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
void ProcessWorkShopScriptObject(uint8 sound); /// ok
void ProcessActiveQueues();
bool ProcessAirBrakes(cVehicleParams *params);
void ProcessAirportScriptObject(uint8 sound);
bool ProcessBoatEngine(cVehicleParams *params);
bool ProcessBoatMovingOverWater(cVehicleParams *params);
void ProcessBridge();
void ProcessBridgeMotor();
void ProcessBridgeOneShots();
void ProcessBridgeWarning();
bool ProcessCarBombTick(cVehicleParams *params);
void ProcessCesna(cVehicleParams *params);
void ProcessCinemaScriptObject(uint8 sound);
void ProcessCrane();
void ProcessDocksScriptObject(uint8 sound);
bool ProcessEngineDamage(cVehicleParams *params);
void ProcessEntity(int32 sound);
void ProcessExplosions(int32 explosion);
void ProcessFireHydrant();
void ProcessFires(int32 entity);
void ProcessFrontEnd();
void ProcessGarages();
bool ProcessHelicopter(cVehicleParams *params);
void ProcessHomeScriptObject(uint8 sound);
void ProcessJumbo(cVehicleParams *);
void ProcessJumboAccel(CPlane *plane);
void ProcessJumboDecel(CPlane *plane);
void ProcessJumboFlying();
void ProcessJumboLanding(CPlane *plane);
void ProcessJumboTakeOff(CPlane *plane);
void ProcessJumboTaxi();
void ProcessLaunderetteScriptObject(uint8 sound);
void ProcessLoopingScriptObject(uint8 sound);
void ProcessMissionAudio();
void ProcessModelCarEngine(cVehicleParams *params);
void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *ped);
void ProcessPedHeadphones(cPedParams *params);
void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id);
void ProcessPlane(cVehicleParams *params);
void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile);
void ProcessPoliceCellBeatingScriptObject(uint8 sound);
void ProcessPornCinema(uint8 sound);
void ProcessProjectiles();
void ProcessRainOnVehicle(cVehicleParams *params);
void ProcessReverb() const;
bool ProcessReverseGear(cVehicleParams *params);
void ProcessSawMillScriptObject(uint8 sound);
void ProcessScriptObject(int32 id);
void ProcessShopScriptObject(uint8 sound);
void ProcessSpecial();
bool ProcessTrainNoise(cVehicleParams *params);
void ProcessVehicle(CVehicle *vehicle);
bool ProcessVehicleDoors(cVehicleParams *params);
void ProcessVehicleEngine(cVehicleParams *params);
void ProcessVehicleHorn(cVehicleParams *params);
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
bool ProcessVehicleRoadNoise(cVehicleParams *params);
void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
void ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
bool ProcessWetRoadNoise(cVehicleParams *params);
void ProcessWorkShopScriptObject(uint8 sound);
int32 RandomDisplacement(uint32 seed) const;
void ReacquireDigitalHandle() const;
void ReleaseDigitalHandle() const;
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
float intensity2); /// ok
void ReportCrime(int32 crime, const CVector *pos); /// ok
void ResetAudioLogicTimers(uint32 timer); /// ok
void ResetPoliceRadio(); /// ok
void ResetTimers(uint32 time); /// ok
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
float collisionPower, float intensity2);
void ReportCrime(int32 crime, const CVector *pos);
void ResetAudioLogicTimers(uint32 timer);
void ResetPoliceRadio();
void ResetTimers(uint32 time);
void Service(); /// ok
void ServiceCollisions(); /// ok
void ServicePoliceRadio(); /// ok
void ServicePoliceRadioChannel(int32 wantedLevel); /// ok
void ServiceSoundEffects(); /// ok
int8 SetCurrent3DProvider(uint8 which); /// ok
void Service();
void ServiceCollisions();
void ServicePoliceRadio();
void ServicePoliceRadioChannel(int32 wantedLevel);
void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool status);
void SetEffectsFadeVolume(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); /// ok
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision);
void SetMissionAudioLocation(float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const;
void SetMonoMode(uint8); // todo (mobile)
void SetMusicFadeVolume(uint8 volume) const;
void SetMusicMasterVolume(uint8 volume) const;
void SetSpeakerConfig(int32 conf) const;
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); /// ok
void SetUpOneShotCollisionSound(cAudioCollision *col); /// ok
bool SetupCrimeReport(); /// ok
bool SetupJumboEngineSound(uint8 vol, int32 freq); /// ok
bool SetupJumboFlySound(uint8 emittingVol); /// ok
bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
bool SetupJumboTaxiSound(uint8 vol); /// ok
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
void SetupSuspectLastSeenReport(); /// ok
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter);
void SetUpOneShotCollisionSound(cAudioCollision *col);
bool SetupCrimeReport();
bool SetupJumboEngineSound(uint8 vol, int32 freq);
bool SetupJumboFlySound(uint8 emittingVol);
bool SetupJumboRumbleSound(uint8 emittingVol);
bool SetupJumboTaxiSound(uint8 vol);
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq);
void SetupPedComments(cPedParams *params, uint32 sound);
void SetupSuspectLastSeenReport();
void Terminate();
void TranslateEntity(CVector *v1, CVector *v2) const;
@ -604,11 +614,10 @@ public:
bool UsesSirenSwitching(int32 model) const;
// only used in pc
void AdjustSamplesVolume(); /// ok
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity,
float dist); /// ok
void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
};
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
extern cAudioManager &AudioManager;
extern cAudioManager AudioManager;

View File

@ -82,34 +82,34 @@ int curBottomBarOption = -1;
int hoveredBottomBarOption = -1;
#endif
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; // 9
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58; // 1
int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C; // 1
int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60; // 1
int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54; // 1
int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E;
int32 &CMenuManager::m_ControlMethod = *(int32*)0x8F5F7C;
int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; // 1
int32 &CMenuManager::m_PrefsLanguage = *(int32*)0x941238;
int32 CMenuManager::OS_Language = LANG_ENGLISH; // *(int32*)0x5F2F78;
int8 CMenuManager::m_PrefsUseVibration; // = *(int8*)0x95CD92;
int8 CMenuManager::m_DisplayControllerOnFoot; // = *(int8*)0x95CD8D;
int8 CMenuManager::m_PrefsVsync = 1; // *(int8*)0x5F2E58;
int8 CMenuManager::m_PrefsVsyncDisp = 1; // *(int8*)0x5F2E5C;
int8 CMenuManager::m_PrefsFrameLimiter = 1; // *(int8*)0x5F2E60;
int8 CMenuManager::m_PrefsShowSubtitles = 1; // *(int8*)0x5F2E54;
int8 CMenuManager::m_PrefsSpeakers; // = *(int8*)0x95CD7E;
int32 CMenuManager::m_ControlMethod; // = *(int32*)0x8F5F7C;
int8 CMenuManager::m_PrefsDMA = 1; // *(int8*)0x5F2F74;
int32 CMenuManager::m_PrefsLanguage; // = *(int32*)0x941238;
uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings
bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; // true
bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4;
bool &CMenuManager::m_bShutDownFrontEndRequested = *(bool*)0x95CD6A;
bool CMenuManager::m_PrefsAllowNastyGame = true; // *(bool*)0x5F2E64;
bool CMenuManager::m_bStartUpFrontEndRequested; // = *(bool*)0x95CCF4;
bool CMenuManager::m_bShutDownFrontEndRequested; // = *(bool*)0x95CD6A;
int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23;
int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4;
int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; // 256
float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4;
int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; // 102
int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; // 102
int8 CMenuManager::m_PrefsUseWideScreen; // = *(int8*)0x95CD23;
int8 CMenuManager::m_PrefsRadioStation; // = *(int8*)0x95CDA4;
int32 CMenuManager::m_PrefsBrightness = 256; // = *(int32*)0x5F2E50;
float CMenuManager::m_PrefsLOD; // = *(float*)0x8F42C4;
int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt; // = *(int8*)0x628CFC;
int32 CMenuManager::m_PrefsMusicVolume = 102; // = *(int32*)0x5F2E4C;
int32 CMenuManager::m_PrefsSfxVolume = 102; // = *(int32*)0x5F2E48;
char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
char CMenuManager::m_PrefsSkinFile[256] = "$$\"\""; // = (char*)0x5F2E74;
int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
int32 CMenuManager::m_KeyPressedCode = -1; // = *(int32*)0x5F2E70;
// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
#ifdef PS2_LIKE_MENU
@ -1655,7 +1655,6 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
}
}
// TODO: Complete aScreens and test that
void
CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight)
{
@ -2463,7 +2462,7 @@ CMenuManager::DrawPlayerSetupScreen()
m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';
// Truncate to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
// Fill to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 39); // game doesn't do that, but in our day strncpy to same string is forbidden
strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 39);
if (oldLength - 4 > 39)
@ -4875,7 +4874,7 @@ float CMenuManager::StretchY(float y)
void
CMenuManager::SwitchMenuOnAndOff()
{
bool menuWasActive = !!m_bMenuActive;
bool menuWasActive = GetIsMenuActive();
// Reminder: You need REGISTER_START_BUTTON defined to make it work.
if (CPad::GetPad(0)->GetStartJustDown()

View File

@ -530,30 +530,30 @@ public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public:
static int32 &OS_Language;
static int8 &m_PrefsUseVibration;
static int8 &m_DisplayControllerOnFoot;
static int8 &m_PrefsUseWideScreen;
static int8 &m_PrefsRadioStation;
static int8 &m_PrefsVsync;
static int8 &m_PrefsVsyncDisp;
static int8 &m_PrefsFrameLimiter;
static int8 &m_PrefsShowSubtitles;
static int8 &m_PrefsSpeakers;
static int32 &m_ControlMethod;
static int8 &m_PrefsDMA;
static int32 &m_PrefsLanguage;
static int32 &m_PrefsBrightness;
static float &m_PrefsLOD;
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume;
static char *m_PrefsSkinFile;
static int32 &m_KeyPressedCode;
static int32 OS_Language;
static int8 m_PrefsUseVibration;
static int8 m_DisplayControllerOnFoot;
static int8 m_PrefsUseWideScreen;
static int8 m_PrefsRadioStation;
static int8 m_PrefsVsync;
static int8 m_PrefsVsyncDisp;
static int8 m_PrefsFrameLimiter;
static int8 m_PrefsShowSubtitles;
static int8 m_PrefsSpeakers;
static int32 m_ControlMethod;
static int8 m_PrefsDMA;
static int32 m_PrefsLanguage;
static int32 m_PrefsBrightness;
static float m_PrefsLOD;
static int8 m_bFrontEnd_ReloadObrTxtGxt;
static int32 m_PrefsMusicVolume;
static int32 m_PrefsSfxVolume;
static char m_PrefsSkinFile[256];
static int32 m_KeyPressedCode;
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
static bool m_bStartUpFrontEndRequested;
static bool m_bShutDownFrontEndRequested;
static bool m_PrefsAllowNastyGame;
static uint8 m_PrefsStereoMono;
static int32 m_SelectedMap;

71
src/core/Profile.cpp Normal file
View File

@ -0,0 +1,71 @@
#include "common.h"
#include "Profile.h"
#ifndef MASTER
float CProfile::ms_afStartTime[NUM_PROFILES];
float CProfile::ms_afCumulativeTime[NUM_PROFILES];
float CProfile::ms_afEndTime[NUM_PROFILES];
float CProfile::ms_afMaxEndTime[NUM_PROFILES];
float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
char *CProfile::ms_pProfileString[NUM_PROFILES];
RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
void CProfile::Initialise()
{
ms_afMaxEndTime[PROFILE_FRAME_RATE] = 0.0f;
ms_afMaxEndTime[PROFILE_PHYSICS] = 0.0f;
ms_afMaxEndTime[PROFILE_COLLISION] = 0.0f;
ms_afMaxEndTime[PROFILE_PED_AI] = 0.0f;
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = 0.0f;
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = 0.0f;
ms_afMaxEndTime[PROFILE_TOTAL] = 0.0f;
ms_pProfileString[PROFILE_FRAME_RATE] = "Frame rate";
ms_pProfileString[PROFILE_PHYSICS] = "Physics";
ms_pProfileString[PROFILE_COLLISION] = "Collision";
ms_pProfileString[PROFILE_PED_AI] = "Ped AI";
ms_pProfileString[PROFILE_PROCESSING_TIME] = "Processing time";
ms_pProfileString[PROFILE_RENDERING_TIME] = "Rendering time";
ms_pProfileString[PROFILE_TOTAL] = "Total";
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_COLLISION] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_PED_AI] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = 0.0f;
ms_afMaxCumulativeTime[PROFILE_TOTAL] = 0.0f;
ms_aBarColours[PROFILE_PHYSICS] = { 0, 127, 255, 255 };
ms_aBarColours[PROFILE_COLLISION] = { 0, 255, 255, 255 };
ms_aBarColours[PROFILE_PED_AI] = { 255, 0, 0, 255 };
ms_aBarColours[PROFILE_PROCESSING_TIME] = { 0, 255, 0, 255 };
ms_aBarColours[PROFILE_RENDERING_TIME] = { 0, 0, 255, 255 };
ms_aBarColours[PROFILE_TOTAL] = { 255, 255, 255, 255 };
}
void CProfile::SuspendProfile(eProfile profile)
{
ms_afEndTime[profile] = -ms_afStartTime[profile];
ms_afCumulativeTime[profile] -= ms_afStartTime[profile];
}
void CProfile::ShowResults()
{
ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
}
#endif

28
src/core/Profile.h Normal file
View File

@ -0,0 +1,28 @@
#pragma once
enum eProfile
{
PROFILE_FRAME_RATE,
PROFILE_PHYSICS,
PROFILE_COLLISION,
PROFILE_PED_AI,
PROFILE_PROCESSING_TIME,
PROFILE_RENDERING_TIME,
PROFILE_TOTAL,
NUM_PROFILES,
};
class CProfile
{
static float ms_afStartTime[NUM_PROFILES];
static float ms_afCumulativeTime[NUM_PROFILES];
static float ms_afEndTime[NUM_PROFILES];
static float ms_afMaxEndTime[NUM_PROFILES];
static float ms_afMaxCumulativeTime[NUM_PROFILES];
static char *ms_pProfileString[NUM_PROFILES];
static RwRGBA ms_aBarColours[NUM_PROFILES];
public:
static void Initialise();
static void SuspendProfile(eProfile profile);
static void ShowResults();
};

View File

@ -4,7 +4,6 @@
#include "Gangs.h"
#include "Weapon.h"
//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
CGangInfo CGangs::Gang[NUM_GANGS];
CGangInfo::CGangInfo() :
@ -70,7 +69,6 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
Initialise();
INITSAVEBUF
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
for (int i = 0; i < NUM_GANGS; i++)

View File

@ -29,39 +29,54 @@
#define PED_REMOVE_DIST (MIN_CREATION_DIST + CREATION_RANGE + 1.0f)
#define PED_REMOVE_DIST_SPECIAL (MIN_CREATION_DIST + CREATION_RANGE + 15.0f) // for peds with bCullExtraFarAway flag
// TO-DO: These are hard-coded, reverse them.
// More clearly they're transition areas between zones.
RegenerationPoint (&aSafeZones)[8] = *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
// Transition areas between zones
const RegenerationPoint aSafeZones[] = {
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 400.0f, 814.0f, -954.0f, -903.0f, 30.0f, 100.0f,
CVector(790.0f, -917.0f, 39.0f), CVector(775.0f, -921.0f, 39.0f), CVector(424.0f, -942.0f, 38.0f), CVector(439.0f, -938.0f, 38.0f) },
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f,
CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f) },
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 26.0f, 44.0f, 124.0f, 87.0f, 20.0f, 6.0f,
CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f) },
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 45.0f, 34.0f, 780.0f, 750.0f, 25.0f, 6.0f,
CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f) },
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 532.0f, 136.0f, 668.0f, 599.0f, 4.0f, 0.0f,
CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f) },
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 325.0f, 175.0f, 7.0f, 5.0f, 30.0f, 10.0f,
CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f) },
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 410.0f, 310.0f, 1055.0f, 1030.0f, 20.0f, 6.0f,
CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) },
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 425.0f, 280.0f, 471.0f, 447.0f, 20.0f, 5.0f,
CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) }
}; // *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
//PedGroup (&CPopulation::ms_pPedGroups)[NUMPEDGROUPS] = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS];
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70;
int32 &CPopulation::MaxNumberOfPedsInUse = *(int32*)0x5FA574;
uint32& CPopulation::ms_nNumCivMale = *(uint32*)0x8F2548;
uint32& CPopulation::ms_nNumCivFemale = *(uint32*)0x8F5F44;
uint32& CPopulation::ms_nNumCop = *(uint32*)0x885AFC;
bool& CPopulation::bZoneChangeHasHappened = *(bool*)0x95CD79;
uint32& CPopulation::ms_nNumEmergency = *(uint32*)0x94071C;
int8& CPopulation::m_CountDownToPedsAtStart = *(int8*)0x95CD4F;
uint32& CPopulation::ms_nNumGang1 = *(uint32*)0x8F1B1C;
uint32& CPopulation::ms_nNumGang2 = *(uint32*)0x8F1B14;
uint32& CPopulation::ms_nTotalPeds = *(uint32*)0x95CB50;
uint32& CPopulation::ms_nNumGang3 = *(uint32*)0x8F2548;
uint32& CPopulation::ms_nTotalGangPeds = *(uint32*)0x885AF0;
uint32& CPopulation::ms_nNumGang4 = *(uint32*)0x8F1B2C;
uint32& CPopulation::ms_nTotalCivPeds = *(uint32*)0x8F2C3C;
uint32& CPopulation::ms_nNumGang5 = *(uint32*)0x8F1B30;
uint32& CPopulation::ms_nNumDummy = *(uint32*)0x8F1A98;
uint32& CPopulation::ms_nNumGang6 = *(uint32*)0x8F1B20;
uint32& CPopulation::ms_nNumGang9 = *(uint32*)0x8F1B10;
uint32& CPopulation::ms_nNumGang7 = *(uint32*)0x8F1B28;
uint32& CPopulation::ms_nNumGang8 = *(uint32*)0x8F1B0C;
CVector &CPopulation::RegenerationPoint_a = *(CVector*)0x8E2AA4;
CVector &CPopulation::RegenerationPoint_b = *(CVector*)0x8E2A98;
CVector &CPopulation::RegenerationForward = *(CVector*)0x8F1AD4;
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS]; // = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
bool CPopulation::ms_bGivePedsWeapons; // = *(bool*)0x95CCF6;
int32 CPopulation::m_AllRandomPedsThisType = -1; // = *(int32*)0x5FA570;
float CPopulation::PedDensityMultiplier = 1.0f; // = *(float*)0x5FA56C;
uint32 CPopulation::ms_nTotalMissionPeds; // = *(uint32*)0x8F5F70;
int32 CPopulation::MaxNumberOfPedsInUse = 25; // *(int32*)0x5FA574;
uint32 CPopulation::ms_nNumCivMale; // = *(uint32*)0x8F2548;
uint32 CPopulation::ms_nNumCivFemale; // = *(uint32*)0x8F5F44;
uint32 CPopulation::ms_nNumCop; // = *(uint32*)0x885AFC;
bool CPopulation::bZoneChangeHasHappened; // = *(bool*)0x95CD79;
uint32 CPopulation::ms_nNumEmergency; // = *(uint32*)0x94071C;
int8 CPopulation::m_CountDownToPedsAtStart; // = *(int8*)0x95CD4F;
uint32 CPopulation::ms_nNumGang1; // = *(uint32*)0x8F1B1C;
uint32 CPopulation::ms_nNumGang2; // = *(uint32*)0x8F1B14;
uint32 CPopulation::ms_nTotalPeds; // = *(uint32*)0x95CB50;
uint32 CPopulation::ms_nNumGang3; // = *(uint32*)0x8F2548;
uint32 CPopulation::ms_nTotalGangPeds; // = *(uint32*)0x885AF0;
uint32 CPopulation::ms_nNumGang4; // = *(uint32*)0x8F1B2C;
uint32 CPopulation::ms_nTotalCivPeds; // = *(uint32*)0x8F2C3C;
uint32 CPopulation::ms_nNumGang5; // = *(uint32*)0x8F1B30;
uint32 CPopulation::ms_nNumDummy; // = *(uint32*)0x8F1A98;
uint32 CPopulation::ms_nNumGang6; // = *(uint32*)0x8F1B20;
uint32 CPopulation::ms_nNumGang9; // = *(uint32*)0x8F1B10;
uint32 CPopulation::ms_nNumGang7; // = *(uint32*)0x8F1B28;
uint32 CPopulation::ms_nNumGang8; // = *(uint32*)0x8F1B0C;
CVector CPopulation::RegenerationPoint_a; // = *(CVector*)0x8E2AA4;
CVector CPopulation::RegenerationPoint_b; // = *(CVector*)0x8E2A98;
CVector CPopulation::RegenerationForward; // = *(CVector*)0x8F1AD4;
void
CPopulation::Initialise()

View File

@ -34,33 +34,33 @@ class CPopulation
{
public:
static PedGroup ms_pPedGroups[NUMPEDGROUPS];
static bool &ms_bGivePedsWeapons;
static int32 &m_AllRandomPedsThisType;
static float &PedDensityMultiplier;
static uint32 &ms_nTotalMissionPeds;
static int32 &MaxNumberOfPedsInUse;
static uint32& ms_nNumCivMale;
static uint32 &ms_nNumCivFemale;
static uint32 &ms_nNumCop;
static bool &bZoneChangeHasHappened;
static uint32 &ms_nNumEmergency;
static int8& m_CountDownToPedsAtStart;
static uint32& ms_nNumGang1;
static uint32& ms_nNumGang2;
static uint32& ms_nTotalPeds;
static uint32& ms_nNumGang3;
static uint32& ms_nTotalGangPeds;
static uint32& ms_nNumGang4;
static uint32& ms_nTotalCivPeds;
static uint32& ms_nNumGang5;
static uint32& ms_nNumDummy;
static uint32& ms_nNumGang6;
static uint32& ms_nNumGang9;
static uint32& ms_nNumGang7;
static uint32& ms_nNumGang8;
static CVector& RegenerationPoint_a;
static CVector& RegenerationPoint_b;
static CVector& RegenerationForward;
static bool ms_bGivePedsWeapons;
static int32 m_AllRandomPedsThisType;
static float PedDensityMultiplier;
static uint32 ms_nTotalMissionPeds;
static int32 MaxNumberOfPedsInUse;
static uint32 ms_nNumCivMale;
static uint32 ms_nNumCivFemale;
static uint32 ms_nNumCop;
static bool bZoneChangeHasHappened;
static uint32 ms_nNumEmergency;
static int8 m_CountDownToPedsAtStart;
static uint32 ms_nNumGang1;
static uint32 ms_nNumGang2;
static uint32 ms_nTotalPeds;
static uint32 ms_nNumGang3;
static uint32 ms_nTotalGangPeds;
static uint32 ms_nNumGang4;
static uint32 ms_nTotalCivPeds;
static uint32 ms_nNumGang5;
static uint32 ms_nNumDummy;
static uint32 ms_nNumGang6;
static uint32 ms_nNumGang9;
static uint32 ms_nNumGang7;
static uint32 ms_nNumGang8;
static CVector RegenerationPoint_a;
static CVector RegenerationPoint_b;
static CVector RegenerationForward;
static void Initialise();
static void Update(void);

View File

@ -3,6 +3,44 @@
#include "patcher.h"
#include "Timecycle.h"
#include "skeleton.h"
#if defined(RWLIBS) && !defined(FINAL)
#include "rtcharse.h"
#pragma comment( lib, "rtcharse.lib" )
RtCharset *debugCharset;
#endif
void CreateDebugFont()
{
#if defined(RWLIBS) && !defined(FINAL)
RwRGBA color = { 255, 255, 128, 255 };
RwRGBA colorbg = { 0, 0, 0, 0 };
RtCharsetOpen();
debugCharset = RtCharsetCreate(&color, &colorbg);
#endif
}
void DestroyDebugFont()
{
#if defined(RWLIBS) && !defined(FINAL)
RtCharsetDestroy(debugCharset);
RtCharsetClose();
#endif
}
void ObrsPrintfString(const char *str, short x, short y)
{
#if defined(RWLIBS) && !defined(FINAL)
RtCharsetPrintBuffered(debugCharset, str, x, y, true);
#endif
}
void FlushObrsPrintfs()
{
#if defined(RWLIBS) && !defined(FINAL)
RtCharsetBufferFlush();
#endif
}
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
@ -347,21 +385,6 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
void CreateDebugFont()
{
;
}
void DestroyDebugFont()
{
;
}
void FlushObrsPrintfs()
{
;
}
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }

View File

@ -5,6 +5,7 @@ void RwFreeAlign(void *mem);
void CreateDebugFont();
void DestroyDebugFont();
void ObrsPrintfString(const char *str, short x, short y);
void FlushObrsPrintfs();
void DefinedState(void);
RwFrame *GetFirstChild(RwFrame *frame);

View File

@ -43,8 +43,16 @@ struct MatFX
int effects;
};
#ifdef RWLIBS
extern "C" {
extern int MatFXMaterialDataOffset;
extern int MatFXAtomicDataOffset;
void _rpMatFXD3D8AtomicMatFXEnvRender(RxD3D8InstanceData* inst, int flags, int sel, RwTexture* texture, RwTexture* envMap);
}
#else
int &MatFXMaterialDataOffset = *(int*)0x66188C;
int &MatFXAtomicDataOffset = *(int*)0x66189C;
#endif
#ifdef PS2_MATFX
@ -206,8 +214,13 @@ _rpMatFXD3D8AtomicMatFXEnvRender_ps2(RxD3D8InstanceData *inst, int flags, int se
RwD3D8SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
}
STARTPATCHES
#ifdef RWLIBS
InjectHook((uintptr)&_rpMatFXD3D8AtomicMatFXEnvRender, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
#else
InjectHook(0x5CF6C0, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
#endif
ENDPATCHES
#endif

View File

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

View File

@ -14,11 +14,11 @@
#include "Vehicle.h"
#include "World.h"
uint8 &CTheCarGenerators::ProcessCounter = *(uint8*)0x95CDAF;
uint32 &CTheCarGenerators::NumOfCarGenerators = *(uint32*)0x8E2C1C;
CCarGenerator (&CTheCarGenerators::CarGeneratorArray)[NUM_CARGENS] = *(CCarGenerator(*)[NUM_CARGENS])*(uintptr*)0x87CB18;
uint8 &CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter = *(uint8*)0x95CDC6;
uint32 &CTheCarGenerators::CurrentActiveCount = *(uint32*)0x8F2C5C;
uint8 CTheCarGenerators::ProcessCounter;
uint32 CTheCarGenerators::NumOfCarGenerators;
CCarGenerator CTheCarGenerators::CarGeneratorArray[NUM_CARGENS];
uint8 CTheCarGenerators::GenerateEvenIfPlayerIsCloseCounter;
uint32 CTheCarGenerators::CurrentActiveCount;
void CCarGenerator::SwitchOff()
{
@ -187,59 +187,6 @@ bool CCarGenerator::CheckIfWithinRangeOfAnyPlayer()
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()
{
if (FindPlayerTrain() || CCutsceneMgr::IsCutsceneProcessing())
@ -268,39 +215,38 @@ void CTheCarGenerators::Init()
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(uint32) + sizeof(CarGeneratorArray) + SAVE_HEADER_SIZE;
INITSAVEBUF
WriteSaveHeader(buffer, 'C','G','N','\0', *size - SAVE_HEADER_SIZE);
WriteSaveBuf(buffer, 12); /* what is this? */
WriteSaveBuf(buffer, nGeneralDataSize);
WriteSaveBuf(buffer, NumOfCarGenerators);
WriteSaveBuf(buffer, CurrentActiveCount);
WriteSaveBuf(buffer, ProcessCounter);
WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter);
WriteSaveBuf(buffer, (int16)0);
WriteSaveBuf(buffer, (int16)0); // alignment
WriteSaveBuf(buffer, sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++){
CarGeneratorArray[i].Save(buffer);
}
for (int i = 0; i < NUM_CARGENS; i++)
WriteSaveBuf(buffer, CarGeneratorArray[i]);
VALIDATESAVEBUF(*size)
}
void CTheCarGenerators::LoadAllCarGenerators(uint8* buffer, uint32 size)
{
const int32 nGeneralDataSize = sizeof(NumOfCarGenerators) + sizeof(CurrentActiveCount) + sizeof(ProcessCounter) + sizeof(GenerateEvenIfPlayerIsCloseCounter) + sizeof(int16);
Init();
INITSAVEBUF
assert(size == 20 + sizeof(CarGeneratorArray) + 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);
CurrentActiveCount = ReadSaveBuf<uint32>(buffer);
ProcessCounter = ReadSaveBuf<uint8>(buffer);
GenerateEvenIfPlayerIsCloseCounter = ReadSaveBuf<uint8>(buffer);
ReadSaveBuf<int16>(buffer);
ReadSaveBuf<int16>(buffer); // alignment
assert(ReadSaveBuf<uint32>(buffer) == sizeof(CarGeneratorArray));
for (int i = 0; i < NUM_CARGENS; i++) {
CarGeneratorArray[i].Load(buffer);
}
for (int i = 0; i < NUM_CARGENS; i++)
CarGeneratorArray[i] = ReadSaveBuf<CCarGenerator>(buffer);
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);
bool CheckForBlockage();
bool CheckIfWithinRangeOfAnyPlayer();
void Save(uint8*&);
void Load(uint8*&);
void SetUsesRemaining(uint16 uses) { m_nUsesRemaining = uses; }
};
class CTheCarGenerators
{
public:
static uint8 &ProcessCounter;
static uint32 &NumOfCarGenerators;
static CCarGenerator (&CarGeneratorArray)[NUM_CARGENS];
static uint8 &GenerateEvenIfPlayerIsCloseCounter;
static uint32 &CurrentActiveCount;
static uint8 ProcessCounter;
static uint32 NumOfCarGenerators;
static CCarGenerator CarGeneratorArray[NUM_CARGENS];
static uint8 GenerateEvenIfPlayerIsCloseCounter;
static uint32 CurrentActiveCount;
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);

View File

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

View File

@ -89,10 +89,9 @@ public:
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle);
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle);
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 int32& NumCranes;
static CCrane(&aCranes)[NUM_CRANES];
static uint32 CarsCollectedMilitaryCrane;
static int32 NumCranes;
static CCrane aCranes[NUM_CRANES];
};
void CranesLoad(uint8*, uint32); // is this really outside CCranes?