Skip to content

Commit

Permalink
Simplified MakeFootsteps().
Browse files Browse the repository at this point in the history
Also removed a leftover debug message.
  • Loading branch information
inkoalawetrust authored and madame-rachelle committed Oct 14, 2024
1 parent b0b58f4 commit b280715
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
3 changes: 0 additions & 3 deletions src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6726,10 +6726,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, const DVector3 &pos, bool check
// Don't splash for living things with small vertical velocities.
// There are levels where the constant splashing from the monsters gets extremely annoying
if (!(flags & THW_NOVEL) && ((thing->flags3 & MF3_ISMONSTER || thing->player) && thing->Vel.Z >= -6) && !force)
{
Printf("Aborting P_HitWater().");
return Terrains[terrainnum].IsLiquid;
}

splash = &Splashes[splashnum];

Expand Down
36 changes: 15 additions & 21 deletions wadsrc/static/zscript/actors/player/player.zs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,32 +1740,26 @@ class PlayerPawn : Actor
bool Running = (cmd.buttons & BT_RUN); //Holding down run key, or it's toggled.
int Delay = !Running ? Ground.WalkStepTics : Ground.RunStepTics;

if (Delay <= 0) return;
if (Delay <= 0 || GetAge() % Delay != 0) return;

Sound Step = Ground.StepSound;

//Generic foot-agnostic sound takes precedence.
if (Ground.StepSound && GetAge() % Delay == 0)
if (!Step)
{
A_StartSound (Ground.StepSound,flags:CHANF_OVERLAP,volume:Ground.StepVolume);
bool Heavy = Mass >= 200 ? 0 : THW_SMALL; //Big player makes big splash.
HitWater (CurSector,(Pos.XY,CurSector.FloorPlane.ZatPoint(Pos.XY)),True,False,flags:Heavy|THW_NOVEL);
return;
//Apparently most people walk with their right foot first, so assume that here.
if (GetAge() % (Delay*2) == 0)
Step = Ground.LeftStepSound;
else
Step = Ground.RightStepSound;
}

//Apparently most people walk with their right foot first, so assume that here.
bool LeftStep; //Prevent the right step playing twice.
if (GetAge() % (Delay*2) == 0)
{
A_StartSound (Ground.LeftStepSound,flags:CHANF_OVERLAP,volume:Ground.StepVolume);
bool Heavy = Mass >= 200 ? 0 : THW_SMALL; //Big player makes big splash.
HitWater (CurSector,(Pos.XY,CurSector.FloorPlane.ZatPoint(Pos.XY)),True,False,flags:Heavy|THW_NOVEL);
LeftStep = True;
}
if (!LeftStep && GetAge() % Delay == 0)
{
A_StartSound (Ground.RightStepSound,flags:CHANF_OVERLAP,volume:Ground.StepVolume);
bool Heavy = Mass >= 200 ? 0 : THW_SMALL; //Big player makes big splash.
HitWater (CurSector,(Pos.XY,CurSector.FloorPlane.ZatPoint(Pos.XY)),True,False,flags:Heavy|THW_NOVEL);
}
if (Step)
A_StartSound (Step,flags:CHANF_OVERLAP,volume:Ground.StepVolume);

//Steps make splashes regardless.
bool Heavy = Mass >= 200 ? 0 : THW_SMALL; //Big player makes big splash.
HitWater (CurSector,(Pos.XY,CurSector.FloorPlane.ZatPoint(Pos.XY)),True,False,flags:Heavy|THW_NOVEL);
}
}

Expand Down

0 comments on commit b280715

Please sign in to comment.