mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Editor: Disable light sprites that are not in bounds. Actually happens in some sectors (ie Drassen)
Editor: Fix for use of uninitialized variable in undo Editor: Fix for clipping bounds that are offscreen (causes crash) Fix for AP bonus reading from INI Fix mine indexes when looking for creature infestation of mines Final (?) fix for militia reinforcements. Also a change: If you refuse reinforcements, none will come for the entirety of the battle Increase size of cover and LOS grids to fit max radius Fix for uninitialized light level in DistanceVisible Move CheckForEndOfBattle to end of ReduceAttackBusy, to remove a possible militia invalidate upon promotion Change the way Alt-L handles reloading git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1142 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -325,26 +325,26 @@ void InitCreatureQuest()
|
||||
//Default them all to infectible
|
||||
memset( fMineInfectible, 1, sizeof( BOOLEAN ) * 4 );
|
||||
|
||||
if( gMineStatus[ DRASSEN_MINE ].fAttackedHeadMiner ||
|
||||
gMineStatus[ DRASSEN_MINE ].uiOreRunningOutPoint ||
|
||||
if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner ||
|
||||
gMineStatus[ MINE_DRASSEN ].uiOreRunningOutPoint ||
|
||||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled )
|
||||
{ //If head miner was attacked, ore will/has run out, or enemy controlled
|
||||
fMineInfectible[ 0 ] = FALSE;
|
||||
}
|
||||
if( gMineStatus[ CAMBRIA_MINE ].fAttackedHeadMiner ||
|
||||
gMineStatus[ CAMBRIA_MINE ].uiOreRunningOutPoint ||
|
||||
if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner ||
|
||||
gMineStatus[ MINE_CAMBRIA ].uiOreRunningOutPoint ||
|
||||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled )
|
||||
{ //If head miner was attacked, ore will/has run out, or enemy controlled
|
||||
fMineInfectible[ 1 ] = FALSE;
|
||||
}
|
||||
if( gMineStatus[ ALMA_MINE ].fAttackedHeadMiner ||
|
||||
gMineStatus[ ALMA_MINE ].uiOreRunningOutPoint ||
|
||||
if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner ||
|
||||
gMineStatus[ MINE_ALMA ].uiOreRunningOutPoint ||
|
||||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled )
|
||||
{ //If head miner was attacked, ore will/has run out, or enemy controlled
|
||||
fMineInfectible[ 2 ] = FALSE;
|
||||
}
|
||||
if( gMineStatus[ GRUMM_MINE ].fAttackedHeadMiner ||
|
||||
gMineStatus[ GRUMM_MINE ].uiOreRunningOutPoint ||
|
||||
if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner ||
|
||||
gMineStatus[ MINE_GRUMM ].uiOreRunningOutPoint ||
|
||||
StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled )
|
||||
{ //If head miner was attacked, ore will/has run out, or enemy controlled
|
||||
fMineInfectible[ 3 ] = FALSE;
|
||||
|
||||
+17
-43
@@ -25,7 +25,6 @@
|
||||
#include "math.h"
|
||||
#include "Auto Resolve.h"
|
||||
#include "Vehicles.h"
|
||||
#include "Soldier Init List.h"
|
||||
#endif
|
||||
|
||||
#include "MilitiaSquads.h"
|
||||
@@ -691,7 +690,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
|
||||
BOOLEAN fMoreTroopsLeft[4] = {FALSE,FALSE,FALSE,FALSE};
|
||||
BOOLEAN fFirstLoop = TRUE;
|
||||
BOOLEAN fMilitiaAlreadyBeen = CountMilitia(pSectorInfo )>0 && gWorldSectorX == sMapX && gWorldSectorY == sMapY && gbWorldSectorZ == 0;
|
||||
BOOLEAN fMilitiaMoved = FALSE;
|
||||
|
||||
guiDirNumber = 0;
|
||||
|
||||
@@ -715,7 +714,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
|
||||
if( fMoreTroopsLeft[ x ] )
|
||||
{
|
||||
if( fMilitiaAlreadyBeen )gfMSResetMilitia = TRUE;
|
||||
fMilitiaMoved = TRUE;
|
||||
|
||||
gpAttackDirs[ x + 1 ][0] += pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA] - uiNumGreen;
|
||||
gpAttackDirs[ x + 1 ][1] += pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA] - uiNumReg;
|
||||
@@ -735,50 +734,18 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
}
|
||||
}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
{
|
||||
RemoveMilitiaFromTactical();
|
||||
//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
|
||||
{
|
||||
#endif
|
||||
if( gpAttackDirs[ x ][ 3 ] == INSERTION_CODE_CENTER )
|
||||
{
|
||||
AddSoldierInitListMilitia( gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
}
|
||||
else
|
||||
{
|
||||
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
}
|
||||
|
||||
guiDirNumber = 0;
|
||||
memset( gpAttackDirs, 0, sizeof( gpAttackDirs));
|
||||
// If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic
|
||||
// changes were made. Either case, this flag should be false.
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
}
|
||||
|
||||
void MSCallBack( UINT8 ubResult )
|
||||
{
|
||||
if( ubResult == MSG_BOX_RETURN_YES )
|
||||
{
|
||||
gTacticalStatus.uiFlags |= WANT_MILITIA_REINFORCEMENTS;
|
||||
DoMilitiaHelpFromAdjacentSectors( sMSMapX, sMSMapY );
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY )
|
||||
@@ -802,13 +769,20 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
{
|
||||
sMSMapX = sMapX;
|
||||
sMSMapY = sMapY;
|
||||
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
|
||||
|
||||
if( !gGameExternalOptions.gfAllowMilitiaGroups )
|
||||
return;
|
||||
|
||||
if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES );
|
||||
gTacticalStatus.uiFlags &= (~WANT_MILITIA_REINFORCEMENTS);
|
||||
|
||||
if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle )
|
||||
guiDirNumber = 0;
|
||||
|
||||
// if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES );
|
||||
|
||||
// This is no longer a question of simply whether to have a full militia count, but also whether we want
|
||||
// reinforcements. So if there are any available, always ask.
|
||||
if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) ) // && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle )
|
||||
DoScreenIndependantMessageBox( gzCWStrings[0], MSG_BOX_FLAG_YESNO, MSCallBack );
|
||||
}
|
||||
|
||||
|
||||
@@ -3216,7 +3216,7 @@ void HandleArrivalOfReinforcements( GROUP *pGroup )
|
||||
|
||||
if( pGroup->fPlayer )
|
||||
{ //We don't have to worry about filling up the player slots, because it is impossible
|
||||
//to have more player's in the game then the number of slots available for the player.
|
||||
//to have more players in the game than the number of slots available for the player.
|
||||
PLAYERGROUP *pPlayer;
|
||||
UINT8 ubStrategicInsertionCode;
|
||||
//First, determine which entrypoint to use, based on the travel direction of the group.
|
||||
|
||||
@@ -1730,15 +1730,18 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
// 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.
|
||||
//Inserts the enemies into the already 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.
|
||||
|
||||
PrepareMilitiaForTactical( FALSE);
|
||||
|
||||
SetPendingNewScreen(GAME_SCREEN);
|
||||
if( !NumEnemyInSector( ) )
|
||||
{
|
||||
PrepareEnemyForSectorBattle();
|
||||
}
|
||||
|
||||
if( gubNumCreaturesAttackingTown && !gbWorldSectorZ &&
|
||||
gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) )
|
||||
{
|
||||
@@ -2072,7 +2075,7 @@ void PrepareLoadedSector()
|
||||
|
||||
PrepareCreaturesForBattle();
|
||||
|
||||
PrepareMilitiaForTactical();
|
||||
PrepareMilitiaForTactical(TRUE);
|
||||
|
||||
// OK, set varibles for entring this new sector...
|
||||
gTacticalStatus.fVirginSector = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user