Fix IT and ctf flag sign interpolation

This commit is contained in:
Eidolon 2023-02-26 16:47:00 -06:00
parent 707860815b
commit c42ef9f1be
2 changed files with 45 additions and 16 deletions

View file

@ -3429,10 +3429,10 @@ state_t states[NUMSTATES] =
{SPR_LCKN, 2|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LOCKONINF3
{SPR_LCKN, 3|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LOCKONINF4
{SPR_TTAG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_TTAG
{SPR_TTAG, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_TTAG
// CTF Sign
{SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG
{SPR_GFLG, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG
// Finish flag
{SPR_FNSF, FF_TRANS30, -1, {NULL}, 0, 0, S_NULL}, // S_FINISHFLAG

View file

@ -3108,14 +3108,25 @@ static void P_DoPlayerHeadSigns(player_t *player)
if (G_TagGametype())
{
// If you're "IT", show a big "IT" over your head for others to see.
if (player->pflags & PF_TAGIT)
if (player->pflags & PF_TAGIT && P_IsLocalPlayer(player))
{
if (!P_IsLocalPlayer(player)) // Don't display it on your own view.
mobj_t* it = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_TAG);
it->x = player->mo->x;
it->y = player->mo->y;
it->z = player->mo->z;
it->old_x = player->mo->old_x;
it->old_y = player->mo->old_y;
it->old_z = player->mo->old_z;
if (!(player->mo->eflags & MFE_VERTICALFLIP))
{
if (!(player->mo->eflags & MFE_VERTICALFLIP))
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height, MT_TAG);
else
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z - mobjinfo[MT_TAG].height, MT_TAG)->eflags |= MFE_VERTICALFLIP;
it->z += player->mo->height;
it->old_z += player->mo->height;
}
else
{
it->z -= mobjinfo[MT_TAG].height;
it->old_z -= mobjinfo[MT_TAG].height;
}
}
}
@ -3123,17 +3134,34 @@ static void P_DoPlayerHeadSigns(player_t *player)
{
// Spawn a got-flag message over the head of the player that
// has it (but not on your own screen if you have the flag).
if (splitscreen || player != &players[consoleplayer])
if (splitscreen || player != &players[consoleplayer] || true)
{
mobj_t *sign = P_SpawnMobj(player->mo->x+player->mo->momx, player->mo->y+player->mo->momy,
player->mo->z+player->mo->momz, MT_GOTFLAG);
if (player->mo->eflags & MFE_VERTICALFLIP)
fixed_t zofs;
mobj_t *sign;
boolean player_is_flipped = (player->mo->eflags & MFE_VERTICALFLIP) > 0;
zofs = player->mo->momz;
if (player_is_flipped)
{
sign->z += player->mo->height-P_GetPlayerHeight(player)-mobjinfo[MT_GOTFLAG].height-FixedMul(16*FRACUNIT, player->mo->scale);
sign->eflags |= MFE_VERTICALFLIP;
zofs += player->mo->height - P_GetPlayerHeight(player) - mobjinfo[MT_GOTFLAG].height - FixedMul(16 * FRACUNIT, player->mo->scale);
}
else
sign->z += P_GetPlayerHeight(player)+FixedMul(16*FRACUNIT, player->mo->scale);
{
zofs += P_GetPlayerHeight(player) + FixedMul(16 * FRACUNIT, player->mo->scale);
}
sign = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, MT_GOTFLAG);
sign->x = player->mo->x;
sign->y = player->mo->y;
sign->z = player->mo->z + zofs;
sign->old_x = player->mo->old_x;
sign->old_y = player->mo->old_y;
sign->old_z = player->mo->old_z + zofs;
if (player_is_flipped)
{
sign->eflags |= MFE_VERTICALFLIP;
}
if (player->gotflag & GF_REDFLAG)
sign->frame = 1|FF_FULLBRIGHT;
@ -12028,7 +12056,6 @@ void P_PlayerThink(player_t *player)
P_DoBubbleBreath(player); // Spawn Sonic's bubbles
P_CheckUnderwaterAndSpaceTimer(player); // Display the countdown drown numbers!
P_CheckInvincibilityTimer(player); // Spawn Invincibility Sparkles
P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head
#if 1
// "Blur" a bit when you have speed shoes and are going fast enough
@ -12893,6 +12920,8 @@ void P_PlayerAfterThink(player_t *player)
}
}
}
P_DoPlayerHeadSigns(player); // Spawn Tag/CTF signs over player's head
}
void P_SetPlayerAngle(player_t *player, angle_t angle)