summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-05-18 07:12:47 +0200
committerSergeanur <s.anureev@yandex.ua>2021-05-18 07:12:47 +0200
commit19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab (patch)
tree3cc2f99dca4e911a1bcfa17860dd2e30a99d6754 /src/peds
parentMerge branch 'miami' into lcs (diff)
parentMerge pull request 'Pool fixes + peds not forming circle fix' (#4) from erorcun/re3:miami into miami (diff)
downloadre3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.gz
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.bz2
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.lz
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.xz
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.tar.zst
re3-19dd95a1cb6ce7bf8cc65b4b8bfbb4fab241a7ab.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/Ped.cpp8
-rw-r--r--src/peds/Ped.h8
-rw-r--r--src/peds/Population.cpp29
4 files changed, 24 insertions, 23 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index f2f3ee27..1efd7733 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -93,7 +93,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
m_nHassleTimer = 0;
field_61C = 0;
field_624 = 0;
- m_pStinger = new CStinger;
+ m_pStinger = new CStinger();
SetWeaponLockOnTarget(nil);
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index f0510099..84153667 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -53,10 +53,10 @@ bool CPed::bFannyMagnetCheat;
bool CPed::bPedCheat3;
CVector2D CPed::ms_vec2DFleePosition;
-void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
-void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->New(handle); }
-void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
-void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
+void *CPed::operator new(size_t sz) throw() { return CPools::GetPedPool()->New(); }
+void *CPed::operator new(size_t sz, int handle) throw() { return CPools::GetPedPool()->New(handle); }
+void CPed::operator delete(void *p, size_t sz) throw() { CPools::GetPedPool()->Delete((CPed*)p); }
+void CPed::operator delete(void *p, int handle) throw() { CPools::GetPedPool()->Delete((CPed*)p); }
float gfTommyFatness = 1.0f;
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 1ddb136d..7637a907 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -708,10 +708,10 @@ public:
float m_radiusToGuard;
float m_fMaxHealth;
- static void *operator new(size_t);
- static void *operator new(size_t, int);
- static void operator delete(void*, size_t);
- static void operator delete(void*, int);
+ static void *operator new(size_t) throw();
+ static void *operator new(size_t, int) throw();
+ static void operator delete(void*, size_t) throw();
+ static void operator delete(void*, int) throw();
CPed(uint32 pedType);
~CPed(void);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 396e6fa2..b8984165 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1404,7 +1404,7 @@ CPopulation::PlaceGangMembersInFormation(ePedType pedType, int pedAmount, CVecto
CPed *createdPeds[5];
if (!TheCamera.IsSphereVisible(coors, 3.0f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, nil)) {
bool leaderFoundGround;
float leaderGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &leaderFoundGround) + 1.0f;
if (leaderFoundGround) {
@@ -1484,7 +1484,7 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
if (!TheCamera.IsSphereVisible(coors, circleR) ||
MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) {
int pedIdx = 0;
CVector leaderPos;
#ifdef FIX_BUGS
@@ -1528,9 +1528,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
}
bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f);
- if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
+ if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) {
CPed* newPed = AddPed(pedType, gangModel, finalPos);
if (newPed) {
createdPeds[pedIdx++] = newPed;
@@ -1543,6 +1543,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
newPed->bCanAttackPlayerWithCops = true;
CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0);
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
// No.
#ifndef FIX_BUGS
@@ -1551,9 +1554,6 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
#endif
}
}
-#ifdef FIX_BUGS
- createLeader = false;
-#endif
}
}
if (pedIdx >= 3) {
@@ -1593,7 +1593,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i
return;
if (!TheCamera.IsSphereVisible(coors, 1.5f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, nil)) {
bool manFoundGround;
float manGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &manFoundGround) + 1.0f;
if (manFoundGround) {
@@ -1675,7 +1675,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
if (!TheCamera.IsSphereVisible(coors, circleR) ||
MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) {
int pedIdx = 0;
CVector leaderPos;
#ifdef FIX_BUGS
@@ -1700,6 +1700,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
int pedModel = ChooseCivilianOccupation(group);
CPedModelInfo *pedModelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(pedModel);
+
if (pedModelInfo->GetRwObject()) {
CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil };
CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(pedModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
@@ -1721,9 +1722,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
}
bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false);
- bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f);
+ bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f);
- if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) {
+ if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) {
CPed *newPed = AddPed(pedModelInfo->m_pedType, pedModel, finalPos);
if (newPed) {
createdPeds[pedIdx++] = newPed;
@@ -1734,6 +1735,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
newPed->m_fRotationCur = angle;
newPed->m_fearFlags = 0;
CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0);
+#ifdef FIX_BUGS
+ createLeader = false;
+#endif
}
// No.
#ifndef FIX_BUGS
@@ -1742,9 +1746,6 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
#endif
}
}
-#ifdef FIX_BUGS
- createLeader = false;
-#endif
}
}
if (pedIdx >= 3) {