diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-03-17 19:03:13 +0100 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-03-21 12:58:54 +0100 |
commit | d5a6e17079ab87b946132155bbe37bd20e27c239 (patch) | |
tree | 87a72ec36821bb04d9c08ed0e5730c2393b8fcf4 /src/control | |
parent | Merge pull request #346 from Sergeanur/Radar2 (diff) | |
download | re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.gz re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.bz2 re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.lz re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.xz re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.zst re3-d5a6e17079ab87b946132155bbe37bd20e27c239.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 | 8 | ||||
-rw-r--r-- | src/control/Garages.cpp | 4 |
4 files changed, 15 insertions, 16 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 f6f9261e..6be1ef9c 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), @@ -30,11 +31,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) @@ -64,11 +65,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 93ebe663..1ffc5ddd 100644 --- a/src/control/Gangs.h +++ b/src/control/Gangs.h @@ -34,18 +34,16 @@ 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); } |