From 3076e73c5956639bd5662cbdafcd7e9e7eb5f8f8 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Mon, 12 May 2025 18:13:34 -0400 Subject: [PATCH] WIP: Nerf bumper car bots --- src/d_player.h | 2 ++ src/k_bot.cpp | 3 +++ src/k_kart.c | 11 +++++++++++ src/lua_playerlib.c | 4 ++++ src/p_map.c | 3 +++ src/p_saveg.cpp | 4 ++++ 6 files changed, 27 insertions(+) diff --git a/src/d_player.h b/src/d_player.h index 64547b348..babfa6a86 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -844,6 +844,8 @@ struct player_t UINT8 trickboost; // Trick boost. This one is weird and has variable speed. Dear god. UINT8 tricklock; // Input safety for 2.2 lenient tricks. + UINT8 bumpslow; + UINT8 dashRingPullTics; // Timer during which the player is pulled towards a dash ring UINT8 dashRingPushTics; // Timer during which the player displays effects and has no gravity after being thrust by a dash ring diff --git a/src/k_bot.cpp b/src/k_bot.cpp index c55766189..1e8cc323b 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -806,6 +806,9 @@ fixed_t K_UpdateRubberband(player_t *player) // Ease into the new value. ret += (dest - player->botvars.rubberband) / 8; + if (player->bumpslow) + ret = FRACUNIT/2; // Magic number! + return ret; } diff --git a/src/k_kart.c b/src/k_kart.c index 5173fa3eb..5fa6ff7aa 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9438,6 +9438,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->trickboost) player->trickboost--; + if (player->bumpslow) + player->bumpslow--; + if (player->flamedash) { player->flamedash--; @@ -10224,6 +10227,14 @@ void K_KartResetPlayerColor(player_t *player) goto base; } + if (player->bumpslow) + { + player->mo->colorized = true; + player->mo->color = SKINCOLOR_RED; + fullbright = true; + goto finalise; + } + if (player->eggmanexplode) // You're gonna diiiiie { const INT32 flashtime = 4<<(player->eggmanexplode/TICRATE); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 62eca4611..4833edfa5 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -526,6 +526,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->trickboost); else if (fastcmp(field,"tricklock")) lua_pushinteger(L, plr->tricklock); + else if (fastcmp(field,"bumpslow")) + lua_pushinteger(L, plr->bumpslow); else if (fastcmp(field,"dashringpulltics")) lua_pushinteger(L, plr->dashRingPullTics); else if (fastcmp(field,"dashringpushtics")) @@ -1136,6 +1138,8 @@ static int player_set(lua_State *L) plr->trickboost = luaL_checkinteger(L, 3); else if (fastcmp(field,"tricklock")) plr->tricklock = luaL_checkinteger(L, 3); + else if (fastcmp(field,"bumpslow")) + plr->bumpslow = luaL_checkinteger(L, 3); else if (fastcmp(field,"dashringpulltics")) plr->dashRingPullTics = luaL_checkinteger(L, 3); else if (fastcmp(field,"dashringpushtics")) diff --git a/src/p_map.c b/src/p_map.c index c4e831118..dc66c03af 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4117,6 +4117,9 @@ static void P_BouncePlayerMove(mobj_t *mo, TryMoveResult_t *result) if (mo->player) mo->player->bumpUnstuck += 5; + if (K_PlayerUsesBotMovement(mo->player)) + mo->player->bumpslow = TICRATE*2; + // Combo avoidance! if (mo->player && P_PlayerInPain(mo->player) && gametyperules & GTR_BUMPERS && mo->health == 1) { diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 9f11fbb70..b3072b409 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -569,6 +569,8 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT8(save->p, players[i].trickboost); WRITEUINT8(save->p, players[i].tricklock); + WRITEUINT8(save->p, players[i].bumpslow); + WRITEUINT8(save->p, players[i].dashRingPullTics); WRITEUINT8(save->p, players[i].dashRingPushTics); @@ -1206,6 +1208,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].trickboost = READUINT8(save->p); players[i].tricklock = READUINT8(save->p); + players[i].bumpslow = READUINT8(save->p); + players[i].dashRingPullTics = READUINT8(save->p); players[i].dashRingPushTics = READUINT8(save->p);