diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index dceba24d3..be9f5ed4f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7667,18 +7667,18 @@ void G_HandleLocalKeys(void) { i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); g_musicIndex = (g_musicIndex+1)%i; - while (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) + while (MapInfo[g_musicIndex].musicfn == NULL) { g_musicIndex++; if (g_musicIndex >= i) 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)) - Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); + if (S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex)) + Bsprintf(ScriptQuotes[QUOTE_MUSIC],"Playing %s",&MapInfo[g_musicIndex].alt_musicfn[0]); 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); } return; @@ -7906,11 +7906,11 @@ FAKE_F3: if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0) { KB_ClearKeyDown(sc_F5); - if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL) - Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); - else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) + if (MapInfo[g_musicIndex].alt_musicfn != NULL) + Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[g_musicIndex].alt_musicfn[0]); + 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."); } else ScriptQuotes[QUOTE_MUSIC][0] = '\0'; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index dcbfca447..6f9d5a711 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4494,12 +4494,12 @@ nullquote: insptr++; if (tw == CON_STARTTRACK) g_musicIndex=(ud.volume_number*MAXLEVELS)+(*(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); continue; } - S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); + S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex); continue; case CON_ACTIVATECHEAT: diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index ca81116b8..79be2d9b1 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -118,7 +118,7 @@ int32_t g_scriptSize = 1048576; char typebuflen,typebuf[141]; -char g_musicIndex; +int32_t g_musicIndex; char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; char g_RTSPlaying; diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index b7288a057..ede1d61c7 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -53,7 +53,7 @@ G_EXTERN char EpisodeNames[MAXVOLUMES][33]; G_EXTERN char GametypeNames[MAXGAMETYPES][33]; G_EXTERN char SkillNames[MAXSKILLS][33]; 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_numPlayerSprites,g_loadFromGroupOnly; G_EXTERN char g_numVolumes; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 9117897c9..fdb8f357e 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -4620,8 +4620,8 @@ cheat_for_port_credits: { if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME) { - if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); + if (MapInfo[g_musicIndex].musicfn != NULL) + S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex); } 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 (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); + if (MapInfo[g_musicIndex].musicfn != NULL) + S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex); } else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); } diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 392410d15..a4f80dc7a 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -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 (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); + if (MapInfo[g_musicIndex].musicfn != NULL) + S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex); } else S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); } diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 2afbafb12..3006bafa6 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -2041,8 +2041,8 @@ int32_t G_EnterLevel(int32_t g) if (ud.recstat != 2) { g_musicIndex = mii; - if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - S_PlayMusic(MapInfo[(uint8_t)g_musicIndex].musicfn, g_musicIndex); + if (MapInfo[g_musicIndex].musicfn != NULL) + S_PlayMusic(MapInfo[g_musicIndex].musicfn, g_musicIndex); } if (g & (MODE_GAME|MODE_EOL)) diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 02cb17cc8..dda58e1a1 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -1745,11 +1745,11 @@ static void postloadplayer(int32_t savegamep) 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)) { 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); diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index adf201a49..d883c05c5 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -177,7 +177,7 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address) sz = (numargs+2)*sizeof(char *) + (c-command+1); 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); if (!external_midi_argv) goto fallback;