change how keepmusic works

compare map and encore instead of the music itself
This commit is contained in:
Alug committed 2024-09-30 11:45:33 +02:00
1 parent f8083e10eb
commit 95cdc2c5a6
3 files changed
+43 -7

No files matched your search

+1
View File
@@ -4267,6 +4267,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
else
{
LUAh_MapChange(gamemap);
S_KeepMusic();
G_DoLoadLevel(resetplayer);
}
+40 -7
View File
@@ -1946,8 +1946,7 @@ boolean S_FadeOutStopMusic(UINT32 ms)
return I_FadeSong(0, ms, &S_StopMusic);
}
static boolean S_KeepMusic(const char *mapmusicname)
/*static boolean S_KeepMusic(void)
{
//if (!cv_keepmusic.value)
//return false;
@@ -1955,16 +1954,50 @@ static boolean S_KeepMusic(const char *mapmusicname)
// should i compare songs or maps?
static char oldmusname[7] = "";
if (strcmp(music_name, mapmusicname) != 0)
if (strcmp(music_name, mapmusname) != 0)
return false;
if (strcmp(oldmusname, mapmusicname) == 0)
if (strcmp(oldmusname, mapmusname) == 0)
return true;
strncpy(oldmusname, mapmusicname, 7);
strncpy(oldmusname, mapmusname, 7);
oldmusname[6] = '\0';
return false;
}*/
static INT16 oldmap = 0;
static INT32 oldencore = 0;
static boolean keepmusic = false;
void S_KeepMusic(void)
{
//if (!cv_keepmusic.value)
//return false;
//this one compares map and encoremode instead of the music itself
//makes tunes work and stuff
keepmusic = false;
//dont keep the intro "sound" lmao
if (strcmp(music_name, (encoremode ? "estart" : "kstart")) == 0)
return;
if (oldencore != cv_kartencore.value)
{
oldencore = cv_kartencore.value;
return;
}
// we on the same map? keep it
if (oldmap == gamemap)
{
keepmusic = true;
return;
}
oldmap = gamemap;
}
/// ------------------------
@@ -1987,7 +2020,7 @@ void S_Start(void)
mapmusresume = 0;
}
if (S_KeepMusic(mapmusname))
if (keepmusic)
return;
/*if (cv_skipintromusic.value)
@@ -2022,7 +2055,7 @@ void M_Start(void)
return;
}*/
if (S_KeepMusic(mapmusname))
if (keepmusic)
return;
// The GO! sound stops the level start ambience
+2
View File
@@ -103,6 +103,8 @@ void S_ClearSfx(void);
void S_Start(void);
void M_Start(void);
void S_KeepMusic(void);
// Stops music and restarts it from same position. Used for instant applying changes to amiga filters.
void S_RestartMusic(void);