diff --git a/GameSettings.cpp b/GameSettings.cpp index b536d9cd..140ace58 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -255,7 +255,8 @@ void InitGameSettings() gGameSettings.fOptions[ TOPTION_SHOW_ITEM_SHADOW ] = TRUE; gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] = TRUE; gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ] = FALSE; - gGameSettings.fOptions[ TOPTION_RAIN_SOUND ] = TRUE; + gGameSettings.fOptions[ TOPTION_RAIN_SOUND ] = TRUE; + gGameSettings.fOptions[ TOPTION_ALLOW_CROWS ] = TRUE; gGameSettings.ubSizeOfDisplayCover = 4; gGameSettings.ubSizeOfLOS = 4; diff --git a/GameSettings.h b/GameSettings.h index 2080b263..71ce2044 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -50,6 +50,7 @@ enum TOPTION_SHOW_WEAPON_RANGE_IN_TILES, TOPTION_TRACERS_FOR_SINGLE_FIRE, TOPTION_RAIN_SOUND, + TOPTION_ALLOW_CROWS, NUM_GAME_OPTIONS, //Toggle up this will be able to be Toggled by the player diff --git a/GameVersion.cpp b/GameVersion.cpp index 4919dff4..183b2115 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -23,7 +23,7 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - INT16 zVersionLabel[256] = { L"Release v1.13.403" }; + INT16 zVersionLabel[256] = { L"Release v1.13.404" }; #endif diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index d9021bb3..2d7829fa 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1243,236 +1243,239 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) UNDERGROUND_SECTORINFO *pUnderWorld=NULL; BOOLEAN fChangeMusic = TRUE; - #ifdef CRIPPLED_VERSION - if( sMapY >= 5 && sMapY != 16 ) - { - CrippledVersionFailureToLoadMapCheck(); - return FALSE; - } - #endif - +#ifdef CRIPPLED_VERSION + if( sMapY >= 5 && sMapY != 16 ) + { + CrippledVersionFailureToLoadMapCheck(); + return FALSE; + } +#endif + // ATE: Zero out accounting functions memset( gbMercIsNewInThisSector, 0, sizeof( gbMercIsNewInThisSector ) ); SyncStrategicTurnTimes(); - - #ifdef JA2BETAVERSION + +#ifdef JA2BETAVERSION if( gfOverrideSector ) { //skip the cancel, and force load the sector. This is used by the AIViewer to "reset" a level with //different numbers of various types of enemies. } else - #endif - // is the sector already loaded? - if( ( gWorldSectorX == sMapX ) && ( sMapY == gWorldSectorY) && ( bMapZ == gbWorldSectorZ) ) - { - //Inserts the enemies into the newly loaded map based on the strategic information. - //Note, the flag will return TRUE only if enemies were added. The game may wish to - //do something else in a case where no enemies are present. - - SetPendingNewScreen(GAME_SCREEN); - if( !NumEnemyInSector( ) ) +#endif + // is the sector already loaded? + if( ( gWorldSectorX == sMapX ) && ( sMapY == gWorldSectorY) && ( bMapZ == gbWorldSectorZ) ) { - PrepareEnemyForSectorBattle(); - } - if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && + //Inserts the enemies into the newly loaded map based on the strategic information. + //Note, the flag will return TRUE only if enemies were added. The game may wish to + //do something else in a case where no enemies are present. + + SetPendingNewScreen(GAME_SCREEN); + if( !NumEnemyInSector( ) ) + { + PrepareEnemyForSectorBattle(); + } + if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) ) - { - PrepareCreaturesForBattle(); - } - if( gfGotoSectorTransition ) - { - BeginLoadScreen( ); - gfGotoSectorTransition = FALSE; + { + PrepareCreaturesForBattle(); + } + if( gfGotoSectorTransition ) + { + BeginLoadScreen( ); + gfGotoSectorTransition = FALSE; + } + + // Check for helicopter being on the ground in this sector... + HandleHelicopterOnGroundGraphic( ); + + ResetMilitia(); + AllTeamsLookForAll( TRUE ); + return( TRUE ); } - // Check for helicopter being on the ground in this sector... - HandleHelicopterOnGroundGraphic( ); - - ResetMilitia(); - AllTeamsLookForAll( TRUE ); - return( TRUE ); - } - - if( gWorldSectorX && gWorldSectorY && gbWorldSectorZ != -1 ) - { - HandleDefiniteUnloadingOfWorld( ABOUT_TO_LOAD_NEW_MAP ); - } - - // make this the currently loaded sector - gWorldSectorX = sMapX; - gWorldSectorY = sMapY; - gbWorldSectorZ = bMapZ; - - // update currently selected map sector to match - ChangeSelectedMapSector( sMapX, sMapY, bMapZ ); - - - //Check to see if the sector we are loading is the cave sector under Tixa. If so - //then we will set up the meanwhile scene to start the creature quest. - if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) - { - StopAnyCurrentlyTalkingSpeech( ); - - if( gWorldSectorX == 9 && gWorldSectorY == 10 && gbWorldSectorZ == 2 ) + if( gWorldSectorX && gWorldSectorY && gbWorldSectorZ != -1 ) { - InitCreatureQuest(); //Ignored if already active. + HandleDefiniteUnloadingOfWorld( ABOUT_TO_LOAD_NEW_MAP ); } - } - //Stop playing any music -- will fade out. - // SetMusicMode( MUSIC_NONE ); + // make this the currently loaded sector + gWorldSectorX = sMapX; + gWorldSectorY = sMapY; + gbWorldSectorZ = bMapZ; - // ATE: Determine if we should set the default music... - - // Are we already in 'tense' music... - - // ATE: Change music only if not loading.... - /*- - if ( gubMusicMode == MUSIC_TACTICAL_ENEMYPRESENT ) - { - fChangeMusic = FALSE; - } - - // Did we 'tactically traverse' over.... - if ( gfTacticalTraversal ) - { - fChangeMusic = FALSE; - } - - // If we have no music playing at all.... - if ( gubMusicMode == MUSIC_NONE ) - { - fChangeMusic = TRUE; - } - -*/ - - if( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) - { - fChangeMusic = TRUE; - } - else - { - fChangeMusic = FALSE; - } + // update currently selected map sector to match + ChangeSelectedMapSector( sMapX, sMapY, bMapZ ); - if ( fChangeMusic ) - { - SetMusicMode( MUSIC_MAIN_MENU ); - } - - // ATE: Do this stuff earlier! - if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) - { - // Update the last time we were in tactical... - gTacticalStatus.uiTimeSinceLastInTactical = GetWorldTotalMin( ); - - // init some AI stuff - InitializeTacticalStatusAtBattleStart(); - - // CJC: delay this until after entering the sector! - //InitAI(); - - // Check for helicopter being on the ground in this sector... - HandleHelicopterOnGroundSkyriderProfile( ); - } - - //Load and enter the new sector - if( EnterSector( gWorldSectorX, gWorldSectorY, bMapZ ) ) - { - // CJC: moved this here Feb 17 + //Check to see if the sector we are loading is the cave sector under Tixa. If so + //then we will set up the meanwhile scene to start the creature quest. if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - InitAI(); + StopAnyCurrentlyTalkingSpeech( ); + + if( gWorldSectorX == 9 && gWorldSectorY == 10 && gbWorldSectorZ == 2 ) + { + InitCreatureQuest(); //Ignored if already active. + } } - //If there are any people with schedules, now is the time to process them. - //CJC: doesn't work here if we're going through the tactical placement GUI; moving - // this call to PrepareLoadedSector() - //PostSchedules(); + //Stop playing any music -- will fade out. + // SetMusicMode( MUSIC_NONE ); - // ATE: OK, add code here to update the states of doors if they should - // be closed...... + // ATE: Determine if we should set the default music... + + // Are we already in 'tense' music... + + // ATE: Change music only if not loading.... + /*- + if ( gubMusicMode == MUSIC_TACTICAL_ENEMYPRESENT ) + { + fChangeMusic = FALSE; + } + + // Did we 'tactically traverse' over.... + if ( gfTacticalTraversal ) + { + fChangeMusic = FALSE; + } + + // If we have no music playing at all.... + if ( gubMusicMode == MUSIC_NONE ) + { + fChangeMusic = TRUE; + } + -*/ + + if( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) + { + fChangeMusic = TRUE; + } + else + { + fChangeMusic = FALSE; + } + + + if ( fChangeMusic ) + { + SetMusicMode( MUSIC_MAIN_MENU ); + } + + // ATE: Do this stuff earlier! if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - ExamineDoorsOnEnteringSector( ); + // Update the last time we were in tactical... + gTacticalStatus.uiTimeSinceLastInTactical = GetWorldTotalMin( ); + + // init some AI stuff + InitializeTacticalStatusAtBattleStart(); + + // CJC: delay this until after entering the sector! + //InitAI(); + + // Check for helicopter being on the ground in this sector... + HandleHelicopterOnGroundSkyriderProfile( ); } - // Update all the doors in the sector according to the temp file previously - // loaded, and any changes made by the schedules - UpdateDoorGraphicsFromStatus( TRUE, FALSE ); + //Load and enter the new sector + if( EnterSector( gWorldSectorX, gWorldSectorY, bMapZ ) ) + { + // CJC: moved this here Feb 17 + if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) + { + InitAI(); + } - //Set the fact we have visited the sector - SetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_ALREADY_LOADED ); + //If there are any people with schedules, now is the time to process them. + //CJC: doesn't work here if we're going through the tactical placement GUI; moving + // this call to PrepareLoadedSector() + //PostSchedules(); - // Check for helicopter being on the ground in this sector... - HandleHelicopterOnGroundGraphic( ); - } - else - return( FALSE ); + // ATE: OK, add code here to update the states of doors if they should + // be closed...... + if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) + { + ExamineDoorsOnEnteringSector( ); + } - if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) - { - if( (gubMusicMode != MUSIC_TACTICAL_ENEMYPRESENT && gubMusicMode != MUSIC_TACTICAL_BATTLE) || + // Update all the doors in the sector according to the temp file previously + // loaded, and any changes made by the schedules + UpdateDoorGraphicsFromStatus( TRUE, FALSE ); + + //Set the fact we have visited the sector + SetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_ALREADY_LOADED ); + + // Check for helicopter being on the ground in this sector... + HandleHelicopterOnGroundGraphic( ); + } + else + return( FALSE ); + + if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) + { + if( (gubMusicMode != MUSIC_TACTICAL_ENEMYPRESENT && gubMusicMode != MUSIC_TACTICAL_BATTLE) || (!NumHostilesInSector( sMapX, sMapY, bMapZ ) && gubMusicMode == MUSIC_TACTICAL_ENEMYPRESENT) ) - { - // ATE; Fade FA.T.... - SetMusicFadeSpeed( 5 ); + { + // ATE; Fade FA.T.... + SetMusicFadeSpeed( 5 ); + + SetMusicMode( MUSIC_TACTICAL_NOTHING ); + } + + // ATE: Check what sector we are in, to show description if we have an RPC..... + HandleRPCDescriptionOfSector( sMapX, sMapY, bMapZ ); + + + + // ATE: Set Flag for being visited... + SetSectorFlag( sMapX, sMapY, bMapZ, SF_HAS_ENTERED_TACTICAL ); + + // ATE; Reset some flags for creature sayings.... + gTacticalStatus.fSaidCreatureFlavourQuote = FALSE; + gTacticalStatus.fHaveSeenCreature = FALSE; + gTacticalStatus.fBeenInCombatOnce = FALSE; + gTacticalStatus.fSaidCreatureSmellQuote = FALSE; + ResetMultiSelection( ); + + // ATE: Decide if we can have crows here.... + gTacticalStatus.fGoodToAllowCrows = FALSE; + gTacticalStatus.fHasEnteredCombatModeSinceEntering = FALSE; + gTacticalStatus.fDontAddNewCrows = FALSE; + + // Adjust delay for tense quote + gTacticalStatus.sCreatureTenseQuoteDelay = (INT16)( 10 + Random( 20 ) ); + + { + INT16 sWarpWorldX; + INT16 sWarpWorldY; + INT8 bWarpWorldZ; + INT16 sWarpGridNo; + + if ( GetWarpOutOfMineCodes( &sWarpWorldX, &sWarpWorldY, &bWarpWorldZ, &sWarpGridNo ) && gbWorldSectorZ >= 2 ) + { + gTacticalStatus.uiFlags |= IN_CREATURE_LAIR; + } + else + { + gTacticalStatus.uiFlags &= ( ~IN_CREATURE_LAIR ); + } + } + + // Every third turn + //if ( Random( 3 ) == 0 ) + { + if(gGameSettings.fOptions[ TOPTION_ALLOW_CROWS ] == TRUE) + { + gTacticalStatus.fGoodToAllowCrows = TRUE; + gTacticalStatus.ubNumCrowsPossible = (UINT8)( 5 + Random( 5 ) ); + } + } - SetMusicMode( MUSIC_TACTICAL_NOTHING ); } - // ATE: Check what sector we are in, to show description if we have an RPC..... - HandleRPCDescriptionOfSector( sMapX, sMapY, bMapZ ); - - - - // ATE: Set Flag for being visited... - SetSectorFlag( sMapX, sMapY, bMapZ, SF_HAS_ENTERED_TACTICAL ); - - // ATE; Reset some flags for creature sayings.... - gTacticalStatus.fSaidCreatureFlavourQuote = FALSE; - gTacticalStatus.fHaveSeenCreature = FALSE; - gTacticalStatus.fBeenInCombatOnce = FALSE; - gTacticalStatus.fSaidCreatureSmellQuote = FALSE; - ResetMultiSelection( ); - - // ATE: Decide if we can have crows here.... - gTacticalStatus.fGoodToAllowCrows = FALSE; - gTacticalStatus.fHasEnteredCombatModeSinceEntering = FALSE; - gTacticalStatus.fDontAddNewCrows = FALSE; - - // Adjust delay for tense quote - gTacticalStatus.sCreatureTenseQuoteDelay = (INT16)( 10 + Random( 20 ) ); - - { - INT16 sWarpWorldX; - INT16 sWarpWorldY; - INT8 bWarpWorldZ; - INT16 sWarpGridNo; - - if ( GetWarpOutOfMineCodes( &sWarpWorldX, &sWarpWorldY, &bWarpWorldZ, &sWarpGridNo ) && gbWorldSectorZ >= 2 ) - { - gTacticalStatus.uiFlags |= IN_CREATURE_LAIR; - } - else - { - gTacticalStatus.uiFlags &= ( ~IN_CREATURE_LAIR ); - } - } - - // Every third turn - //if ( Random( 3 ) == 0 ) - { - gTacticalStatus.fGoodToAllowCrows = TRUE; - gTacticalStatus.ubNumCrowsPossible = (UINT8)( 5 + Random( 5 ) ); - } - - } - - return( TRUE ); + return( TRUE ); } BOOLEAN MapExists( UINT8 * szFilename ) diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index b52dd037..a291d850 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1221,7 +1221,7 @@ STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags ) { // finds a structure that matches any of the given flags STRUCTURE * pCurrent; - if( sGridNo > WORLD_MAX-1 ) + if( sGridNo > WORLD_MAX-1 ) //bug fix for win98 crash when traveling between sectors return( NULL ); pCurrent = gpWorldLevelData[sGridNo].pStructureHead; diff --git a/Utils/Utils.vcproj b/Utils/Utils.vcproj index da3e0d36..6682cd64 100644 --- a/Utils/Utils.vcproj +++ b/Utils/Utils.vcproj @@ -3075,9 +3075,6 @@ - -