Speed up lightsnaking if dying with airtime

This commit is contained in:
James R 2021-11-21 22:02:45 -08:00
parent fa8bffabfc
commit f205d6d8fd
2 changed files with 13 additions and 2 deletions

View file

@ -263,6 +263,7 @@ typedef struct respawnvars_s
fixed_t pointz;
boolean flip; // Flip upside down or not
tic_t timer; // Time left on respawn animation once you're there
tic_t airtimer; // Time spent in the air before respawning
UINT32 distanceleft; // How far along the course to respawn you
tic_t dropdash; // Drop Dash charge timer
} respawnvars_t;

View file

@ -276,6 +276,8 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.timer = RESPAWN_TIME;
player->respawn.state = RESPAWNST_MOVE;
player->respawn.airtimer = player->airtime;
}
/*--------------------------------------------------
@ -318,8 +320,9 @@ size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint)
--------------------------------------------------*/
static void K_MovePlayerToRespawnPoint(player_t *player)
{
const fixed_t realstepamt = (64 * mapobjectscale);
fixed_t stepamt = realstepamt;
const int airCompensation = 128;
fixed_t realstepamt = (64 * mapobjectscale);
fixed_t stepamt;
vector3_t dest, step, laser;
angle_t stepha, stepva;
@ -330,6 +333,13 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
waypoint_t *laserwp;
boolean laserflip;
/* speed up if in the air for a long time */
realstepamt += FixedMul(realstepamt,
(player->respawn.airtimer * FRACUNIT)
/ airCompensation);
stepamt = realstepamt;
player->mo->momx = player->mo->momy = player->mo->momz = 0;
player->flashing = 2;