Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Stopped crouching when walking up hillside
Browse files Browse the repository at this point in the history
  • Loading branch information
Causeless committed Dec 28, 2023
1 parent 060fe74 commit bf25eca
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Entities/AHuman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "GUI.h"
#include "AllegroBitmap.h"

#include "PrimitiveMan.h"

#include "tracy/Tracy.hpp"

namespace RTE {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit bf25eca

Please sign in to comment.