summaryrefslogtreecommitdiffstats
path: root/src/entities/Physical.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-09-11 17:46:16 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-09-11 17:46:16 +0200
commite5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b (patch)
treeb6f2c470ea7846dc626c20bcbb3b821143fb72f1 /src/entities/Physical.cpp
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar.gz
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar.bz2
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar.lz
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar.xz
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.tar.zst
re3-e5faeea2e51da5e6ea9ef18b3358c82d69d1ca4b.zip
Diffstat (limited to 'src/entities/Physical.cpp')
-rw-r--r--src/entities/Physical.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 5fe29a79..b190d03a 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -23,6 +23,11 @@
//--MIAMI: file done
+#ifdef WALLCLIMB_CHEAT
+bool gGravityCheat;
+#endif
+
+
CPhysical::CPhysical(void)
{
int i;
@@ -521,8 +526,29 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin
void
CPhysical::ApplyGravity(void)
{
- if(bAffectedByGravity)
- m_vecMoveSpeed.z -= GRAVITY * CTimer::GetTimeStep();
+ if (!bAffectedByGravity)
+ return;
+#ifdef WALLCLIMB_CHEAT
+ if (gGravityCheat && this == FindPlayerVehicle()) {
+ static CVector v1(0.0f, 0.0f, 1.0f), v2(0.0f, 0.0f, 1.0f);
+ CVector prop = GetPosition() - (GetUp() + GetUp());
+ CColPoint point;
+ CEntity* entity;
+ if (CWorld::ProcessLineOfSight(GetPosition(), prop, point, entity, true, false, false, false, false, false))
+ v2 = point.normal;
+ else
+ v2 = CVector(0.0f, 0.0f, 1.0f);
+ float coef = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
+ v1 = v1 * (1.0f - coef) + v2 * coef;
+ if (v1.MagnitudeSqr() < 0.1f)
+ v1 = CVector(0.0f, 0.0f, 1.0f);
+ else
+ v1.Normalise();
+ m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * v1;
+ return;
+ }
+#endif
+ m_vecMoveSpeed.z -= GRAVITY * CTimer::GetTimeStep();
}
void