From bf25eca486ad499c74eb2b3ad338383994a94c2f Mon Sep 17 00:00:00 2001 From: Causeless Date: Thu, 28 Dec 2023 00:29:04 +0000 Subject: [PATCH] Stopped crouching when walking up hillside --- Entities/AHuman.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Entities/AHuman.cpp b/Entities/AHuman.cpp index a02f1b463..ddedc3bf9 100644 --- a/Entities/AHuman.cpp +++ b/Entities/AHuman.cpp @@ -30,6 +30,8 @@ #include "GUI.h" #include "AllegroBitmap.h" +#include "PrimitiveMan.h" + #include "tracy/Tracy.hpp" namespace RTE { @@ -1730,15 +1732,15 @@ void AHuman::UpdateCrouching() { Vector hitPosStart = (m_pHead->GetPos() + Vector(0.0F, m_SpriteRadius * 0.5F)).Floor(); Vector hitPosPredictedStart = (m_pHead->GetPos() + Vector(toPredicted, m_SpriteRadius * 0.5F)).Floor(); Vector hitPos, hitPosPredicted; - g_SceneMan.CastStrengthRay(hitPosStart, Vector(0.0F, -desiredCrouchHeadRoom + m_SpriteRadius * -0.5F), 10.0F, hitPos, 0, g_MaterialGrass); - g_SceneMan.CastStrengthRay(hitPosPredictedStart, Vector(0.0F, -desiredCrouchHeadRoom + m_SpriteRadius * -0.5F), 10.0F, hitPosPredicted, 0, g_MaterialGrass); + g_SceneMan.CastStrengthRay(hitPosStart, Vector(0.0F, -desiredCrouchHeadRoom + m_SpriteRadius * -0.5F), 1.0F, hitPos, 0, g_MaterialGrass); + g_SceneMan.CastStrengthRay(hitPosPredictedStart, Vector(0.0F, -desiredCrouchHeadRoom + m_SpriteRadius * -0.5F), 1.0F, hitPosPredicted, 0, g_MaterialGrass); // Don't do it if we're already hitting, we're probably in a weird spot - if (hitPosStart == hitPos) { + if (hitPosStart.m_Y - hitPos.m_Y <= 2.0F) { hitPos.m_X = 0.0F; } - if (hitPosPredictedStart == hitPosPredicted) { + if (hitPosPredictedStart.m_Y - hitPosPredicted.m_Y <= 2.0F) { hitPosPredicted.m_X = 0.0F; }