mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-10 10:10:52 +00:00
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:
parent
331ea9814f
commit
8426ce8d9c
2 changed files with 14 additions and 6 deletions
14
src/p_map.c
14
src/p_map.c
|
@ -129,6 +129,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||||
return false;
|
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!
|
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
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!
|
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
||||||
return;
|
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 (spring->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (object->z + object->height > spring->z + spring->height)
|
if (object->z > spring->z + spring->height)
|
||||||
return;
|
return;
|
||||||
zdist = (spring->z + spring->height) - (object->z + object->height);
|
zdist = (spring->z + spring->height) - (object->z + object->height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (object->z < spring->z)
|
if (object->z + object->height < spring->z)
|
||||||
return;
|
return;
|
||||||
zdist = object->z - spring->z;
|
zdist = object->z - spring->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (spring->type)
|
switch (spring->type)
|
||||||
{
|
{
|
||||||
case MT_FAN: // fan
|
case MT_FAN: // fan
|
||||||
|
|
|
@ -2376,9 +2376,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly
|
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;
|
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||||
|
|
||||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2532,7 +2532,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
||||||
mom.z = tmfloorthing->momz;
|
mom.z = tmfloorthing->momz;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (mo->standingslope) {
|
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
|
||||||
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue