Rename m_ped_flagA2 into bWasStanding

This commit is contained in:
Sergeanur 2020-04-30 18:13:38 +03:00
parent 94acee8580
commit 81094f2cd7
3 changed files with 16 additions and 16 deletions

View File

@ -1886,7 +1886,7 @@ CPhysical::ProcessCollision(void)
// TODO: get rid of copy paste? // TODO: get rid of copy paste?
if(CheckCollision()){ if(CheckCollision()){
if(IsPed() && m_vecMoveSpeed.z == 0.0f && if(IsPed() && m_vecMoveSpeed.z == 0.0f &&
!ped->m_ped_flagA2 && !ped->bWasStanding &&
ped->bIsStanding) ped->bIsStanding)
savedMatrix.GetPosition().z = GetPosition().z; savedMatrix.GetPosition().z = GetPosition().z;
GetMatrix() = savedMatrix; GetMatrix() = savedMatrix;
@ -1894,7 +1894,7 @@ CPhysical::ProcessCollision(void)
return; return;
} }
if(IsPed() && m_vecMoveSpeed.z == 0.0f && if(IsPed() && m_vecMoveSpeed.z == 0.0f &&
!ped->m_ped_flagA2 && !ped->bWasStanding &&
ped->bIsStanding) ped->bIsStanding)
savedMatrix.GetPosition().z = GetPosition().z; savedMatrix.GetPosition().z = GetPosition().z;
GetMatrix() = savedMatrix; GetMatrix() = savedMatrix;

View File

