summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modelinfo/PedModelInfo.cpp6
-rw-r--r--src/peds/Population.cpp33
2 files changed, 31 insertions, 8 deletions
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp
index 28de2507..25b260d3 100644
--- a/src/modelinfo/PedModelInfo.cpp
+++ b/src/modelinfo/PedModelInfo.cpp
@@ -86,6 +86,11 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
for(int i = 0; i < NUMPEDINFONODES; i++){
*mat = *invmat;
+
+ // From LCS. Otherwise gives FPE
+#ifdef FIX_BUGS
+ spheres[i].center = CVector(0.0f, 0.0f, 0.0f);
+#else
int id = ConvertPedNode2BoneTag(m_pColNodeInfos[i].pedNode); // this is wrong, wtf R* ???
int idx = RpHAnimIDGetIndex(hier, id);
@@ -95,6 +100,7 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
RwV3dTransformPoints(&pos, &pos, 1, mat);
spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z);
+#endif
spheres[i].radius = m_pColNodeInfos[i].radius;
spheres[i].surface = SURFACE_PED;
spheres[i].piece = m_pColNodeInfos[i].pieceType;
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) {