Remove stacked stunned tics

This commit is contained in:
Lach 2025-06-20 20:40:29 +10:00 committed by AJ Martinez
parent d58414b440
commit fceb325bd4
4 changed files with 3 additions and 21 deletions

View file

@ -740,7 +740,6 @@ struct player_t
UINT8 tumbleBounces;
UINT16 tumbleHeight; // In *mobjscaled* fracunits, or mfu, not raw fu
UINT16 stunned; // Number of tics during which rings cannot be picked up
UINT8 stunnedCombo; // Number of hits sustained while stunned, reduces consecutive stun penalties
mobj_t *flybot; // One Flybot767 circling the player while stunned
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.

View file

@ -9741,13 +9741,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
// timer counts down at triple speed while spindashing
player->stunned = max(0, player->stunned - (player->spindash ? 3 : 1));
// when timer reaches 0, reset the stun combo counter
if (player->stunned == 0)
{
player->stunnedCombo = 0;
}
// otherwise if the flybots aren't spawned, spawn them now!
else if (P_MobjWasRemoved(player->flybot))
// if the flybots aren't spawned, spawn them now!
if (player->stunned != 0 && P_MobjWasRemoved(player->flybot))
{
Obj_SpawnFlybotsForPlayer(player);
}
@ -16326,7 +16321,6 @@ void K_ApplyStun(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 dama
// calculate base stun tics
stunTics = Easing_Linear((player->kartweight - 1) * FRACUNIT / 8, BASE_STUN_TICS_MAX, BASE_STUN_TICS_MIN);
stunTics >>= player->stunnedCombo; // consecutive hits add half as much stun as the previous hit
// reduce stun in games with more than 8 players
if (numPlayers > 8)
@ -16340,12 +16334,7 @@ void K_ApplyStun(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 dama
stunTics /= 3;
}
if (player->stunnedCombo < UINT8_MAX)
{
player->stunnedCombo++;
}
stunTics = min(max(player->stunned + stunTics, 0), UINT16_MAX);
player->stunned = stunTics;
player->stunned = max(stunTics, 0);
#undef BASE_STUN_TICS_MIN
#undef BASE_STUN_TICS_MAX

View file

@ -262,8 +262,6 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->tumbleHeight);
else if (fastcmp(field,"stunned"))
lua_pushinteger(L, plr->stunned);
else if (fastcmp(field,"stunnedcombo"))
lua_pushinteger(L, plr->stunnedCombo);
else if (fastcmp(field,"flybot"))
LUA_PushUserdata(L, plr->flybot, META_MOBJ);
else if (fastcmp(field,"justdi"))
@ -898,8 +896,6 @@ static int player_set(lua_State *L)
plr->tumbleHeight = luaL_checkinteger(L, 3);
else if (fastcmp(field,"stunned"))
plr->stunned = luaL_checkinteger(L, 3);
else if (fastcmp(field,"stunnedcombo"))
plr->stunnedCombo = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flybot"))
{
mobj_t *mo = NULL;

View file

@ -470,7 +470,6 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].tumbleBounces);
WRITEUINT16(save->p, players[i].tumbleHeight);
WRITEUINT16(save->p, players[i].stunned);
WRITEUINT8(save->p, players[i].stunnedCombo);
WRITEUINT8(save->p, players[i].justDI);
WRITEUINT8(save->p, players[i].flipDI);
@ -1129,7 +1128,6 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].tumbleBounces = READUINT8(save->p);
players[i].tumbleHeight = READUINT16(save->p);
players[i].stunned = READUINT16(save->p);
players[i].stunnedCombo = READUINT8(save->p);
players[i].justDI = READUINT8(save->p);
players[i].flipDI = (boolean)READUINT8(save->p);