mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Make both offroad dust and terrain particles
This commit is contained in:
parent
661285d3c6
commit
dc7d157162
1 changed files with 21 additions and 31 deletions
|
|
@ -956,13 +956,12 @@ static void K_SpawnFootstepParticle(mobj_t *mo, t_footstep_t *fs, tic_t timer)
|
||||||
See header file for description.
|
See header file for description.
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
|
|
||||||
#define INVALIDFOOTSTEP (fs == NULL || fs->mobjType == MT_NULL || fs->frequency <= 0)
|
#define INVALIDFOOTSTEP(footstep) (footstep == NULL || footstep->mobjType == MT_NULL || footstep->frequency <= 0)
|
||||||
|
|
||||||
void K_HandleFootstepParticles(mobj_t *mo)
|
void K_HandleFootstepParticles(mobj_t *mo)
|
||||||
{
|
{
|
||||||
tic_t timer = leveltime;
|
tic_t timer = leveltime;
|
||||||
t_footstep_t *fs = NULL;
|
t_footstep_t *fs = NULL, *ofs = NULL;
|
||||||
boolean offroadslowed = false;
|
|
||||||
|
|
||||||
if (mo == NULL || P_MobjWasRemoved(mo) == true)
|
if (mo == NULL || P_MobjWasRemoved(mo) == true)
|
||||||
{
|
{
|
||||||
|
|
@ -970,41 +969,32 @@ void K_HandleFootstepParticles(mobj_t *mo)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
offroadslowed = (mo->player != NULL && mo->player->boostpower < FRACUNIT);
|
if (mo->player)
|
||||||
|
|
||||||
if (!offroadslowed)
|
|
||||||
{
|
{
|
||||||
if (!(mo->flags & MF_APPLYTERRAIN) || mo->terrain == NULL)
|
// Offset the timer.
|
||||||
|
timer += mo->player - players;
|
||||||
|
|
||||||
|
if (mo->player->boostpower < FRACUNIT)
|
||||||
{
|
{
|
||||||
// No TERRAIN effects for this object.
|
// Create default offroad footstep
|
||||||
return;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
fs = K_GetFootstepByIndex(mo->terrain->footstepID);
|
fs = K_GetFootstepByIndex(mo->terrain->footstepID);
|
||||||
|
|
||||||
if (mo->player != NULL)
|
if (INVALIDFOOTSTEP(fs) || ofs == fs)
|
||||||
{
|
|
||||||
// Match behaviour of the previous entry in the series:
|
|
||||||
// Only do footsteps for offroad if you're slowed by it,
|
|
||||||
// and guarantee the defaults if none were found for this.
|
|
||||||
if (offroadslowed)
|
|
||||||
{
|
|
||||||
if (INVALIDFOOTSTEP)
|
|
||||||
{
|
|
||||||
fs = K_GetFootstepByIndex(defaultOffroadFootstep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mo->terrain->offroad != 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Offset timer by player ID.
|
|
||||||
timer += mo->player - players;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (INVALIDFOOTSTEP)
|
|
||||||
{
|
{
|
||||||
// No particles to spawn.
|
// No particles to spawn.
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue