diff --git a/Init.cpp b/Init.cpp index b21ac62f..b2bd507f 100644 --- a/Init.cpp +++ b/Init.cpp @@ -1355,7 +1355,7 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0); gAimOldArchives[p-1].FaceID=-1; } - + #ifdef NEWMUSIC UINT32 iloop; UINT32 zloop; for(iloop=0; iloop<256; iloop++) @@ -1380,7 +1380,7 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0); { LetLuaMusicControl(0); } - + #endif LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true); g_luaUnderground.LoadScript(GetLanguagePrefix()); // load Lua for Strategic Mines initialization diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 3fb66322..cf4bff32 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -3999,6 +3999,7 @@ if( !SaveNewEmailDataToSaveGameFile( hFile ) ) } //restore the music mode + #ifdef NEWMUSIC if ( GetMusicMode() == MUSIC_TACTICAL_NOTHING && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] != -1 ) SetMusicModeID( GetMusicMode(), MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] ); else if ( GetMusicMode() == MUSIC_TACTICAL_ENEMYPRESENT && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 ) @@ -4008,6 +4009,7 @@ if( !SaveNewEmailDataToSaveGameFile( hFile ) ) else if ( GetMusicMode() == MUSIC_TACTICAL_VICTORY && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] != -1 ) SetMusicModeID( GetMusicMode(), MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] ); else + #endif SetMusicMode( GetMusicMode() ); //Unset the fact that we are saving a game @@ -5897,6 +5899,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) //if( SaveGameHeader.fWorldLoaded ) //{ + #ifdef NEWMUSIC if ( gMusicModeToPlay == MUSIC_TACTICAL_NOTHING && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] != -1 ) SetMusicModeID( gMusicModeToPlay, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] ); else if ( gMusicModeToPlay == MUSIC_TACTICAL_ENEMYPRESENT && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 ) @@ -5906,6 +5909,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) else if ( gMusicModeToPlay == MUSIC_TACTICAL_VICTORY && MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] != -1 ) SetMusicModeID( gMusicModeToPlay, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ] ); else + #endif SetMusicMode( gMusicModeToPlay ); //} //else diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index f9e99b16..9f0375bd 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2060,11 +2060,12 @@ void RenderAutoResolve() SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0; SetThisSectorAsPlayerControlled( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE ); - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_VICTORY ); LogBattleResults( LOG_VICTORY ); @@ -2085,11 +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 ); - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_DEATH ); gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ); @@ -2106,11 +2108,12 @@ void RenderAutoResolve() gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ); gsCiviliansEatenByMonsters = gpAR->ubAliveEnemies; } - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_DEATH ); LogBattleResults( LOG_DEFEAT ); diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 74973298..c2cf0ac6 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -1284,11 +1284,12 @@ BOOLEAN PrepareCreaturesForBattle() { //creatures are attacking a town sector //gfUseCreatureMusic = TRUE; UseCreatureMusic(TRUE); - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); ubCreatureHabitat = MINE_EXIT; diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 396c4b02..b56e7bed 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -537,12 +537,16 @@ 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 static int l_gAddMusic(lua_State *L); static int l_SetMusicID (lua_State *L); static int l_GetMusicID (lua_State *L); +#endif //static int l_MusicStop (lua_State *L); //static int l_MusicFadeOut (lua_State *L); //static int l_MusicFadeIn (lua_State *L); @@ -809,8 +813,9 @@ BOOLEAN LuaInternalQuest( UINT8 ubQuest, INT16 sSectorX, INT16 sSectorY, BOOLEAN static int l_GiveQuestRewardPoint(lua_State *L); BOOLEAN LuaExecuteStrategicEvent( UINT8 EventCallbackID, UINT32 uiTimeStamp, UINT32 uiTimeOffset, UINT8 ubEventType, UINT8 ubFlags, UINT32 EventParam, UINT32 Init); BOOLEAN LuaIDScripts(UINT8 Init, UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum); +#ifdef NEWMUSIC BOOLEAN LetLuaMusicControl(UINT8 Init); - +#endif static int l_CurrentSquad (lua_State *L); static int l_SetgfTacticalTraversal (lua_State *L); static int l_GetgfTacticalTraversal (lua_State *L); @@ -1304,12 +1309,13 @@ void IniFunction(lua_State *L, BOOLEAN bQuests ) lua_register(L, "PlayJA2Sample", l_PlayJA2Sample); 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 ); lua_register(L, "GetMusicID", l_GetMusicID ); - + #endif lua_register(L, "MusicSetVolume", l_MusicSetVolume ); lua_register(L, "MusicGetVolume", l_MusicGetVolume ); //lua_register(L, "MusicStop", l_MusicStop ); @@ -1680,7 +1686,7 @@ void IniFunction(lua_State *L, BOOLEAN bQuests ) lua_register(L,"EnvEndRainStorm", l_EnvEndRainStorm); } - +#ifdef NEWMUSIC BOOLEAN LetLuaMusicControl(UINT8 Init) { const char* filename = "scripts\\Music.lua"; @@ -1699,7 +1705,7 @@ BOOLEAN LetLuaMusicControl(UINT8 Init) return true; } - +#endif //------------------- intro ----------- BOOLEAN LuaIntro(UINT8 Init, UINT32 uiCurrentVideo, INT8 bIntroType, UINT32 iStringToUse ) @@ -5448,7 +5454,7 @@ static int l_MusicSetVolume (lua_State *L) } return 0; } - +#ifdef NEWMUSIC static int l_SetMusicID (lua_State *L) { if ( lua_gettop(L) >= 4 ) @@ -5608,18 +5614,22 @@ static int l_gAddMusic(lua_State *L) return 0; } - +#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 ) @@ -5632,7 +5642,7 @@ static int l_MusicPlayId (lua_State *L) } return 0; } - +#endif static int l_SetMusicMode (lua_State *L) { if ( lua_gettop(L) >= 1 ) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index cd7e0c93..febe5519 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -872,11 +872,13 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) #ifdef ENABLE_ZOMBIES UseCreatureMusic(HostileZombiesPresent()); #endif - + + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); #ifdef JA2UB diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index d3eeac35..0bf68f3e 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -963,11 +963,12 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating #ifdef ENABLE_ZOMBIES UseCreatureMusic(HostileZombiesPresent()); #endif - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup || diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index ccd8557e..c25691b2 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -2282,11 +2282,13 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { // ATE; Fade FA.T.... SetMusicFadeSpeed( 5 ); - + + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); } @@ -4470,10 +4472,12 @@ void AllMercsHaveWalkedOffSector( ) // ATE; Fade FAST.... SetMusicFadeSpeed( 5 ); + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); } } diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index 6509a60b..b018e755 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -156,11 +156,13 @@ void BeginAutoBandage( ) } } +#ifdef NEWMUSIC 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 ); +#endif } diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index 862a561a..b986c16a 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -118,10 +118,12 @@ void ExitBoxing( void ) { EndTopMessage(); + #ifdef NEWMUSIC 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] ); + SetMusicModeID( MUSIC_TACTICAL_NOTHING, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] ); else + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); // Lock UI until we get out of the ring diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 96953cf2..8a3056b9 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -910,10 +910,12 @@ void HandleFirstHeliDropOfGame( ) #ifdef ENABLE_ZOMBIES UseCreatureMusic(HostileZombiesPresent()); #endif + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); } @@ -922,11 +924,13 @@ void HandleFirstHeliDropOfGame( ) // Say quote..... SayQuoteFromAnyBodyInSector( QUOTE_MERC_REACHED_DESTINATION ); // Start music + #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ]; if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] != -1 ) //SetMusicMode( MUSIC_TACTICAL_VICTORY ); SetMusicModeID( MUSIC_TACTICAL_NOTHING, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalNothing[gbWorldSectorZ] ); else + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); } diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index a9fb9efb..ecc8bb01 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -5896,10 +5896,12 @@ void CommonEnterCombatModeCode( ) // Say quote..... // Change music modes + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_BATTLE ); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CommonEnterCombatMode done"); @@ -6062,10 +6064,12 @@ void ExitCombatMode( ) UseCreatureMusic(HostileZombiesPresent()); #endif + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); BetweenTurnsVisibilityAdjustments(); @@ -6128,10 +6132,12 @@ void SetEnemyPresence( ) #ifdef ENABLE_ZOMBIES UseCreatureMusic(HostileZombiesPresent()); #endif + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); @@ -6473,10 +6479,12 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) #ifdef ENABLE_ZOMBIES UseCreatureMusic(HostileZombiesPresent()); #endif + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); return( TRUE ); @@ -6931,10 +6939,12 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) } // Play death music + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_DEATH ); SetCustomizableTimerCallbackAndDelay( 10000, DeathNoMessageTimerCallback, FALSE ); @@ -7088,10 +7098,12 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Change music modes if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) ) { + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_VICTORY ); // OJW - 20081222 - dont auto-bandage if networked @@ -7141,10 +7153,12 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) else { // Change to nothing music... + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); // OJW - 20081222 - dont auto bandage if networked if (!is_networked) @@ -7225,11 +7239,12 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) HandleFirstBattleEndingWhileInTown( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE ); #endif } - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_NOTHING ); } diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index a9d78a87..d155a6fc 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -2652,11 +2652,12 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo ) PlayJA2SampleFromFile( "Sounds\\zombie1.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); UseCreatureMusic(TRUE); // Madd: music when zombies rise - + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 3e1b638c..f3c61f80 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -3622,10 +3622,12 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN // If we are NOT in any music mode... if ( GetMusicMode() == MUSIC_NONE ) { + #ifdef NEWMUSIC 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 + #endif SetMusicMode( MUSIC_TACTICAL_BATTLE ); } } diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index dba1c520..3a229eff 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -30,6 +30,7 @@ static UINT8 gubOldMusicMode = 0; static INT8 gbVictorySongCount = 0; static INT8 gbDeathSongCount = 0; +#ifdef NEWMUSIC static INT32 bNothingModeSong = NOTHING_A_MUSIC; static INT32 bEnemyModeSong = TENSOR_A_MUSIC; static INT32 bBattleModeSong = BATTLE_A_MUSIC; @@ -38,6 +39,11 @@ static INT32 NewSoundID = -1; static BOOLEAN SetSoundID = FALSE; static INT32 gubOldMusicMode2 = 0; +#else +static INT8 bNothingModeSong; +static INT8 bEnemyModeSong; +static INT8 bBattleModeSong; +#endif static BOOLEAN gfUseCreatureMusic = FALSE; @@ -75,9 +81,10 @@ BOOLEAN MusicStop(void); BOOLEAN MusicFadeOut(void); BOOLEAN MusicFadeIn(void); +#ifdef NEWMUSIC MUSIC_SOUND_VALUES MusicSoundValues[256]; INT32 GlobalSoundID = -1; - +#endif //extern void HandleEndDemoInCreatureLevel( ); //BOOLEAN NoEnemiesInSight( ) @@ -114,7 +121,11 @@ INT32 GlobalSoundID = -1; // Returns: TRUE if the music was started, FALSE if an error occurred // //******************************************************************************** +#ifdef NEWMUSIC BOOLEAN MusicPlay(UINT32 uiNum, UINT32 MusicMode, BOOLEAN NewSound ) +#else +BOOLEAN MusicPlay(UINT32 uiNum) +#endif { // WANNE: We want music in windowed mode //if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/ @@ -136,11 +147,14 @@ BOOLEAN MusicPlay(UINT32 uiNum, UINT32 MusicMode, BOOLEAN NewSound ) //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "About to call SoundPlayStreamedFile" ); // Lesh: patch to allow playback ogg files +#ifdef NEWMUSIC if ( NewSound == FALSE && MusicMode == MUSIC_OLD_TYPE ) { +#endif sprintf( zFileName, "%s.ogg", szMusicList[uiNum] ); if ( !FileExists( zFileName ) ) sprintf( zFileName, "%s.wav", szMusicList[uiNum] ); +#ifdef NEWMUSIC } else if ( NewSound == TRUE ) { @@ -189,7 +203,7 @@ BOOLEAN MusicPlay(UINT32 uiNum, UINT32 MusicMode, BOOLEAN NewSound ) } } - +#endif uiMusicHandle = SoundPlayStreamedFile(zFileName, &spParms); if(uiMusicHandle != SOUND_ERROR) @@ -429,7 +443,7 @@ BOOLEAN MusicPoll(BOOLEAN /*fForce*/) //DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll done"); return TRUE; } - +#ifdef NEWMUSIC static BOOLEAN SetMusicModeID(UINT8 ubMusicMode, INT32 SoundID, BOOLEAN fForce) { static INT8 bPreviousMode = 0; @@ -487,17 +501,20 @@ static BOOLEAN SetMusicModeID(UINT8 ubMusicMode, INT32 SoundID, BOOLEAN fForce) return TRUE; } +#endif static BOOLEAN SetMusicMode(UINT8 ubMusicMode, BOOLEAN fForce) { static INT8 bPreviousMode = 0; + #ifdef NEWMUSIC SetSoundID = FALSE; //GlobalSoundID = -1; if ( SetSoundID == FALSE ) NewSoundID = -1; - + #endif + // OK, check if we want to restore if (ubMusicMode == MUSIC_RESTORE) { @@ -505,7 +522,8 @@ static BOOLEAN SetMusicMode(UINT8 ubMusicMode, BOOLEAN fForce) { bPreviousMode = MUSIC_TACTICAL_NOTHING; } - + + #ifdef NEWMUSIC if ( GlobalSoundID == -1 ) { SetSoundID = FALSE; @@ -518,7 +536,7 @@ static BOOLEAN SetMusicMode(UINT8 ubMusicMode, BOOLEAN fForce) NewSoundID = gubOldMusicMode2; GlobalSoundID = NewSoundID; } - + #endif ubMusicMode = bPreviousMode; @@ -530,7 +548,11 @@ static BOOLEAN SetMusicMode(UINT8 ubMusicMode, BOOLEAN fForce) } // if different, start a new music song + #ifdef NEWMUSIC if (fForce || gubOldMusicMode != ubMusicMode || GlobalSoundID == -1 || SetSoundID == TRUE ) + #else + if (fForce || gubOldMusicMode != ubMusicMode) + #endif { // Set mode.... gubMusicMode = ubMusicMode; @@ -557,12 +579,11 @@ static BOOLEAN SetMusicMode(UINT8 ubMusicMode, BOOLEAN fForce) return TRUE; } - +#ifdef NEWMUSIC static BOOLEAN StartMusicBasedOnMode(void) { static BOOLEAN fFirstTime = TRUE; - static BOOLEAN fCivGroup = FALSE; if (fFirstTime) { @@ -734,16 +755,121 @@ static BOOLEAN StartMusicBasedOnMode(void) return TRUE; } +#else +static BOOLEAN StartMusicBasedOnMode(void) +{ + static BOOLEAN fFirstTime = TRUE; + + if (fFirstTime) + { + fFirstTime = FALSE; + + bNothingModeSong = (INT8) (NOTHING_A_MUSIC + Random(4)); + bEnemyModeSong = (INT8) (TENSOR_A_MUSIC + Random(3)); + bBattleModeSong = (INT8) (BATTLE_A_MUSIC + Random(2)); + } + + + //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "StartMusicBasedOnMode() %d %d", uiMusicHandle, gubMusicMode ) ); + + // Setup a song based on mode we're in! + switch(gubMusicMode) + { + case MUSIC_MAIN_MENU: + // ATE: Don't fade in + gbFadeSpeed = (INT8)uiMusicVolume; + MusicPlay(MENUMIX_MUSIC); + break; + + case MUSIC_LAPTOP: + gbFadeSpeed = (INT8)uiMusicVolume; + MusicPlay(MARIMBAD2_MUSIC); + break; + + case MUSIC_TACTICAL_NOTHING: + // ATE: Don't fade in + gbFadeSpeed = (INT8)uiMusicVolume; + if(gfUseCreatureMusic) + { + MusicPlay(CREEPY_MUSIC); + } + else + { + MusicPlay(bNothingModeSong); + bNothingModeSong = (INT8) (NOTHING_A_MUSIC + Random(4)); + } + break; + + case MUSIC_TACTICAL_ENEMYPRESENT: + // ATE: Don't fade in EnemyPresent... + gbFadeSpeed = (INT8)uiMusicVolume; + if(gfUseCreatureMusic) + { + MusicPlay(CREEPY_MUSIC); + } + else + { + MusicPlay(bEnemyModeSong); + bEnemyModeSong = (INT8) (TENSOR_A_MUSIC + Random(3)); + } + break; + + case MUSIC_TACTICAL_BATTLE: + // ATE: Don't fade in + gbFadeSpeed = (INT8)uiMusicVolume; + if(gfUseCreatureMusic) + { + MusicPlay(CREATURE_BATTLE_MUSIC); + } + else + { + MusicPlay(bBattleModeSong); + } + bBattleModeSong = (INT8) (BATTLE_A_MUSIC + Random(2)); + break; + + case MUSIC_TACTICAL_VICTORY: + + // ATE: Don't fade in EnemyPresent... + gbFadeSpeed = (INT8)uiMusicVolume; + MusicPlay(TRIUMPH_MUSIC); + gbVictorySongCount++; + + if(gfUseCreatureMusic && !gbWorldSectorZ) + { + //We just killed all the creatures that just attacked the town. + gfUseCreatureMusic = FALSE; + } + break; + + case MUSIC_TACTICAL_DEATH: + + // ATE: Don't fade in EnemyPresent... + gbFadeSpeed = (INT8)uiMusicVolume; + MusicPlay(DEATH_MUSIC); + gbDeathSongCount++; + break; + + default: + MusicFadeOut(); + break; + } + + return TRUE; +} +#endif BOOLEAN SetMusicMode(UINT8 ubMusicMode) { return SetMusicMode(ubMusicMode, FALSE); } +#ifdef NEWMUSIC BOOLEAN SetMusicModeID(UINT8 ubMusicMode, INT32 SoundID) { return SetMusicModeID(ubMusicMode, SoundID, FALSE); } +#endif static void MusicStopCallback(void *pData) { diff --git a/Utils/Music Control.h b/Utils/Music Control.h index fedbb6aa..6a6109ff 100644 --- a/Utils/Music Control.h +++ b/Utils/Music Control.h @@ -42,6 +42,7 @@ enum MusicMode MUSIC_TACTICAL_CIV_GROUP_BATTLE, }; +#ifdef NEWMUSIC typedef struct { UINT16 uiIndex; @@ -58,6 +59,7 @@ typedef struct extern MUSIC_SOUND_VALUES MusicSoundValues[256]; extern INT32 GlobalSoundID; +#endif //extern UINT32 uiMusicHandle; //extern BOOLEAN fMusicPlaying; @@ -68,10 +70,15 @@ UINT8 GetMusicMode(void); BOOLEAN SetMusicMode(UINT8 ubMusicMode); // only for editor (editscreen.cpp) +#ifdef NEWMUSIC BOOLEAN MusicPlay(UINT32 uiNum, UINT32 MusicMode, BOOLEAN NewSound); +#else +BOOLEAN MusicPlay(UINT32 uiNum); +#endif +#ifdef NEWMUSIC BOOLEAN SetMusicModeID(UINT8 ubMusicMode, INT32 SoundID); - +#endif UINT32 MusicGetVolume(void); BOOLEAN MusicSetVolume(UINT32 uiVolume);