1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 18:50:00 +00:00

Merge pull request #348 from erorcun/erorcun

ProcessButtonPresses and fixes
This commit is contained in:
erorcun 2020-03-22 04:50:38 +03:00 committed by GitHub
commit 23f2ab5ff1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1763 additions and 757 deletions

View file

@ -596,10 +596,10 @@ CCarCtrl::ChooseCarModel(int32 vehclass)
case TAXI: case TAXI:
{ {
if (TotalNumOfCarsOfRating[vehclass] == 0) 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]]; model = CarArrays[vehclass][NextCarOfRating[vehclass]];
int32 total = TotalNumOfCarsOfRating[vehclass]; int32 total = TotalNumOfCarsOfRating[vehclass];
NextCarOfRating[vehclass] += 1 + CGeneral::GetRandomNumberInRange(0, total - 1); NextCarOfRating[vehclass] += CGeneral::GetRandomNumberInRange(1, total);
while (NextCarOfRating[vehclass] >= total) while (NextCarOfRating[vehclass] >= total)
NextCarOfRating[vehclass] -= total; NextCarOfRating[vehclass] -= total;
//NextCarOfRating[vehclass] %= total; //NextCarOfRating[vehclass] %= total;

View file

@ -3,7 +3,8 @@
#include "ModelIndices.h" #include "ModelIndices.h"
#include "Gangs.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() : CGangInfo::CGangInfo() :
m_nVehicleMI(MI_BUS), m_nVehicleMI(MI_BUS),
@ -34,11 +35,11 @@ void CGangs::SetGangVehicleModel(int16 gang, int32 model)
GetGangInfo(gang)->m_nVehicleMI = 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); CGangInfo *gi = GetGangInfo(gang);
gi->m_Weapon1 = weapon1; gi->m_Weapon1 = (eWeaponType)weapon1;
gi->m_Weapon2 = weapon2; gi->m_Weapon2 = (eWeaponType)weapon2;
} }
void CGangs::SetGangPedModelOverride(int16 gang, int8 ovrd) void CGangs::SetGangPedModelOverride(int16 gang, int8 ovrd)
@ -68,11 +69,11 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
Initialize(); Initialize();
INITSAVEBUF INITSAVEBUF
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
WriteSaveHeader(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++)
Gang[i] = ReadSaveBuf<CGangInfo>(buf); Gang[i] = ReadSaveBuf<CGangInfo>(buf);
VALIDATESAVEBUF(size); VALIDATESAVEBUF(size);
} }

View file

@ -32,18 +32,15 @@ class CGangs
public: public:
static void Initialize(void); static void Initialize(void);
static void SetGangVehicleModel(int16, int32); static void SetGangVehicleModel(int16, int32);
static void SetGangWeapons(int16, eWeaponType, eWeaponType); static void SetGangWeapons(int16, int32, int32);
static void SetGangPedModelOverride(int16, int8); static void SetGangPedModelOverride(int16, int8);
static int8 GetGangPedModelOverride(int16); static int8 GetGangPedModelOverride(int16);
static void SaveAllGangData(uint8 *, uint32 *); static void SaveAllGangData(uint8 *, uint32 *);
static void LoadAllGangData(uint8 *, uint32); static void LoadAllGangData(uint8 *, uint32);
static int32 GetGangVehicleModel(int16 gang) { return Gang[gang].m_nVehicleMI; } 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: private:
static CGangInfo(&Gang)[NUM_GANGS]; static CGangInfo Gang[NUM_GANGS];
}; };

View file

@ -14,7 +14,7 @@ int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A; bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D; bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D;
int32 &CGarages::CarsCollected = *(int32 *)0x880E18; 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; int32 &CGarages::CrushedCarId = *(int32 *)0x943060;
uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58; uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58;
int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8; int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8;
@ -27,7 +27,7 @@ bool &CGarages::PlayerInGarage = *(bool *)0x95CD83;
int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444; int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444;
uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570; 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::Init(void) { EAXJMP(0x421C60); }
WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); } WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); }

View file

