Final rearrangement

- If terrain has footsteps, always show those footsteps regardless of player speed slowdown
- Otherwise, if player is slowed down, show default offroad particles
This commit is contained in:
toaster 2023-05-01 17:52:43 +01:00
parent dc7d157162
commit f450789a08

View file

@ -956,12 +956,12 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs, tic_t timer)
See header file for description.
--------------------------------------------------*/
#define INVALIDFOOTSTEP(footstep) (footstep == NULL || footstep->mobjType == MT_NULL || footstep->frequency <= 0)
#define INVALIDFOOTSTEP (fs == NULL || fs->mobjType == MT_NULL || fs->frequency <= 0)
void K_HandleFootstepParticles(mobj_t *mo)
{
tic_t timer = leveltime;
t_footstep_t *fs = NULL, *ofs = NULL;
t_footstep_t *fs = NULL;
if (mo == NULL || P_MobjWasRemoved(mo) == true)
{
@ -973,35 +973,51 @@ void K_HandleFootstepParticles(mobj_t *mo)
{
// Offset the timer.
timer += mo->player - players;
if (mo->player->boostpower < FRACUNIT)
{
// Create default offroad footstep
ofs = K_GetFootstepByIndex(defaultOffroadFootstep);
if (!INVALIDFOOTSTEP(ofs))
{
K_SpawnFootstepParticle(mo, ofs, timer);
}
}
}
if (!(mo->flags & MF_APPLYTERRAIN) || mo->terrain == NULL)
{
// No TERRAIN effects for this object.
return;
goto offroadhandle;
}
fs = K_GetFootstepByIndex(mo->terrain->footstepID);
if (INVALIDFOOTSTEP(fs) || ofs == fs)
if (INVALIDFOOTSTEP)
{
// No particles to spawn.
goto offroadhandle;
}
// Idea for later: if different spawning styles are desired,
// we can put a switch case here!
K_SpawnFootstepParticle(mo, fs, timer);
return;
offroadhandle:
// ...unless you're
// - A player and
if (mo->player == NULL)
{
return;
}
// - Being affected by offroad
if (mo->player->boostpower >= FRACUNIT)
{
return;
}
// in which case make default offroad footstep!
fs = K_GetFootstepByIndex(defaultOffroadFootstep);
if (INVALIDFOOTSTEP)
{
// No particles to spawn.
return;
}
// Idea for later: if different spawning styles are desired,
// we can put a switch case here!
K_SpawnFootstepParticle(mo, fs, timer);
}