Change flipped starpostz to define the top of the player object, for cases where scale on contact with starpost is different to spawn scale.

This commit is contained in:
toaster 2019-09-08 21:21:36 +01:00
parent d26ff197dc
commit 11e3f5ec96
3 changed files with 19 additions and 14 deletions

View File

@ -833,7 +833,10 @@ void Command_Savecheckpoint_f(void)
players[consoleplayer].starpostangle = players[consoleplayer].mo->angle;
players[consoleplayer].starpostscale = players[consoleplayer].mo->destscale;
if (players[consoleplayer].mo->flags2 & MF2_OBJECTFLIP)
{
players[consoleplayer].starpostscale *= -1;
players[consoleplayer].starpostz += players[consoleplayer].mo->height;
}
CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].starpostx, players[consoleplayer].starposty, players[consoleplayer].starpostz);
}

View File

@ -1431,7 +1431,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->flags2 & MF2_OBJECTFLIP)
{
players[i].starpostscale *= -1;
players[i].starpostz += (special->height - P_GetPlayerHeight(player))>>FRACBITS;
players[i].starpostz += special->height>>FRACBITS;
}
players[i].starpostnum = special->health;
@ -1453,7 +1453,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->flags2 & MF2_OBJECTFLIP)
{
player->starpostscale *= -1;
player->starpostz += (special->height - P_GetPlayerHeight(player))>>FRACBITS;
player->starpostz += special->height>>FRACBITS;
}
player->starpostnum = special->health;
S_StartSound(toucher, special->info->painsound);

View File

@ -10669,24 +10669,26 @@ void P_MovePlayerToStarpost(INT32 playernum)
P_SetScale(mobj, (mobj->destscale = abs(p->starpostscale)));
mobj->floorz = floor;
mobj->ceilingz = ceiling;
if (z <= floor)
z = floor;
else if (z >= ceiling - mobj->height)
z = ceiling - mobj->height;
mobj->z = z;
if (p->starpostscale < 0)
{
mobj->flags2 |= MF2_OBJECTFLIP;
if (mobj->z + mobj->height == mobj->ceilingz)
if (z >= ceiling)
{
mobj->eflags |= MFE_ONGROUND;
z = ceiling;
}
z -= mobj->height;
}
else if (mobj->z == mobj->floorz)
else if (z <= floor)
{
mobj->eflags |= MFE_ONGROUND;
z = floor;
}
mobj->floorz = floor;
mobj->ceilingz = ceiling;
mobj->z = z;
mobj->angle = p->starpostangle;