@ -2327,7 +2327,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
bool init = false; bool init = false;
if (isexist) if (!isexist)
{ {
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++) for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
{ {

File diff suppressed because it is too large Load diff

View file

@ -212,7 +212,7 @@ enum eMenuAction
MENUACTION_LANG_GER, MENUACTION_LANG_GER,
MENUACTION_LANG_ITA, MENUACTION_LANG_ITA,
MENUACTION_LANG_SPA, MENUACTION_LANG_SPA,
MENUACTION_UPDATESAVE, MENUACTION_POPULATESLOTS_CHANGEMENU,
MENUACTION_CHECKSAVE, MENUACTION_CHECKSAVE,
MENUACTION_UNK24, MENUACTION_UNK24,
MENUACTION_NEWGAME, MENUACTION_NEWGAME,
@ -239,7 +239,7 @@ enum eMenuAction
MENUACTION_PARSEHEAP, MENUACTION_PARSEHEAP,
MENUACTION_SHOWCULL, MENUACTION_SHOWCULL,
MENUACTION_MEMCARDSAVECONFIRM, MENUACTION_MEMCARDSAVECONFIRM,
MENUACTION_UPDATEMEMCARDSAVE, MENUACTION_RESUME_FROM_SAVEZONE,
MENUACTION_UNK50, MENUACTION_UNK50,
MENUACTION_DEBUGSTREAM, MENUACTION_DEBUGSTREAM,
MENUACTION_MPMAP_LIBERTY, MENUACTION_MPMAP_LIBERTY,
@ -272,7 +272,7 @@ enum eMenuAction
MENUACTION_SHOWHEADBOB, MENUACTION_SHOWHEADBOB,
MENUACTION_UNK80, MENUACTION_UNK80,
MENUACTION_INVVERT, MENUACTION_INVVERT,
MENUACTION_CANCLEGAME, MENUACTION_CANCELGAME,
MENUACTION_MP_PLAYERNUMBER, MENUACTION_MP_PLAYERNUMBER,
MENUACTION_MOUSESENS, MENUACTION_MOUSESENS,
MENUACTION_CHECKMPGAMES, MENUACTION_CHECKMPGAMES,
@ -283,7 +283,7 @@ enum eMenuAction
MENUACTION_MP_LAN, MENUACTION_MP_LAN,
MENUACTION_MP_INTERNET, MENUACTION_MP_INTERNET,
MENUACTION_RESUME, MENUACTION_RESUME,
MENUACTION_DONTCANCLE, MENUACTION_DONTCANCEL,
MENUACTION_SCREENRES, MENUACTION_SCREENRES,
MENUACTION_AUDIOHW, MENUACTION_AUDIOHW,
MENUACTION_SPEAKERCONF, MENUACTION_SPEAKERCONF,
@ -307,27 +307,37 @@ enum eCheckHover
{ {
HOVEROPTION_0, HOVEROPTION_0,
HOVEROPTION_1, HOVEROPTION_1,
HOVEROPTION_DEFAULT, HOVEROPTION_RANDOM_ITEM,
HOVEROPTION_3, HOVEROPTION_3,
HOVEROPTION_4, HOVEROPTION_4,
HOVEROPTION_5, HOVEROPTION_5,
HOVEROPTION_6, HOVEROPTION_6,
HOVEROPTION_7, HOVEROPTION_7,
HOVEROPTION_8, HOVEROPTION_8,
HOVEROPTION_9, HOVEROPTION_BACK, // used in controller setup
HOVEROPTION_10, HOVEROPTION_10,
HOVEROPTION_11, HOVEROPTION_11,
HOVEROPTION_12, HOVEROPTION_OVER_SCROLL_UP,
HOVEROPTION_13, HOVEROPTION_OVER_SCROLL_DOWN,
HOVEROPTION_14, HOVEROPTION_CLICKED_SCROLL_UP,
HOVEROPTION_15, HOVEROPTION_CLICKED_SCROLL_DOWN,
HOVEROPTION_16, HOVEROPTION_HOLDING_SCROLLBAR,
HOVEROPTION_17, HOVEROPTION_PAGEUP,
HOVEROPTION_18, HOVEROPTION_PAGEDOWN,
HOVEROPTION_19, HOVEROPTION_19,
HOVEROPTION_20, HOVEROPTION_20,
HOVEROPTION_CHANGESKIN, HOVEROPTION_CHANGESKIN,
HOVEROPTION_INCREASE_BRIGHTNESS = 32, HOVEROPTION_RADIO_0,
HOVEROPTION_RADIO_1,
HOVEROPTION_RADIO_2,
HOVEROPTION_RADIO_3,
HOVEROPTION_RADIO_4,
HOVEROPTION_RADIO_5,
HOVEROPTION_RADIO_6,
HOVEROPTION_RADIO_7,
HOVEROPTION_RADIO_8,
HOVEROPTION_RADIO_9,
HOVEROPTION_INCREASE_BRIGHTNESS,
HOVEROPTION_DECREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS,
HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_INCREASE_DRAWDIST,
HOVEROPTION_DECREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST,
@ -337,7 +347,7 @@ enum eCheckHover
HOVEROPTION_DECREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME,
HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_INCREASE_MOUSESENS,
HOVEROPTION_DECREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS,
HOVEROPTION_42, HOVEROPTION_NOT_HOVERING,
}; };
enum enum
@ -353,13 +363,19 @@ enum eControlMethod
struct tSkinInfo struct tSkinInfo
{ {
int field_0; int32 field_0;
char skinName[256]; char skinName[256];
char currSkinName[256]; char currSkinName[256];
char date[256]; char date[256];
tSkinInfo *field_304; tSkinInfo *field_304;
}; };
struct BottomBarOption
{
char name[8];
int32 screenId;
};
struct CMenuScreen struct CMenuScreen
{ {
char m_ScreenName[8]; char m_ScreenName[8];
@ -387,8 +403,8 @@ public:
int32 m_nHelperTextMsgId; int32 m_nHelperTextMsgId;
bool m_bLanguageLoaded; bool m_bLanguageLoaded;
bool m_bMenuActive; bool m_bMenuActive;
char field_112; bool m_bMenuNotProcessed;
char field_113; bool m_bWaitingForNewKeyBind;
bool m_bStartGameLoading; bool m_bStartGameLoading;
bool m_bFirstTime; bool m_bFirstTime;
bool m_bGameNotLoaded; bool m_bGameNotLoaded;
@ -399,46 +415,46 @@ public:
bool m_bShowMouse; bool m_bShowMouse;
tSkinInfo m_sSkin; tSkinInfo m_sSkin;
tSkinInfo *m_pSelectedSkin; tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438; int32 m_nFirstVisibleRowOnList;
float field_43C; float m_nCurListItemY;
int m_nCurrExSize; int32 m_nTotalListRow;
int m_nSkinsTotal; int32 m_nSkinsTotal;
char _unk0[4]; char _unk0[4];
int m_nCurrExOption; int32 m_nSelectedListRow;
bool m_bSkinsFound; bool m_bSkinsFound;
bool m_bQuitGameNoCD; bool m_bQuitGameNoCD;
bool m_bRenderGameInMenu; bool m_bRenderGameInMenu;
bool m_bSaveMenuActive; bool m_bSaveMenuActive;
bool m_bLoadingSavedGame; bool m_bLoadingSavedGame;
char field_455; char field_455;
char field_456; bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded; bool m_bSpritesLoaded;
CSprite2d m_aFrontEndSprites[28]; CSprite2d m_aFrontEndSprites[28];
CSprite2d m_aMenuSprites[20]; CSprite2d m_aMenuSprites[20];
int field_518; int32 field_518;
int m_nMenuFadeAlpha; int32 m_nMenuFadeAlpha;
char field_520; bool m_bPressedPgUpOnList;
char field_521; bool m_bPressedPgDnOnList;
char field_522; bool m_bPressedUpOnList;
char field_523; bool m_bPressedDownOnList;
char field_524; bool m_bPressedScrollButton;
int m_CurrCntrlAction; int32 m_CurrCntrlAction;
char _unk1[4]; char _unk1[4];
int field_530; int32 field_530;
char field_534; bool m_bKeyIsOK;
char field_535; bool field_535;
int8 m_nCurrExLayer; int8 m_nCurrExLayer; // TODO: What's that?
int m_nHelperTextAlpha; int32 m_nHelperTextAlpha;
int m_nMouseOldPosX; int32 m_nMouseOldPosX;
int m_nMouseOldPosY; int32 m_nMouseOldPosY;
int m_nHoverOption; int32 m_nHoverOption;
int m_nCurrScreen; int32 m_nCurrScreen;
int m_nCurrOption; int32 m_nCurrOption;
int m_nPrevOption; int32 m_nPrevOption;
int m_nPrevScreen; int32 m_nPrevScreen;
uint32 field_558; uint32 field_558;
int m_nCurrSaveSlot; int32 m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer; int32 m_nScreenChangeDelayTimer;
public: public:
bool GetIsMenuActive() {return !!m_bMenuActive;} bool GetIsMenuActive() {return !!m_bMenuActive;}
@ -473,8 +489,8 @@ public:
static float &menuXYpadding; static float &menuXYpadding;
static float &actionTextScaleX; static float &actionTextScaleX;
static float &actionTextScaleY; static float &actionTextScaleY;
static int &sthWithButtons; static int32 &sthWithButtons;
static int &sthWithButtons2; static int32 &sthWithButtons2;
public: public:
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2); static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
@ -510,7 +526,7 @@ public:
void Process(); void Process();
void ProcessButtonPresses(); void ProcessButtonPresses();
void ProcessOnOffMenuOptions(); void ProcessOnOffMenuOptions();
static void RequestFrontEndShutdown(); static void RequestFrontEndShutDown();
static void RequestFrontEndStartUp(); static void RequestFrontEndStartUp();
void ResetHelperText(); void ResetHelperText();
void SaveLoadFileError_SetUpErrorScreen(); void SaveLoadFileError_SetUpErrorScreen();
@ -526,8 +542,6 @@ public:
// New content: // New content:
uint8 GetNumberOfMenuOptions(); uint8 GetNumberOfMenuOptions();
void SwitchToNewScreen(int32 screen);
void SetDefaultPreferences(int32 screen);
}; };
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

View file

@ -14,8 +14,8 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NEW_GAME = 2 // MENUPAGE_NEW_GAME = 2
{ "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1, { "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD, MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT, MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT, MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -29,7 +29,7 @@ const CMenuScreen aScreens[] = {
MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SOUND_SETTINGS = 5 // MENUPAGE_SOUND_SETTINGS = 5
@ -41,7 +41,7 @@ const CMenuScreen aScreens[] = {
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_GRAPHICS_SETTINGS = 6 // MENUPAGE_GRAPHICS_SETTINGS = 6
@ -98,7 +98,7 @@ const CMenuScreen aScreens[] = {
{ "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0, { "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
}, },
// MENUPAGE_LOAD_SLOT_CONFIRM = 11 // MENUPAGE_LOAD_SLOT_CONFIRM = 11
@ -175,15 +175,14 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_SAVE = 24 // MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG #ifdef PS2_SAVE_DIALOG
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
#else #else
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
#endif #endif
@ -194,15 +193,15 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CHOOSE_SAVE_SLOT = 26 // MENUPAGE_CHOOSE_SAVE_SLOT = 26
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_3, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_4, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_5, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_6, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_7, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_SAVE_OVERWRITE_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL8", SAVESLOT_8, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
}, },
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27 // MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
@ -298,10 +297,10 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_OPTIONS = 41 // MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT, MENUACTION_PLAYERSETUP, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -309,7 +308,7 @@ const CMenuScreen aScreens[] = {
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_SAVING_IN_PROGRESS = 43 // MENUPAGE_SAVING_IN_PROGRESS = 43
@ -320,7 +319,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_SAVE_SUCCESSFUL = 44 // MENUPAGE_SAVE_SUCCESSFUL = 44
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0, { "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE, MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_UPDATEMEMCARDSAVE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT, MENUACTION_RESUME_FROM_SAVEZONE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
}, },
// MENUPAGE_DELETING = 45 // MENUPAGE_DELETING = 45
@ -380,12 +379,12 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_SKIN_SELECT = 54 // MENUPAGE_SKIN_SELECT = 54
{ "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4, { "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
}, },
// MENUPAGE_KEYBOARD_CONTROLS = 55 // MENUPAGE_KEYBOARD_CONTROLS = 55
{ "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1, { "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
}, },
// MENUPAGE_MOUSE_CONTROLS = 56 // MENUPAGE_MOUSE_CONTROLS = 56

