summaryrefslogtreecommitdiffstats
path: root/src/peds/Population.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-03-02 01:38:41 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-03-02 01:38:41 +0100
commit97008905b6f51ce73121ebd99d0e34cf9489593b (patch)
treebf0c3338f780b9b60ca978024945f4dd5ff21aa8 /src/peds/Population.cpp
parentfix new renderer (diff)
downloadre3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar.gz
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar.bz2
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar.lz
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar.xz
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.tar.zst
re3-97008905b6f51ce73121ebd99d0e34cf9489593b.zip
Diffstat (limited to '')
-rw-r--r--src/peds/Population.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index d7a545d8..13ae95d2 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1517,8 +1517,11 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
int pedIdx = 0;
CVector leaderPos;
+#ifdef FIX_BUGS
+ bool createLeader = true;
+#endif
- for (int i = 0; i < pedAmount; i++) {
+ for (int i = 0; i < pedAmount; i++) {
float angleMult = i + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
float randomR = circleR + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f) * circleR;
float xOffset = randomR * Cos(angleMult * circleSector);
@@ -1527,8 +1530,10 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
float groundZ = CWorld::FindGroundZFor3DCoord(xOffset + coors.x, yOffset + coors.y, coors.z + 1.0, &foundGround) + 1.0f;
if (foundGround) {
CVector finalPos(coors.x + xOffset, coors.y + yOffset, coors.z > groundZ ? coors.z : groundZ);
-
- if (i == 0)
+#ifndef FIX_BUGS
+ const bool createLeader = i == 0;
+#endif
+ if (createLeader)
leaderPos = finalPos;
int gangModel = ChooseGangOccupation(pedType - PEDTYPE_GANG1);
@@ -1551,9 +1556,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
}
}
}
- bool memberCanSeeLeader = i == 0 ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
+ bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = i == 0 ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
CPed* newPed = AddPed(pedType, gangModel, finalPos);
@@ -1576,6 +1581,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
#endif
}
}
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
}
if (pedIdx >= 3) {
@@ -1700,6 +1708,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
int pedIdx = 0;
CVector leaderPos;
+#ifdef FIX_BUGS
+ bool createLeader = true;
+#endif
for (int i = 0; i < pedAmount; i++) {
float angleMult = i + CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
@@ -1711,7 +1722,10 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
if (foundGround) {
CVector finalPos(coors.x + xOffset, coors.y + yOffset, coors.z > groundZ ? coors.z : groundZ);
- if (i == 0)
+#ifndef FIX_BUGS
+ const bool createLeader = i == 0;
+#endif
+ if (createLeader)
leaderPos = finalPos;
int pedModel = ChooseCivilianOccupation(group);
@@ -1735,9 +1749,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
}
}
}
- bool memberCanSeeLeader = i == 0 ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
+ bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = i == 0 ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
CPed *newPed = AddPed(pedModelInfo->m_pedType, pedModel, finalPos);
@@ -1758,6 +1772,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
#endif
}
}
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
}
if (pedIdx >= 3) {