mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Massive effort to reign in militia problem. Still has issues :(
Fix: If only some of mercs go to a lower level (mine, basement, etc) but do not choose to "GO TO SECTOR", sector is still inaccessible from strategic map. However, watch for triggers that might happen on first visit to a sector, that fail. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1076 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ja2.rc
|
||||
// Used by ja2.rc and console.rc
|
||||
//
|
||||
#define IDI_ICON1 113
|
||||
#define IDI_ICON2 115
|
||||
|
||||
+1830
-1830
File diff suppressed because it is too large
Load Diff
@@ -85,7 +85,9 @@ INT32 giMaxEnemiesToRender = 40;
|
||||
INT32 giMaxMilitiaToRender = 20;//Changes depending on merc amount
|
||||
|
||||
extern UINT8 gubReinforcementMinEnemyStaticGroupSize;
|
||||
extern BOOLEAN gfStrategicMilitiaChangesMade;
|
||||
|
||||
extern void ResetMilitia();
|
||||
extern BOOLEAN AutoReload( SOLDIERTYPE *pSoldier );
|
||||
extern HVSURFACE ghFrameBuffer;
|
||||
BOOLEAN gfTransferTacticalOppositionToAutoResolve = FALSE;
|
||||
@@ -2469,6 +2471,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
||||
UnloadButtonImage( gpAR->iButtonImage[ i ] );
|
||||
RemoveButton( gpAR->iButton[ i ] );
|
||||
}
|
||||
|
||||
if( fDeleteForGood )
|
||||
{ //Warp the game time accordingly
|
||||
|
||||
@@ -2501,6 +2504,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
||||
gubSectorIDOfCreatureAttack = 0;
|
||||
}
|
||||
//VtPauseSampling();
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
|
||||
void PauseButtonCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
|
||||
@@ -702,7 +702,7 @@ void PauseTimeForInterupt()
|
||||
}
|
||||
|
||||
//USING CLOCK RESOLUTION
|
||||
//Note, that changing the clock resolution doesn't effect the amount of game time that passes per
|
||||
//Note, that changing the clock resolution doesn't affect the amount of game time that passes per
|
||||
//real second, but how many times per second the clock is updated. This rate will break up the actual
|
||||
//time slices per second into smaller chunks. This is useful for animating strategic movement under
|
||||
//fast time compression, so objects don't warp around.
|
||||
|
||||
@@ -5046,9 +5046,6 @@ void DisplayLevelString( void )
|
||||
// function to manipulate the number of towns people on the cursor
|
||||
BOOLEAN PickUpATownPersonFromSector( UINT8 ubType, INT16 sX, INT16 sY )
|
||||
{
|
||||
|
||||
|
||||
|
||||
// see if there are any militia of this type in this sector
|
||||
if( !SectorInfo[ SECTOR( sX, sY ) ].ubNumberOfCivsAtLevel[ ubType ] )
|
||||
{
|
||||
@@ -5067,7 +5064,7 @@ BOOLEAN PickUpATownPersonFromSector( UINT8 ubType, INT16 sX, INT16 sY )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
if( SECTOR( sX, sY ) == SECTOR( gWorldSectorX, gWorldSectorY ) )
|
||||
if( sX == gWorldSectorX && sY == gWorldSectorY )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
@@ -5115,11 +5112,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2");
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
if( SECTOR( sX, sY ) == SECTOR( gWorldSectorX, gWorldSectorY ) )
|
||||
if( sX == gWorldSectorX && sY == gWorldSectorY )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// drop the guy into this sector
|
||||
switch( ubType )
|
||||
{
|
||||
@@ -6119,6 +6117,12 @@ void MilitiaDoneButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
// reset fact we are in the box
|
||||
sSelectedMilitiaTown = 0;
|
||||
fMapPanelDirty = TRUE;
|
||||
|
||||
// Go ahead and reset the militia in the selected sector (even if we didn't change it here)
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,11 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY )
|
||||
if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];else
|
||||
if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];
|
||||
|
||||
// Update the militia if the current sector is affected
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
|
||||
// Creates militia at destination sector and removes it from starting sector
|
||||
@@ -176,6 +181,11 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL
|
||||
{--pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];}else
|
||||
if(pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])
|
||||
{--pTSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA];}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN MoveOneBestMilitiaMan(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY)
|
||||
@@ -481,6 +491,11 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
||||
return;
|
||||
|
||||
CreateMilitiaSquads( sMapX, sMapY );
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -530,12 +545,8 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY )
|
||||
|
||||
MoveMilitiaSquad( sMapX, sMapY, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ), FALSE );
|
||||
AddToBlockMoveList( SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ) );
|
||||
|
||||
if ( gWorldSectorX == SECTORX( pMoveDir[ iRandomRes ][0] ) &&
|
||||
gWorldSectorY == SECTORY( pMoveDir[ iRandomRes ][0] ) &&
|
||||
!gbWorldSectorZ )
|
||||
if ( gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
ResetMilitia();
|
||||
}
|
||||
|
||||
@@ -723,6 +734,12 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
}
|
||||
}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
RemoveMilitiaFromTactical();
|
||||
PrepareMilitiaForTactical();
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void MSCallBack( UINT8 ubResult )
|
||||
|
||||
@@ -911,6 +911,8 @@ void KillPreBattleInterface()
|
||||
{
|
||||
ShowButton( giCharInfoButton[ 1 ] );
|
||||
}
|
||||
|
||||
gfPersistantPBI = FALSE; // If killing the PBI, it must not be persistant anymore!
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1132,8 +1132,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
}
|
||||
}
|
||||
|
||||
//Well, not so rarely with mobile reinforcements!
|
||||
//Rarely, there will be more enemies than supported by the engine. In this case, these
|
||||
//soldier's are waiting for a slot to be free so that they can enter the battle. This
|
||||
//soldiers are waiting for a slot to be free so that they can enter the battle. This
|
||||
//essentially allows for an infinite number of troops, though only 32 at a time can fight.
|
||||
//This is also called whenever an enemy group's reinforcements arrive because the code is
|
||||
//identical, though it is highly likely that they will all be successfully added on the first call.
|
||||
@@ -1304,6 +1305,13 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
AddEnemiesToBattle( pGroup, ubStrategicInsertionCode, ubNumAdmins, ubNumTroops, ubNumElites, FALSE );
|
||||
gfPendingEnemies = TRUE;
|
||||
}
|
||||
|
||||
// If there are still more to contribute, then move the remaining back to the sector they came from.
|
||||
if (ubNumAvailable)
|
||||
{
|
||||
pGroup->ubSectorX = pGroup->ubPrevX;
|
||||
pGroup->ubSectorY = pGroup->ubPrevY;
|
||||
}
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,10 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
ubPredefinedInsertionCode = DoReinforcementAsPendingMilitia( gWorldSectorX, gWorldSectorY, &ubPredefinedRank );
|
||||
|
||||
if( ubPredefinedInsertionCode != 255 )
|
||||
{
|
||||
AddPossiblePendingMilitiaToBattle();
|
||||
gfStrategicMilitiaChangesMade = FALSE; // Handled them here
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,6 +51,8 @@
|
||||
|
||||
#include "MilitiaSquads.h"
|
||||
|
||||
extern UINT32 guiLastTacticalRealTime;
|
||||
|
||||
// the delay for a group about to arrive
|
||||
#define ABOUT_TO_ARRIVE_DELAY 5
|
||||
|
||||
@@ -1075,6 +1077,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
if( NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) )
|
||||
{
|
||||
fBattlePending = TRUE;
|
||||
StopTimeCompression();
|
||||
}
|
||||
|
||||
if( pGroup->uiFlags & GROUPFLAG_HIGH_POTENTIAL_FOR_AMBUSH && fBattlePending )
|
||||
@@ -1089,6 +1092,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
{
|
||||
fBloodCatAmbush = TRUE;
|
||||
fBattlePending = TRUE;
|
||||
StopTimeCompression();
|
||||
}
|
||||
|
||||
if( fBattlePending && (!fBloodCatAmbush || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE) )
|
||||
@@ -1118,7 +1122,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
}
|
||||
|
||||
if( fBattlePending )
|
||||
{ //A battle is pending, but the player's could be all unconcious or dead.
|
||||
{ //A battle is pending, but the players could be all unconcious or dead.
|
||||
//Go through every group until we find at least one concious merc. The looping will determine
|
||||
//if there are any live mercs and/or concious ones. If there are no concious mercs, but alive ones,
|
||||
//then we will go straight to autoresolve, where the enemy will likely annihilate them or capture them.
|
||||
@@ -1128,6 +1132,8 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
ValidateGroups( pGroup );
|
||||
#endif
|
||||
|
||||
StopTimeCompression();
|
||||
|
||||
if( gubNumGroupsArrivedSimultaneously )
|
||||
{ //Because this is a battle case, clear all the group flags
|
||||
curr = gpGroupList;
|
||||
@@ -1970,7 +1976,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
if ( !fGroupDestroyed )
|
||||
{
|
||||
//Determine if a battle should start.
|
||||
//if a battle does start, or get's delayed, then we will keep the group in memory including
|
||||
//if a battle does start, or gets delayed, then we will keep the group in memory including
|
||||
//all waypoints, until after the battle is resolved. At that point, we will continue the processing.
|
||||
if( fCheckForBattle && !CheckConditionsForBattle( pGroup ) && !gfWaitingForInput )
|
||||
{
|
||||
@@ -2706,6 +2712,8 @@ void SetGroupSectorValue( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT8
|
||||
}
|
||||
|
||||
CheckAndHandleUnloadingOfCurrentWorld();
|
||||
|
||||
SetSectorFlag( sSectorX, sSectorY, (UINT8) sSectorZ, SF_ALREADY_VISITED);
|
||||
}
|
||||
|
||||
void SetEnemyGroupSector( GROUP *pGroup, UINT8 ubSectorID )
|
||||
|
||||
@@ -119,7 +119,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
|
||||
|
||||
// force tactical to update militia status
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
|
||||
// ok, so what do we do with all this training? Well, in order of decreasing priority:
|
||||
// 1) If there's room in training sector, create new GREEN militia guys there
|
||||
@@ -148,6 +148,11 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
{
|
||||
// great! Create a new GREEN militia guy in the training sector
|
||||
StrategicAddMilitiaToSector(sMapX, sMapY, GREEN_MILITIA, 1);
|
||||
|
||||
if (sMapX == gWorldSectorX && sMapY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,6 +171,11 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// great! Create a new GREEN militia guy in the neighbouring sector
|
||||
StrategicAddMilitiaToSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1);
|
||||
|
||||
if (sNeighbourX == gWorldSectorX && sNeighbourY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
fFoundOne = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -183,6 +193,10 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// great! Promote a GREEN militia guy in the training sector to a REGULAR
|
||||
StrategicPromoteMilitiaInSector(sMapX, sMapY, GREEN_MILITIA, 1);
|
||||
fFoundOne = TRUE;
|
||||
if (sMapX == gWorldSectorX && sMapY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -200,6 +214,11 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// great! Promote a GREEN militia guy in the neighbouring sector to a REGULAR
|
||||
StrategicPromoteMilitiaInSector(sNeighbourX, sNeighbourY, GREEN_MILITIA, 1);
|
||||
|
||||
if (sNeighbourX == gWorldSectorX && sNeighbourY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
fFoundOne = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -217,6 +236,12 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
{
|
||||
// great! Promote a REGULAR militia guy in the training sector to a VETERAN
|
||||
StrategicPromoteMilitiaInSector(sMapX, sMapY, REGULAR_MILITIA, 1);
|
||||
|
||||
if (sMapX == gWorldSectorX && sMapY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
fFoundOne = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -235,6 +260,11 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
// great! Promote a Regular militia guy in the neighbouring sector to a Veteran
|
||||
StrategicPromoteMilitiaInSector(sNeighbourX, sNeighbourY, REGULAR_MILITIA, 1);
|
||||
|
||||
if (sNeighbourX == gWorldSectorX && sNeighbourY == gWorldSectorY)
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
fFoundOne = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -258,6 +288,10 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
ubMilitiaTrained++;
|
||||
}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
|
||||
// if anyone actually got trained
|
||||
if (ubMilitiaTrained > 0)
|
||||
@@ -333,6 +367,11 @@ void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 u
|
||||
|
||||
pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] += ubHowMany;
|
||||
|
||||
if (ubHowMany && sMapX == gWorldSectorX && sMapY == gWorldSectorY )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
// update the screen display
|
||||
fMapPanelDirty = TRUE;
|
||||
}
|
||||
@@ -354,6 +393,11 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa
|
||||
pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] -= ubHowMany;
|
||||
pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank + 1 ] += ubHowMany;
|
||||
|
||||
if (ubHowMany && sMapX == gWorldSectorX && sMapY == gWorldSectorY )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
// update the screen display
|
||||
fMapPanelDirty = TRUE;
|
||||
}
|
||||
@@ -374,6 +418,11 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI
|
||||
|
||||
pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] -= ubHowMany;
|
||||
|
||||
if (ubHowMany && sMapX == gWorldSectorX && sMapY == gWorldSectorY )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
|
||||
// update the screen display
|
||||
fMapPanelDirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -1753,7 +1753,16 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
// Check for helicopter being on the ground in this sector...
|
||||
HandleHelicopterOnGroundGraphic( );
|
||||
|
||||
ResetMilitia();
|
||||
// 0verhaul: Okay, it is apparent that the enemies are not reset incorrectly. So I will now try to add symmetry
|
||||
// between enemy placement and militia placement. The enemies do have one advantage here, though: If a sector
|
||||
// is in enemy hands, then their sector is not actually loaded. At least not normally. Perhaps it would be useful
|
||||
// to lose a battle with one group of mercs, then bring in another group without changing to another sector to see
|
||||
// if enemy integrity holds. But this would require the enemies to come up with reinforcements inbetween the battles
|
||||
// to really test out.
|
||||
//
|
||||
// Anyway, for now I will remove this call from here. The objective is to add militia any time we could add enemies
|
||||
// except for the case of training new militia. But that case can be handled each time militia training finishes.
|
||||
// ResetMilitia();
|
||||
AllTeamsLookForAll( TRUE );
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -3367,7 +3376,7 @@ void AllMercsWalkedToExitGrid()
|
||||
pPlayer = pPlayer->next;
|
||||
}
|
||||
|
||||
SetGroupSectorValue( (UINT8)gsAdjacentSectorX, (UINT8)gsAdjacentSectorY, gbAdjacentSectorZ, gpAdjacentGroup->ubGroupID );
|
||||
SetGroupSectorValue( gsAdjacentSectorX, gsAdjacentSectorY, (INT16) gbAdjacentSectorZ, gpAdjacentGroup->ubGroupID );
|
||||
AttemptToMergeSeparatedGroups( gpAdjacentGroup, FALSE );
|
||||
|
||||
SetDefaultSquadOnSectorEntry( TRUE );
|
||||
@@ -3412,7 +3421,7 @@ void AllMercsWalkedToExitGrid()
|
||||
|
||||
pPlayer = pPlayer->next;
|
||||
}
|
||||
SetGroupSectorValue( gsAdjacentSectorX, gsAdjacentSectorY, gbAdjacentSectorZ, gpAdjacentGroup->ubGroupID );
|
||||
SetGroupSectorValue( gsAdjacentSectorX, gsAdjacentSectorY, (INT16) gbAdjacentSectorZ, gpAdjacentGroup->ubGroupID );
|
||||
AttemptToMergeSeparatedGroups( gpAdjacentGroup, FALSE );
|
||||
|
||||
gFadeOutDoneCallback = DoneFadeOutExitGridSector;
|
||||
|
||||
@@ -126,47 +126,66 @@ void ResetMilitia()
|
||||
UINT8 ubNumVet = 0;
|
||||
UINT32 cnt;
|
||||
|
||||
if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
fBattleInProgress = TRUE;
|
||||
// if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
// fBattleInProgress = TRUE;
|
||||
|
||||
// 0verhaul: Instead of relying on the "changes made" flag, which isn't even saved in a saved game and therefore not
|
||||
// reliable, we'll just do this the hard way, by taking inventory.
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
for (cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; cnt++)
|
||||
// gfStrategicMilitiaChangesMade = FALSE;
|
||||
// for (cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; cnt++)
|
||||
// {
|
||||
// if (!MercPtrs[cnt]->bActive)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// switch (MercPtrs[cnt]->ubSoldierClass)
|
||||
// {
|
||||
// case SOLDIER_CLASS_GREEN_MILITIA: ubNumGreen++; break;
|
||||
// case SOLDIER_CLASS_REG_MILITIA: ubNumReg++; break;
|
||||
// case SOLDIER_CLASS_ELITE_MILITIA: ubNumVet++; break;
|
||||
// default: ;
|
||||
// }
|
||||
// }
|
||||
// if (MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, GREEN_MILITIA) != ubNumGreen ||
|
||||
// MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, REGULAR_MILITIA) != ubNumReg ||
|
||||
// MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, ELITE_MILITIA) != ubNumVet)
|
||||
// {
|
||||
// gfStrategicMilitiaChangesMade = TRUE;
|
||||
// }
|
||||
//
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
if (!MercPtrs[cnt]->bActive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// I truly hope that we remove such inane control methods from the soldier create code when we break the merc slot barrier
|
||||
// Hacks like this really depress me.
|
||||
UINT32 cs = guiCurrentScreen;
|
||||
// Make sure we aren't on the AUTORESOLVE screen for this. Even if we are. We are removing and creating soldiers for
|
||||
// tactical here, not autoresolve. In my opinion the CreateSoldierXXX and TacticalRemoveSoldierXXX functions should take
|
||||
// a flag for autoresolve if different initialization or destruction is desired.
|
||||
guiCurrentScreen = GAME_SCREEN;
|
||||
|
||||
|
||||
switch (MercPtrs[cnt]->ubSoldierClass)
|
||||
{
|
||||
case SOLDIER_CLASS_GREEN_MILITIA: ubNumGreen++; break;
|
||||
case SOLDIER_CLASS_REG_MILITIA: ubNumReg++; break;
|
||||
case SOLDIER_CLASS_ELITE_MILITIA: ubNumVet++; break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
if (MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, GREEN_MILITIA) != ubNumGreen ||
|
||||
MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, REGULAR_MILITIA) != ubNumReg ||
|
||||
MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, ELITE_MILITIA) != ubNumVet)
|
||||
{
|
||||
RemoveMilitiaFromTactical();
|
||||
ubNumGreen = MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, GREEN_MILITIA);
|
||||
ubNumReg = MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, REGULAR_MILITIA);
|
||||
ubNumVet = MilitiaInSectorOfRank(gWorldSectorX, gWorldSectorY, ELITE_MILITIA);
|
||||
|
||||
AddSoldierInitListMilitia( ubNumGreen, ubNumReg, ubNumVet );
|
||||
|
||||
// Now restore the original screen setting so the game doesn't go wacky.
|
||||
guiCurrentScreen = cs;
|
||||
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
}
|
||||
|
||||
// if( ( gfStrategicMilitiaChangesMade && !fBattleInProgress ) || gTacticalStatus.uiFlags & LOADING_SAVED_GAME || gfMSResetMilitia )
|
||||
if(gfMSResetMilitia )
|
||||
{
|
||||
// if(gfMSResetMilitia )
|
||||
// {
|
||||
// if( !gfMSResetMilitia )
|
||||
// RemoveMilitiaFromTactical();
|
||||
PrepareMilitiaForTactical();
|
||||
gfMSResetMilitia = FALSE;
|
||||
}
|
||||
// PrepareMilitiaForTactical();
|
||||
// gfMSResetMilitia = FALSE;
|
||||
// }
|
||||
}
|
||||
|
||||
void RemoveMilitiaFromTactical()
|
||||
@@ -212,17 +231,22 @@ void PrepareMilitiaForTactical()
|
||||
{
|
||||
for( x = 0 ; x < guiDirNumber ; ++x )
|
||||
{
|
||||
#if 0
|
||||
// ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] );
|
||||
if( gfMSResetMilitia )
|
||||
{
|
||||
if( gpAttackDirs[ x ][ 3 ] != INSERTION_CODE_CENTER )
|
||||
{
|
||||
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
ubGreen -= gpAttackDirs[ x ][0];
|
||||
ubRegs -= gpAttackDirs[ x ][1];
|
||||
ubElites -= gpAttackDirs[ x ][2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( gpAttackDirs[ x ][ 3 ] == INSERTION_CODE_CENTER )
|
||||
#endif
|
||||
if( gpAttackDirs[ x ][ 3 ] == INSERTION_CODE_CENTER )
|
||||
{
|
||||
AddSoldierInitListMilitia( gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
}
|
||||
@@ -230,7 +254,7 @@ void PrepareMilitiaForTactical()
|
||||
{
|
||||
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -247,6 +271,7 @@ void PrepareMilitiaForTactical()
|
||||
// }
|
||||
// }
|
||||
guiDirNumber = 0;
|
||||
memset( gpAttackDirs, 0, sizeof( gpAttackDirs));
|
||||
}
|
||||
|
||||
void HandleMilitiaPromotions( void )
|
||||
@@ -302,6 +327,11 @@ void HandleMilitiaPromotions( void )
|
||||
// BuildMilitiaPromotionsString( str );
|
||||
// DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
ResetMilitia();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3423,8 +3423,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
|
||||
|
||||
if (bMilitiaRank != -1)
|
||||
{
|
||||
BOOLEAN NeedReset = gfStrategicMilitiaChangesMade;
|
||||
// remove this militia from the strategic records
|
||||
StrategicRemoveMilitiaFromSector( gWorldSectorX, gWorldSectorY, bMilitiaRank, 1 );
|
||||
gfStrategicMilitiaChangesMade = NeedReset;
|
||||
}
|
||||
|
||||
// If the militia's killer is known
|
||||
|
||||
@@ -1430,6 +1430,7 @@ BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehi
|
||||
{
|
||||
DeleteSoldier( pSoldier );
|
||||
}
|
||||
|
||||
MemFree( pSoldier );
|
||||
}
|
||||
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ja2.rc
|
||||
//
|
||||
#define IDI_ICON1 113
|
||||
#define IDI_ICON2 115
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 114
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define ID_ABOUT 116
|
||||
#define IDD_ABOUT 117
|
||||
#define ID_COPY 118
|
||||
#define ID_PASTE 119
|
||||
#define ID_EXIT_CONSOLE 120
|
||||
#define IDR_POPUP_MENU 130
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user