View file

@ -256,6 +256,11 @@ public:
bool GetMouseX1JustDown() { return !!(NewMouseControllerState.MXB1 && !OldMouseControllerState.MXB1); } bool GetMouseX1JustDown() { return !!(NewMouseControllerState.MXB1 && !OldMouseControllerState.MXB1); }
bool GetMouseX2JustDown() { return !!(NewMouseControllerState.MXB2 && !OldMouseControllerState.MXB2); } bool GetMouseX2JustDown() { return !!(NewMouseControllerState.MXB2 && !OldMouseControllerState.MXB2); }
bool GetLeftMouseJustUp() { return !!(!NewMouseControllerState.LMB && OldMouseControllerState.LMB); }
bool GetRightMouseJustUp() { return !!(!NewMouseControllerState.RMB && OldMouseControllerState.RMB); }
bool GetMiddleMouseJustUp() { return !!(!NewMouseControllerState.MMB && OldMouseControllerState.MMB); }
bool GetMouseWheelUpJustUp() { return !!(!NewMouseControllerState.WHEELUP && OldMouseControllerState.WHEELUP); }
bool GetMouseWheelDownJustUp() { return !!(!NewMouseControllerState.WHEELDN && OldMouseControllerState.WHEELDN); }
bool GetLeftMouse() { return NewMouseControllerState.LMB; } bool GetLeftMouse() { return NewMouseControllerState.LMB; }
bool GetRightMouse() { return NewMouseControllerState.RMB; } bool GetRightMouse() { return NewMouseControllerState.RMB; }
@ -328,6 +333,12 @@ public:
bool GetEnterJustDown() { return GetPadEnterJustDown() || GetReturnJustDown(); } bool GetEnterJustDown() { return GetPadEnterJustDown() || GetReturnJustDown(); }
bool GetAltJustDown() { return GetLeftAltJustDown() || GetRightAltJustDown(); } bool GetAltJustDown() { return GetLeftAltJustDown() || GetRightAltJustDown(); }
bool GetLeftJustUp() { return !!(!NewKeyState.LEFT && OldKeyState.LEFT); }
bool GetRightJustUp() { return !!(!NewKeyState.RIGHT && OldKeyState.RIGHT); }
bool GetEnterJustUp() { return GetPadEnterJustUp() || GetReturnJustUp(); }
bool GetReturnJustUp() { return !!(!NewKeyState.EXTENTER && OldKeyState.EXTENTER); }
bool GetPadEnterJustUp() { return !!(!NewKeyState.ENTER && OldKeyState.ENTER); }
bool GetChar(int32 c) { return NewKeyState.VK_KEYS[c]; } bool GetChar(int32 c) { return NewKeyState.VK_KEYS[c]; }
bool GetF(int32 n) { return NewKeyState.F[n]; } bool GetF(int32 n) { return NewKeyState.F[n]; }
bool GetEscape() { return NewKeyState.ESC; } bool GetEscape() { return NewKeyState.ESC; }
@ -392,6 +403,13 @@ public:
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); } bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); } bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
bool GetDPadDownJustUp() { return !!(!NewState.DPadDown && OldState.DPadDown); }
bool GetDPadLeftJustUp() { return !!(!NewState.DPadLeft && OldState.DPadLeft); }
bool GetDPadRightJustUp() { return !!(!NewState.DPadRight && OldState.DPadRight); }
bool GetTriangle() { return !!NewState.Triangle; } bool GetTriangle() { return !!NewState.Triangle; }
bool GetCircle() { return !!NewState.Circle; } bool GetCircle() { return !!NewState.Circle; }
bool GetCross() { return !!NewState.Cross; } bool GetCross() { return !!NewState.Cross; }

