mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Fix support for .def defined highres music replacements
git-svn-id: https://svn.eduke32.com/eduke32@1475 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c9c02c2773
commit
796919268c
5 changed files with 37 additions and 28 deletions
|
@ -1048,7 +1048,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
int32_t partime, designertime;
|
||||
char *name, *filename, *musicfn, *musicfn1;
|
||||
char *name, *filename, *musicfn, *alt_musicfn;
|
||||
mapstate_t *savedstate;
|
||||
} map_t;
|
||||
|
||||
|
|
|
@ -8416,7 +8416,7 @@ static void G_HandleLocalKeys(void)
|
|||
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
|
||||
{
|
||||
if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex))
|
||||
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn1[0]);
|
||||
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
|
||||
else
|
||||
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
|
||||
P_DoQuote(26,g_player[myconnectindex].ps);
|
||||
|
@ -8636,8 +8636,8 @@ FAKE_F3:
|
|||
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
|
||||
{
|
||||
KB_ClearKeyDown(sc_F5);
|
||||
if (MapInfo[(uint8_t)g_musicIndex].musicfn1 != NULL)
|
||||
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].musicfn1[0]);
|
||||
if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL)
|
||||
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
|
||||
else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
|
||||
|
@ -9166,9 +9166,9 @@ static int32_t AL_DefineMusic(char *ID,char *name)
|
|||
ID=MapInfo[sel].musicfn;
|
||||
}
|
||||
|
||||
MapInfo[sel].musicfn1=makename(MapInfo[sel].musicfn1,name,ID);
|
||||
MapInfo[sel].alt_musicfn=makename(MapInfo[sel].alt_musicfn,name,ID);
|
||||
// initprintf("%-15s | ",ID);
|
||||
// initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].musicfn1);
|
||||
// initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn);
|
||||
// S_PlayMusic(ID,sel);
|
||||
return 0;
|
||||
}
|
||||
|
@ -10187,7 +10187,7 @@ static void G_FreeMemory(void)
|
|||
if (MapInfo[i].name != NULL) Bfree(MapInfo[i].name);
|
||||
if (MapInfo[i].filename != NULL) Bfree(MapInfo[i].filename);
|
||||
if (MapInfo[i].musicfn != NULL) Bfree(MapInfo[i].musicfn);
|
||||
if (MapInfo[i].musicfn1 != NULL) Bfree(MapInfo[i].musicfn1);
|
||||
if (MapInfo[i].alt_musicfn != NULL) Bfree(MapInfo[i].alt_musicfn);
|
||||
if (MapInfo[i].savedstate != NULL) G_FreeMapState(i);
|
||||
}
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@ void G_CacheMapData(void)
|
|||
return;
|
||||
|
||||
S_PauseMusic(1);
|
||||
if (MapInfo[MAXVOLUMES*MAXLEVELS+2].musicfn1)
|
||||
if (MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn)
|
||||
{
|
||||
S_StopMusic();
|
||||
S_PlayMusic(&EnvMusicFilename[2][0],MAXVOLUMES*MAXLEVELS+2); // loadmus
|
||||
|
@ -1770,16 +1770,16 @@ int32_t G_EnterLevel(int32_t g)
|
|||
if (fil > -1)
|
||||
{
|
||||
kclose(fil);
|
||||
if (MapInfo[ud.m_level_number].musicfn1 == NULL)
|
||||
MapInfo[ud.m_level_number].musicfn1 = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
||||
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.m_level_number].musicfn1))
|
||||
MapInfo[ud.m_level_number].musicfn1 = Brealloc(MapInfo[ud.m_level_number].musicfn1,(Bstrlen(levname)+1));
|
||||
Bstrcpy(MapInfo[ud.m_level_number].musicfn1,levname);
|
||||
if (MapInfo[ud.m_level_number].alt_musicfn == NULL)
|
||||
MapInfo[ud.m_level_number].alt_musicfn = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
||||
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.m_level_number].alt_musicfn))
|
||||
MapInfo[ud.m_level_number].alt_musicfn = Brealloc(MapInfo[ud.m_level_number].alt_musicfn,(Bstrlen(levname)+1));
|
||||
Bstrcpy(MapInfo[ud.m_level_number].alt_musicfn,levname);
|
||||
}
|
||||
else if (MapInfo[ud.m_level_number].musicfn1 != NULL)
|
||||
else if (MapInfo[ud.m_level_number].alt_musicfn != NULL)
|
||||
{
|
||||
Bfree(MapInfo[ud.m_level_number].musicfn1);
|
||||
MapInfo[ud.m_level_number].musicfn1 = NULL;
|
||||
Bfree(MapInfo[ud.m_level_number].alt_musicfn);
|
||||
MapInfo[ud.m_level_number].alt_musicfn = NULL;
|
||||
}
|
||||
|
||||
p[1]='m';
|
||||
|
|
|
@ -458,16 +458,16 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
if (fil > -1)
|
||||
{
|
||||
kclose(fil);
|
||||
if (MapInfo[ud.level_number].musicfn1 == NULL)
|
||||
MapInfo[ud.level_number].musicfn1 = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
||||
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.level_number].musicfn1))
|
||||
MapInfo[ud.level_number].musicfn1 = Brealloc(MapInfo[ud.level_number].musicfn1,(Bstrlen(levname)+1));
|
||||
Bstrcpy(MapInfo[ud.level_number].musicfn1,levname);
|
||||
if (MapInfo[ud.level_number].alt_musicfn == NULL)
|
||||
MapInfo[ud.level_number].alt_musicfn = Bcalloc(Bstrlen(levname)+1,sizeof(uint8_t));
|
||||
else if ((Bstrlen(levname)+1) > sizeof(MapInfo[ud.level_number].alt_musicfn))
|
||||
MapInfo[ud.level_number].alt_musicfn = Brealloc(MapInfo[ud.level_number].alt_musicfn,(Bstrlen(levname)+1));
|
||||
Bstrcpy(MapInfo[ud.level_number].alt_musicfn,levname);
|
||||
}
|
||||
else if (MapInfo[ud.level_number].musicfn1 != NULL)
|
||||
else if (MapInfo[ud.level_number].alt_musicfn != NULL)
|
||||
{
|
||||
Bfree(MapInfo[ud.level_number].musicfn1);
|
||||
MapInfo[ud.level_number].musicfn1 = NULL;
|
||||
Bfree(MapInfo[ud.level_number].alt_musicfn);
|
||||
MapInfo[ud.level_number].alt_musicfn = NULL;
|
||||
}
|
||||
|
||||
p[1]='m';
|
||||
|
@ -488,7 +488,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
Bstrcpy(MapInfo[ud.level_number].musicfn,levname);
|
||||
}
|
||||
|
||||
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL && (i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].musicfn1))
|
||||
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL && (i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn))
|
||||
{
|
||||
S_StopMusic();
|
||||
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex);
|
||||
|
|
|
@ -293,8 +293,8 @@ void _playmusic(const char *fn)
|
|||
int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
||||
{
|
||||
g_musicSize=0;
|
||||
if (MapInfo[sel].musicfn1 != NULL)
|
||||
_playmusic(MapInfo[sel].musicfn1);
|
||||
if (MapInfo[sel].alt_musicfn != NULL)
|
||||
_playmusic(MapInfo[sel].alt_musicfn);
|
||||
if (!g_musicSize)
|
||||
{
|
||||
_playmusic(fn);
|
||||
|
@ -306,12 +306,18 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
|
||||
int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
||||
{
|
||||
char *ofn = (char *)fn;
|
||||
int32_t fp;
|
||||
char * testfn, * extension;
|
||||
int32_t alt = 0;
|
||||
|
||||
if (ud.config.MusicToggle == 0) return 0;
|
||||
if (ud.config.MusicDevice < 0) return 0;
|
||||
|
||||
if (MapInfo[sel].alt_musicfn != NULL)
|
||||
alt = (int32_t)(fn = MapInfo[sel].alt_musicfn);
|
||||
|
||||
|
||||
testfn = (char *) malloc(strlen(fn) + 5);
|
||||
strcpy(testfn, fn);
|
||||
extension = strrchr(testfn, '.');
|
||||
|
@ -335,6 +341,9 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
|
||||
// just use what we've been given
|
||||
fp = kopen4loadfrommod((char *)fn, 0);
|
||||
|
||||
if (alt && fp < 0)
|
||||
fp = kopen4loadfrommod(ofn, 0);
|
||||
}
|
||||
while (0);
|
||||
|
||||
|
@ -359,7 +368,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
FX_MUSIC_PRIORITY, MUSIC_ID);
|
||||
MusicIsWaveform = 1;
|
||||
}
|
||||
return 0;
|
||||
return (alt != 0);
|
||||
}
|
||||
|
||||
void S_StopMusic(void)
|
||||
|
|
Loading…
Reference in a new issue