summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-10-07 00:13:18 +0200
committereray orçunus <erayorcunus@gmail.com>2019-10-07 00:13:18 +0200
commitc9d92a7d1b760ac23ec0b6117562f87c35ab41af (patch)
tree5b5d195d528c58bdcfb2b0b425c385481e20f60c /src
parentMerge pull request #226 from erorcun/erorcun (diff)
downloadre3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar.gz
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar.bz2
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar.lz
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar.xz
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.tar.zst
re3-c9d92a7d1b760ac23ec0b6117562f87c35ab41af.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/re3.cpp2
-rw-r--r--src/peds/Ped.cpp7
-rw-r--r--src/peds/Ped.h1
3 files changed, 7 insertions, 3 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 8e20ffb3..b9b5c76e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -146,7 +146,7 @@ LetThemFollowYou(void) {
CPed *nearPed = player->m_nearPeds[i];
if (nearPed && !nearPed->IsPlayer()) {
nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
- nearPed->m_pedFormation = (eFormation)(rand() & 7);
+ nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
nearPed->bScriptObjectiveCompleted = false;
}
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 1cf15cb6..e9ed2103 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -388,7 +388,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_vecOffsetSeek.x = 0.0f;
m_vecOffsetSeek.y = 0.0f;
m_vecOffsetSeek.z = 0.0f;
- m_pedFormation = FORMATION_REAR;
+ m_pedFormation = FORMATION_UNDEFINED;
m_collidingThingTimer = 0;
m_nPedStateTimer = 0;
m_actionX = 0;
@@ -2686,7 +2686,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_FOLLOW_PED_IN_FORMATION:
m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
- m_pedFormation = FORMATION_REAR_LEFT;
+ m_pedFormation = FORMATION_REAR;
break;
case OBJECTIVE_LEAVE_VEHICLE:
#ifdef VC_PED_PORTS
@@ -14395,6 +14395,9 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
void
CPed::SetFormation(eFormation type)
{
+ // FIX: Formations in GetFormationPosition were in range 1-8, whereas in here it's 0-7.
+ // To not change the behaviour, range in here tweaked by 1 with the use of enum.
+
switch (m_pedFormation) {
case FORMATION_REAR:
case FORMATION_REAR_LEFT:
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 3d7354a3..74d85e56 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -26,6 +26,7 @@ struct CPedAudioData
enum eFormation
{
+ FORMATION_UNDEFINED,
FORMATION_REAR,
FORMATION_REAR_LEFT,
FORMATION_REAR_RIGHT,