From 9f9e42a004f31d5dff415cc585a5739fde0f8985 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Thu, 31 May 2012 19:55:48 +0000 Subject: [PATCH] 1. Feature - Spooky creature music now plays when zombies are present 2. Bugfix - CheckForFullStruct in Soldier Control.cpp was referencing NUMBEROFTILES instead of new global variable git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5323 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Meanwhile.cpp | 1 + Strategic/PreBattle Interface.cpp | 1 + Strategic/Strategic Movement.cpp | 1 + Tactical/Merc Entering.cpp | 1 + Tactical/Overhead.cpp | 25 +++++++++++++++++++++++++ Tactical/Overhead.h | 2 ++ Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Create.cpp | 2 -- TileEngine/tiledef.cpp | 4 ++-- TileEngine/worlddef.cpp | 4 ++-- 10 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index e2f2a8b1..18f132ac 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -820,6 +820,7 @@ void EndMeanwhile( ) { // We leave this sector open for our POWs to escape! // Set music mode to enemy present! + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); // ATE: Restore people to saved positions... diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index f01eabc6..1734e414 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -867,6 +867,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //Disable the options button when the auto resolve screen comes up EnableDisAbleMapScreenOptionsButton( FALSE ); + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); #ifdef JA2UB diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 3f930164..9eef45dc 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -959,6 +959,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating } //Set music + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); if( gfTacticalTraversal && pInitiatingBattleGroup == gpTacticalTraversalGroup || diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 5ce9060a..ef8bcaf5 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -908,6 +908,7 @@ void HandleFirstHeliDropOfGame( ) // Say quote..... SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); // Start music + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); } else diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index e2ee0eee..a363755c 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6181,6 +6181,7 @@ void ExitCombatMode( ) // unused //gfForceMusicToTense = TRUE; + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); BetweenTurnsVisibilityAdjustments(); @@ -6239,6 +6240,7 @@ void SetEnemyPresence( ) #endif { + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); sniperwarning = FALSE; @@ -6576,6 +6578,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) // Begin tense music.... // unused //gfForceMusicToTense = TRUE; + UseCreatureMusic(HostileZombiesPresent()); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); return( TRUE ); @@ -9276,6 +9279,28 @@ BOOLEAN HostileBloodcatsPresent( void ) return( FALSE ); } +BOOLEAN HostileZombiesPresent( void ) +{ + INT32 iLoop; + SOLDIERTYPE * pSoldier; + + if ( gTacticalStatus.Team[ CREATURE_TEAM ].bTeamActive == FALSE ) + { + return( FALSE ); + } + + for ( iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; iLoop++ ) + { + pSoldier = MercPtrs[ iLoop ]; + + if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->IsZombie() ) + { + return( TRUE ); + } + } + + return( FALSE ); +} void HandleCreatureTenseQuote( ) { diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 4fb1226d..d7782cfc 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -362,6 +362,8 @@ void DoPOWPathChecks( void ); BOOLEAN HostileCiviliansWithGunsPresent( void ); BOOLEAN HostileCiviliansPresent( void ); BOOLEAN HostileBloodcatsPresent( void ); +BOOLEAN HostileZombiesPresent( void ); + UINT8 NumPCsInSector( void ); void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 1b7cab38..99a2da63 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -10687,7 +10687,7 @@ BOOLEAN CheckForFullStruct( INT32 sGridNo, UINT16 *pusIndex ) while( pStruct != NULL ) { - if ( pStruct->usIndex != NO_TILE && pStruct->usIndex < NUMBEROFTILES ) + if ( pStruct->usIndex != NO_TILE && pStruct->usIndex < giNumberOfTiles ) { GetTileFlags( pStruct->usIndex, &fTileFlags ); diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 40b6cdb3..4d1c0f64 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -579,8 +579,6 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * *pubID = NOBODY; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("TacticalCreateSoldier")); - - INT8 tbTeam; BOOLEAN tfPP; tbTeam=pCreateStruct->bTeam; diff --git a/TileEngine/tiledef.cpp b/TileEngine/tiledef.cpp index 8d32c482..f8fb9984 100644 --- a/TileEngine/tiledef.cpp +++ b/TileEngine/tiledef.cpp @@ -798,8 +798,8 @@ void CreateTileDatabase( ) //Calculate mem usgae gSurfaceMemUsage = guiMemTotal - gSurfaceMemUsage; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Sizes: %d vs %d", gTileDatabaseSize, NUMBEROFTILES ) ); - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Types: %d", NUMBEROFTILETYPES ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Sizes: %d vs %d", gTileDatabaseSize, giNumberOfTiles ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Types: %d", giNumberOfTileTypes ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Item Mem: %d", gTileDatabaseSize * sizeof( TILE_ELEMENT ) ) ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Database Item Total Mem: %d", gSurfaceMemUsage ) ); diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 39b3e306..ae9ea6f5 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -301,10 +301,10 @@ BOOLEAN InitializeWorld( ) memset( TileSurfaceFilenames, '\0', sizeof( TileSurfaceFilenames ) ); // ATE: MEMSET LOG HEIGHT VALUES - memset( gTileTypeLogicalHeight, 1, sizeof( gTileTypeLogicalHeight ) ); + memset( gTileTypeLogicalHeight, 1, sizeof( gTileTypeLogicalHeight) ); // Memset tile database - memset( gTileDatabase, 0, sizeof( gTileDatabase ) ); + memset( gTileDatabase, 0, sizeof(gTileDatabase) ); // Init surface list memset( gTileSurfaceArray, 0, sizeof( gTileSurfaceArray ) );