mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Expanded feature: Militia Strategic Movement is turned on with ALLOW_MILITIA_STRATEGIC_COMMAND set to TRUE and allows plotting paths for the militia just like for merc squads.
GameDir >= r2204 is recommended. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7727 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1074,7 +1074,14 @@ void HandleDialogue( )
|
||||
if( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_TRIGGERPREBATTLEINTERFACE )
|
||||
{
|
||||
UnLockPauseState();
|
||||
|
||||
// Flugente: what hideous idiocy is this? We cast a UINT32 as GROUP*? This is likely to return garbage.
|
||||
// Why the hell not use the id instead?
|
||||
InitPreBattleInterface( (GROUP*)QItem->uiSpecialEventData, TRUE );
|
||||
|
||||
/*GROUP* pGroup = GetGroup( (UINT8)QItem->uiSpecialEventData );
|
||||
if ( pGroup )
|
||||
InitPreBattleInterface( pGroup, TRUE );*/
|
||||
}
|
||||
if( QItem->uiSpecialEventFlag & DIALOGUE_ADD_EVENT_FOR_SOLDIER_UPDATE_BOX )
|
||||
{
|
||||
|
||||
@@ -4010,6 +4010,9 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX,
|
||||
|
||||
void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens)
|
||||
{
|
||||
if ( !gGameExternalOptions.fMilitiaUseSectorInventory )
|
||||
return;
|
||||
|
||||
// atm there is no class-specific selection, but that might change in the future
|
||||
for (UINT8 i = 0; i < usElites; ++i)
|
||||
{
|
||||
|
||||
@@ -206,23 +206,24 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
SECTORINFO *pSector;
|
||||
INT32 x;
|
||||
UINT8 ubGreen, ubRegs, ubElites;
|
||||
|
||||
if( gbWorldSectorZ > 0 )
|
||||
return;
|
||||
|
||||
// Do we have a loaded sector?
|
||||
if ( gWorldSectorX ==0 && gWorldSectorY == 0 )
|
||||
if ( gWorldSectorX == 0 && gWorldSectorY == 0 )
|
||||
return;
|
||||
|
||||
for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
//for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
{
|
||||
//CHRISL: What's this assert for?
|
||||
//Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds(MercPtrs[i]->sGridNo));
|
||||
}
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
|
||||
ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
|
||||
ubElites = pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
ubGreen = MilitiaInSectorOfRank( gWorldSectorX, gWorldSectorY, GREEN_MILITIA );
|
||||
ubRegs = MilitiaInSectorOfRank( gWorldSectorX, gWorldSectorY, REGULAR_MILITIA );
|
||||
ubElites = MilitiaInSectorOfRank( gWorldSectorX, gWorldSectorY, ELITE_MILITIA );
|
||||
|
||||
// Prevent militia from just waiting on the border
|
||||
gTacticalStatus.Team[MILITIA_TEAM].bAwareOfOpposition = (pSector->uiFlags & SF_PLAYER_KNOWS_ENEMIES_ARE_HERE) != 0;
|
||||
@@ -270,7 +271,7 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
// }
|
||||
// }
|
||||
|
||||
for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
//for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
{
|
||||
//CHRISL: What's this assert for?
|
||||
//Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds(MercPtrs[i]->sGridNo));
|
||||
@@ -279,10 +280,10 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
|
||||
void HandleMilitiaPromotions( void )
|
||||
{
|
||||
UINT8 cnt;
|
||||
UINT8 ubMilitiaRank;
|
||||
SOLDIERTYPE * pTeamSoldier;
|
||||
UINT8 ubPromotions;
|
||||
UINT8 cnt;
|
||||
UINT8 ubMilitiaRank;
|
||||
SOLDIERTYPE* pTeamSoldier;
|
||||
UINT8 ubPromotions;
|
||||
|
||||
gbGreenToElitePromotions = 0;
|
||||
gbGreenToRegPromotions = 0;
|
||||
@@ -291,7 +292,7 @@ void HandleMilitiaPromotions( void )
|
||||
|
||||
cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID;
|
||||
|
||||
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++)
|
||||
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt, ++pTeamSoldier)
|
||||
{
|
||||
if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 )
|
||||
{
|
||||
@@ -303,18 +304,18 @@ void HandleMilitiaPromotions( void )
|
||||
{
|
||||
if( ubPromotions == 2 )
|
||||
{
|
||||
gbGreenToElitePromotions++;
|
||||
gbMilitiaPromotions++;
|
||||
++gbGreenToElitePromotions;
|
||||
++gbMilitiaPromotions;
|
||||
}
|
||||
else if( pTeamSoldier->ubSoldierClass == SOLDIER_CLASS_GREEN_MILITIA )
|
||||
{
|
||||
gbGreenToRegPromotions++;
|
||||
gbMilitiaPromotions++;
|
||||
++gbGreenToRegPromotions;
|
||||
++gbMilitiaPromotions;
|
||||
}
|
||||
else if( pTeamSoldier->ubSoldierClass == SOLDIER_CLASS_REG_MILITIA )
|
||||
{
|
||||
gbRegToElitePromotions++;
|
||||
gbMilitiaPromotions++;
|
||||
++gbRegToElitePromotions;
|
||||
++gbMilitiaPromotions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +323,7 @@ void HandleMilitiaPromotions( void )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( gbMilitiaPromotions )
|
||||
{
|
||||
// ATE: Problems here with bringing up message box...
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "DisplayCover.h"
|
||||
#include "worldman.h"
|
||||
#include "Queen Command.h"
|
||||
#include "strategicmap.h"
|
||||
|
||||
// sevenfm: need this for correct calculation of traits menu position
|
||||
extern INT16 gsInterfaceLevel;
|
||||
@@ -501,7 +502,7 @@ ReinforcementSector::Setup( UINT32 aVal )
|
||||
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ReinforcementNumber, sectornr ) );
|
||||
|
||||
// grey out if no reinforcements can be called from this sector
|
||||
if ( !NumNonPlayerTeamMembersInSector( loopX, loopY, MILITIA_TEAM ) )
|
||||
if ( !CanRequestMilitiaReinforcements( pSoldier->sSectorX, pSoldier->sSectorY, loopX, loopY ) )
|
||||
{
|
||||
// Set this option off.
|
||||
pOption->setAvail(new popupCallbackFunction<bool,void*>( &Popup_OptionOff, NULL ));
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
#include "LOS.h" // added by SANDRO
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "Interface Panels.h"
|
||||
#include "Queen Command.h" // added by Flugente
|
||||
#include "Town Militia.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#include "ub_config.h"
|
||||
@@ -17874,8 +17876,12 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN
|
||||
}
|
||||
else if ( bTeam == MILITIA_TEAM )
|
||||
{
|
||||
nummortars = (SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[GREEN_MILITIA] + SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[REGULAR_MILITIA] + SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[ELITE_MILITIA]) / gSkillTraitValues.usVOMortarCountDivisor;
|
||||
numshells = gSkillTraitValues.usVOMortarPointsAdmin * SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[GREEN_MILITIA] + gSkillTraitValues.usVOMortarPointsTroop * SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[REGULAR_MILITIA] + gSkillTraitValues.usVOMortarPointsElite * SectorInfo[usSectorNr].ubNumberOfCivsAtLevel[ELITE_MILITIA];
|
||||
UINT8 militia_green = MilitiaInSectorOfRank( sSectorX, sSectorY, GREEN_MILITIA );
|
||||
UINT8 militia_troop = MilitiaInSectorOfRank( sSectorX, sSectorY, REGULAR_MILITIA );
|
||||
UINT8 militia_elite = MilitiaInSectorOfRank( sSectorX, sSectorY, ELITE_MILITIA );
|
||||
|
||||
nummortars = (militia_green + militia_troop + militia_elite) / gSkillTraitValues.usVOMortarCountDivisor;
|
||||
numshells = gSkillTraitValues.usVOMortarPointsAdmin * militia_green + gSkillTraitValues.usVOMortarPointsTroop * militia_troop + gSkillTraitValues.usVOMortarPointsElite * militia_elite;
|
||||
}
|
||||
|
||||
if ( gSkillTraitValues.usVOMortarShellDivisor * nummortars < 1 )
|
||||
@@ -22110,8 +22116,8 @@ BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
||||
if ( bSectorZ > 0 || sSectorX < 1 || sSectorX >= MAP_WORLD_X - 1 || sSectorY < 1 || sSectorY >= MAP_WORLD_Y - 1 )
|
||||
return FALSE;
|
||||
|
||||
UINT16 usEnemies = (UINT16)NumEnemiesInAnySector( sSectorX, sSectorY, bSectorZ );
|
||||
UINT16 usMilitia = (UINT16)GetNumberOfMilitiaInSector( sSectorX, sSectorY, (INT16)bSectorZ );
|
||||
UINT16 usEnemies = (UINT16)NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
UINT16 usMilitia = (UINT16)NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM );
|
||||
UINT16 usMercs = (UINT16)PlayerMercsInSector( (UINT8)sSectorX, (UINT8)sSectorY, (UINT8)bSectorZ );
|
||||
|
||||
SECTORINFO *pSectorInfo = &(SectorInfo[SECTOR( sSectorX, sSectorY )]);
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "Map Edgepoints.h"
|
||||
#include "Campaign.h" // added by Flugente for HighestPlayerProgressPercentage()
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "Town Militia.h" // added by Flugente
|
||||
|
||||
BOOLEAN gfOriginalList = TRUE;
|
||||
|
||||
@@ -2825,17 +2826,13 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
if ( sMapZ > 0 )
|
||||
return;
|
||||
|
||||
SECTORINFO *pSector = &SectorInfo[ SECTOR( sMapX, sMapY ) ];
|
||||
if ( !pSector )
|
||||
return;
|
||||
|
||||
// does not work atm, time gets reset too early
|
||||
// not if we have recently been in this sector
|
||||
//if ( pSector->uiTimeCurrentSectorWasLastLoaded + 10 > GetWorldTotalMin() )
|
||||
//return;
|
||||
|
||||
// do not spawn if militia size is very small (we will be spotted much easier by the player)
|
||||
UINT32 totalmilitia = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] + pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
UINT32 totalmilitia = NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM );
|
||||
if ( totalmilitia < gGameExternalOptions.usAssassinMinimumMilitia )
|
||||
return;
|
||||
|
||||
@@ -2856,16 +2853,16 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ )
|
||||
return;
|
||||
|
||||
// now count militia, and which type (green, regular, elite) is most numerous - that will be the best type to blend in
|
||||
UINT8 militiacnt = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
|
||||
UINT8 militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA );
|
||||
UINT8 militiadisguise = GREEN_MILITIA;
|
||||
if ( pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] > militiacnt )
|
||||
if ( MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ) > militiacnt )
|
||||
{
|
||||
militiacnt = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
|
||||
militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA );
|
||||
militiadisguise = REGULAR_MILITIA;
|
||||
}
|
||||
if ( pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] > militiacnt )
|
||||
|
||||
if ( MilitiaInSectorOfRank( sMapX, sMapY, ELITE_MILITIA ) > militiacnt )
|
||||
{
|
||||
militiacnt = pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ];
|
||||
militiadisguise = ELITE_MILITIA;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "Quests.h"
|
||||
#include "Creature Spreading.h"
|
||||
#include "Queen Command.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -307,12 +308,14 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )//
|
||||
if( gTacticalStatus.fEnemyInSector )
|
||||
{
|
||||
if( gExitDialog.fMultipleSquadsInSector )
|
||||
{ //We have multiple squads in a hostile sector. That means that we can't load the adjacent sector.
|
||||
{
|
||||
//We have multiple squads in a hostile sector. That means that we can't load the adjacent sector.
|
||||
gExitDialog.fGotoSectorDisabled = TRUE;
|
||||
gExitDialog.fGotoSector = FALSE;
|
||||
}
|
||||
else if( GetNumberOfMilitiaInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) )
|
||||
{ //Leaving this sector will result in militia being forced to fight the battle, can't load adjacent sector.
|
||||
else if ( gbWorldSectorZ <= 0 && NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, MILITIA_TEAM ) )
|
||||
{
|
||||
//Leaving this sector will result in militia being forced to fight the battle, can't load adjacent sector.
|
||||
gExitDialog.fGotoSectorDisabled = TRUE;
|
||||
gExitDialog.fGotoSector = FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user