View file

@ -162,6 +162,7 @@ enum Config {
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box #define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
// Script // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default

View file

@ -2,6 +2,7 @@
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
#include "PedType.h" #include "PedType.h"
#include "PedStats.h"
enum PedNode { enum PedNode {
PED_TORSO, PED_TORSO,
@ -24,7 +25,7 @@ class CPedModelInfo : public CClumpModelInfo
public: public:
uint32 m_animGroup; uint32 m_animGroup;
ePedType m_pedType; ePedType m_pedType;
uint32 m_pedStatType; ePedStats m_pedStatType;
uint32 m_carsCanDrive; uint32 m_carsCanDrive;
CColModel *m_hitColModel; CColModel *m_hitColModel;
RpAtomic *m_head; RpAtomic *m_head;

View file

@ -259,17 +259,17 @@ CCopPed::ScanForCrimes(void)
} }
} }
// Look for stolen cop cars (it was broken until now) // Look for stolen cop cars
if (!m_bIsInPursuit) { if (!m_bIsInPursuit) {
CPlayerPed *player = FindPlayerPed(); CPlayerPed *player = FindPlayerPed();
#ifdef FIX_BUGS
if ((player->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || player->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER)
#else
if ((m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) if ((m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER)
#endif && player->m_pWanted->m_nWantedLevel == 0) {
&& player->m_pWanted->m_nWantedLevel == 0 && player->m_pMyVehicle) {
if (player->m_pMyVehicle->bIsLawEnforcer) if (player->m_pMyVehicle
#ifdef FIX_BUGS
&& m_pMyVehicle == player->m_pMyVehicle
#endif
&& player->m_pMyVehicle->bIsLawEnforcer)
player->SetWantedLevelNoDrop(1); player->SetWantedLevelNoDrop(1);
} }
} }

View file

@ -2261,7 +2261,7 @@ CPed::SetModelIndex(uint32 mi)
RpAnimBlendClumpInit(GetClump()); RpAnimBlendClumpInit(GetClump());
RpAnimBlendClumpFillFrameArray(GetClump(), m_pFrames); RpAnimBlendClumpFillFrameArray(GetClump(), m_pFrames);
CPedModelInfo *modelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); CPedModelInfo *modelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex);
SetPedStats((ePedStats) modelInfo->m_pedStatType); SetPedStats(modelInfo->m_pedStatType);
m_headingRate = m_pedStats->m_headingChangeRate; m_headingRate = m_pedStats->m_headingChangeRate;
m_animGroup = (AssocGroupId) modelInfo->m_animGroup; m_animGroup = (AssocGroupId) modelInfo->m_animGroup;
CAnimManager::AddAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE); CAnimManager::AddAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE);
@ -6928,11 +6928,9 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
if (obstacle) { if (obstacle) {
animAssoc->flags |= ASSOC_DELETEFADEDOUT; animAssoc->flags |= ASSOC_DELETEFADEDOUT;
#ifndef VC_PED_PORTS
// ANIM_HIT_WALL in VC (which makes more sense)
CAnimBlendAssociation *handsCoverAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_HANDSCOWER, 8.0f); CAnimBlendAssociation *handsCoverAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_HANDSCOWER, 8.0f);
#else
CAnimBlendAssociation* handsCoverAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_HIT_WALL, 8.0f);
#endif
handsCoverAssoc->flags &= ~ASSOC_FADEOUTWHENDONE; handsCoverAssoc->flags &= ~ASSOC_FADEOUTWHENDONE;
handsCoverAssoc->SetFinishCallback(FinishHitHeadCB, ped); handsCoverAssoc->SetFinishCallback(FinishHitHeadCB, ped);
ped->bIsLanding = true; ped->bIsLanding = true;

