Merge branch 'shorter-turn-lockout' into 'master'

Adjust steering lock after successful DI

See merge request KartKrew/Kart!602
This commit is contained in:
Sal 2022-05-24 06:48:46 +00:00
commit 7b64b07494
5 changed files with 16 additions and 7 deletions

View file

@ -402,7 +402,7 @@ typedef struct player_s
UINT8 justbumped; // Prevent players from endlessly bumping into each other UINT8 justbumped; // Prevent players from endlessly bumping into each other
UINT8 tumbleBounces; UINT8 tumbleBounces;
UINT16 tumbleHeight; // In *mobjscaled* fracunits, or mfu, not raw fu UINT16 tumbleHeight; // In *mobjscaled* fracunits, or mfu, not raw fu
boolean justDI; // Directional Influence ended, true until letting go of turn UINT8 justDI; // Turn-lockout timer to briefly prevent unintended turning after DI, resets when actionable or no input
boolean flipDI; // Bananas flip the DI direction. Was a bug, but it made bananas much more interesting. boolean flipDI; // Bananas flip the DI direction. Was a bug, but it made bananas much more interesting.
SINT8 drift; // (-5 to 5) - Drifting Left or Right, plus a bigger counter = sharper turn SINT8 drift; // (-5 to 5) - Drifting Left or Right, plus a bigger counter = sharper turn

View file

@ -7561,6 +7561,15 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->instashield) if (player->instashield)
player->instashield--; player->instashield--;
if (player->justDI)
{
player->justDI--;
// return turning if player is fully actionable, no matter when!
if (!P_PlayerInPain(player))
player->justDI = 0;
}
if (player->eggmanexplode) if (player->eggmanexplode)
{ {
if (player->spectator || (gametype == GT_BATTLE && !player->bumpers)) if (player->spectator || (gametype == GT_BATTLE && !player->bumpers))
@ -8296,7 +8305,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
return 0; return 0;
} }
if (player->justDI == true) if (player->justDI > 0)
{ {
// No turning until you let go after DI-ing. // No turning until you let go after DI-ing.
return 0; return 0;
@ -10496,7 +10505,7 @@ void K_HandleDirectionalInfluence(player_t *player)
} }
// DI attempted!! // DI attempted!!
player->justDI = true; player->justDI = MAXHITLAGTICS;
cmd = &player->cmd; cmd = &player->cmd;

View file

@ -239,7 +239,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"tumbleHeight")) else if (fastcmp(field,"tumbleHeight"))
lua_pushinteger(L, plr->tumbleHeight); lua_pushinteger(L, plr->tumbleHeight);
else if (fastcmp(field,"justDI")) else if (fastcmp(field,"justDI"))
lua_pushboolean(L, plr->justDI); lua_pushinteger(L, plr->justDI);
else if (fastcmp(field,"flipDI")) else if (fastcmp(field,"flipDI"))
lua_pushboolean(L, plr->flipDI); lua_pushboolean(L, plr->flipDI);
else if (fastcmp(field,"drift")) else if (fastcmp(field,"drift"))
@ -593,7 +593,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"tumbleHeight")) else if (fastcmp(field,"tumbleHeight"))
plr->tumbleHeight = luaL_checkinteger(L, 3); plr->tumbleHeight = luaL_checkinteger(L, 3);
else if (fastcmp(field,"justDI")) else if (fastcmp(field,"justDI"))
plr->justDI = luaL_checkboolean(L, 3); plr->justDI = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flipDI")) else if (fastcmp(field,"flipDI"))
plr->flipDI = luaL_checkboolean(L, 3); plr->flipDI = luaL_checkboolean(L, 3);
else if (fastcmp(field,"drift")) else if (fastcmp(field,"drift"))

View file

@ -521,7 +521,7 @@ static void P_NetUnArchivePlayers(void)
players[i].tumbleBounces = READUINT8(save_p); players[i].tumbleBounces = READUINT8(save_p);
players[i].tumbleHeight = READUINT16(save_p); players[i].tumbleHeight = READUINT16(save_p);
players[i].justDI = (boolean)READUINT8(save_p); players[i].justDI = READUINT8(save_p);
players[i].flipDI = (boolean)READUINT8(save_p); players[i].flipDI = (boolean)READUINT8(save_p);
players[i].drift = READSINT8(save_p); players[i].drift = READSINT8(save_p);

View file

@ -2142,7 +2142,7 @@ void P_MovePlayer(player_t *player)
if (cmd->turning == 0) if (cmd->turning == 0)
{ {
player->justDI = false; player->justDI = 0;
} }
// Kart frames // Kart frames