From f749424de76eee886f3f55b030c4745b260f63fa Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 14 Feb 2022 15:04:30 -0800 Subject: [PATCH 1/5] Turn kstart into sfx --- src/p_user.c | 7 ++++++- src/s_sound.c | 7 ++++++- src/sounds.c | 1 + src/sounds.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1e1269751..e65eb6fb2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -805,7 +805,12 @@ void P_RestoreMusic(player_t *player) // Event - Level Start if (leveltime < (starttime + (TICRATE/2))) - S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic(); + { + if (encoremode) + S_ChangeMusicInternal("estart", false); //S_StopMusic(); + else + S_StartSound(NULL, sfx_kstart); + } else // see also where time overs are handled - search for "lives = 2" in this file { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow diff --git a/src/s_sound.c b/src/s_sound.c index ac66a5777..3e416a883 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2351,7 +2351,12 @@ void S_StartEx(boolean reset) S_StopMusic(); // Starting ambience should always be restarted, if playing. if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart - S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0); + { + if (encoremode) + S_ChangeMusicEx("estart", 0, false, mapmusposition, 0, 0); + else + S_StartSound(NULL, sfx_kstart); + } else S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); diff --git a/src/sounds.c b/src/sounds.c index e9a13da77..58e8f2afe 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1099,6 +1099,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Debug notification {"cock", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Hammer cocks, bang bang {"itcaps", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, "Item capsule"}, + {"kstart", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // Sonic Adventure shwing! // SRB2Kart - Engine sounds // Engine class A diff --git a/src/sounds.h b/src/sounds.h index 9abf99117..4093fec7b 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -1163,6 +1163,7 @@ typedef enum sfx_dbgsal, sfx_cock, sfx_itcaps, + sfx_kstart, // Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy... // Engine class A - Low Speed, Low Weight From 418156bebf6da16fd8a423938a960ae18e707294 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 15 Feb 2022 14:19:10 -0800 Subject: [PATCH 2/5] Use float value for LOOPMS Extra precision. --- src/sdl/mixer_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 4a135c136..d50bb49b5 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1227,7 +1227,7 @@ boolean I_LoadSong(char *data, size_t len) else if (!strncmp(p, key3, key3len)) // is it LOOPMS=? { p += key3len; // skip MS= - loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds. + loop_point = atof(p) / 1000.f; // LOOPMS works by real time, as miliseconds. // Everything that uses LOOPMS will work perfectly with SDL_Mixer. } } From 62b5f9c90f716897a893e569506daee4f0ef580d Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 15 Feb 2022 15:38:11 -0800 Subject: [PATCH 3/5] Leave introtime at 3 for 1v1 Preticker uses up a few tics, so setting it to 0 makes it useless. --- src/k_kart.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 99f2b1cac..28814bafa 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -81,11 +81,9 @@ void K_TimerInit(void) rainbowstartavailable = false; } - if (numPlayers <= 2) - { - introtime = 0; // No intro in Record Attack / 1v1 - } - else + // No intro in Record Attack / 1v1 + // Leave unset for the value in K_TimerReset + if (numPlayers > 2) { introtime = (108) + 5; // 108 for rotation, + 5 for white fade } From 9095261a1844d0f23d3a6f862cc91f0ae44b4dbe Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 15 Feb 2022 15:49:49 -0800 Subject: [PATCH 4/5] POSITION music Play SA2 "shwing" at title card; play POSITION music once camera is steady (instantly in 1v1). Encore: play portal warp sound instead of "shwing"; play portal drone instead of POSITION music, always start instantly. --- src/p_tick.c | 13 +++++++++++++ src/p_user.c | 9 +-------- src/s_sound.c | 7 +------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 69641d6be..22a090fba 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -617,6 +617,19 @@ void P_Ticker(boolean run) S_ShowMusicCredit(); } + if (encoremode) + { + // Encore humming starts immediately. + if (leveltime == 3) + S_ChangeMusicInternal("encore", true); + } + else + { + // Plays the POSITION music after the camera spin + if (leveltime == introtime) + S_ChangeMusicInternal("postn", true); + } + ps_lua_thinkframe_time = I_GetPreciseTime(); LUAh_ThinkFrame(); ps_lua_thinkframe_time = I_GetPreciseTime() - ps_lua_thinkframe_time; diff --git a/src/p_user.c b/src/p_user.c index e65eb6fb2..3b7382392 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -804,14 +804,7 @@ void P_RestoreMusic(player_t *player) return; // Event - Level Start - if (leveltime < (starttime + (TICRATE/2))) - { - if (encoremode) - S_ChangeMusicInternal("estart", false); //S_StopMusic(); - else - S_StartSound(NULL, sfx_kstart); - } - else // see also where time overs are handled - search for "lives = 2" in this file + if (leveltime >= (starttime + (TICRATE/2))) // see also where time overs are handled - search for "lives = 2" in this file { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow diff --git a/src/s_sound.c b/src/s_sound.c index 3e416a883..4a224ec6f 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2351,12 +2351,7 @@ void S_StartEx(boolean reset) S_StopMusic(); // Starting ambience should always be restarted, if playing. if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart - { - if (encoremode) - S_ChangeMusicEx("estart", 0, false, mapmusposition, 0, 0); - else - S_StartSound(NULL, sfx_kstart); - } + S_StartSound(NULL, encoremode ? sfx_ruby2 : sfx_kstart); else S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); From e28e67f84df5fff8fc520258f143a5f9f13c4a61 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 15 Feb 2022 15:49:21 -0800 Subject: [PATCH 5/5] Fade out POSITION music at 3 2 1 --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 28814bafa..bf63ad04e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9673,11 +9673,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) S_StartSound(NULL, sfx_s3ka7); - if (leveltime == starttime) - { + + if (leveltime == starttime-(3*TICRATE)) + S_FadeOutStopMusic(3500); + else if (leveltime == starttime) S_StartSound(NULL, sfx_s3kad); - S_StopMusic(); // The GO! sound stops the level start ambience - } } }