mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Bugfix: Externalized Music (Music.lua) (by Jazz)
o Added missing: 6 - creature start battle (CREATURE_BATTLE_xxx.wav or CREATURE_BATTLE_xxx.ogg) 7 - creepy music (CREEPY_xxx.wav or CREEPY_xxx.ogg) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6296 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1344,6 +1344,9 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
|
||||
MusicSoundValues[iloop].SoundTacticalNothing[zloop] = -1;
|
||||
MusicSoundValues[iloop].SoundTacticalTensor[zloop] = -1;
|
||||
MusicSoundValues[iloop].SoundTacticalDeath[zloop] = -1;
|
||||
MusicSoundValues[iloop].SoundTacticalBattleCreature[zloop] = -1;
|
||||
MusicSoundValues[iloop].SoundTacticalBattleCreepy[zloop] = -1;
|
||||
MusicSoundValues[iloop].SoundTacticalBattleGroup[iloop] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2061,7 +2061,12 @@ void RenderAutoResolve()
|
||||
SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0;
|
||||
SetThisSectorAsPlayerControlled( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE );
|
||||
|
||||
GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalVictory[0];
|
||||
if ( MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalVictory[0] != -1 )
|
||||
SetMusicModeID( MUSIC_TACTICAL_VICTORY, MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalVictory[0] );
|
||||
else
|
||||
SetMusicMode( MUSIC_TACTICAL_VICTORY );
|
||||
|
||||
LogBattleResults( LOG_VICTORY );
|
||||
break;
|
||||
|
||||
@@ -2081,7 +2086,12 @@ void RenderAutoResolve()
|
||||
HandleMoraleEvent( NULL, MORALE_HEARD_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 );
|
||||
if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 );
|
||||
|
||||
GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0];
|
||||
if ( MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] != -1 )
|
||||
SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] );
|
||||
else
|
||||
SetMusicMode( MUSIC_TACTICAL_DEATH );
|
||||
|
||||
gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
break;
|
||||
case BATTLE_DEFEAT:
|
||||
@@ -2096,7 +2106,13 @@ void RenderAutoResolve()
|
||||
gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
gsCiviliansEatenByMonsters = gpAR->ubAliveEnemies;
|
||||
}
|
||||
|
||||
GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0];
|
||||
if ( MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] != -1 )
|
||||
SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] );
|
||||
else
|
||||
SetMusicMode( MUSIC_TACTICAL_DEATH );
|
||||
|
||||
LogBattleResults( LOG_DEFEAT );
|
||||
break;
|
||||
|
||||
|
||||
@@ -1284,7 +1284,13 @@ BOOLEAN PrepareCreaturesForBattle()
|
||||
{ //creatures are attacking a town sector
|
||||
//gfUseCreatureMusic = TRUE;
|
||||
UseCreatureMusic(TRUE);
|
||||
|
||||
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 );
|
||||
|
||||
ubCreatureHabitat = MINE_EXIT;
|
||||
ubNumCreatures = gubNumCreaturesAttackingTown;
|
||||
}
|
||||
|
||||
@@ -5283,6 +5283,16 @@ static int l_SetMusicID (lua_State *L)
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalDeath[z] );
|
||||
}
|
||||
else if ( MusicType == 6 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SetMusicModeID( MUSIC_TACTICAL_BATTLE, MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreature[z] );
|
||||
}
|
||||
else if ( MusicType == 7 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SetMusicModeID( MUSIC_TACTICAL_BATTLE, MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreepy[z] );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -5320,6 +5330,21 @@ INT32 SoundID = -1;
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SoundID = MusicSoundValues[SECTOR( x, y )].SoundTacticalVictory[z];
|
||||
}
|
||||
else if ( MusicType == 5 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SoundID = MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalDeath[z];
|
||||
}
|
||||
else if ( MusicType == 6 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SoundID = MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreature[z];
|
||||
}
|
||||
else if ( MusicType == 7 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
SoundID = MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreepy[z];
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushinteger(L, SoundID);
|
||||
@@ -5364,6 +5389,21 @@ static int l_gAddMusic(lua_State *L)
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
MusicSoundValues[SECTOR( x, y )].SoundTacticalVictory[z] = SoundId;
|
||||
}
|
||||
else if ( MusicType == 5 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalDeath[z] = SoundId;
|
||||
}
|
||||
else if ( MusicType == 6 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreature[z] = SoundId;
|
||||
}
|
||||
else if ( MusicType == 7 )
|
||||
{
|
||||
if ((x>=1 || x<=16) && (y>=1 || y<=16) && (z>=0 || z<=3) )
|
||||
MusicSoundValues[ SECTOR( x, y ) ].SoundTacticalBattleCreepy[z] = SoundId;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -873,6 +873,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
UseCreatureMusic(HostileZombiesPresent());
|
||||
#endif
|
||||
|
||||
GlobalSoundID = MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ];
|
||||
if ( MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ] != -1 )
|
||||
SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ] );
|
||||
else
|
||||
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -2210,4 +2214,4 @@ void HandlePreBattleInterfaceStates()
|
||||
{
|
||||
gfTransitionMapscreenToAutoResolve = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,6 +963,10 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
|
||||
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 );
|
||||
|
||||
if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup ||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "English.h"
|
||||
#endif
|
||||
|
||||
#include "Music Control.h"
|
||||
|
||||
// max number of merc faces per row in autobandage box
|
||||
#define NUMBER_MERC_FACES_AUTOBANDAGE_BOX 4
|
||||
@@ -154,6 +155,12 @@ void BeginAutoBandage( )
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ BEGIN_AUTOBANDAGE_PROMPT_STR ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, BeginAutoBandageCallBack, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -117,6 +117,11 @@ void ExitBoxing( void )
|
||||
if ( CheckForEndOfCombatMode( FALSE ) )
|
||||
{
|
||||
EndTopMessage();
|
||||
|
||||
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 );
|
||||
|
||||
// Lock UI until we get out of the ring
|
||||
|
||||
@@ -7215,6 +7215,13 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
||||
HandleFirstBattleEndingWhileInTown( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE );
|
||||
#endif
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
|
||||
|
||||
@@ -2652,7 +2652,14 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo )
|
||||
PlayJA2SampleFromFile( "Sounds\\zombie1.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||
|
||||
UseCreatureMusic(TRUE); // Madd: music when zombies rise
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-2
@@ -11,6 +11,7 @@
|
||||
#include "strategicmap.h"
|
||||
#endif
|
||||
|
||||
#include "Overhead Types.h"
|
||||
//extern int iScreenMode;
|
||||
|
||||
static UINT32 uiMusicHandle = NO_SAMPLE;
|
||||
@@ -168,6 +169,25 @@ BOOLEAN MusicPlay(UINT32 uiNum, UINT32 MusicMode, BOOLEAN NewSound )
|
||||
if ( !FileExists( zFileName ) )
|
||||
sprintf( zFileName, "%s\\TRIUMPH_%d.wav", szMusicList[15], uiNum );
|
||||
}
|
||||
else if ( MusicMode == MUSIC_TACTICAL_BATTLE_MUSIC )
|
||||
{
|
||||
sprintf( zFileName, "%s\\CREATURE_BATTLE_%d.ogg", szMusicList[15], uiNum);
|
||||
if ( !FileExists( zFileName ) )
|
||||
sprintf( zFileName, "%s\\CREATURE_BATTLE_%d.wav", szMusicList[15], uiNum );
|
||||
}
|
||||
else if ( MusicMode == MUSIC_TACTICAL_CREEPY_MUSIC )
|
||||
{
|
||||
sprintf( zFileName, "%s\\CREEPY_%d.ogg", szMusicList[15], uiNum);
|
||||
if ( !FileExists( zFileName ) )
|
||||
sprintf( zFileName, "%s\\CREEPY_%d.wav", szMusicList[15], uiNum );
|
||||
}
|
||||
else if ( MusicMode == OTHER_MUSIC_TACTICAL )
|
||||
{
|
||||
sprintf( zFileName, "%s\\%d.ogg", szMusicList[15], uiNum);
|
||||
if ( !FileExists( zFileName ) )
|
||||
sprintf( zFileName, "%s\\%d.wav", szMusicList[15], uiNum );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uiMusicHandle = SoundPlayStreamedFile(zFileName, &spParms);
|
||||
@@ -542,6 +562,8 @@ static BOOLEAN StartMusicBasedOnMode(void)
|
||||
{
|
||||
static BOOLEAN fFirstTime = TRUE;
|
||||
|
||||
static BOOLEAN fCivGroup = FALSE;
|
||||
|
||||
if (fFirstTime)
|
||||
{
|
||||
fFirstTime = FALSE;
|
||||
@@ -581,7 +603,7 @@ static BOOLEAN StartMusicBasedOnMode(void)
|
||||
else
|
||||
{
|
||||
SetSoundID = TRUE;
|
||||
MusicPlay(NewSoundID,MUSIC_TACTICAL_NOTHING,TRUE);
|
||||
MusicPlay(NewSoundID,MUSIC_TACTICAL_CREEPY_MUSIC,TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -646,7 +668,7 @@ static BOOLEAN StartMusicBasedOnMode(void)
|
||||
else
|
||||
{
|
||||
SetSoundID = TRUE;
|
||||
MusicPlay(NewSoundID,MUSIC_TACTICAL_BATTLE,TRUE);
|
||||
MusicPlay(NewSoundID,MUSIC_TACTICAL_BATTLE_MUSIC,TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _MUSIC_CONTROL_H_
|
||||
#define _MUSIC_CONTROL_H_
|
||||
|
||||
#include "Overhead Types.h"
|
||||
|
||||
enum MusicList
|
||||
{
|
||||
MARIMBAD2_MUSIC,
|
||||
@@ -34,6 +36,10 @@ enum MusicMode
|
||||
MUSIC_TACTICAL_DEATH,
|
||||
MUSIC_LAPTOP,
|
||||
MUSIC_OLD_TYPE,
|
||||
MUSIC_TACTICAL_BATTLE_MUSIC,
|
||||
MUSIC_TACTICAL_CREEPY_MUSIC,
|
||||
OTHER_MUSIC_TACTICAL,
|
||||
MUSIC_TACTICAL_CIV_GROUP_BATTLE,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -44,6 +50,9 @@ typedef struct
|
||||
INT32 SoundTacticalNothing[4];
|
||||
INT32 SoundTacticalTensor[4];
|
||||
INT32 SoundTacticalDeath[4];
|
||||
INT32 SoundTacticalBattleCreature[4];
|
||||
INT32 SoundTacticalBattleCreepy[4];
|
||||
INT32 SoundTacticalBattleGroup[NUM_CIV_GROUPS];
|
||||
|
||||
} MUSIC_SOUND_VALUES;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user