From 4369917912463f3d6191afa2360bae951515fdb5 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 22:38:43 -0400 Subject: [PATCH 1/3] Fix offsets, add colormapping --- src/k_kart.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ee59566f..453b0be8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7376,41 +7376,48 @@ static void K_drawLapStartAnim(void) { // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; + UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); - V_DrawScaledPatch(BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)), - 56 - (32*max(0, progress-76)), - 0, kp_lapanim_emblem); + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_emblem, colormap); if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { - V_DrawScaledPatch(27 - (32*max(0, progress-76)), - 32, - 0, kp_lapanim_final[min(progress/2, 10)]); + V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_final[min(progress/2, 10)], NULL); if (progress/2-12 >= 0) { - V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_lap[min(progress/2-12, 6)]); + V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_lap[min(progress/2-12, 6)], NULL); } } else { - V_DrawScaledPatch(61 - (32*max(0, progress-76)), - 32, - 0, kp_lapanim_lap[min(progress/2, 6)]); + V_DrawFixedPatch((82 - (32*max(0, progress-76)))*FRACUNIT, // 61 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_lap[min(progress/2, 6)], NULL); if (progress/2-8 >= 0) { - V_DrawScaledPatch(194 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)]); + V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)], NULL); if (progress/2-10 >= 0) { - V_DrawScaledPatch(221 + (32*max(0, progress-76)), - 32, - 0, kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)]); + V_DrawFixedPatch((208 + (32*max(0, progress-76)))*FRACUNIT, // 221 + (-6)*FRACUNIT, // 24 + FRACUNIT, V_HUDTRANS, + kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)], NULL); } } } From 6c557407d51493dea993354689ef4857d3877a99 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 31 Oct 2018 23:10:38 -0400 Subject: [PATCH 2/3] Added judging hands (if'd out) --- src/k_kart.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 453b0be8..78b92a9f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5577,6 +5577,9 @@ static patch_t *kp_lapanim_lap[7]; static patch_t *kp_lapanim_final[11]; static patch_t *kp_lapanim_number[10][3]; static patch_t *kp_lapanim_emblem; +#if 0 +static patch_t *kp_lapanim_hand[3]; +#endif void K_LoadKartHUDGraphics(void) { @@ -5796,6 +5799,15 @@ void K_LoadKartHUDGraphics(void) } kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); + +#if 0 + sprintf(buffer, "K_LAPH0x"); + for (i = 0; i < 3; i++) + { + buffer[7] = '0'+(i+1); + kp_lapanim_hand[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } +#endif } // For the item toggle menu @@ -7377,12 +7389,28 @@ static void K_drawLapStartAnim(void) // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); +#if 0 + UINT8 h = 1; + + if (stplyr->kartstuff[k_position] == 1) + h = 0; + else if (K_IsPlayerLosing(stplyr)) + h = 2; +#endif V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, (48 - (32*max(0, progress-76)))*FRACUNIT, FRACUNIT, V_HUDTRANS, kp_lapanim_emblem, colormap); +#if 0 + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)) + + 4 - abs((leveltime % 8) - 4))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_hand[h], NULL); +#endif + if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27 From 7e9300c4201cd7aeaf37790e40e964bf2d2908a3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Nov 2018 16:15:25 -0400 Subject: [PATCH 3/3] Lap hands touch-up --- src/d_player.h | 1 + src/dehacked.c | 1 + src/k_kart.c | 27 ++++++++------------------- src/p_spec.c | 37 ++++++++++++++++++++++++++++--------- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 866589df..f06a7313 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -280,6 +280,7 @@ typedef enum k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir") 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_voices, // Used to stop the player saying more voices than it should k_tauntvoices, // Used to specifically stop taunt voice spam diff --git a/src/dehacked.c b/src/dehacked.c index 77663ccd..3545e055 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7867,6 +7867,7 @@ static const char *const KARTSTUFF_LIST[] = { "THROWDIR", "LAPANIMATION", + "LAPHAND", "CARDANIMATION", "VOICES", "TAUNTVOICES", diff --git a/src/k_kart.c b/src/k_kart.c index 78b92a9f..9af07ec8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5577,9 +5577,7 @@ static patch_t *kp_lapanim_lap[7]; static patch_t *kp_lapanim_final[11]; static patch_t *kp_lapanim_number[10][3]; static patch_t *kp_lapanim_emblem; -#if 0 static patch_t *kp_lapanim_hand[3]; -#endif void K_LoadKartHUDGraphics(void) { @@ -5800,14 +5798,12 @@ void K_LoadKartHUDGraphics(void) kp_lapanim_emblem = (patch_t *) W_CachePatchName("K_LAPE00", PU_HUDGFX); -#if 0 sprintf(buffer, "K_LAPH0x"); for (i = 0; i < 3; i++) { buffer[7] = '0'+(i+1); kp_lapanim_hand[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } -#endif } // For the item toggle menu @@ -7389,27 +7385,20 @@ static void K_drawLapStartAnim(void) // This is an EVEN MORE insanely complicated animation. const UINT8 progress = 80-stplyr->kartstuff[k_lapanimation]; UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); -#if 0 - UINT8 h = 1; - - if (stplyr->kartstuff[k_position] == 1) - h = 0; - else if (K_IsPlayerLosing(stplyr)) - h = 2; -#endif V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, (48 - (32*max(0, progress-76)))*FRACUNIT, FRACUNIT, V_HUDTRANS, kp_lapanim_emblem, colormap); -#if 0 - V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, - (48 - (32*max(0, progress-76)) - + 4 - abs((leveltime % 8) - 4))*FRACUNIT, - FRACUNIT, V_HUDTRANS, - kp_lapanim_hand[h], NULL); -#endif + if (stplyr->kartstuff[k_laphand] >= 1 && stplyr->kartstuff[k_laphand] <= 3) + { + V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, + (48 - (32*max(0, progress-76)) + + 4 - abs((leveltime % 8) - 4))*FRACUNIT, + FRACUNIT, V_HUDTRANS, + kp_lapanim_hand[stplyr->kartstuff[k_laphand]-1], NULL); + } if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { diff --git a/src/p_spec.c b/src/p_spec.c index 76ed73aa..9f18fdc7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4196,7 +4196,34 @@ DoneSection2: { if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { + UINT8 i; + UINT8 nump = 0; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator) + continue; + nump++; + } + player->laps++; + + // Set up lap animation vars + if (nump > 1) + { + if (K_IsPlayerLosing(player)) + player->kartstuff[k_laphand] = 3; + else + { + if (nump > 2 && player->kartstuff[k_position] == 1) // 1st place in 1v1 uses thumbs up + player->kartstuff[k_laphand] = 1; + else + player->kartstuff[k_laphand] = 2; + } + } + else + player->kartstuff[k_laphand] = 0; // No hands in FREE PLAY + player->kartstuff[k_lapanimation] = 80; if (player->pflags & PF_NIGHTSMODE) @@ -4237,15 +4264,7 @@ DoneSection2: // Figure out how many are playing on the last lap, to prevent spectate griefing if (!nospectategrief && player->laps >= (UINT8)(cv_numlaps.value - 1)) - { - UINT8 i; - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator) - continue; - nospectategrief++; - } - } + nospectategrief = nump; } else if (player->starpostnum) {