some fixes

This commit is contained in:
Nikolay Korolev 2020-11-13 13:19:54 +03:00
parent 4f8029ad7c
commit 2e915780aa
6 changed files with 30 additions and 19 deletions

View File

@ -221,7 +221,11 @@ void WeaponCheat2()
CStreaming::RequestModel(MI_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
#ifdef FIX_BUGS
FindPlayerPed()->GiveWeapon(WEAPONTYPE_KATANA, 1);
#else
FindPlayerPed()->GiveWeapon(WEAPONTYPE_KATANA, 0); FindPlayerPed()->GiveWeapon(WEAPONTYPE_KATANA, 0);
#endif
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 10); FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 10);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40); FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_STUBBY_SHOTGUN, 25); FindPlayerPed()->GiveWeapon(WEAPONTYPE_STUBBY_SHOTGUN, 25);
@ -261,7 +265,11 @@ void WeaponCheat3()
CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
#ifdef FIX_BUGS
FindPlayerPed()->GiveWeapon(WEAPONTYPE_CHAINSAW, 1);
#else
FindPlayerPed()->GiveWeapon(WEAPONTYPE_CHAINSAW, 0); FindPlayerPed()->GiveWeapon(WEAPONTYPE_CHAINSAW, 0);
#endif
FindPlayerPed()->GiveWeapon(WEAPONTYPE_GRENADE, 10); FindPlayerPed()->GiveWeapon(WEAPONTYPE_GRENADE, 10);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40); FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 30); FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 30);

View File

@ -602,7 +602,7 @@ INITSAVEBUF
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
} }
pPed->GiveWeapon(pBufferPlayer->GetWeapon(i).m_eWeaponType, pBufferPlayer->GetWeapon(i).m_nAmmoTotal); pPed->GiveWeapon(pBufferPlayer->GetWeapon(i).m_eWeaponType, pBufferPlayer->GetWeapon(i).m_nAmmoTotal, false);
} }
} }

View File

@ -192,13 +192,18 @@ void CStats::Init()
KillsSinceLastCheckpoint = 0; KillsSinceLastCheckpoint = 0;
TotalLegitimateKills = 0; TotalLegitimateKills = 0;
for (int i = 0; i < ARRAY_SIZE(LastMissionPassedName); i++)
LastMissionPassedName[i] = 0;
IndustrialPassed = 0; IndustrialPassed = 0;
CommercialPassed = 0; CommercialPassed = 0;
SuburbanPassed = 0; SuburbanPassed = 0;
PamphletMissionPassed = 0; PamphletMissionPassed = 0;
NoMoreHurricanes = 0; NoMoreHurricanes = 0;
ShowChaseStatOnScreen = 0; ShowChaseStatOnScreen = 0;
abSonyCDs[0] = 0; for (int i = 0; i < ARRAY_SIZE(abSonyCDs); i++)
abSonyCDs[i] = 0;
PopulateFavoriteRadioStationList(); PopulateFavoriteRadioStationList();
NumPropertyOwned = 0; NumPropertyOwned = 0;

View File

@ -20077,7 +20077,7 @@ CPed::Load(uint8*& buf)
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
} }
GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal); GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal, false);
} }
} }
SkipSaveBuf(buf, 252); SkipSaveBuf(buf, 252);

View File

@ -703,7 +703,7 @@ public:
void PlayFootSteps(void); void PlayFootSteps(void);
void QuitEnteringCar(void); void QuitEnteringCar(void);
void BuildPedLists(void); void BuildPedLists(void);
int32 GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused = false); int32 GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused = true);
void CalculateNewOrientation(void); void CalculateNewOrientation(void);
float WorkOutHeadingForMovingFirstPerson(float); float WorkOutHeadingForMovingFirstPerson(float);
void CalculateNewVelocity(void); void CalculateNewVelocity(void);

View File

@ -148,24 +148,22 @@ GenericSave(int file)
// Save simple vars // Save simple vars
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG"); lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
if (lastMissionPassed[0] != '\0') { AsciiToUnicode("...'", suffix);
AsciiToUnicode("...'", suffix); suffix[3] = L'\0';
suffix[3] = L'\0';
#ifdef FIX_BUGS #ifdef FIX_BUGS
// fix buffer overflow // fix buffer overflow
int len = UnicodeStrlen(lastMissionPassed); int len = UnicodeStrlen(lastMissionPassed);
if (len > ARRAY_SIZE(saveName)-1) if (len > ARRAY_SIZE(saveName)-1)
len = ARRAY_SIZE(saveName)-1; len = ARRAY_SIZE(saveName)-1;
memcpy(saveName, lastMissionPassed, sizeof(wchar) * len); memcpy(saveName, lastMissionPassed, sizeof(wchar) * len);
#else #else
TextCopy(saveName, lastMissionPassed); TextCopy(saveName, lastMissionPassed);
int len = UnicodeStrlen(saveName); int len = UnicodeStrlen(saveName);
#endif #endif
saveName[len] = '\0'; saveName[len] = '\0';
if (len > ARRAY_SIZE(saveName)-2) if (len > ARRAY_SIZE(saveName)-2)
TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix); TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix);
saveName[ARRAY_SIZE(saveName)-1] = '\0'; saveName[ARRAY_SIZE(saveName)-1] = '\0';
}
WriteDataToBufferPointer(buf, saveName); WriteDataToBufferPointer(buf, saveName);
GetLocalTime(&saveTime); GetLocalTime(&saveTime);
WriteDataToBufferPointer(buf, saveTime); WriteDataToBufferPointer(buf, saveTime);