mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Respawning: set MF2_OBJECTFLIP directly in P_GetMobjGravity
K_RespawnOffset is called before the player is actually at the waypoint's position, so even if P_GetMobjGravity is called there to check, it reflects the player's current sector, which may not necessarily be the waypoint's sector.
This commit is contained in:
parent
b0cb804fe4
commit
56dcfaedf8
2 changed files with 20 additions and 10 deletions
|
|
@ -34,20 +34,10 @@ fixed_t K_RespawnOffset(player_t *player, boolean flip)
|
|||
|
||||
if (flip == true)
|
||||
{
|
||||
// Lat 24/7/20: Okay so before we even think about applying this flag, check if the sector we're in doesn't already have reverse gravity for that.
|
||||
// Otherwise, we would reverse the reverse gravity and cancel it out. Yes, this is absolutely fucking dumb.
|
||||
// I'm honestly not sure if this flag is even necessary anymore but we'll keep it just in case.
|
||||
|
||||
if (P_GetMobjGravity(player->mo) < 0)
|
||||
player->mo->flags2 |= MF2_OBJECTFLIP;
|
||||
|
||||
player->mo->eflags |= MFE_VERTICALFLIP;
|
||||
z -= ((128 * mapobjectscale) + (player->mo->height));
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->flags2 &= ~MF2_OBJECTFLIP;
|
||||
player->mo->eflags &= ~MFE_VERTICALFLIP;
|
||||
z += (128 * mapobjectscale);
|
||||
}
|
||||
|
||||
|
|
@ -447,6 +437,13 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
player->respawn.wp = player->respawn.wp->nextwaypoints[nwp];
|
||||
K_RespawnAtWaypoint(player, player->respawn.wp);
|
||||
|
||||
player->mo->eflags &= ~(MFE_VERTICALFLIP);
|
||||
|
||||
if (player->respawn.flip)
|
||||
{
|
||||
player->mo->eflags |= MFE_VERTICALFLIP;
|
||||
}
|
||||
|
||||
dest.x = player->respawn.pointx;
|
||||
dest.y = player->respawn.pointy;
|
||||
dest.z = player->respawn.pointz;
|
||||
|
|
|
|||
13
src/p_mobj.c
13
src/p_mobj.c
|
|
@ -1119,6 +1119,19 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
|
|||
|
||||
if (mo->player)
|
||||
{
|
||||
if (mo->player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
// Respawning forces gravity to match waypoint configuration
|
||||
mo->flags2 &= ~(MF2_OBJECTFLIP);
|
||||
|
||||
// If this sector's gravity doesn't already match
|
||||
if ((gravityadd > 0) != mo->player->respawn.flip)
|
||||
{
|
||||
mo->flags2 |= MF2_OBJECTFLIP;
|
||||
}
|
||||
}
|
||||
|
||||
// MF2_OBJECTFLIP is relative -- flips sector reverse gravity back to normal
|
||||
if (mo->flags2 & MF2_OBJECTFLIP)
|
||||
{
|
||||
gravityadd = -gravityadd;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue