summaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-03-17 21:03:13 +0300
committereray orçunus <erayorcunus@gmail.com>2020-03-21 14:58:54 +0300
commitd5a6e17079ab87b946132155bbe37bd20e27c239 (patch)
tree87a72ec36821bb04d9c08ed0e5730c2393b8fcf4 /src/control
parent31d16d395eb6582b20a157764ce8b0da608ef3d8 (diff)
ProcessButtonPresses and fixes
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp4
-rw-r--r--src/control/Gangs.cpp15
-rw-r--r--src/control/Gangs.h8
-rw-r--r--src/control/Garages.cpp4
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); }