Minor change to fans and gas jets that makes them work on slopes.

- Now checks whether the player's top is below the bottom of the fan/gas jet, instead of its bottom. zdist calculation not affected.
- mo->standingslope is NULL'd so the player isn't launched off at a wacky angle. (I also did this for springs, since Prime mentioned it was a problem for them too.)
This commit is contained in:
toasterbabe 2016-06-30 23:23:50 +01:00
parent 331ea9814f
commit 8426ce8d9c
2 changed files with 14 additions and 6 deletions

View File

@ -129,6 +129,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
return false;
}
#ifdef ESLOPE
object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
#endif
object->eflags |= MFE_SPRUNG; // apply this flag asap!
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
@ -232,20 +236,24 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
return;
// is object below thruster's position? if not, calculate distance between their bottoms
// is object's top below thruster's position? if not, calculate distance between their bottoms
if (spring->eflags & MFE_VERTICALFLIP)
{
if (object->z + object->height > spring->z + spring->height)
if (object->z > spring->z + spring->height)
return;
zdist = (spring->z + spring->height) - (object->z + object->height);
}
else
{
if (object->z < spring->z)
if (object->z + object->height < spring->z)
return;
zdist = object->z - spring->z;
}
#ifdef ESLOPE
object->standingslope = NULL; // No launching off at silly angles for you.
#endif
switch (spring->type)
{
case MT_FAN: // fan

View File

@ -2376,9 +2376,9 @@ static boolean P_ZMovement(mobj_t *mo)
#ifdef ESLOPE
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) {
if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM))
{
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
@ -2532,7 +2532,7 @@ static boolean P_ZMovement(mobj_t *mo)
mom.z = tmfloorthing->momz;
#ifdef ESLOPE
if (mo->standingslope) {
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif