diff options
author | erorcun <erayorcunus@gmail.com> | 2020-03-22 02:50:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 02:50:38 +0100 |
commit | 23f2ab5ff168e821c54ff84618bd4a5a12476cd5 (patch) | |
tree | d42b0d0fe6ef7f1b2d68b71ecbc63437d6ab2c4d /src/control | |
parent | Merge pull request #349 from Nick007J/master (diff) | |
parent | Merge branch 'master' into erorcun (diff) | |
download | re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar.gz re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar.bz2 re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar.lz re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar.xz re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.tar.zst re3-23f2ab5ff168e821c54ff84618bd4a5a12476cd5.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/CarCtrl.cpp | 4 | ||||
-rw-r--r-- | src/control/Gangs.cpp | 15 | ||||
-rw-r--r-- | src/control/Gangs.h | 9 | ||||
-rw-r--r-- | src/control/Garages.cpp | 4 |
4 files changed, 15 insertions, 17 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index ab7a4aa1..de8c799e 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -596,10 +596,10 @@ CCarCtrl::ChooseCarModel(int32 vehclass) case TAXI: { if (TotalNumOfCarsOfRating[vehclass] == 0) - debug("ChooseCarModel : No cars of type %d have been declared\n"); + debug("ChooseCarModel : No cars of type %d have been declared\n", vehclass); model = CarArrays[vehclass][NextCarOfRating[vehclass]]; int32 total = TotalNumOfCarsOfRating[vehclass]; - NextCarOfRating[vehclass] += 1 + CGeneral::GetRandomNumberInRange(0, total - 1); + NextCarOfRating[vehclass] += CGeneral::GetRandomNumberInRange(1, total); while (NextCarOfRating[vehclass] >= total) NextCarOfRating[vehclass] -= total; //NextCarOfRating[vehclass] %= total; diff --git a/src/control/Gangs.cpp b/src/control/Gangs.cpp index f5f609bc..f9cb4698 100644 --- a/src/control/Gangs.cpp +++ b/src/control/Gangs.cpp @@ -3,7 +3,8 @@ #include "ModelIndices.h" #include "Gangs.h" -CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78; +//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78; +CGangInfo CGangs::Gang[NUM_GANGS]; CGangInfo::CGangInfo() : m_nVehicleMI(MI_BUS), @@ -34,11 +35,11 @@ void CGangs::SetGangVehicleModel(int16 gang, int32 model) GetGangInfo(gang)->m_nVehicleMI = model; } -void CGangs::SetGangWeapons(int16 gang, eWeaponType weapon1, eWeaponType weapon2) +void CGangs::SetGangWeapons(int16 gang, int32 weapon1, int32 weapon2) { CGangInfo *gi = GetGangInfo(gang); - gi->m_Weapon1 = weapon1; - gi->m_Weapon2 = weapon2; + gi->m_Weapon1 = (eWeaponType)weapon1; + gi->m_Weapon2 = (eWeaponType)weapon2; } void CGangs::SetGangPedModelOverride(int16 gang, int8 ovrd) @@ -68,11 +69,11 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size) Initialize();
INITSAVEBUF
-
- WriteSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE); + // original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
+ CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE); + for (int i = 0; i < NUM_GANGS; i++) Gang[i] = ReadSaveBuf<CGangInfo>(buf); - VALIDATESAVEBUF(size); } diff --git a/src/control/Gangs.h b/src/control/Gangs.h index 379543ee..a348f259 100644 --- a/src/control/Gangs.h +++ b/src/control/Gangs.h @@ -32,18 +32,15 @@ class CGangs public: static void Initialize(void); static void SetGangVehicleModel(int16, int32); - static void SetGangWeapons(int16, eWeaponType, eWeaponType); + static void SetGangWeapons(int16, int32, int32); static void SetGangPedModelOverride(int16, int8); static int8 GetGangPedModelOverride(int16); static void SaveAllGangData(uint8 *, uint32 *); static void LoadAllGangData(uint8 *, uint32); static int32 GetGangVehicleModel(int16 gang) { return Gang[gang].m_nVehicleMI; } - static eWeaponType GetGangWeapon1(int16 gang) { return Gang[gang].m_Weapon1; } - static eWeaponType GetGangWeapon2(int16 gang) { return Gang[gang].m_Weapon2; } - static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; } + static CGangInfo *GetGangInfo(int16 gang) { return &Gang[gang]; } private: - static CGangInfo(&Gang)[NUM_GANGS]; - + static CGangInfo Gang[NUM_GANGS]; }; diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 9f300257..5ac15377 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -14,7 +14,7 @@ int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34; bool &CGarages::BombsAreFree = *(bool *)0x95CD7A; bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D; int32 &CGarages::CarsCollected = *(int32 *)0x880E18; -int32 (&CGarages::CarTypesCollected)[TOTAL_COLLECTCARS_GARAGES] = *(int32 (*)[TOTAL_COLLECTCARS_GARAGES])(uintptr*)0x8E286C; +int32 (&CGarages::CarTypesCollected)[TOTAL_COLLECTCARS_GARAGES] = *(int32 (*)[TOTAL_COLLECTCARS_GARAGES])*(uintptr*)0x8E286C; int32 &CGarages::CrushedCarId = *(int32 *)0x943060; uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58; int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8; @@ -27,7 +27,7 @@ bool &CGarages::PlayerInGarage = *(bool *)0x95CD83; int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444; uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570; -CGarage(&CGarages::Garages)[NUM_GARAGES] = *(CGarage(*)[NUM_GARAGES])(uintptr*)0x72BCD0; +CGarage(&CGarages::Garages)[NUM_GARAGES] = *(CGarage(*)[NUM_GARAGES])*(uintptr*)0x72BCD0; WRAPPER void CGarages::Init(void) { EAXJMP(0x421C60); } WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); } |