add some basics of what i wanna have for music stuff

- basic keepmusic implementation (currently checks for if the song changes instead of the map, idk if i keep this, since this allows certain maps to change the music on start, ex abstract avenue or wandering balls)
- Toggle to ignore any kind of music change during the level (includes intermission music, depends on how custom intermission music works)
-toggle to start map music instantly on levelload and skip the intro fanfare (also skips any linedef executed sound so some map intros dont interfere with this)
This commit is contained in:
Alug committed 2024-09-30 06:28:02 +02:00
1 parent fae42eecbc
commit ef58f61d8e
3 files changed
+58 -1

No files matched your search

+7
View File
@@ -2127,6 +2127,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 413: // Change music
//if (ignoremusicchanges)
//return;
// console player only unless NOCLIMB is set
if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)))
{
@@ -2209,6 +2212,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
INT32 sfxnum;
//dont play any funky sound intros that may interfere with the music
//if (cv_skipintromusic.value && (leveltime < (starttime + (TICRATE/2))))
//return;
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
if (sfxnum == sfx_None)
+3
View File
@@ -611,6 +611,9 @@ boolean P_EndingMusic(player_t *player)
INT32 bestlocalpos;
player_t *bestlocalplayer;
//if (!ignoremusicchanges)
//return false;
if (!P_IsLocalPlayer(player)) // Only applies to a local player
return false;
+48 -1
View File
@@ -1946,6 +1946,28 @@ boolean S_FadeOutStopMusic(UINT32 ms)
return I_FadeSong(0, ms, &S_StopMusic);
}
static boolean S_KeepMusic(const char *mapmusicname)
{
//if (!cv_keepmusic.value)
//return false;
// should i compare songs or maps?
// comparing songs makes this alot easier honestly
static char oldmusname[7] = "";
if (strcmp(music_name, mapmusicname) != 0)
return false;
if (strcmp(oldmusname, mapmusicname) == 0)
return true;
strncpy(oldmusname, mapmusicname, 7);
oldmusname[6] = '\0';
return false;
}
/// ------------------------
/// Init & Others
/// ------------------------
@@ -1966,6 +1988,16 @@ void S_Start(void)
mapmusresume = 0;
}
if (S_KeepMusic(mapmusname))
return;
/*if (cv_skipintromusic.value)
{
S_StopMusic();
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
return;
}*/
S_StopMusic();
if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart
@@ -1975,7 +2007,21 @@ void S_Start(void)
void M_Start(void)
{
if (leveltime > (starttime + (TICRATE/2)))
// need to be after race starts so "certain" maps don´t break Zzz...
//ignoremusicchanges = cv_ignoremusicchanges.value && (leveltime > (starttime + (TICRATE/2)));
//no need to constantly run this after race has started
//but let it run atleast half a tic after map music started to let shit update lmao
if (leveltime > (starttime + TICRATE))
return;
/*if (cv_skipintromusic.value && leveltime == (starttime + (TICRATE/2)))
{
S_ShowMusicCredit();
return;
}*/
if (S_KeepMusic(mapmusname))
return;
// The GO! sound stops the level start ambience
@@ -1990,6 +2036,7 @@ void M_Start(void)
}
}
void S_RestartMusic(void)
{
S_StopMusic();