View file

@ -4,7 +4,8 @@
#include "FileMgr.h" #include "FileMgr.h"
#include "PedStats.h" #include "PedStats.h"
CPedStats *(&CPedStats::ms_apPedStats)[NUM_PEDSTATS] = *(CPedStats *(*)[NUM_PEDSTATS]) *(uintptr*)0x9404D4; //CPedStats *(&CPedStats::ms_apPedStats)[NUM_PEDSTATS] = *(CPedStats *(*)[NUM_PEDSTATS]) *(uintptr*)0x9404D4;
CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS];
void void
CPedStats::Initialise(void) CPedStats::Initialise(void)
@ -68,9 +69,9 @@ CPedStats::LoadPedStats(void)
line[linelen++] = ' '; line[linelen++] = ' ';
else else
line[linelen++] = buf[bp]; line[linelen++] = buf[bp];
line[linelen] = '\0';
} }
bp++; bp++;
line[linelen] = '\0';
// skip white space // skip white space
for(lp = 0; line[lp] <= ' '; lp++); for(lp = 0; line[lp] <= ' '; lp++);
@ -107,14 +108,13 @@ CPedStats::LoadPedStats(void)
delete[] buf; delete[] buf;
} }
int32 ePedStats
CPedStats::GetPedStatType(char *name) CPedStats::GetPedStatType(char *name)
{ {
int type; for(uint16 type = 0; type < NUM_PEDSTATS; type++)
for(type = 0; type < NUM_PEDSTATS; type++)
if(!CGeneral::faststrcmp(ms_apPedStats[type]->m_name, name)) if(!CGeneral::faststrcmp(ms_apPedStats[type]->m_name, name))
return type; return (ePedStats) type;
return NUM_PEDSTATS; return NUM_PEDSTATS;
} }

