Merge branch 'thwomp-fixes' into 'next'

Thwomp fixes: Don't trigger on spectator; don't trigger on ~FF_EXISTS

See merge request STJr/SRB2!277
This commit is contained in:
Monster Iestyn 2018-09-13 14:47:40 -04:00
commit 6fbc014ea3

View file

@ -1818,6 +1818,7 @@ void T_ThwompSector(levelspecthink_t *thwomp)
#define ceilingwasheight vars[5] #define ceilingwasheight vars[5]
fixed_t thwompx, thwompy; fixed_t thwompx, thwompy;
sector_t *actionsector; sector_t *actionsector;
ffloor_t *rover = NULL;
INT32 secnum; INT32 secnum;
// If you just crashed down, wait a second before coming back up. // If you just crashed down, wait a second before coming back up.
@ -1832,7 +1833,16 @@ void T_ThwompSector(levelspecthink_t *thwomp)
secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1); secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1);
if (secnum > 0) if (secnum > 0)
{
actionsector = &sectors[secnum]; actionsector = &sectors[secnum];
// Look for thwomp FFloor
for (rover = actionsector->ffloors; rover; rover = rover->next)
{
if (rover->master == thwomp->sourceline)
break;
}
}
else else
return; // Bad bad bad! return; // Bad bad bad!
@ -1921,10 +1931,13 @@ void T_ThwompSector(levelspecthink_t *thwomp)
{ {
mobj_t *mp = (void *)&actionsector->soundorg; mobj_t *mp = (void *)&actionsector->soundorg;
if (thwomp->sourceline->flags & ML_EFFECT4) if (!rover || (rover->flags & FF_EXISTS))
S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); {
else if (thwomp->sourceline->flags & ML_EFFECT4)
S_StartSound(mp, sfx_thwomp); S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS);
else
S_StartSound(mp, sfx_thwomp);
}
thwomp->direction = 1; // start heading back up thwomp->direction = 1; // start heading back up
thwomp->distance = TICRATE; // but only after a small delay thwomp->distance = TICRATE; // but only after a small delay
@ -1938,18 +1951,22 @@ void T_ThwompSector(levelspecthink_t *thwomp)
thinker_t *th; thinker_t *th;
mobj_t *mo; mobj_t *mo;
// scan the thinkers to find players! if (!rover || (rover->flags & FF_EXISTS))
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{ {
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // scan the thinkers to find players!
continue; for (th = thinkercap.next; th != &thinkercap; th = th->next)
mo = (mobj_t *)th;
if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
{ {
thwomp->direction = -1; if (th->function.acp1 != (actionf_p1)P_MobjThinker)
break; continue;
mo = (mobj_t *)th;
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
&& mo->z <= thwomp->sector->ceilingheight
&& P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT)
{
thwomp->direction = -1;
break;
}
} }
} }