Merge branch 'boostpower-terrain-particles' into 'master'

Slowdown Terrain Particle repair

See merge request KartKrew/Kart!1166
This commit is contained in:
Oni 2023-05-01 19:33:02 +00:00
commit 1058d210d1

View file

@ -955,6 +955,9 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs, tic_t timer)
See header file for description.
--------------------------------------------------*/
#define INVALIDFOOTSTEP (fs == NULL || fs->mobjType == MT_NULL || fs->frequency <= 0)
void K_HandleFootstepParticles(mobj_t *mo)
{
tic_t timer = leveltime;
@ -966,31 +969,60 @@ void K_HandleFootstepParticles(mobj_t *mo)
return;
}
if (mo->player)
{
// Offset the timer.
timer += mo->player - players;
}
if (!(mo->flags & MF_APPLYTERRAIN) || mo->terrain == NULL)
{
// No TERRAIN effects for this object.
return;
goto offroadhandle;
}
fs = K_GetFootstepByIndex(mo->terrain->footstepID);
if (fs == NULL || fs->mobjType == MT_NULL || fs->frequency <= 0)
if (INVALIDFOOTSTEP)
{
// No particles to spawn.
return;
}
if (mo->player != NULL)
{
// Offset timer by player ID.
timer += mo->player - players;
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;
}
K_SpawnFootstepParticle(mo, fs, timer);
}
#undef INVALIDFOOTSTEP
/*--------------------------------------------------
static void K_CleanupTerrainOverlay(mobj_t *mo)