P_MovePlayerToSpawn: Use mthing->z instead of mthing->options >> ZSHIFT
This commit is contained in:
parent
12d30b7acc
commit
f4c6068ab1
21
src/p_mobj.c
21
src/p_mobj.c
|
@ -11562,7 +11562,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
||||||
|
|
||||||
fixed_t z;
|
fixed_t z;
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
fixed_t floor, ceiling;
|
fixed_t floor, ceiling, ceilingspawn;
|
||||||
|
|
||||||
player_t *p = &players[playernum];
|
player_t *p = &players[playernum];
|
||||||
mobj_t *mobj = p->mo;
|
mobj_t *mobj = p->mo;
|
||||||
|
@ -11589,23 +11589,18 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
||||||
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
||||||
#endif
|
#endif
|
||||||
sector->ceilingheight;
|
sector->ceilingheight;
|
||||||
|
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
|
||||||
|
|
||||||
if (mthing)
|
if (mthing)
|
||||||
{
|
{
|
||||||
|
fixed_t offset = mthing->z << FRACBITS;
|
||||||
|
|
||||||
// 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 (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||||
{
|
z = ceilingspawn - offset;
|
||||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
z = floor + offset;
|
||||||
z = floor;
|
|
||||||
if (mthing->options >> ZSHIFT)
|
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
|
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
|
||||||
{
|
{
|
||||||
|
@ -11622,8 +11617,8 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
||||||
|
|
||||||
if (z < floor)
|
if (z < floor)
|
||||||
z = floor;
|
z = floor;
|
||||||
else if (z > ceiling - mobjinfo[MT_PLAYER].height)
|
else if (z > ceilingspawn)
|
||||||
z = ceiling - mobjinfo[MT_PLAYER].height;
|
z = ceilingspawn;
|
||||||
|
|
||||||
mobj->floorz = floor;
|
mobj->floorz = floor;
|
||||||
mobj->ceilingz = ceiling;
|
mobj->ceilingz = ceiling;
|
||||||
|
|
Loading…
Reference in a new issue