@ -522,7 +522,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_fElasticity = 0.05f; m_fElasticity = 0.05f;
bIsStanding = false; bIsStanding = false;
m_ped_flagA2 = false; bWasStanding = false;
bIsAttacking = false; bIsAttacking = false;
bIsPointingGunAt = false; bIsPointingGunAt = false;
bIsLooking = false; bIsLooking = false;
@ -9487,14 +9487,14 @@ CPed::ProcessControl(void)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (bIsInWater) { if (bIsInWater) {
bIsStanding = false; bIsStanding = false;
m_ped_flagA2 = false; bWasStanding = false;
CPhysical::ProcessControl(); CPhysical::ProcessControl();
} }
#endif #endif
return; return;
} }
m_ped_flagA2 = false; bWasStanding = false;
if (bIsStanding) { if (bIsStanding) {
if (!CWorld::bForceProcessControl) { if (!CWorld::bForceProcessControl) {
if (m_pCurrentPhysSurface && m_pCurrentPhysSurface->bIsInSafePosition) { if (m_pCurrentPhysSurface && m_pCurrentPhysSurface->bIsInSafePosition) {
@ -10106,7 +10106,7 @@ CPed::ProcessControl(void)
} }
if ((bIsInTheAir && !DyingOrDead()) if ((bIsInTheAir && !DyingOrDead())
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
|| (!bIsStanding && !m_ped_flagA2 && m_nPedState == PED_FALL) || (!bIsStanding && !bWasStanding && m_nPedState == PED_FALL)
#endif #endif
) { ) {
if (m_nPedStateTimer <= 1000 && m_nPedStateTimer) { if (m_nPedStateTimer <= 1000 && m_nPedStateTimer) {
@ -12344,7 +12344,7 @@ CPed::PlacePedOnDryLand(void)
posToCheck.z = 0.8f + foundColZ; posToCheck.z = 0.8f + foundColZ;
GetPosition() = posToCheck; GetPosition() = posToCheck;
bIsStanding = true; bIsStanding = true;
m_ped_flagA2 = true; bWasStanding = true;
return true; return true;
} }
} }
@ -12362,7 +12362,7 @@ CPed::PlacePedOnDryLand(void)
posToCheck.z = 0.8f + foundColZ; posToCheck.z = 0.8f + foundColZ;
GetPosition() = posToCheck; GetPosition() = posToCheck;
bIsStanding = true; bIsStanding = true;
m_ped_flagA2 = true; bWasStanding = true;
return true; return true;
} }
@ -14671,7 +14671,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
#endif #endif
if (bIsStanding) { if (bIsStanding) {
bIsStanding = false; bIsStanding = false;
m_ped_flagA2 = true; bWasStanding = true;
} }
bCollisionProcessed = true; bCollisionProcessed = true;
m_fCollisionSpeed += m_vecMoveSpeed.Magnitude2D() * CTimer::GetTimeStep(); m_fCollisionSpeed += m_vecMoveSpeed.Magnitude2D() * CTimer::GetTimeStep();
@ -14684,7 +14684,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
} else { } else {
CVector pos = GetPosition(); CVector pos = GetPosition();
float potentialGroundZ = GetPosition().z - FEET_OFFSET; float potentialGroundZ = GetPosition().z - FEET_OFFSET;
if (m_ped_flagA2) { if (bWasStanding) {
pos.z += -0.25f; pos.z += -0.25f;
potentialGroundZ += gravityEffect; potentialGroundZ += gravityEffect;
} }
@ -14716,7 +14716,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
// 0.52f should be a ped's approx. radius // 0.52f should be a ped's approx. radius
float totalRadiusWhenCollided = collidingEnt->GetBoundRadius() + 0.52f - gravityEffect; float totalRadiusWhenCollided = collidingEnt->GetBoundRadius() + 0.52f - gravityEffect;
if (m_ped_flagA2) { if (bWasStanding) {
if (collidedWithBoat) { if (collidedWithBoat) {
potentialCenter.z += 2.0f * gravityEffect; potentialCenter.z += 2.0f * gravityEffect;
totalRadiusWhenCollided += Abs(gravityEffect); totalRadiusWhenCollided += Abs(gravityEffect);
@ -14728,7 +14728,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
ourLine.p0 = GetPosition(); ourLine.p0 = GetPosition();
ourLine.p1 = GetPosition(); ourLine.p1 = GetPosition();
ourLine.p1.z = GetPosition().z - FEET_OFFSET; ourLine.p1.z = GetPosition().z - FEET_OFFSET;
if (m_ped_flagA2) { if (bWasStanding) {
ourLine.p1.z = ourLine.p1.z + gravityEffect; ourLine.p1.z = ourLine.p1.z + gravityEffect;
ourLine.p0.z = ourLine.p0.z + -0.25f; ourLine.p0.z = ourLine.p0.z + -0.25f;
} }
@ -14736,7 +14736,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
belowTorsoCollided = CCollision::ProcessVerticalLine(ourLine, collidingEnt->GetMatrix(), *hisCol, belowTorsoCollided = CCollision::ProcessVerticalLine(ourLine, collidingEnt->GetMatrix(), *hisCol,
intersectionPoint, minDist, false, &m_collPoly); intersectionPoint, minDist, false, &m_collPoly);
if (collidedWithBoat && m_ped_flagA2 && !belowTorsoCollided) { if (collidedWithBoat && bWasStanding && !belowTorsoCollided) {
ourLine.p0.z = ourLine.p1.z; ourLine.p0.z = ourLine.p1.z;
ourLine.p1.z = ourLine.p1.z + gravityEffect; ourLine.p1.z = ourLine.p1.z + gravityEffect;
belowTorsoCollided = CCollision::ProcessVerticalLine(ourLine, collidingEnt->GetMatrix(), *hisCol, belowTorsoCollided = CCollision::ProcessVerticalLine(ourLine, collidingEnt->GetMatrix(), *hisCol,
@ -14817,7 +14817,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
} }
#else #else
float speedSqr = 0.0f; float speedSqr = 0.0f;
if (!m_ped_flagA2) { if (!bWasStanding) {
if (m_vecMoveSpeed.z >= -0.25f && (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) <= sq(0.5f)) { if (m_vecMoveSpeed.z >= -0.25f && (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) <= sq(0.5f)) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) { if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
@ -14862,7 +14862,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
} }
if (collidingEnt->IsBuilding() || collidingEnt->bIsStatic) { if (collidingEnt->IsBuilding() || collidingEnt->bIsStatic) {
if (m_ped_flagA2) { if (bWasStanding) {
CVector sphereNormal; CVector sphereNormal;
float normalLength; float normalLength;
for(int sphere = 0; sphere < ourCollidedSpheres; sphere++) { for(int sphere = 0; sphere < ourCollidedSpheres; sphere++) {

View File

@ -303,7 +303,7 @@ public:
// cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CPed.h from R* // cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CPed.h from R*
uint32 bIsStanding : 1; uint32 bIsStanding : 1;
uint32 m_ped_flagA2 : 1; // bWasStanding? uint32 bWasStanding : 1;
uint32 bIsAttacking : 1; // doesn't reset after fist fight uint32 bIsAttacking : 1; // doesn't reset after fist fight
uint32 bIsPointingGunAt : 1; uint32 bIsPointingGunAt : 1;
uint32 bIsLooking : 1; uint32 bIsLooking : 1;