mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 03:51:50 +00:00
Stereo Mode: Fix multi-Track musicdefs not having their first part loop under non-Seq conditions
Had to introduce a hacky Music_SetFadeOut func, but I didn't want to rework this section of code/menu too heavily for how little time we have left
This commit is contained in:
parent
7db5094577
commit
57d5e54983
3 changed files with 39 additions and 7 deletions
|
|
@ -218,6 +218,23 @@ void Music_Play(const char* id)
|
|||
}
|
||||
}
|
||||
|
||||
void Music_SetFadeOut(const char* id, int fade_out)
|
||||
{
|
||||
Tune* tune = g_tunes.find(id);
|
||||
|
||||
if (tune)
|
||||
{
|
||||
tune->fade_out = fade_out;
|
||||
|
||||
if (tune->time_remaining() <= detail::msec_to_tics(tune->fade_out))
|
||||
{
|
||||
// If this action would cause a fade out, start
|
||||
// fading immediately.
|
||||
g_tunes.tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Music_DelayEnd(const char* id, tic_t duration)
|
||||
{
|
||||
Tune* tune = g_tunes.find(id);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ const char *Music_CurrentId(void);
|
|||
// back to the start.)
|
||||
void Music_Play(const char *id);
|
||||
|
||||
// Set fade out duration. Mostly to fix a last minute bug
|
||||
// with Stereo Mode.
|
||||
void Music_SetFadeOut(const char* id, int fade_out);
|
||||
|
||||
// Postpone the end of this tune until N tics from now. The
|
||||
// tune should already be playing before calling this.
|
||||
void Music_DelayEnd(const char *id, tic_t duration);
|
||||
|
|
|
|||
|
|
@ -1690,10 +1690,7 @@ const char *S_SoundTestTune(UINT8 invert)
|
|||
|
||||
boolean S_SoundTestCanSequenceFade(void)
|
||||
{
|
||||
return
|
||||
soundtest.current->basenoloop[soundtest.currenttrack] == false &&
|
||||
// Only fade out if we're the last track for this song.
|
||||
soundtest.currenttrack == soundtest.current->numtracks-1;
|
||||
return soundtest.current->basenoloop[soundtest.currenttrack] == false;
|
||||
}
|
||||
|
||||
static void S_SoundTestReconfigure(const char *tune)
|
||||
|
|
@ -1728,12 +1725,16 @@ void S_SoundTestPlay(void)
|
|||
}
|
||||
|
||||
// Does song have default loop?
|
||||
if (soundtest.current->basenoloop[soundtest.currenttrack] == false)
|
||||
if (S_SoundTestCanSequenceFade() == true)
|
||||
{
|
||||
// I'd personally like songs in sequence to last between 3 and 6 minutes.
|
||||
if (sequencemaxtime < 3*60*1000)
|
||||
{
|
||||
// I'd personally like songs in sequence to last between 3 and 6 minutes.
|
||||
const UINT32 loopduration = (sequencemaxtime - I_GetSongLoopPoint());
|
||||
const UINT32 looppoint = I_GetSongLoopPoint();
|
||||
const UINT32 loopduration =
|
||||
(looppoint < sequencemaxtime)
|
||||
? sequencemaxtime - looppoint
|
||||
: 0;
|
||||
|
||||
if (!loopduration)
|
||||
;
|
||||
|
|
@ -1745,6 +1746,16 @@ void S_SoundTestPlay(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Only the last track fades out... but we still use stereo_fade to handle stopping.
|
||||
if (soundtest.currenttrack == soundtest.current->numtracks-1)
|
||||
{
|
||||
Music_SetFadeOut("stereo_fade", 5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
Music_SetFadeOut("stereo_fade", 0);
|
||||
}
|
||||
|
||||
Music_DelayEnd(
|
||||
S_SoundTestCanSequenceFade() ? "stereo_fade" : "stereo",
|
||||
(TICRATE*sequencemaxtime)/1000 // ms to TICRATE conversion
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue