Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions Editor/editscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@
class OBJECTTYPE;
class SOLDIERTYPE;

extern CHAR8 *szMusicList[NUM_MUSIC];

BOOLEAN gfCorruptMap = FALSE;
BOOLEAN gfCorruptSchedules = FALSE;
BOOLEAN gfProfileDataLoaded = FALSE;
Expand Down Expand Up @@ -169,6 +167,7 @@ LEVELNODE *gCursorNode = NULL;
INT32 gsCursorGridNo;

INT32 giMusicID = 0;
NewMusicList gMusicMode = MUSICLIST_MAIN_MENU;

void EraseWorldData( );

Expand Down Expand Up @@ -1616,16 +1615,27 @@ void HandleKeyboardShortcuts( )
break;

case F4:
#ifdef NEWMUSIC
MusicPlay( giMusicID, MUSIC_OLD_TYPE, FALSE );
#else
MusicPlay( giMusicID );
#endif
MusicPlay(gMusicMode, giMusicID);
ScreenMsg( FONT_YELLOW, MSG_INTERFACE, L"%S", MusicLists[gMusicMode][giMusicID] );

ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"%S", szMusicList[giMusicID] );
// Select next track
giMusicID++;
if( giMusicID >= NUM_MUSIC )
if (giMusicID >= MusicLists[gMusicMode].size())
{
giMusicID = 0;
for (size_t i = 0; i < MAX_MUSIC; i++)
{
if (gMusicMode == i)
{
gMusicMode = static_cast<NewMusicList>(i + 1);
if (gMusicMode == MAX_MUSIC)
{
gMusicMode = MUSICLIST_MAIN_MENU;
}
break;
}
}
}
break;

case F5:
Expand Down
29 changes: 4 additions & 25 deletions Strategic/LuaInitNPCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,6 @@ static int l_AnimMercPtsrusStrategicInsertionData (lua_State *L);

static int l_SetMusicMode (lua_State *L);
static int l_MusicPlay (lua_State *L);
#ifdef NEWMUSIC
static int l_MusicPlayId (lua_State *L);
#endif
static int l_MusicSetVolume (lua_State *L);
static int l_MusicGetVolume (lua_State *L);
#ifdef NEWMUSIC
Expand Down Expand Up @@ -1398,7 +1395,6 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
lua_register(L, "SetMusicMode", l_SetMusicMode );
lua_register(L, "MusicPlay", l_MusicPlay );
#ifdef NEWMUSIC
lua_register(L, "MusicIdPlay", l_MusicPlayId );
lua_register(L, "AddMusic", l_gAddMusic );

lua_register(L, "SetMusicID", l_SetMusicID );
Expand Down Expand Up @@ -5715,33 +5711,16 @@ static int l_gAddMusic(lua_State *L)
}
#endif
static int l_MusicPlay (lua_State *L)
{
if ( lua_gettop(L) >= 1 )
{
UINT32 uiNum = lua_tointeger(L,1);
#ifdef NEWMUSIC
MusicPlay( uiNum, MUSIC_OLD_TYPE, FALSE);
#else
MusicPlay( uiNum );
#endif
}
return 0;
}

#ifdef NEWMUSIC
static int l_MusicPlayId (lua_State *L)
{
if ( lua_gettop(L) >= 2 )
{
UINT32 uiNum = lua_tointeger(L,1);
UINT32 uiType = lua_tointeger(L,2);

if (uiType>=1 || uiType<=5 )
MusicPlay( uiNum, uiType, TRUE);
UINT32 musicMode = lua_tointeger(L, 1);
UINT32 song = lua_tointeger(L,2);
MusicPlay( static_cast<NewMusicList>(musicMode), song );
}
return 0;
}
#endif

static int l_SetMusicMode (lua_State *L)
{
if ( lua_gettop(L) >= 1 )
Expand Down
Loading