Prevent flipped over players from tumbling endlessly
I'm not sure why this wasn't a thing in the first place
This commit is contained in:
parent
75a69e664c
commit
bad7611b93
2 changed files with 12 additions and 5 deletions
|
|
@ -7127,8 +7127,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->spinouttimer = 0;
|
||||
player->wipeoutslow = 0;
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) &&
|
||||
((INT32)(player->flipovertimer - 1) > 2))
|
||||
if ((P_IsObjectOnGround(player->mo) &&
|
||||
((INT32)(player->flipovertimer - 1) > 2)) || // Hit the ground...
|
||||
(player->flipovertimer >
|
||||
FLIPOVERLIMIT)) // ...or we've been tumbling around for too long.
|
||||
{
|
||||
player->flipovertimer = 0;
|
||||
player->mo->rollangle = 0;
|
||||
|
|
|
|||
11
src/k_kart.h
11
src/k_kart.h
|
|
@ -48,11 +48,16 @@ Make sure this matches the actual number of states
|
|||
#define FLIPOVERDIST (336<<FRACBITS)
|
||||
|
||||
// Time (in tics) of a flipover.
|
||||
// (TICRATE * (0.56666 * FRACUNIT))
|
||||
#define FLIPOVERTICS 19
|
||||
// (TICRATE * 0.56666)
|
||||
#define FLIPOVERTICS (19)
|
||||
#define FLIPOVERHALFTICS (FLIPOVERTICS>>1)
|
||||
|
||||
#define FLIPOVER_90DEGTIME ((FLIPOVERTICS>>2)+1) // 0.1666 * FRACUNIT
|
||||
#define FLIPOVER_90DEGTIME ((FLIPOVERTICS>>2)+1) // TICRATE * 0.1666
|
||||
#define FLIPOVER_360DEGTIME (FLIPOVER_90DEGTIME * 4)
|
||||
|
||||
// Force-stops a flipover if the timer exceeds this limit.
|
||||
// Initially enough to last 2 rotations.
|
||||
#define FLIPOVERLIMIT (FLIPOVER_360DEGTIME * 2)
|
||||
|
||||
// Angle movement for a flipover
|
||||
// ANGLE_90 / FLIPOVER_90DEGTIME
|
||||
|
|
|
|||
Loading…
Reference in a new issue