From fdf1be6a501a698a46d5c6eee0c5abcfad8c5595 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Mon, 29 Apr 2024 19:31:36 -0700 Subject: [PATCH] Grow/invinc tweakpass --- src/d_player.h | 2 ++ src/k_kart.c | 15 +++++++++++---- src/lua_playerlib.c | 4 ++++ src/objects/shrink.c | 7 ++++++- src/p_saveg.c | 4 ++++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 1eb5ba6aa..f35da663a 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -983,6 +983,8 @@ struct player_t UINT8 lastsafelap; UINT8 lastsafecheatcheck; + UINT8 ignoreAirtimeLeniency; // We bubblebounced or otherwise did an airtime thing with control, powerup timers should still count down + fixed_t topAccel; // Reduced on straight wall collisions to give players extra recovery time mobj_t *stumbleIndicator; diff --git a/src/k_kart.c b/src/k_kart.c index fba7c2f99..02f7aa3cd 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8925,7 +8925,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } } - if (player->invincibilitytimer && (onground == true || K_PowerUpRemaining(player, POWERUP_SMONITOR))) + if (player->invincibilitytimer && (player->ignoreAirtimeLeniency > 0 || onground == true || K_PowerUpRemaining(player, POWERUP_SMONITOR))) player->invincibilitytimer--; if (!player->invincibilitytimer) @@ -8961,7 +8961,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if ((player->respawn.state == RESPAWNST_NONE) && player->growshrinktimer != 0) { - if (player->growshrinktimer > 0 && onground == true) + if (player->growshrinktimer > 0 && (onground == true || player->ignoreAirtimeLeniency > 0)) player->growshrinktimer--; if (player->growshrinktimer < 0) player->growshrinktimer++; @@ -8987,6 +8987,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->finalfailsafe = 0; } + if (player->ignoreAirtimeLeniency) + player->ignoreAirtimeLeniency--; + if (player->freeRingShooterCooldown && !player->mo->hitlag) player->freeRingShooterCooldown--; @@ -11848,6 +11851,8 @@ boolean K_FastFallBounce(player_t *player) fixed_t fallspeed = abs(player->fastfall); P_InstaThrust(player->mo, player->mo->angle, 11*max(minspeed, fallspeed)/10); + player->ignoreAirtimeLeniency = max(player->ignoreAirtimeLeniency, TICRATE); + bounce += 3 * mapobjectscale; } else @@ -12494,12 +12499,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) // Doesn't hold your item slot hostage normally, so you're free to waste it if you have multiple { UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing); - UINT32 behindScaled = behind * TICRATE / 4000; + UINT32 behindScaled = behind * TICRATE / 4500; behindScaled = min(behindScaled, 10*TICRATE); K_DoInvincibility(player, - max(10u * TICRATE + behindScaled, player->invincibilitytimer + 5u*TICRATE)); + max(6u * TICRATE + behindScaled, player->invincibilitytimer + 5u*TICRATE)); K_PlayPowerGloatSound(player->mo); + if (!K_PlayerUsesBotMovement(player)) + CONS_Printf("invinc %d\n", player->invincibilitytimer); player->itemamount--; player->botvars.itemconfirm = 0; } diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 6ec65fe86..83bf618a2 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -366,6 +366,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->lastsafelap); else if (fastcmp(field,"lastsafecheatcheck")) lua_pushinteger(L, plr->lastsafecheatcheck); + else if (fastcmp(field,"ignoreairtimeleniency")) + lua_pushinteger(L, plr->ignoreAirtimeLeniency); else if (fastcmp(field,"topaccel")) lua_pushinteger(L, plr->topAccel); else if (fastcmp(field,"instawhipcharge")) @@ -912,6 +914,8 @@ static int player_set(lua_State *L) plr->lastsafelap = luaL_checkinteger(L, 3); else if (fastcmp(field,"lastsafecheatcheck")) plr->lastsafecheatcheck = luaL_checkinteger(L, 3); + else if (fastcmp(field,"ignoreairtimeleniency")) + plr->ignoreAirtimeLeniency = luaL_checkinteger(L, 3); else if (fastcmp(field,"topaccel")) plr->topAccel = luaL_checkinteger(L, 3); else if (fastcmp(field,"instawhipcharge")) diff --git a/src/objects/shrink.c b/src/objects/shrink.c index ab2cba295..4a7350638 100644 --- a/src/objects/shrink.c +++ b/src/objects/shrink.c @@ -23,6 +23,7 @@ #include "../z_zone.h" #include "../k_waypoint.h" #include "../music.h" +#include "../m_easing.h" #define POHBEE_HOVER (128 << FRACBITS) #define POHBEE_SPEED (128 << FRACBITS) @@ -569,7 +570,11 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim) K_RemoveGrowShrink(victim->player); } - victim->player->growshrinktimer += 6*TICRATE; + UINT8 oldGrow = max(victim->player->growshrinktimer, 0); + fixed_t easePercent = min(oldGrow * 6*TICRATE / FRACUNIT, FRACUNIT); + victim->player->growshrinktimer += Easing_OutSine(easePercent, 6*TICRATE, 2*TICRATE); + if (!K_PlayerUsesBotMovement(victim->player)) + CONS_Printf("grow %d\n", victim->player->growshrinktimer); S_StartSound(victim, sfx_kc5a); if (victim->player->roundconditions.consecutive_grow_lasers < UINT8_MAX) diff --git a/src/p_saveg.c b/src/p_saveg.c index 7f53c0437..4dab0507b 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -587,6 +587,8 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT8(save->p, players[i].lastsafelap); WRITEUINT8(save->p, players[i].lastsafecheatcheck); + WRITEUINT8(save->p, players[i].ignoreAirtimeLeniency); + WRITEFIXED(save->p, players[i].topAccel); WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH); @@ -1183,6 +1185,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].lastsafelap = READUINT8(save->p); players[i].lastsafecheatcheck = READUINT8(save->p); + players[i].ignoreAirtimeLeniency = READUINT8(save->p); + players[i].topAccel = READFIXED(save->p); READMEM(save->p, players[i].public_key, PUBKEYLENGTH);