summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-03-17 19:03:13 +0100
committereray orçunus <erayorcunus@gmail.com>2020-03-21 12:58:54 +0100
commitd5a6e17079ab87b946132155bbe37bd20e27c239 (patch)
tree87a72ec36821bb04d9c08ed0e5730c2393b8fcf4 /src/peds
parentMerge pull request #346 from Sergeanur/Radar2 (diff)
downloadre3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.gz
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.bz2
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.lz
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.xz
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.tar.zst
re3-d5a6e17079ab87b946132155bbe37bd20e27c239.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CopPed.cpp14
-rw-r--r--src/peds/Ped.cpp8
-rw-r--r--src/peds/PedStats.cpp14
-rw-r--r--src/peds/PedStats.h4
-rw-r--r--src/peds/PedType.cpp7
-rw-r--r--src/peds/Population.cpp11
-rw-r--r--src/peds/Population.h2
7 files changed, 30 insertions, 30 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index bf0cc59c..53ae1747 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -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) {
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)
-#endif
- && player->m_pWanted->m_nWantedLevel == 0 && player->m_pMyVehicle) {
+ && player->m_pWanted->m_nWantedLevel == 0) {
- 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);
}
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 3c62512e..b7dbab82 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2261,7 +2261,7 @@ CPed::SetModelIndex(uint32 mi)
RpAnimBlendClumpInit(GetClump());
RpAnimBlendClumpFillFrameArray(GetClump(), m_pFrames);
CPedModelInfo *modelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex);
- SetPedStats((ePedStats) modelInfo->m_pedStatType);
+ SetPedStats(modelInfo->m_pedStatType);
m_headingRate = m_pedStats->m_headingChangeRate;
m_animGroup = (AssocGroupId) modelInfo->m_animGroup;
CAnimManager::AddAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE);
@@ -6928,11 +6928,9 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
if (obstacle) {
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);
-#else
- CAnimBlendAssociation* handsCoverAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_HIT_WALL, 8.0f);
-#endif
handsCoverAssoc->flags &= ~ASSOC_FADEOUTWHENDONE;
handsCoverAssoc->SetFinishCallback(FinishHitHeadCB, ped);
ped->bIsLanding = true;
diff --git a/src/peds/PedStats.cpp b/src/peds/PedStats.cpp
index c393fddc..147f11e2 100644
--- a/src/peds/PedStats.cpp
+++ b/src/peds/PedStats.cpp
@@ -4,7 +4,8 @@
#include "FileMgr.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
CPedStats::Initialise(void)
@@ -68,9 +69,9 @@ CPedStats::LoadPedStats(void)
line[linelen++] = ' ';
else
line[linelen++] = buf[bp];
- line[linelen] = '\0';
}
bp++;
+ line[linelen] = '\0';
// skip white space
for(lp = 0; line[lp] <= ' '; lp++);
@@ -107,14 +108,13 @@ CPedStats::LoadPedStats(void)
delete[] buf;
}
-int32
+ePedStats
CPedStats::GetPedStatType(char *name)
{
- int type;
-
- for(type = 0; type < NUM_PEDSTATS; type++)
+ for(uint16 type = 0; type < NUM_PEDSTATS; type++)
if(!CGeneral::faststrcmp(ms_apPedStats[type]->m_name, name))
- return type;
+ return (ePedStats) type;
+
return NUM_PEDSTATS;
}
diff --git a/src/peds/PedStats.h b/src/peds/PedStats.h
index ce92d4da..4c35e8ee 100644
--- a/src/peds/PedStats.h
+++ b/src/peds/PedStats.h
@@ -69,11 +69,11 @@ public:
float m_defendWeakness;
int16 m_flags;
- static CPedStats* (&ms_apPedStats)[NUM_PEDSTATS];
+ static CPedStats *ms_apPedStats[NUM_PEDSTATS];
static void Initialise(void);
static void Shutdown(void);
static void LoadPedStats(void);
- static int32 GetPedStatType(char *name);
+ static ePedStats GetPedStatType(char *name);
};
static_assert(sizeof(CPedStats) == 0x34, "CPedStats: error");
diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp
index 3b95109d..4c9d6b3f 100644
--- a/src/peds/PedType.cpp
+++ b/src/peds/PedType.cpp
@@ -63,9 +63,9 @@ CPedType::LoadPedData(void)
line[linelen++] = ' ';
else
line[linelen++] = buf[bp];
- line[linelen] = '\0';
}
bp++;
+ line[linelen] = '\0';
// skip white space
for(lp = 0; line[lp] <= ' '; lp++);
@@ -74,7 +74,7 @@ CPedType::LoadPedData(void)
line[lp] == '#')
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);
if(strncmp(word, "Threat", 7) == 0){
@@ -195,7 +195,8 @@ void
CPedType::Load(uint8 *buf, uint32 size)
{
INITSAVEBUF
- CheckSaveHeader(buf, 'P','T','P','\0', size - SAVE_HEADER_SIZE);
+ // original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
+ CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE);
for(int i = 0; i < NUM_PEDTYPES; i++)
*ms_apPedType[i] = ReadSaveBuf<CPedType>(buf);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 496ece34..bb5ec475 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -30,7 +30,8 @@
// More clearly they're transition areas between zones.
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;
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
@@ -80,7 +81,7 @@ CPopulation::Initialise()
ms_nNumDummy = 0;
m_AllRandomPedsThisType = -1;
- PedDensityMultiplier = 1.0;
+ PedDensityMultiplier = 1.0f;
bZoneChangeHasHappened = false;
m_CountDownToPedsAtStart = 2;
@@ -511,9 +512,9 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
uint32 weapon;
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
- weapon = ped->GiveWeapon(CGangs::GetGangWeapon1(pedType - PEDTYPE_GANG1), 25001);
+ weapon = ped->GiveWeapon(CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
ped->SetCurrentWeapon(weapon);
return ped;
}
@@ -770,7 +771,7 @@ CPopulation::AddPedInCar(CVehicle* car)
// fall through
default:
- int gangOfPed = GANG_MAFIA;
+ int gangOfPed = 0;
imSureThatModelIsLoaded = false;
while (gangOfPed < NUM_GANGS && CGangs::GetGangInfo(gangOfPed)->m_nVehicleMI != car->m_modelIndex)
diff --git a/src/peds/Population.h b/src/peds/Population.h
index 152fb7ae..b299c0a1 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -33,7 +33,7 @@ struct RegenerationPoint
class CPopulation
{
public:
- static PedGroup (&ms_pPedGroups)[NUMPEDGROUPS];
+ static PedGroup ms_pPedGroups[NUMPEDGROUPS];
static bool &ms_bGivePedsWeapons;
static int32 &m_AllRandomPedsThisType;
static float &PedDensityMultiplier;