summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-11-13 13:14:56 +0100
committeraap <aap@papnet.eu>2020-11-13 13:14:56 +0100
commit257f45c3c37530ec86bb4e5906d1cf5b6005cf38 (patch)
tree014b72e88afdb350d5f7dbd9e23debd07054fbec /src
parentCPed review, part 1 (diff)
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar.gz
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar.bz2
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar.lz
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar.xz
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.tar.zst
re3-257f45c3c37530ec86bb4e5906d1cf5b6005cf38.zip
Diffstat (limited to '')
-rw-r--r--src/core/Pad.cpp8
-rw-r--r--src/core/Pools.cpp2
-rw-r--r--src/core/Stats.cpp7
-rw-r--r--src/peds/Ped.cpp2
-rw-r--r--src/peds/Ped.h2
-rw-r--r--src/save/GenericGameStorage.cpp28
6 files changed, 30 insertions, 19 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 983fc588..b1e91f89 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -221,7 +221,11 @@ void WeaponCheat2()
CStreaming::RequestModel(MI_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
+#ifdef FIX_BUGS
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_KATANA, 1);
+#else
FindPlayerPed()->GiveWeapon(WEAPONTYPE_KATANA, 0);
+#endif
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 10);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_STUBBY_SHOTGUN, 25);
@@ -261,7 +265,11 @@ void WeaponCheat3()
CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
+#ifdef FIX_BUGS
+ FindPlayerPed()->GiveWeapon(WEAPONTYPE_CHAINSAW, 1);
+#else
FindPlayerPed()->GiveWeapon(WEAPONTYPE_CHAINSAW, 0);
+#endif
FindPlayerPed()->GiveWeapon(WEAPONTYPE_GRENADE, 10);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_PYTHON, 40);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 30);
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index b25fa4e1..cbc57902 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -602,7 +602,7 @@ INITSAVEBUF
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);
}
}
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 373c295d..e078e6d0 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -192,13 +192,18 @@ void CStats::Init()
KillsSinceLastCheckpoint = 0;
TotalLegitimateKills = 0;
+
+ for (int i = 0; i < ARRAY_SIZE(LastMissionPassedName); i++)
+ LastMissionPassedName[i] = 0;
+
IndustrialPassed = 0;
CommercialPassed = 0;
SuburbanPassed = 0;
PamphletMissionPassed = 0;
NoMoreHurricanes = 0;
ShowChaseStatOnScreen = 0;
- abSonyCDs[0] = 0;
+ for (int i = 0; i < ARRAY_SIZE(abSonyCDs); i++)
+ abSonyCDs[i] = 0;
PopulateFavoriteRadioStationList();
NumPropertyOwned = 0;
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 222ac638..56635315 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -19969,7 +19969,7 @@ CPed::Load(uint8*& buf)
CStreaming::LoadAllRequestedModels(false);
}
- GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal);
+ GiveWeapon(bufWeapon.m_eWeaponType, bufWeapon.m_nAmmoTotal, false);
}
}
SkipSaveBuf(buf, 252);
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 3a4edfae..497994c2 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -697,7 +697,7 @@ public:
void PlayFootSteps(void);
void QuitEnteringCar(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);
float WorkOutHeadingForMovingFirstPerson(float);
void CalculateNewVelocity(void);
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 966f353a..82f66308 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -148,24 +148,22 @@ GenericSave(int file)
// Save simple vars
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
- if (lastMissionPassed[0] != '\0') {
- AsciiToUnicode("...'", suffix);
- suffix[3] = L'\0';
+ AsciiToUnicode("...'", suffix);
+ suffix[3] = L'\0';
#ifdef FIX_BUGS
- // fix buffer overflow
- int len = UnicodeStrlen(lastMissionPassed);
- if (len > ARRAY_SIZE(saveName)-1)
- len = ARRAY_SIZE(saveName)-1;
- memcpy(saveName, lastMissionPassed, sizeof(wchar) * len);
+ // fix buffer overflow
+ int len = UnicodeStrlen(lastMissionPassed);
+ if (len > ARRAY_SIZE(saveName)-1)
+ len = ARRAY_SIZE(saveName)-1;
+ memcpy(saveName, lastMissionPassed, sizeof(wchar) * len);
#else
- TextCopy(saveName, lastMissionPassed);
- int len = UnicodeStrlen(saveName);
+ TextCopy(saveName, lastMissionPassed);
+ int len = UnicodeStrlen(saveName);
#endif
- saveName[len] = '\0';
- if (len > ARRAY_SIZE(saveName)-2)
- TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix);
- saveName[ARRAY_SIZE(saveName)-1] = '\0';
- }
+ saveName[len] = '\0';
+ if (len > ARRAY_SIZE(saveName)-2)
+ TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix);
+ saveName[ARRAY_SIZE(saveName)-1] = '\0';
WriteDataToBufferPointer(buf, saveName);
GetLocalTime(&saveTime);
WriteDataToBufferPointer(buf, saveTime);