This probably fixes the music breakage caused by r2727.

git-svn-id: https://svn.eduke32.com/eduke32@2738 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-06-04 22:01:45 +00:00
parent 3fbf46ce3a
commit 9f40f84cbe
9 changed files with 24 additions and 24 deletions

View file

@ -7667,18 +7667,18 @@ void G_HandleLocalKeys(void)
{ {
i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6);
g_musicIndex = (g_musicIndex+1)%i; g_musicIndex = (g_musicIndex+1)%i;
while (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) while (MapInfo[g_musicIndex].musicfn == NULL)
{ {
g_musicIndex++; g_musicIndex++;
if (g_musicIndex >= i) if (g_musicIndex >= i)
g_musicIndex = 0; g_musicIndex = 0;
} }
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[g_musicIndex].musicfn != NULL)
{ {
if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex)) if (S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex))
Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[g_musicIndex].alt_musicfn[0]);
else else
Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[g_musicIndex].musicfn[0]);
P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps); P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps);
} }
return; return;
@ -7906,11 +7906,11 @@ FAKE_F3:
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0) if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
{ {
KB_ClearKeyDown(sc_F5); KB_ClearKeyDown(sc_F5);
if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL) if (MapInfo[g_musicIndex].alt_musicfn != NULL)
Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[g_musicIndex].alt_musicfn[0]);
else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) else if (MapInfo[g_musicIndex].musicfn != NULL)
{ {
Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[QUOTE_MUSIC],". Use SHIFT-F5 to change."); Bstrcat(ScriptQuotes[QUOTE_MUSIC],". Use SHIFT-F5 to change.");
} }
else ScriptQuotes[QUOTE_MUSIC][0] = '\0'; else ScriptQuotes[QUOTE_MUSIC][0] = '\0';

View file

@ -4494,12 +4494,12 @@ nullquote:
insptr++; insptr++;
if (tw == CON_STARTTRACK) g_musicIndex=(ud.volume_number*MAXLEVELS)+(*(insptr++)); if (tw == CON_STARTTRACK) g_musicIndex=(ud.volume_number*MAXLEVELS)+(*(insptr++));
else g_musicIndex=(ud.volume_number*MAXLEVELS)+(Gv_GetVarX(*(insptr++))); else g_musicIndex=(ud.volume_number*MAXLEVELS)+(Gv_GetVarX(*(insptr++)));
if (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) if (MapInfo[g_musicIndex].musicfn == NULL)
{ {
OSD_Printf(CON_ERROR "null music for map %d\n",g_errorLineNum,keyw[g_tw],g_musicIndex); OSD_Printf(CON_ERROR "null music for map %d\n",g_errorLineNum,keyw[g_tw],g_musicIndex);
continue; continue;
} }
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex);
continue; continue;
case CON_ACTIVATECHEAT: case CON_ACTIVATECHEAT:

View file

@ -118,7 +118,7 @@ int32_t g_scriptSize = 1048576;
char typebuflen,typebuf[141]; char typebuflen,typebuf[141];
char g_musicIndex; int32_t g_musicIndex;
char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
char g_RTSPlaying; char g_RTSPlaying;

View file

@ -53,7 +53,7 @@ G_EXTERN char EpisodeNames[MAXVOLUMES][33];
G_EXTERN char GametypeNames[MAXGAMETYPES][33]; G_EXTERN char GametypeNames[MAXGAMETYPES][33];
G_EXTERN char SkillNames[MAXSKILLS][33]; G_EXTERN char SkillNames[MAXSKILLS][33];
G_EXTERN char g_RTSPlaying; G_EXTERN char g_RTSPlaying;
G_EXTERN char g_musicIndex; G_EXTERN int32_t g_musicIndex;
G_EXTERN char g_numGametypes; G_EXTERN char g_numGametypes;
G_EXTERN char g_numPlayerSprites,g_loadFromGroupOnly; G_EXTERN char g_numPlayerSprites,g_loadFromGroupOnly;
G_EXTERN char g_numVolumes; G_EXTERN char g_numVolumes;

View file

@ -4620,8 +4620,8 @@ cheat_for_port_credits:
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex);
} }
else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS);
@ -4717,8 +4717,8 @@ cheat_for_port_credits:
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex);
} }
else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS);
} }

View file

@ -330,8 +330,8 @@ static int32_t osdcmd_restartsound(const osdfuncparm_t *parm)
{ {
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{ {
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex);
} }
else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS);
} }

View file

@ -2041,8 +2041,8 @@ int32_t G_EnterLevel(int32_t g)
if (ud.recstat != 2) if (ud.recstat != 2)
{ {
g_musicIndex = mii; g_musicIndex = mii;
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) if (MapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(MapInfo[(uint8_t)g_musicIndex].musicfn, g_musicIndex); S_PlayMusic(MapInfo[g_musicIndex].musicfn, g_musicIndex);
} }
if (g & (MODE_GAME|MODE_EOL)) if (g & (MODE_GAME|MODE_EOL))

View file

@ -1745,11 +1745,11 @@ static void postloadplayer(int32_t savegamep)
if (ud.config.MusicToggle) if (ud.config.MusicToggle)
{ {
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL && if (MapInfo[g_musicIndex].musicfn != NULL &&
(i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn)) (i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn))
{ {
S_StopMusic(); S_StopMusic();
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0], g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0], g_musicIndex);
} }
S_PauseMusic(0); S_PauseMusic(0);

View file

@ -177,7 +177,7 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
sz = (numargs+2)*sizeof(char *) + (c-command+1); sz = (numargs+2)*sizeof(char *) + (c-command+1);
sz = ((sz+pagesize-1)/pagesize)*pagesize; sz = ((sz+pagesize-1)/pagesize)*pagesize;
#if defined(NEDMALLOC) || defined(__APPLE__) #if defined(NEDMALLOC) || defined(__APPLE__) || defined(__ANDROID__)
external_midi_argv = Bcalloc(1,sz+pagesize); external_midi_argv = Bcalloc(1,sz+pagesize);
if (!external_midi_argv) if (!external_midi_argv)
goto fallback; goto fallback;