Rearrange P_PlayerThink to make some things occur even in Hitlag
Notably REALTIME - prevents the timer stopping when you get hit, but also: - Typing indicator - Airtime tracking - Kickstart accel - No Contesting due to racecountdown - Spectator data wipe - Stronger preventative measure for possible finish line multi-hit events
This commit is contained in:
parent
eeafd2bcc0
commit
50721175ce
1 changed files with 85 additions and 85 deletions
170
src/p_user.c
170
src/p_user.c
|
|
@ -3855,8 +3855,6 @@ void P_PlayerThink(player_t *player)
|
|||
|
||||
player->old_drawangle = player->drawangle;
|
||||
|
||||
player->pflags &= ~PF_HITFINISHLINE;
|
||||
|
||||
if (player->awayviewmobj && P_MobjWasRemoved(player->awayviewmobj))
|
||||
{
|
||||
P_SetTarget(&player->awayviewmobj, NULL); // remove awayviewmobj asap if invalid
|
||||
|
|
@ -4040,29 +4038,6 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
// check water content, set stuff in mobj
|
||||
P_MobjCheckWater(player->mo);
|
||||
|
||||
#ifndef SECTORSPECIALSAFTERTHINK
|
||||
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
|
||||
player->onconveyor = 0;
|
||||
// check special sectors : damage & secrets
|
||||
|
||||
if (!player->spectator)
|
||||
P_PlayerInSpecialSector(player);
|
||||
#endif
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
if (player->spectator)
|
||||
player->mo->renderflags |= RF_GHOSTLY;
|
||||
else
|
||||
player->mo->renderflags &= ~RF_GHOSTLYMASK;
|
||||
P_DeathThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure spectators always have a score and ring count of 0.
|
||||
if (player->spectator)
|
||||
{
|
||||
|
|
@ -4163,8 +4138,91 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && player->spectator && cmd->buttons & BT_ATTACK && !player->flashing)
|
||||
|
||||
if (cmd->flags & TICCMD_TYPING)
|
||||
{
|
||||
/*
|
||||
typing_duration is slow to start and slow to stop.
|
||||
|
||||
typing_timer counts down a grace period before the player is not
|
||||
actually considered typing anymore.
|
||||
*/
|
||||
if (cmd->flags & TICCMD_KEYSTROKE)
|
||||
{
|
||||
/* speed up if we are typing quickly! */
|
||||
if (player->typing_duration > 0 && player->typing_timer > 12)
|
||||
{
|
||||
if (player->typing_duration < 16)
|
||||
{
|
||||
player->typing_duration = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* slows down a tiny bit as it approaches the next dot */
|
||||
const UINT8 step = (((player->typing_duration + 15) & ~15) -
|
||||
player->typing_duration) / 2;
|
||||
player->typing_duration += max(step, 4);
|
||||
}
|
||||
}
|
||||
|
||||
player->typing_timer = 15;
|
||||
}
|
||||
else if (player->typing_timer > 0)
|
||||
{
|
||||
player->typing_timer--;
|
||||
}
|
||||
|
||||
/* if we are in the grace period (including currently typing) */
|
||||
if (player->typing_timer + player->typing_duration > 0)
|
||||
{
|
||||
/* always end the cycle on two dots */
|
||||
if (player->typing_timer == 0 &&
|
||||
(player->typing_duration < 16 || player->typing_duration == 40))
|
||||
{
|
||||
player->typing_duration = 0;
|
||||
}
|
||||
else if (player->typing_duration < 63)
|
||||
{
|
||||
player->typing_duration++;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->typing_duration = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->typing_timer = 0;
|
||||
player->typing_duration = 0;
|
||||
}
|
||||
|
||||
player->pflags &= ~PF_HITFINISHLINE;
|
||||
|
||||
// check water content, set stuff in mobj
|
||||
P_MobjCheckWater(player->mo);
|
||||
|
||||
#ifndef SECTORSPECIALSAFTERTHINK
|
||||
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
|
||||
player->onconveyor = 0;
|
||||
// check special sectors : damage & secrets
|
||||
|
||||
if (!player->spectator)
|
||||
P_PlayerInSpecialSector(player);
|
||||
#endif
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
if (player->spectator)
|
||||
player->mo->renderflags |= RF_GHOSTLY;
|
||||
else
|
||||
player->mo->renderflags &= ~RF_GHOSTLYMASK;
|
||||
P_DeathThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && player->spectator && !player->bot && cmd->buttons & BT_ATTACK && !player->flashing)
|
||||
{
|
||||
player->pflags ^= PF_WANTSTOJOIN;
|
||||
player->flashing = TICRATE/2 + 1;
|
||||
|
|
@ -4281,64 +4339,6 @@ void P_PlayerThink(player_t *player)
|
|||
player->mo->renderflags &= ~RF_DONTDRAW;
|
||||
}
|
||||
|
||||
if (cmd->flags & TICCMD_TYPING)
|
||||
{
|
||||
/*
|
||||
typing_duration is slow to start and slow to stop.
|
||||
|
||||
typing_timer counts down a grace period before the player is not
|
||||
actually considered typing anymore.
|
||||
*/
|
||||
if (cmd->flags & TICCMD_KEYSTROKE)
|
||||
{
|
||||
/* speed up if we are typing quickly! */
|
||||
if (player->typing_duration > 0 && player->typing_timer > 12)
|
||||
{
|
||||
if (player->typing_duration < 16)
|
||||
{
|
||||
player->typing_duration = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* slows down a tiny bit as it approaches the next dot */
|
||||
const UINT8 step = (((player->typing_duration + 15) & ~15) -
|
||||
player->typing_duration) / 2;
|
||||
player->typing_duration += max(step, 4);
|
||||
}
|
||||
}
|
||||
|
||||
player->typing_timer = 15;
|
||||
}
|
||||
else if (player->typing_timer > 0)
|
||||
{
|
||||
player->typing_timer--;
|
||||
}
|
||||
|
||||
/* if we are in the grace period (including currently typing) */
|
||||
if (player->typing_timer + player->typing_duration > 0)
|
||||
{
|
||||
/* always end the cycle on two dots */
|
||||
if (player->typing_timer == 0 &&
|
||||
(player->typing_duration < 16 || player->typing_duration == 40))
|
||||
{
|
||||
player->typing_duration = 0;
|
||||
}
|
||||
else if (player->typing_duration < 63)
|
||||
{
|
||||
player->typing_duration++;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->typing_duration = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->typing_timer = 0;
|
||||
player->typing_duration = 0;
|
||||
}
|
||||
|
||||
K_KartPlayerThink(player, cmd); // SRB2kart
|
||||
|
||||
DoABarrelRoll(player);
|
||||
|
|
|
|||
Loading…
Reference in a new issue