From 883522c17bef7b7b2a6fa6fe305c018704ce92e8 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy <86008856+GenericHeroGuy@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:06:23 +0100 Subject: [PATCH] Interp- I mean, uh, uncap battle animations --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 20 +++++++++++++------- src/p_user.c | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 4d61474fb..862298beb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -250,6 +250,7 @@ typedef enum k_lapanimation, // Used to show the lap start wing logo animation k_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down: k_cardanimation, // Used to determine the position of some full-screen Battle Mode graphics + k_oldcardanimation, // Used to interpolate full-screen Battle Mode graphics k_voices, // Used to stop the player saying more voices than it should k_tauntvoices, // Used to specifically stop taunt voice spam k_instashield, // Instashield no-damage animation timer diff --git a/src/dehacked.c b/src/dehacked.c index c42b191a4..7b1fba740 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7713,6 +7713,7 @@ static const char *const KARTSTUFF_LIST[] = { "LAPANIMATION", "LAPHAND", "CARDANIMATION", + "OLDCARDANIMATION", "VOICES", "TAUNTVOICES", "INSTASHIELD", diff --git a/src/k_kart.c b/src/k_kart.c index d00831b06..83c441395 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4969,6 +4969,8 @@ void K_KartPlayerHUDUpdate(player_t *player) if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) { + player->kartstuff[k_oldcardanimation] = player->kartstuff[k_cardanimation]; + if (player->exiting) { if (player->exiting < 6*TICRATE) @@ -9868,8 +9870,12 @@ static void K_drawKartFinish(void) static void K_drawBattleFullscreen(void) { + #define lerp(from, to) (from) + FixedMul(rendertimefrac, (to) - (from)) + INT32 cardanim = lerp(stplyr->kartstuff[k_oldcardanimation]<kartstuff[k_cardanimation]<kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen + INT32 y = (-64*FRACUNIT) + cardanim; // card animation goes from 0 to 164, 164 is the middle of the screen INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead fixed_t scale = FRACUNIT; boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. @@ -9881,11 +9887,11 @@ static void K_drawBattleFullscreen(void) { if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2)) { - y = 232-(stplyr->kartstuff[k_cardanimation]/2); + y = (232*FRACUNIT) - (cardanim/2); splitflags = V_SNAPTOBOTTOM; } else - y = -32+(stplyr->kartstuff[k_cardanimation]/2); + y = (-32*FRACUNIT) + (cardanim/2); if (splitscreen > 1) { @@ -9917,9 +9923,9 @@ static void K_drawBattleFullscreen(void) if (stplyr->exiting < 6*TICRATE && !stplyr->spectator) { if (stplyr->kartstuff[k_position] == 1) - V_DrawFixedPatch(x< 1) V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); diff --git a/src/p_user.c b/src/p_user.c index edf585626..0de0f4244 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1322,7 +1322,7 @@ void P_DoPlayerExit(player_t *player) player->powers[pw_underwater] = 0; player->powers[pw_spacetime] = 0; - player->kartstuff[k_cardanimation] = 0; // srb2kart: reset battle animation + player->kartstuff[k_cardanimation] = player->kartstuff[k_oldcardanimation] = 0; // srb2kart: reset battle animation if (player == &players[consoleplayer]) demo.savebutton = leveltime;