diff --git a/GameSettings.cpp b/GameSettings.cpp index 8a6ba5c31..6de756f93 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -2621,12 +2621,13 @@ void LoadModSettings(){ //[San Mona] gModSettings.usPornShopRoomHans = iniReader.ReadInteger("San Mona", "PORN_SHOP_ROOM_HANS", 49); - gModSettings.iHansGridNo = iniReader.ReadInteger("San Mona", "HANS_POSTION", 13523); + gModSettings.iHansGridNo = iniReader.ReadInteger("San Mona", "HANS_POSITION", 13523); gModSettings.usPornShopRoomBrenda = iniReader.ReadInteger("San Mona", "PORN_SHOP_ROOM_BRENDA", 47); gModSettings.usPornShopRoomTony = iniReader.ReadInteger("San Mona", "PORN_SHOP_ROOM_TONY", 50); gModSettings.ubPornShopTonySectorX = iniReader.ReadInteger("San Mona", "PORN_SHOP_TONY_SECTOR_X", 5); gModSettings.ubPornShopTonySectorY = iniReader.ReadInteger("San Mona", "PORN_SHOP_TONY_SECTOR_Y", 3); gModSettings.ubPornShopTonySectorZ = iniReader.ReadInteger("San Mona", "PORN_SHOP_TONY_SECTOR_Z", 0); + gModSettings.iPornShopEntranceGridNo = iniReader.ReadInteger("San Mona", "PORN_SHOP_ENTRANCE_GRIDNO", 13531); gModSettings.iKyleMoneyGridNo = iniReader.ReadInteger("San Mona", "KYLE_MONEY_POSITION", 14952); @@ -2680,6 +2681,10 @@ void LoadModSettings(){ //[Balime] //[Meduna] + gModSettings.ubQueenBasementSectorX = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_X", 3); + gModSettings.ubQueenBasementSectorY = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_Y", 16); + gModSettings.ubQueenBasementSectorZ = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_Z", 1); + gModSettings.iQueenAlternateGridNo = iniReader.ReadInteger("San Mona", "QUEEN_ALTERNATE_GRIDNO", 11448); //[Chitzena] diff --git a/GameSettings.h b/GameSettings.h index 451adb5aa..9def381a8 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -2026,6 +2026,7 @@ typedef struct UINT8 ubPornShopTonySectorX; UINT8 ubPornShopTonySectorY; UINT8 ubPornShopTonySectorZ; + INT32 iPornShopEntranceGridNo; // Kyle Lemmons Leather Shop Deed Quest INT32 iKyleMoneyGridNo; @@ -2084,6 +2085,11 @@ typedef struct //[Balime] //[Meduna] + //Queen's new gridno instead of the map pre-placed gridno if basement sector is cleared + UINT8 ubQueenBasementSectorX; + UINT8 ubQueenBasementSectorY; + UINT8 ubQueenBasementSectorZ; + INT32 iQueenAlternateGridNo; //[Chitzena] diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index 38ad13f1c..f2fd07951 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -269,17 +269,21 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B if ((bTownId != OMERTA) || (GetWorldDay() != 1)) { ubSectorID = (UINT8)SECTOR( sMapX, sMapY ); - if( !bMapZ && ubSectorID != SEC_J9 && ubSectorID != SEC_K4 ) + if( !bMapZ ) { HandleMoraleEvent( NULL, MORALE_TOWN_LIBERATED, sMapX, sMapY, bMapZ ); + // single sector towns does not give global loyalty bonus + if( GetTownSectorSize( bTownId ) != 1 ) + { #ifdef JA2UB //Ja25: no loyalty #else HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_TOWN_SECTOR, sMapX, sMapY, bMapZ ); #endif - // liberation by definition requires that the place was enemy controlled in the first place - CheckIfEntireTownHasBeenLiberated( bTownId, sMapX, sMapY ); + } + // liberation by definition requires that the place was enemy controlled in the first place + CheckIfEntireTownHasBeenLiberated( bTownId, sMapX, sMapY ); } } } @@ -368,8 +372,9 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B //Ja25 No strategic ai #else - if( sMapX == 3 && sMapY == 16 && bMapZ == 1 ) - { //Basement sector (P3_b1) + if( sMapX == gModSettings.ubQueenBasementSectorX && sMapY == gModSettings.ubQueenBasementSectorY + && bMapZ == gModSettings.ubQueenBasementSectorZ ) + { //Basement sector gfUseAlternateQueenPosition = TRUE; } #endif diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index dc2896f15..c553560bf 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -454,6 +454,9 @@ void ClearStrategicLog(); void RecalculatePatrolWeight( INT32 iPatrolID ); void RecalculateGarrisonWeight( INT32 iGarrisonID ); +extern INT8 GetTownAssociatedWithMine( INT8 bMineIndex ); +extern INT8 GetMineIndexForSector( INT16 sX, INT16 sY ); + INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinforcements ); INT32 PatrolReinforcementsRequested( INT32 iPatrolID ); @@ -5712,81 +5715,21 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, //will cause them to avoid the sector. Returns the number of redirected groups. RedirectEnemyGroupsMovingThroughSector( (UINT8)sSectorX, (UINT8)sSectorY ); - //For the purposes of a town being lost, we shall check to see if the queen wishes to investigate quickly after - //losing. This is done in town sectors when the character first takes it. - switch( ubSectorID ) + //For the purposes of a town being lost, we shall check to see if the queen wishes to investigate quickly after losing. + //This is done in town sectors when the character first takes it. + //Only town size greater than 1 will be investigated from other sectors of the same town + UINT8 ubTownId = GetTownIdForSector( sSectorX, sSectorY ); + + if( ubTownId != BLANK_SECTOR && GetTownSectorSize( ubTownId ) != 1 ) { - case SEC_B13: - case SEC_C13: - case SEC_D13: - //Drassen - SectorInfo[ SEC_B13 ].ubInvestigativeState++; - SectorInfo[ SEC_C13 ].ubInvestigativeState++; - SectorInfo[ SEC_D13 ].ubInvestigativeState++; - break; - case SEC_A2: - case SEC_B2: - //Chitzena - SectorInfo[ SEC_A2 ].ubInvestigativeState++; - SectorInfo[ SEC_B2 ].ubInvestigativeState++; - break; - case SEC_G1: - case SEC_G2: - case SEC_H1: - case SEC_H2: - case SEC_H3: - //Grumm - SectorInfo[ SEC_G1 ].ubInvestigativeState++; - SectorInfo[ SEC_G2 ].ubInvestigativeState++; - SectorInfo[ SEC_H1 ].ubInvestigativeState++; - SectorInfo[ SEC_H2 ].ubInvestigativeState++; - SectorInfo[ SEC_H3 ].ubInvestigativeState++; - break; - case SEC_F8: - case SEC_F9: - case SEC_G8: - case SEC_G9: - case SEC_H8: - //Cambria - SectorInfo[ SEC_F8 ].ubInvestigativeState++; - SectorInfo[ SEC_F9 ].ubInvestigativeState++; - SectorInfo[ SEC_G8 ].ubInvestigativeState++; - SectorInfo[ SEC_G9 ].ubInvestigativeState++; - SectorInfo[ SEC_H8 ].ubInvestigativeState++; - break; - case SEC_H13: - case SEC_H14: - case SEC_I13: - case SEC_I14: - //Alma - SectorInfo[ SEC_H13 ].ubInvestigativeState++; - SectorInfo[ SEC_H14 ].ubInvestigativeState++; - SectorInfo[ SEC_I13 ].ubInvestigativeState++; - SectorInfo[ SEC_I14 ].ubInvestigativeState++; - break; - case SEC_L11: - case SEC_L12: - //Balime - SectorInfo[ SEC_L11 ].ubInvestigativeState++; - SectorInfo[ SEC_L12 ].ubInvestigativeState++; - break; - case SEC_N3: - case SEC_N4: - case SEC_N5: - case SEC_O3: - case SEC_O4: - case SEC_P3: - //Meduna - SectorInfo[ SEC_N3 ].ubInvestigativeState++; - SectorInfo[ SEC_N4 ].ubInvestigativeState++; - SectorInfo[ SEC_N5 ].ubInvestigativeState++; - SectorInfo[ SEC_O3 ].ubInvestigativeState++; - SectorInfo[ SEC_O4 ].ubInvestigativeState++; - SectorInfo[ SEC_P3 ].ubInvestigativeState++; - break; - default: - return; + for( INT32 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ ) + { + if( StrategicMap[ i ].bNameId == ubTownId ) + SectorInfo[ STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ].ubInvestigativeState++; + } } + else + return; //Madd: tweaked to increase attacks for experienced and expert to 8 and 12, and unlimited for insane UINT8 value9; @@ -6080,32 +6023,18 @@ void RenderAIViewerGarrisonInfo( INT32 x, INT32 y, SECTORINFO *pSector ) void StrategicHandleMineThatRanOut( UINT8 ubSectorID ) { - Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ + // Queen will then have little interest in the town + Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ - switch( ubSectorID ) + UINT8 ubTownId = GetTownAssociatedWithMine( GetMineIndexForSector( SECTORX( ubSectorID ), SECTORY( ubSectorID ) ) ); + + if( ubTownId != BLANK_SECTOR ) { - case SEC_B2: - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_A2 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_B2 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - break; - case SEC_D13: - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_B13 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_C13 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_D13 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - break; - case SEC_H8: - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_F8 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_F9 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_G8 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_G9 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H8 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - break; - case SEC_I14: - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H13 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_H14 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_I13 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_I14 ].ubGarrisonID ].ubComposition ].bPriority /= 4; - break; + for( INT32 i = 0; i < MAP_WORLD_X * MAP_WORLD_Y + 1; i++ ) + { + if( StrategicMap[ i ].bNameId == ubTownId ) + gArmyComp[ gGarrisonGroup[ SectorInfo[ STRATEGIC_INDEX_TO_SECTOR_INFO( i ) ].ubGarrisonID ].ubComposition ].bPriority /= 4; + } } } diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index c87638cfd..8f1f95867 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -661,7 +661,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: set quest overrides")); // quest-related overrides - if ( gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_C ) + if ( gWorldSectorX == gModSettings.ubPornShopTonySectorX && gWorldSectorY == gModSettings.ubPornShopTonySectorY && gbWorldSectorZ == gModSettings.ubPornShopTonySectorZ ) { //DBrot: More rooms //UINT8 ubRoom; @@ -673,7 +673,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) if (tempDetailedPlacement.ubProfile == NO_PROFILE) {//dnl!!! // these guys should be guarding Tony! - tempDetailedPlacement.sInsertionGridNo = 13531 + + tempDetailedPlacement.sInsertionGridNo = gModSettings.iPornShopEntranceGridNo + (INT16) ( PreRandom( 8 ) * ( PreRandom( 1 ) ? -1 : 1) + PreRandom( 8 ) * ( PreRandom( 1 ) ? -1 : 1) * WORLD_ROWS ); @@ -694,7 +694,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) else if (tempDetailedPlacement.ubProfile == BILLY ) {//dnl!!! // billy should now be able to roam around - tempDetailedPlacement.sInsertionGridNo = 13531 + + tempDetailedPlacement.sInsertionGridNo = gModSettings.iPornShopEntranceGridNo + (INT16) ( PreRandom( 30 ) * ( PreRandom( 1 ) ? -1 : 1) + PreRandom( 30 ) * ( PreRandom( 1 ) ? -1 : 1) * WORLD_ROWS ); tempDetailedPlacement.bOrders = SEEKENEMY; @@ -714,7 +714,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) #ifdef JA2UB //Ja25: no queen #else - else if ( !gfInMeanwhile && gWorldSectorX == 3 && gWorldSectorY == 16 && !gbWorldSectorZ ) + else if ( !gfInMeanwhile && gWorldSectorX == gMercProfiles[ QUEEN ].sSectorX && gWorldSectorY == gMercProfiles[ QUEEN ].sSectorY && gbWorldSectorZ == gMercProfiles[ QUEEN ].bSectorZ ) { //Special civilian setup for queen's palace. if( gubFact[ FACT_QUEEN_DEAD ] ) { @@ -727,7 +727,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { if( gfUseAlternateQueenPosition && tempDetailedPlacement.ubProfile == QUEEN ) { - tempDetailedPlacement.sInsertionGridNo = 11448;//dnl!!! + tempDetailedPlacement.sInsertionGridNo = gModSettings.iQueenAlternateGridNo;//dnl!!! } if( tempDetailedPlacement.ubCivilianGroup != QUEENS_CIV_GROUP ) { //The free civilians aren't added if queen is alive @@ -746,7 +746,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) return( TRUE ); } } - else if ( gWorldSectorX == 13 && gWorldSectorY == MAP_ROW_C && gbWorldSectorZ == 0 ) + else if ( gWorldSectorX == gMercProfiles[ DOREEN ].sSectorX && gWorldSectorY == gMercProfiles[ DOREEN ].sSectorY && gbWorldSectorZ == gMercProfiles[ DOREEN ].bSectorZ ) { if ( CheckFact( FACT_KIDS_ARE_FREE, 0 ) ) {