View file

@ -69,11 +69,11 @@ public:
float m_defendWeakness; float m_defendWeakness;
int16 m_flags; int16 m_flags;
static CPedStats* (&ms_apPedStats)[NUM_PEDSTATS]; static CPedStats *ms_apPedStats[NUM_PEDSTATS];
static void Initialise(void); static void Initialise(void);
static void Shutdown(void); static void Shutdown(void);
static void LoadPedStats(void); static void LoadPedStats(void);
static int32 GetPedStatType(char *name); static ePedStats GetPedStatType(char *name);
}; };
static_assert(sizeof(CPedStats) == 0x34, "CPedStats: error"); static_assert(sizeof(CPedStats) == 0x34, "CPedStats: error");

View file

@ -63,9 +63,9 @@ CPedType::LoadPedData(void)
line[linelen++] = ' '; line[linelen++] = ' ';
else else
line[linelen++] = buf[bp]; line[linelen++] = buf[bp];
line[linelen] = '\0';
} }
bp++; bp++;
line[linelen] = '\0';
// skip white space // skip white space
for(lp = 0; line[lp] <= ' '; lp++); for(lp = 0; line[lp] <= ' '; lp++);
@ -74,7 +74,7 @@ CPedType::LoadPedData(void)
line[lp] == '#') line[lp] == '#')
continue; continue;
// FIX: game just uses line here // Game uses just "line" here since sscanf already trims whitespace, but this is safer
sscanf(&line[lp], "%s", word); sscanf(&line[lp], "%s", word);
if(strncmp(word, "Threat", 7) == 0){ if(strncmp(word, "Threat", 7) == 0){
@ -195,6 +195,7 @@ void
CPedType::Load(uint8 *buf, uint32 size) CPedType::Load(uint8 *buf, uint32 size)
{ {
INITSAVEBUF INITSAVEBUF
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE); CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE);
for(int i = 0; i < NUM_PEDTYPES; i++) for(int i = 0; i < NUM_PEDTYPES; i++)

View file

@ -30,7 +30,8 @@
// More clearly they're transition areas between zones. // More clearly they're transition areas between zones.
RegenerationPoint (&aSafeZones)[8] = *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578; RegenerationPoint (&aSafeZones)[8] = *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
PedGroup (&CPopulation::ms_pPedGroups)[NUMPEDGROUPS] = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248; //PedGroup (&CPopulation::ms_pPedGroups)[NUMPEDGROUPS] = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS];
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6; bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570; int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C; float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
@ -80,7 +81,7 @@ CPopulation::Initialise()
ms_nNumDummy = 0; ms_nNumDummy = 0;
m_AllRandomPedsThisType = -1; m_AllRandomPedsThisType = -1;
PedDensityMultiplier = 1.0; PedDensityMultiplier = 1.0f;
bZoneChangeHasHappened = false; bZoneChangeHasHappened = false;
m_CountDownToPedsAtStart = 2; m_CountDownToPedsAtStart = 2;
@ -511,9 +512,9 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
uint32 weapon; uint32 weapon;
if (CGeneral::GetRandomNumberInRange(0, 100) >= 50) if (CGeneral::GetRandomNumberInRange(0, 100) >= 50)
weapon = ped->GiveWeapon(CGangs::GetGangWeapon2(pedType - PEDTYPE_GANG1), 25001); weapon = ped->GiveWeapon(CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2, 25001);
else else
weapon = ped->GiveWeapon(CGangs::GetGangWeapon1(pedType - PEDTYPE_GANG1), 25001); weapon = ped->GiveWeapon(CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
ped->SetCurrentWeapon(weapon); ped->SetCurrentWeapon(weapon);
return ped; return ped;
} }
@ -770,7 +771,7 @@ CPopulation::AddPedInCar(CVehicle* car)
// fall through // fall through
default: default:
int gangOfPed = GANG_MAFIA; int gangOfPed = 0;
imSureThatModelIsLoaded = false; imSureThatModelIsLoaded = false;
while (gangOfPed < NUM_GANGS && CGangs::GetGangInfo(gangOfPed)->m_nVehicleMI != car->m_modelIndex) while (gangOfPed < NUM_GANGS && CGangs::GetGangInfo(gangOfPed)->m_nVehicleMI != car->m_modelIndex)

View file

@ -33,7 +33,7 @@ struct RegenerationPoint
class CPopulation class CPopulation
{ {
public: public:
static PedGroup (&ms_pPedGroups)[NUMPEDGROUPS]; static PedGroup ms_pPedGroups[NUMPEDGROUPS];
static bool &ms_bGivePedsWeapons; static bool &ms_bGivePedsWeapons;
static int32 &m_AllRandomPedsThisType; static int32 &m_AllRandomPedsThisType;
static float &PedDensityMultiplier; static float &PedDensityMultiplier;