mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-10 16:52:16 +00:00
Merge branch 'no-position-no-music-reset' into 'master'
Do not reset music in Sealed Stars and Tutorials See merge request KartKrew/Kart!1676
This commit is contained in:
commit
6378c9d544
7 changed files with 57 additions and 15 deletions
|
|
@ -3065,7 +3065,7 @@ static gametype_t defaultgametypes[] =
|
|||
{
|
||||
"Special",
|
||||
"GT_SPECIAL",
|
||||
GTR_CATCHER|GTR_SPECIALSTART|GTR_ROLLINGSTART|GTR_CIRCUIT,
|
||||
GTR_CATCHER|GTR_SPECIALSTART|GTR_ROLLINGSTART|GTR_CIRCUIT|GTR_NOPOSITION,
|
||||
TOL_SPECIAL,
|
||||
int_time,
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,12 @@ void Music_Init(void)
|
|||
tune.nightcoreable = true;
|
||||
}
|
||||
|
||||
{
|
||||
Tune& tune = g_tunes.insert("level_nosync", g_tunes.find("level"));
|
||||
|
||||
tune.sync = false;
|
||||
}
|
||||
|
||||
{
|
||||
Tune& tune = g_tunes.insert("position");
|
||||
|
||||
|
|
@ -133,9 +139,9 @@ void Music_Init(void)
|
|||
}
|
||||
|
||||
{
|
||||
Tune& tune = g_tunes.insert("menu_nocred");
|
||||
Tune& tune = g_tunes.insert("menu_nocred", g_tunes.find("menu"));
|
||||
|
||||
tune.priority = 100;
|
||||
tune.credit = false;
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -165,14 +171,10 @@ void Music_Init(void)
|
|||
}
|
||||
|
||||
{
|
||||
Tune& tune = g_tunes.insert("stereo_fade");
|
||||
Tune& tune = g_tunes.insert("stereo_fade", g_tunes.find("stereo"));
|
||||
|
||||
tune.priority = 1000;
|
||||
tune.fade_out = 5000;
|
||||
tune.fade_out_inclusive = false;
|
||||
tune.resist = true;
|
||||
tune.keep_open = true;
|
||||
tune.credit = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -350,3 +352,13 @@ const char* Music_CurrentId(void)
|
|||
{
|
||||
return g_tunes.current_id();
|
||||
}
|
||||
|
||||
void Music_BatchExempt(const char* id)
|
||||
{
|
||||
Tune* tune = g_tunes.find(id);
|
||||
|
||||
if (tune)
|
||||
{
|
||||
tune->resist_once = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,10 @@ void Music_Remap(const char *id, const char *song);
|
|||
// Set whether a tune should loop.
|
||||
void Music_Loop(const char *id, boolean loop);
|
||||
|
||||
// Temporarily exemplify a tune from batch operations, such
|
||||
// as Music_StopAll.
|
||||
void Music_BatchExempt(const char *id);
|
||||
|
||||
|
||||
//
|
||||
// Query properties.
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ public:
|
|||
return it != map_.end() ? const_cast<Tune*>(&it->second) : nullptr;
|
||||
}
|
||||
|
||||
Tune& insert(const char* id)
|
||||
Tune& insert(const char* id, const Tune* original = nullptr)
|
||||
{
|
||||
auto res = map_.emplace(id, Tune{});
|
||||
auto res = map_.emplace(id, original ? *original : Tune{});
|
||||
|
||||
SRB2_ASSERT(res.second);
|
||||
|
||||
|
|
@ -73,6 +73,12 @@ public:
|
|||
{
|
||||
for (auto& [_, tune] : map_)
|
||||
{
|
||||
if (tune.resist_once)
|
||||
{
|
||||
tune.resist_once = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tune.resist)
|
||||
{
|
||||
f(tune);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public:
|
|||
// from TuneManager::stop_all etc. It must be
|
||||
// stopped/paused individually.
|
||||
bool resist = false;
|
||||
bool resist_once = false; // set at runtime
|
||||
|
||||
// This tune shows a credit when first played (not
|
||||
// resumed).
|
||||
|
|
|
|||
|
|
@ -8110,11 +8110,26 @@ void P_ResetLevelMusic(void)
|
|||
|
||||
void P_LoadLevelMusic(void)
|
||||
{
|
||||
tic_t level_music_start = starttime + (TICRATE/2);
|
||||
const char *music = mapheaderinfo[gamemap-1]->musname[mapmusrng];
|
||||
|
||||
Music_StopAll();
|
||||
Music_Remap("level", mapheaderinfo[gamemap-1]->musname[mapmusrng]);
|
||||
Music_Seek("level", max(leveltime, level_music_start) - level_music_start);
|
||||
if (gametyperules & GTR_NOPOSITION)
|
||||
{
|
||||
if (!stricmp(Music_Song("level_nosync"), music))
|
||||
{
|
||||
// Do not reset music if it is the same
|
||||
Music_BatchExempt("level_nosync");
|
||||
}
|
||||
Music_StopAll();
|
||||
Music_Remap("level_nosync", music);
|
||||
}
|
||||
else
|
||||
{
|
||||
Music_StopAll();
|
||||
Music_Remap("level", music);
|
||||
|
||||
tic_t level_music_start = starttime + (TICRATE/2);
|
||||
Music_Seek("level", max(leveltime, level_music_start) - level_music_start);
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads a level from a lump or external wad.
|
||||
|
|
|
|||
|
|
@ -975,7 +975,11 @@ void P_Ticker(boolean run)
|
|||
if (leveltime == (starttime + (TICRATE/2)))
|
||||
{
|
||||
// Plays the music after the starting countdown.
|
||||
Music_Play("level");
|
||||
if (!Music_Playing("level_nosync"))
|
||||
{
|
||||
// Do not stop level_nosync
|
||||
Music_Play(Music_Song("level_nosync")[0] ? "level_nosync" : "level");
|
||||
}
|
||||
}
|
||||
else if (starttime != introtime)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue