Skip to content

Commit 04829b5

Browse files
committed
Little cleanup, tweaking and adjustment
1 parent 6df4484 commit 04829b5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8484

8585
- New `Actor` INI and Lua (R/W) property `PainThreshold`, which determines how much damage this actor must take in a frame to play their `PainSound`. This can be set to 0 to never manually play the sound. Defaults to 15.
8686

87-
- New `AHuman` INI and Lua (R/W) property `MaxWalkPathCrouchShift`, which determines how much the actor will automatically duck down to avoid low ceilings above them. This can be set to 0 to never duck. Defaults to 5.
87+
- New `AHuman` INI and Lua (R/W) property `MaxWalkPathCrouchShift`, which determines how much the actor will automatically duck down to avoid low ceilings above them. This can be set to 0 to never duck. Defaults to 6.
8888

8989
- New `MOPixel` INI and Lua (R/W) property `Staininess`, which defines how likely a pixel is to stain a surface when it collides with it. Staining a surface changes that surface's `Color` to that of this `MOPixel`, without changing the underlying material. Value can be between 0 and 1. Defaults to 0 (never stain).
9090

Entities/AHuman.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void AHuman::Clear()
6363
m_MoveState = STAND;
6464
m_ProneState = NOTPRONE;
6565
m_ProneTimer.Reset();
66-
m_MaxWalkPathCrouchShift = 5.0F;
66+
m_MaxWalkPathCrouchShift = 6.0F;
6767
for (int i = 0; i < MOVEMENTSTATECOUNT; ++i) {
6868
m_Paths[FGROUND][i].Reset();
6969
m_Paths[BGROUND][i].Reset();
@@ -1717,14 +1717,13 @@ void AHuman::UpdateWalkAngle(AHuman::Layer whichLayer) {
17171717

17181718
if (m_pHead) {
17191719
// Cast a ray above our head to either side to determine whether we need to crouch
1720-
float desiredCrouchHeadRoom = std::floor(m_pHead->GetRadius() + 2.0f);
1720+
float desiredCrouchHeadRoom = std::floor(m_pHead->GetRadius() + 1.5f);
17211721
float toSide = std::floor(m_pHead->GetRadius() + 3.0f);
17221722
Vector hitPosLeft = (m_pHead->GetPos() + Vector(-toSide, 0.0F)).Floor();
17231723
Vector hitPosRight = (m_pHead->GetPos() + Vector(toSide, 0.0F)).Floor();
1724-
bool leftHit = g_SceneMan.CastStrengthRay(hitPosLeft, Vector(0.0F, -desiredCrouchHeadRoom), 10.0F, hitPosLeft, 0, g_MaterialGrass);
1725-
bool rightHit = g_SceneMan.CastStrengthRay(hitPosRight, Vector(0.0F, -desiredCrouchHeadRoom), 10.0F, hitPosRight, 0, g_MaterialGrass);
1726-
float lowestY = std::max(hitPosLeft.m_Y, hitPosRight.m_Y);
1727-
float headroom = std::floor(m_pHead->GetPos().m_Y - lowestY);
1724+
g_SceneMan.CastStrengthRay(hitPosLeft, Vector(0.0F, -desiredCrouchHeadRoom), 10.0F, hitPosLeft, 0, g_MaterialGrass);
1725+
g_SceneMan.CastStrengthRay(hitPosRight, Vector(0.0F, -desiredCrouchHeadRoom), 10.0F, hitPosRight, 0, g_MaterialGrass);
1726+
float headroom = m_pHead->GetPos().m_Y - std::max(hitPosLeft.m_Y, hitPosRight.m_Y);
17281727
float adjust = desiredCrouchHeadRoom - headroom;
17291728
m_WalkPathYOffset = std::clamp(LERP(0.0F, 1.0F, m_WalkPathYOffset, adjust, 0.3F), 0.0F, m_MaxWalkPathCrouchShift);
17301729
} else {

0 commit comments

Comments
 (0)