From 1999cf05099595e23186163e3ab8364e22feb756 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 26 Nov 2022 22:25:15 +0000 Subject: [PATCH 1/2] Rank num SFX tweak - Add new sounds at various pitches depending on position - Don't play sound if a pass has just happened --- src/k_kart.c | 11 +++++++++-- src/sounds.c | 18 ++++++++++++++++++ src/sounds.h | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 033f4e3ed..84bcc72be 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9916,10 +9916,17 @@ void K_KartUpdatePosition(player_t *player) if (position != oldposition) // Changed places? { - if (position < oldposition && P_IsDisplayPlayer(player) == true) + if (player->positiondelay <= 0 && position < oldposition && P_IsDisplayPlayer(player) == true) { // Play sound when getting closer to 1st. - S_StartSound(player->mo, sfx_mbs41); + UINT32 soundpos = (max(0, position - 1) * MAXPLAYERS)/realplayers; // always 1-15 despite there being 16 players at max... +#if MAXPLAYERS > 16 + if (soundpos < 15) + { + soundpos = 15; + } +#endif + S_StartSound(player->mo, sfx_pass02 + soundpos); // ...which is why we can start at index 2 for a lower general pitch } player->positiondelay = POS_DELAY_TIME + 4; // Position number growth diff --git a/src/sounds.c b/src/sounds.c index e10adc82c..f50e94942 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1130,6 +1130,24 @@ sfxinfo_t S_sfx[NUMSFX] = {"gate04", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"gate05", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + // Passing sounds + {"pass01", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass02", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass03", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass04", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass05", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass06", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass07", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass08", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass09", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass10", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass11", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass12", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass13", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass14", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass15", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + {"pass16", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, + // SRB2Kart - Engine sounds // Engine class A {"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR, ""}, diff --git a/src/sounds.h b/src/sounds.h index 5194d1114..fe4427048 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1195,6 +1195,24 @@ typedef enum sfx_gate04, sfx_gate05, + // Passing sounds + sfx_pass01, + sfx_pass02, + sfx_pass03, + sfx_pass04, + sfx_pass05, + sfx_pass06, + sfx_pass07, + sfx_pass08, + sfx_pass09, + sfx_pass10, + sfx_pass11, + sfx_pass12, + sfx_pass13, + sfx_pass14, + sfx_pass15, + sfx_pass16, + // Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy... // Engine class A - Low Speed, Low Weight sfx_krta00, From b1adc3d27c5ff8fdb4dfc06fc413d06ab1c36d16 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 26 Nov 2022 22:39:27 +0000 Subject: [PATCH 2/2] Fix chunky gap between Kart position numbers There's still a big gap but that's a graphics lump size issue, code wouldn't solve it --- src/k_hud.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index d9908c4c6..40f98323e 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1574,8 +1574,8 @@ static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fi overlayFlags[1] = V_SUBTRACT; } - w = kp_positionnum[num][0][splitIndex]->width * scale; - h = kp_positionnum[num][0][splitIndex]->height * scale; + w = SHORT(kp_positionnum[num][0][splitIndex]->width) * scale; + h = SHORT(kp_positionnum[num][0][splitIndex]->height) * scale; if (flags & V_SNAPTORIGHT) { @@ -1597,7 +1597,12 @@ static fixed_t K_DrawKartPositionNumPatch(UINT8 num, UINT8 *color, fixed_t x, fi ); } - return (x - w); + if (!(flags & V_SNAPTORIGHT)) + { + x -= w; + } + + return x; } static void K_DrawKartPositionNum(INT32 num)