Some cleanup

This commit is contained in:
erorcun 2020-04-14 03:21:16 +03:00 committed by GitHub
parent fb5846b7bd
commit 313f547860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 108 deletions

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;

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);