Use mt->z instead of mt->options >> ZSHIFT in Command_Teleport_f

This commit is contained in:
MascaraSnake 2019-12-26 20:48:52 +01:00
parent 855f5da6c9
commit f86c5f13ce

View file

@ -517,6 +517,7 @@ void Command_Teleport_f(void)
if (!starpostnum) // spawnpoints... if (!starpostnum) // spawnpoints...
{ {
mapthing_t *mt; mapthing_t *mt;
fixed_t offset;
if (starpostpath >= numcoopstarts) if (starpostpath >= numcoopstarts)
{ {
@ -527,6 +528,7 @@ void Command_Teleport_f(void)
mt = playerstarts[starpostpath]; // Given above check, should never be NULL. mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
intx = mt->x<<FRACBITS; intx = mt->x<<FRACBITS;
inty = mt->y<<FRACBITS; inty = mt->y<<FRACBITS;
offset = mt->z<<FRACBITS;
ss = R_IsPointInSubsector(intx, inty); ss = R_IsPointInSubsector(intx, inty);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
@ -538,17 +540,9 @@ void Command_Teleport_f(void)
// Flagging a player's ambush will make them start on the ceiling // Flagging a player's ambush will make them start on the ceiling
// Objectflip inverts // Objectflip inverts
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP)) if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
{ intz = ss->sector->ceilingheight - p->mo->height - offset;
intz = ss->sector->ceilingheight - p->mo->height;
if (mt->options >> ZSHIFT)
intz -= ((mt->options >> ZSHIFT) << FRACBITS);
}
else else
{ intz = ss->sector->floorheight + offset;
intz = ss->sector->floorheight;
if (mt->options >> ZSHIFT)
intz += ((mt->options >> ZSHIFT) << FRACBITS);
}
if (mt->options & MTF_OBJECTFLIP) // flip the player! if (mt->options & MTF_OBJECTFLIP) // flip the player!
{ {