This commit is contained in:
erorcun 2021-03-02 03:38:41 +03:00
parent 6122f6980b
commit 97008905b6
2 changed files with 31 additions and 8 deletions

View File

@ -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;

View File

@ -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) {