- New Externalization: Externalized the used music to an OPTIONAL "Scripts\Music.lua" file (by Jazz)

o This file is OPTIONAL and if not available, the game uses the default music tracks
o With the user of the Music.lua script file, you can play different musics and types for each sector (*.WAV or *.OGG)
o An example of the usage has been added to "Docs\Externalized Music Example.zip"
o See comments from the Music.lua scripts below

--[[
AddMusic(SectorX,SectorY,SectorZ,MusicType,MusicID)

MusicType :
1 - standard music, sector no enemy (NOTHING_xxx.wav or NOTHING_xxx.ogg)
2 - enemy in sector  (TENSOR_xxx.wav or TENSOR_xxx.ogg)
3 - start battle  (BATTLE_xxx.wav or BATTLE_xxx.ogg)
4 - victory  (TRIUMPH_xxx.wav or TRIUMPH_xxx.ogg)
5 - death merc  (DEATH_xxx.wav or DEATH_xxx.ogg)

xxx - number file

MusicID - id of music

Put to "Music" folder ogg or wav file. We number the names of files NOTHING_0.wav... NOTHING_10.wav ... etc

Example :
AddMusic(1,10,0,1,0) -- add to sector A10, music type "1" and file NOTHING_0.wav or NOTHING_0.ogg.
AddMusic(1,10,1,1,0) -- add to sector A10_B1, music type "1" and file NOTHING_0.wav or NOTHING_0.ogg.
AddMusic(1,9,0,2,10) -- add to sector A9, music type "2" and file TENSOR_10.wav or TENSOR_10.ogg.

for x = 1,16 do
        for y = 1,16 do
		AddMusic(x,y,0,1,10) -- add to all sector, music type "1" and file NOTHING_10.wav or NOTHING_10.ogg.
	end
end

]]

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6295 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-08-20 07:15:30 +00:00
parent 74f52b3982
commit ab02106512
11 changed files with 500 additions and 21 deletions
+30 -2
View File
@@ -117,6 +117,7 @@
#include "LuaInitNPCs.h"
#include "Interface.h"
#include "Vehicles.h"
#include "Music Control.h"
#ifdef JA2UB
#include "Ja25 Strategic Ai.h"
#include "Ja25_Tactical.h"
@@ -5885,6 +5886,10 @@ void CommonEnterCombatModeCode( )
// Say quote.....
// Change music modes
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalBattle[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalBattle[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_BATTLE, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalBattle[gbWorldSectorZ]);
else
SetMusicMode( MUSIC_TACTICAL_BATTLE );
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CommonEnterCombatMode done");
@@ -6047,6 +6052,10 @@ void ExitCombatMode( )
UseCreatureMusic(HostileZombiesPresent());
#endif
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
BetweenTurnsVisibilityAdjustments();
@@ -6109,8 +6118,12 @@ void SetEnemyPresence( )
#ifdef ENABLE_ZOMBIES
UseCreatureMusic(HostileZombiesPresent());
#endif
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false"));
sniperwarning = FALSE;
biggunwarning = FALSE;
@@ -6450,7 +6463,10 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen )
#ifdef ENABLE_ZOMBIES
UseCreatureMusic(HostileZombiesPresent());
#endif
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
return( TRUE );
@@ -6905,6 +6921,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
}
// Play death music
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalDeath[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalDeath[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalDeath[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_DEATH );
SetCustomizableTimerCallbackAndDelay( 10000, DeathNoMessageTimerCallback, FALSE );
@@ -7058,6 +7078,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
// Change music modes
if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) )
{
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_VICTORY, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_VICTORY );
// OJW - 20081222 - dont auto-bandage if networked
@@ -7107,6 +7131,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
else
{
// Change to nothing music...
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_NOTHING, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] );
else
SetMusicMode( MUSIC_TACTICAL_NOTHING );
// OJW - 20081222 - dont auto bandage if networked
if (!is_networked)