Allow custom music to be added

Additional music can be added by placing sound files into Dataa/Music folder following this naming convention

musicmode_runningNumber.fileformat, so for example:

Mainmenu_001.mp3
Mainmenu_002.ogg
Laptop_002.ogg
Tactical_003.wav

*****************************************************************
Different musicmodes are

Mainmenu_ 		<-- Mainmenu music
Laptop_ 		<-- Laptop music
Tactical_		<-- Tactical with nothing special going on
Enemy_			<-- Tactical, enemy present
Battle_			<-- Tactical, enemy present and visible
Victory_		<-- Tactical, battle victory
Death_			<-- Tactical, battle defeat
Creepy_			<-- Tactical, creatures present
CreepyBattle_	<-- Tactical, creatures present and visible

Music files can be .mp3, .ogg or .wav formats and 100 songs in each category is supported.
The running numbering starts from 000

*****************************************************************
A few filenames are treated in a special way to facilitate easy replacement of original music.
To replace original music, insert the following named files into this folder

"menumix1"			<-- Mainmenu music
"marimbad 2"		<-- Laptop music
"nothing A"			<-- Tactical with nothing special going on
"nothing B"
"nothing C"
"nothing D"
"tensor A"			<-- Tactical, enemy present
"tensor B"
"tensor C"
"triumph"
"death"
"battle A"			<-- Tactical, enemy present and visible
"tensor B"			<-- This file is also used as battle music
"creepy"			<-- Tactical, creatures present
"creature battle"	<-- Tactical, creatures present and visible
This commit is contained in:
Asdow
2024-01-27 14:29:51 +02:00
parent c7bd75b60d
commit 7546a23d0d
5 changed files with 194 additions and 480 deletions
+4 -25
View File
@@ -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
@@ -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 );
@@ -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 )