mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Space Viking's many mercs changes plus numerous generic bug fixes
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2498 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+89
-21
@@ -61,6 +61,7 @@
|
||||
#include "Map Screen Interface Map Inventory.h"
|
||||
#include "interface dialogue.h"
|
||||
#endif
|
||||
#include <vector>
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
@@ -197,7 +198,7 @@ BOOLEAN gfAddDisplayBoxToWaitingQueue = FALSE;
|
||||
// redraw character list
|
||||
extern BOOLEAN fDrawCharacterList;
|
||||
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
SOLDIERTYPE *gpDismissSoldier = NULL;
|
||||
|
||||
@@ -517,6 +518,8 @@ void ChangeSoldiersAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment )
|
||||
// values like fFixingRobot. It will clear all subsidiary values so we don't leave the merc in a messed
|
||||
// up state!
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
pSoldier->bAssignment = bAssignment;
|
||||
/// don't kill iVehicleId, though, 'cause militia training tries to put guys back in their vehicles when it's done(!)
|
||||
|
||||
@@ -540,6 +543,7 @@ void ChangeSoldiersAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment )
|
||||
|
||||
BOOLEAN BasicCanCharacterAssignment( SOLDIERTYPE * pSoldier, BOOLEAN fNotInCombat )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
// global conditions restricting all assignment changes
|
||||
if ( SectorIsImpassable( (INT16) SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) )
|
||||
{
|
||||
@@ -559,6 +563,7 @@ BOOLEAN BasicCanCharacterAssignment( SOLDIERTYPE * pSoldier, BOOLEAN fNotInComba
|
||||
/*
|
||||
BOOLEAN CanSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
switch( bAssignment )
|
||||
{
|
||||
case( DOCTOR ):
|
||||
@@ -596,6 +601,7 @@ BOOLEAN CanSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment )
|
||||
|
||||
BOOLEAN CanCharacterDoctorButDoesntHaveMedKit( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -656,6 +662,8 @@ BOOLEAN CanCharacterDoctor( SOLDIERTYPE *pSoldier )
|
||||
BOOLEAN fFoundMedKit = FALSE;
|
||||
INT8 bPocket = 0;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -694,6 +702,7 @@ BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
INT32 iCounter;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// items?
|
||||
if ( DoesCharacterHaveAnyItemsToRepair( pSoldier, FINAL_REPAIR_PASS ) )
|
||||
@@ -739,6 +748,8 @@ BOOLEAN HasCharacterFinishedRepairing( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
BOOLEAN fCanStillRepair;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// NOTE: This must detect situations where the vehicle/robot has left the sector, in which case we want the
|
||||
// guy to say "assignment done", so we return that he can no longer repair
|
||||
|
||||
@@ -772,6 +783,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
|
||||
OBJECTTYPE * pObj;
|
||||
UINT8 ubPassType;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// check for jams
|
||||
// CHRISL: Changed to dynamically determine max inventory locations.
|
||||
@@ -852,6 +864,8 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
|
||||
|
||||
BOOLEAN BasicCanCharacterRepair( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -907,6 +921,8 @@ BOOLEAN BasicCanCharacterRepair( SOLDIERTYPE * pSoldier )
|
||||
|
||||
BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( BasicCanCharacterRepair( pSoldier ) == FALSE )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -925,6 +941,7 @@ BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier )
|
||||
// check that character is alive, oklife, has repair skill, and equipment, etc.
|
||||
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
@@ -959,6 +976,8 @@ BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
|
||||
// can character be set to patient?
|
||||
BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -1019,6 +1038,8 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
// they must be alive/conscious and in the sector with the town
|
||||
BOOLEAN fSamSitePresent = FALSE;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -1111,6 +1132,7 @@ BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
|
||||
BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if (gGameExternalOptions.gfmusttrainroaming
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiAllowMilitiaGroupsDelay)
|
||||
@@ -1150,7 +1172,6 @@ BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pSoldier )
|
||||
|
||||
BOOLEAN DoesTownHaveRatingToTrainMilitia( INT8 bTownId )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Assignments1");
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Assignments1");
|
||||
// min loyalty rating?
|
||||
if( ( gTownLoyalty[ bTownId ].ubRating < gGameExternalOptions.iMinLoyaltyToTrain ) )
|
||||
@@ -1169,6 +1190,7 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol
|
||||
INT8 bTownId = 0;
|
||||
BOOLEAN fSamSitePresent = FALSE;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// underground training is not allowed (code doesn't support and it's a reasonable enough limitation)
|
||||
if( pSoldier->bSectorZ != 0 )
|
||||
@@ -1209,6 +1231,8 @@ INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier )
|
||||
SOLDIERTYPE * pOtherSoldier;
|
||||
INT8 bCount = 0;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ )
|
||||
{
|
||||
pOtherSoldier = MercPtrs[ bLoop ];
|
||||
@@ -1230,6 +1254,7 @@ BOOLEAN IsMilitiaTrainableFromSoldiersSectorMaxed( SOLDIERTYPE *pSoldier, INT8 i
|
||||
INT8 bTownId = 0;
|
||||
BOOLEAN fSamSitePresent = FALSE;
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if( pSoldier->bSectorZ != 0 )
|
||||
{
|
||||
@@ -1269,6 +1294,8 @@ BOOLEAN CanCharacterTrainStat( SOLDIERTYPE *pSoldier, INT8 bStat, BOOLEAN fTrain
|
||||
{
|
||||
// is the character capable of training this stat? either self or as trainer
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -1453,6 +1480,8 @@ BOOLEAN CanCharacterOnDuty( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// can character commit themselves to on duty?
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// only need to be alive and well to do so right now
|
||||
// alive and conscious
|
||||
if( pSoldier->stats.bLife < OKLIFE )
|
||||
@@ -1514,6 +1543,8 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// can character practise right now?
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -1571,6 +1602,7 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier )
|
||||
|
||||
BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// can character train at all
|
||||
if( CanCharacterPractise( pSoldier ) == FALSE )
|
||||
@@ -1592,6 +1624,7 @@ BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
|
||||
|
||||
BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// can character train at all
|
||||
if( CanCharacterPractise( pSoldier ) == FALSE )
|
||||
@@ -1616,6 +1649,8 @@ BOOLEAN CanCharacterSleep( SOLDIERTYPE *pSoldier, BOOLEAN fExplainWhyNot )
|
||||
{
|
||||
CHAR16 sString[ 128 ];
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// dead or dying?
|
||||
if( pSoldier->stats.bLife < OKLIFE )
|
||||
{
|
||||
@@ -1726,6 +1761,8 @@ BOOLEAN CanCharacterBeAwakened( SOLDIERTYPE *pSoldier, BOOLEAN fExplainWhyNot )
|
||||
{
|
||||
CHAR16 sString[ 128 ];
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// if dead tired
|
||||
if( ( pSoldier->bBreathMax <= BREATHMAX_ABSOLUTE_MINIMUM ) && !pSoldier->flags.fMercCollapsedFlag )
|
||||
{
|
||||
@@ -1754,6 +1791,8 @@ BOOLEAN CanCharacterVehicle( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// can character enter/leave vehicle?
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
@@ -1828,8 +1867,8 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue )
|
||||
// can character join this squad?
|
||||
INT16 sX, sY, sZ;
|
||||
|
||||
|
||||
Assert( bSquadValue < ON_DUTY );
|
||||
AssertLT( bSquadValue, ON_DUTY );
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
if ( pSoldier->bAssignment == bSquadValue )
|
||||
{
|
||||
@@ -1904,6 +1943,7 @@ INT8 CanCharacterSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue )
|
||||
|
||||
BOOLEAN IsCharacterInTransit( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// valid character?
|
||||
if( pSoldier == NULL )
|
||||
@@ -2014,7 +2054,7 @@ void VerifyTownTrainingIsPaidFor( void )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -2080,6 +2120,7 @@ UINT8 GetNumberThatCanBeDoctored( SOLDIERTYPE *pDoctor, BOOLEAN fThisHour, BOOLE
|
||||
SOLDIERTYPE *pSoldier = MercPtrs[0], *pTeamSoldier = NULL;
|
||||
UINT8 ubNumberOfPeople = 0;
|
||||
|
||||
AssertNotNIL(pDoctor);
|
||||
|
||||
// go through list of characters, find all who are patients/doctors healable by this doctor
|
||||
for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++)
|
||||
@@ -2103,6 +2144,8 @@ SOLDIERTYPE *AnyDoctorWhoCanHealThisPatient( SOLDIERTYPE *pPatient, BOOLEAN fThi
|
||||
int cnt;
|
||||
SOLDIERTYPE *pSoldier = MercPtrs[0], *pTeamSoldier = NULL;
|
||||
|
||||
AssertNotNIL(pPatient);
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
// go through list of characters, find all who are patients/doctors healable by this doctor
|
||||
for ( cnt = 0, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++)
|
||||
@@ -2129,6 +2172,9 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
|
||||
UINT16 usKitPts = 0;
|
||||
INT8 bMedFactor;
|
||||
|
||||
AssertNotNIL(pDoctor);
|
||||
AssertNotNIL(pusMaxPts);
|
||||
|
||||
// make sure he has a medkit in his hand, and preferably make it a medical bag, not a first aid kit
|
||||
if( fMakeSureKitIsInHand )
|
||||
{
|
||||
@@ -2487,7 +2533,7 @@ BOOLEAN IsSoldierCloseEnoughToADoctor( SOLDIERTYPE *pPatient )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
pSoldier = &Menptr[ iCounter ];
|
||||
|
||||
@@ -2971,8 +3017,8 @@ OBJECTTYPE* FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPa
|
||||
INT8 bSlotToCheck;
|
||||
OBJECTTYPE * pObj;
|
||||
|
||||
|
||||
Assert( ubPassType < NUM_REPAIR_PASS_TYPES );
|
||||
AssertLT( ubPassType, NUM_REPAIR_PASS_TYPES );
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
pPassList = &( gRepairPassSlotList[ ubPassType ] );
|
||||
|
||||
@@ -2980,7 +3026,7 @@ OBJECTTYPE* FindRepairableItemOnOtherSoldier( SOLDIERTYPE * pSoldier, UINT8 ubPa
|
||||
for ( bLoop = 0; bLoop < pPassList->ubChoices[UsingNewInventorySystem()]; bLoop++ )
|
||||
{
|
||||
bSlotToCheck = pPassList->bSlot[ bLoop ];
|
||||
Assert( bSlotToCheck != -1 );
|
||||
AssertNE( bSlotToCheck, -1 );
|
||||
|
||||
for ( bLoop2 = 0; bLoop2 < pSoldier->inv[ bSlotToCheck ].ubNumberOfObjects; bLoop2++ )
|
||||
{
|
||||
@@ -3008,6 +3054,8 @@ OBJECTTYPE* FindRepairableItemInLBENODE( OBJECTTYPE * pObj, UINT8 subObject)
|
||||
{
|
||||
OBJECTTYPE * pObject;
|
||||
|
||||
AssertNotNIL(pObj);
|
||||
|
||||
if(UsingNewInventorySystem() == false)
|
||||
return( 0 );
|
||||
|
||||
@@ -3039,6 +3087,7 @@ OBJECTTYPE* FindRepairableItemInLBENODE( OBJECTTYPE * pObj, UINT8 subObject)
|
||||
|
||||
OBJECTTYPE* FindRepairableItemInSpecificPocket( OBJECTTYPE * pObj, UINT8 subObject)
|
||||
{
|
||||
AssertNotNIL(pObj);
|
||||
if ( IsItemRepairable( pObj->usItem, (*pObj)[subObject]->data.objectStatus ) )
|
||||
{
|
||||
return( pObj );
|
||||
@@ -3060,6 +3109,10 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, UI
|
||||
{
|
||||
INT16 sRepairCostAdj;
|
||||
UINT16 usDamagePts, usPtsFixed;
|
||||
|
||||
AssertNotNIL (pSoldier);
|
||||
AssertNotNIL (pbStatus);
|
||||
AssertNotNIL (pubRepairPtsLeft);
|
||||
|
||||
// get item's repair ease, for each + point is 10% easier, each - point is 10% harder to repair
|
||||
sRepairCostAdj = 100 - ( 10 * Item[ usItem ].bRepairEase );
|
||||
@@ -3528,7 +3581,9 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
SOLDIERTYPE *pStatTrainerList[ NUM_TRAINABLE_STATS ]; // can't have more "best" trainers than trainable stats
|
||||
INT16 sBestTrainingPts;
|
||||
INT16 sTownTrainingPts;
|
||||
TOWN_TRAINER_TYPE TownTrainer[ MAX_CHARACTER_COUNT ];
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
TOWN_TRAINER_TYPE TownTrainer[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
// std::vector<TOWN_TRAINER_TYPE> TownTrainer (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS);
|
||||
UINT8 ubTownTrainers;
|
||||
UINT16 usMaxPts;
|
||||
BOOLEAN fSamSiteInSector = FALSE;
|
||||
@@ -3649,7 +3704,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
if( ( (StrategicMap[ sMapX + ( sMapY * MAP_WORLD_X ) ].bNameId != BLANK_SECTOR ) || ( fSamSiteInSector == TRUE ) ) && (bZ == 0) )
|
||||
{
|
||||
// init town trainer list
|
||||
memset( TownTrainer, 0, sizeof( TownTrainer ) );
|
||||
memset( TownTrainer, 0, sizeof( TownTrainer ) );
|
||||
ubTownTrainers = 0;
|
||||
|
||||
// build list of all the town trainers in this sector and their training pts
|
||||
@@ -4184,7 +4239,7 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1
|
||||
ubTownId = StrategicMap[ pTrainer->sSectorX + pTrainer->sSectorY * MAP_WORLD_X ].bNameId;
|
||||
if( fSamSiteInSector == FALSE )
|
||||
{
|
||||
Assert(ubTownId != BLANK_SECTOR);
|
||||
AssertNE(ubTownId, BLANK_SECTOR);
|
||||
}
|
||||
|
||||
// trainer gains leadership - training argument is FALSE, because the trainer is not the one training!
|
||||
@@ -4267,7 +4322,7 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts )
|
||||
/* ARM: Decided this didn't make much sense - the guys I'm training damn well BETTER be loyal - and screw the rest!
|
||||
// get town index
|
||||
ubTownId = StrategicMap[ pTrainer->sSectorX + pTrainer->sSectorY * MAP_WORLD_X ].bNameId;
|
||||
Assert(ubTownId != BLANK_SECTOR);
|
||||
AssertNE(ubTownId, BLANK_SECTOR);
|
||||
|
||||
// adjust for town loyalty
|
||||
sTotalTrainingPts = (sTotalTrainingPts * gTownLoyalty[ ubTownId ].ubRating) / 100;
|
||||
@@ -4310,7 +4365,7 @@ void MakeSoldiersTacticalAnimationReflectAssignment( SOLDIERTYPE *pSoldier )
|
||||
|
||||
void AssignmentAborted( SOLDIERTYPE *pSoldier, UINT8 ubReason )
|
||||
{
|
||||
Assert( ubReason < NUM_ASSIGN_ABORT_REASONS );
|
||||
AssertLT( ubReason, NUM_ASSIGN_ABORT_REASONS );
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ ubReason ], pSoldier->name );
|
||||
|
||||
@@ -4952,7 +5007,7 @@ void VehicleMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
iVehicleID = MSYS_GetRegionUserData( pRegion, 1 );
|
||||
|
||||
// inaccessible vehicles shouldn't be listed in the menu!
|
||||
Assert( IsThisVehicleAccessibleToSoldier( pSoldier, iVehicleID ) );
|
||||
// AssertT( IsThisVehicleAccessibleToSoldier( pSoldier, iVehicleID ) );
|
||||
|
||||
if ( IsEnoughSpaceInVehicle( iVehicleID ) )
|
||||
{
|
||||
@@ -5532,6 +5587,12 @@ void MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
if( Item[pSoldier->inv[ bPocket ].usItem].toolkit )
|
||||
{
|
||||
// If the second hand is empty, swap item in first hand there
|
||||
if (pSoldier->inv[HANDPOS].exists() &&
|
||||
!pSoldier->inv[SECONDHANDPOS].exists() &&
|
||||
CanItemFitInPosition(pSoldier, &pSoldier->inv[SECONDHANDPOS], HANDPOS, FALSE)) {
|
||||
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE );
|
||||
}
|
||||
if(!CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], bPocket, FALSE))
|
||||
SwapObjs(pSoldier, HANDPOS, SECONDHANDPOS, TRUE);
|
||||
SwapObjs( pSoldier, HANDPOS, bPocket, TRUE );
|
||||
@@ -5562,6 +5623,12 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier )
|
||||
if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit )
|
||||
{
|
||||
fCharacterInfoPanelDirty = TRUE;
|
||||
// If the second hand is empty, swap item in first hand there
|
||||
if (pSoldier->inv[HANDPOS].exists() &&
|
||||
!pSoldier->inv[SECONDHANDPOS].exists() &&
|
||||
CanItemFitInPosition(pSoldier, &pSoldier->inv[SECONDHANDPOS], HANDPOS, FALSE)) {
|
||||
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE );
|
||||
}
|
||||
if(!CanItemFitInPosition(pSoldier, &pSoldier->inv[HANDPOS], bPocket, FALSE))
|
||||
SwapObjs(pSoldier, HANDPOS, SECONDHANDPOS, TRUE);
|
||||
SwapObjs( pSoldier, HANDPOS, bPocket, TRUE );
|
||||
@@ -7057,7 +7124,8 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
// can't renew contracts from tactical!
|
||||
}
|
||||
|
||||
Assert( pSoldier && pSoldier->bActive );
|
||||
AssertNotNIL( pSoldier );
|
||||
AssertT( pSoldier->bActive );
|
||||
|
||||
|
||||
iValue = MSYS_GetRegionUserData( pRegion, 0 );
|
||||
@@ -10399,8 +10467,8 @@ BOOLEAN AnyMercInGroupCantContinueMoving( GROUP *pGroup )
|
||||
BOOLEAN fGroupMustStop = FALSE;
|
||||
|
||||
|
||||
Assert( pGroup );
|
||||
Assert( pGroup->fPlayer );
|
||||
AssertNotNIL( pGroup );
|
||||
AssertT( pGroup->fPlayer );
|
||||
|
||||
pPlayer = pGroup->pPlayerList;
|
||||
|
||||
@@ -10546,7 +10614,7 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn
|
||||
CHAR16 sString[ 128 ];
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
pSoldier = NULL;
|
||||
|
||||
@@ -10865,7 +10933,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam )
|
||||
|
||||
|
||||
// sets assignment for the list
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( gCharactersList[ iCounter ].fValid ) &&
|
||||
( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) &&
|
||||
@@ -11425,7 +11493,7 @@ SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK )
|
||||
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
|
||||
{
|
||||
// mapscreen version
|
||||
if( ( bSelectedAssignChar >= 0 ) && ( bSelectedAssignChar < MAX_CHARACTER_COUNT ) &&
|
||||
if( ( bSelectedAssignChar >= 0 ) && ( bSelectedAssignChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) &&
|
||||
( gCharactersList[ bSelectedAssignChar ].fValid ) )
|
||||
{
|
||||
pSoldier = &Menptr[ gCharactersList[ bSelectedAssignChar ].usSolID ];
|
||||
|
||||
+62
-33
@@ -1,4 +1,3 @@
|
||||
// MAXIMUM NUMBER OF ENEMIES: 32
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Strategic All.h"
|
||||
#include "GameSettings.h"
|
||||
@@ -66,6 +65,8 @@
|
||||
#include "cheats.h"
|
||||
#include "Map Information.h"
|
||||
#include "MilitiaSquads.h"
|
||||
// #include "Strategic AI.h"
|
||||
#include "interface Dialogue.h"
|
||||
#endif
|
||||
|
||||
#include "Reinforcement.h"
|
||||
@@ -134,7 +135,8 @@ typedef struct AUTORESOLVE_STRUCT
|
||||
INT32 iButton[ NUM_AR_BUTTONS ];
|
||||
INT32 iButtonImage[ NUM_AR_BUTTONS ];
|
||||
INT32 iFaces; //for generic civs and enemies
|
||||
INT32 iMercFaces[20]; //for each merc face
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
INT32 iMercFaces[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; //for each merc face
|
||||
INT32 iIndent;
|
||||
INT32 iInterfaceBuffer;
|
||||
INT32 iNumMercFaces;
|
||||
@@ -337,11 +339,6 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell );
|
||||
void RenderSoldierCell( SOLDIERCELL *pCell );
|
||||
void RenderSoldierCellBars( SOLDIERCELL *pCell );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
extern void CountRandomCalls( BOOLEAN fStart );
|
||||
extern void GetRandomCalls( UINT32 *puiRandoms, UINT32 *puiPreRandoms );
|
||||
#endif
|
||||
|
||||
void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3], BOOLEAN fWithCities, BOOLEAN fForBattle, BOOLEAN fOnlyCitySectors );
|
||||
|
||||
|
||||
@@ -586,11 +583,6 @@ extern UINT8 guiDirNumber;
|
||||
|
||||
void EnterAutoResolveMode( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
CountRandomCalls( TRUE );
|
||||
#endif
|
||||
|
||||
|
||||
guiDirNumber = 0;
|
||||
|
||||
//Set up mapscreen for removal
|
||||
@@ -599,19 +591,20 @@ void EnterAutoResolveMode( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
RenderButtons();
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1");
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
//Allocate memory for all the globals while we are in this mode.
|
||||
gpAR = (AUTORESOLVE_STRUCT*)MemAlloc( sizeof( AUTORESOLVE_STRUCT ) );
|
||||
Assert( gpAR );
|
||||
memset( gpAR, 0, sizeof( AUTORESOLVE_STRUCT ) );
|
||||
//Mercs -- 20 max
|
||||
gpMercs = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * 20 );
|
||||
//Mercs
|
||||
gpMercs = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE );
|
||||
Assert( gpMercs );
|
||||
memset( gpMercs, 0, sizeof( SOLDIERCELL ) * 20 );
|
||||
//Militia -- MAX_ALLOWABLE_MILITIA_PER_SECTOR max
|
||||
memset( gpMercs, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE );
|
||||
//Militia
|
||||
gpCivs = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE );
|
||||
Assert( gpCivs );
|
||||
memset( gpCivs, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE );
|
||||
//Enemies -- 32 max
|
||||
//Enemies
|
||||
gpEnemies = (SOLDIERCELL*)MemAlloc( sizeof( SOLDIERCELL) * MAX_AR_TEAM_SIZE );
|
||||
Assert( gpEnemies );
|
||||
memset( gpEnemies, 0, sizeof( SOLDIERCELL ) * MAX_AR_TEAM_SIZE );
|
||||
@@ -706,12 +699,6 @@ UINT32 AutoResolveScreenHandle()
|
||||
{
|
||||
gfEnteringMapScreen = TRUE;
|
||||
RemoveAutoResolveInterface( TRUE );
|
||||
#ifdef JA2BETAVERSION
|
||||
{
|
||||
UINT32 uiRandoms, uiPreRandoms;
|
||||
GetRandomCalls( &uiRandoms, &uiPreRandoms );
|
||||
}
|
||||
#endif
|
||||
return MAP_SCREEN;
|
||||
}
|
||||
if( gpAR->fPendingSurrender )
|
||||
@@ -948,6 +935,8 @@ void CalculateSoldierCells( BOOLEAN fReset )
|
||||
gpAR->ubAliveCivs = gpAR->ubCivs;
|
||||
gpAR->ubAliveEnemies = gpAR->ubEnemies;
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// WDS TO BE FIXED -- Why is this 40 here? (18 April 2008)
|
||||
//iMaxTeamSize = max( gpAR->ubMercs + gpAR->ubCivs, gpAR->ubEnemies );
|
||||
iMaxTeamSize = max( min( 40, gpAR->ubMercs + gpAR->ubCivs ), min( 40, gpAR->ubEnemies ) );
|
||||
|
||||
@@ -2495,14 +2484,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
||||
}
|
||||
}
|
||||
}
|
||||
//Eliminate all excess soldiers (as more than 32 can exist in the same battle.
|
||||
//Autoresolve only processes 32, so the excess is slaughtered as the player never
|
||||
//knew they existed.
|
||||
//Eliminate all excess soldiers
|
||||
if( fDeleteForGood )
|
||||
{ //Warp the game time accordingly
|
||||
if( gpAR->ubBattleStatus == BATTLE_VICTORY )
|
||||
{ //Get rid of any extra enemies that could be here. It is possible for the number of total enemies to exceed 32, but
|
||||
//autoresolve can only process 32. We basically cheat by eliminating the rest of them.
|
||||
{ //Get rid of any extra enemies that could be here.
|
||||
EliminateAllEnemies( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
}
|
||||
else
|
||||
@@ -3043,7 +3029,7 @@ void CalculateRowsAndColumns()
|
||||
gpAR->ubEnemyRows = (gpAR->ubEnemies+2)/3;
|
||||
}
|
||||
else
|
||||
{ //16-32
|
||||
{ //16+
|
||||
gpAR->ubEnemyCols = 4;
|
||||
gpAR->ubEnemyRows = (gpAR->ubEnemies+3)/4;
|
||||
}
|
||||
@@ -3187,6 +3173,19 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
|
||||
gpAR->fInstantFinish ^= TRUE;
|
||||
}
|
||||
break;
|
||||
// WDS - Debug "Drassen" battles
|
||||
case F12:
|
||||
if( CHEATER_CHEAT_LEVEL() )
|
||||
{
|
||||
UINT8 ubMapX, ubMapY;
|
||||
for ( ubMapX = 1; ubMapX < MAP_WORLD_X - 1; ubMapX++ ) {
|
||||
for ( ubMapY = 1; ubMapY < MAP_WORLD_Y - 1; ubMapY++ ) {
|
||||
SetSectorFlag( ubMapX, ubMapY, 0, SF_ALREADY_VISITED ); //hayden
|
||||
}
|
||||
}
|
||||
ExecuteStrategicAIAction( NPC_ACTION_SEND_SOLDIERS_TO_DRASSEN, 13, 4 );
|
||||
}
|
||||
break;
|
||||
case BACKSPACE:
|
||||
if( CHEATER_CHEAT_LEVEL() )
|
||||
{
|
||||
@@ -3318,7 +3317,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
|
||||
case '>':
|
||||
if( CHEATER_CHEAT_LEVEL() )
|
||||
{
|
||||
gpAR->ubEnemies = 32;
|
||||
gpAR->ubEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
|
||||
fResetAutoResolve = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -3335,7 +3334,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
|
||||
case '.':
|
||||
if( CHEATER_CHEAT_LEVEL() )
|
||||
{
|
||||
if( gpAR->ubEnemies < 32 )
|
||||
if( gpAR->ubEnemies < gGameExternalOptions.ubGameMaximumNumberOfEnemies )
|
||||
{
|
||||
gpAR->ubEnemies++;
|
||||
fResetAutoResolve = TRUE;
|
||||
@@ -3354,9 +3353,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
|
||||
case '?':
|
||||
if( CHEATER_CHEAT_LEVEL() )
|
||||
{
|
||||
gpAR->ubMercs = 20;
|
||||
gpAR->ubMercs = gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs;
|
||||
gpAR->ubCivs = MAX_AR_TEAM_SIZE;
|
||||
gpAR->ubEnemies = 32;
|
||||
gpAR->ubEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
|
||||
fResetAutoResolve = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -4139,6 +4138,7 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
|
||||
pAttacker->pSoldier->usAttackingWeapon = pAttacker->pSoldier->inv[ pAttacker->bWeaponSlot ].usItem;
|
||||
}
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// WANNE: Does this lead to a CTD -> no I did not get any CTD, so I reenabled it
|
||||
if( pAttacker->bWeaponSlot != HANDPOS && pAttacker->bWeaponSlot != -1)
|
||||
{
|
||||
@@ -4153,12 +4153,14 @@ void AttackTarget( SOLDIERCELL *pAttacker, SOLDIERCELL *pTarget )
|
||||
{
|
||||
iImpact = HTHImpact( pAttacker->pSoldier, pTarget->pSoldier, ubAccuracy, (BOOLEAN)(fKnife || fClaw) );
|
||||
}
|
||||
|
||||
// WANNE: Why is impact here always set to 0? The impact was calculated a few lines before!
|
||||
//iImpact = 0;
|
||||
|
||||
// WANNE: Just for safty.
|
||||
if (iImpact < 0)
|
||||
iImpact = 0;
|
||||
|
||||
iNewLife = pTarget->pSoldier->stats.bLife - iImpact;
|
||||
|
||||
if( pAttacker->uiFlags & CELL_MERC )
|
||||
@@ -5027,3 +5029,30 @@ BOOLEAN ProcessLoyalty()
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors()
|
||||
{
|
||||
for(int sX = 1; sX < ( MAP_WORLD_X - 1 ); sX++ ) {
|
||||
for(int sY = 1; sY < ( MAP_WORLD_Y - 1); sY++ ) {
|
||||
// Check if there is a sector where enemies retreated to and there are also militia present
|
||||
if ((NumEnemiesInSector(sX, sY) > 0) &&
|
||||
(CountAllMilitiaInSector(sX, sY) > 0) &&
|
||||
(!gTacticalStatus.fEnemyInSector)) {
|
||||
unsigned mercCnt = 0;
|
||||
for( int i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) {
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ i ] ) )
|
||||
{ //Merc is active and alive, and not a vehicle or robot
|
||||
if ((MercPtrs[ i ]->sSectorX == sX) &&(MercPtrs[ i ]->sSectorY == sY) && (MercPtrs[ i ]->bSectorZ == 0)) {
|
||||
++mercCnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If there are PC mercs here the player will have to handle the battle
|
||||
if (mercCnt == 0) {
|
||||
// EnterAutoResolveMode ((UINT8)sX, (UINT8)sY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ extern BOOLEAN gfTransferTacticalOppositionToAutoResolve;
|
||||
//Returns TRUE if autoresolve is active or a sector is loaded.
|
||||
BOOLEAN GetCurrentBattleSectorXYZ( INT16 *psSectorX, INT16 *psSectorY, INT16 *psSectorZ );
|
||||
|
||||
void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors();
|
||||
|
||||
#endif
|
||||
@@ -575,7 +575,10 @@ void InitNewCampaign()
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"InitNewCampaign");
|
||||
//First clear all the sector information of all enemy existance. Conveniently, the
|
||||
//ubGroupType is also cleared, which is perceived to be an empty group.
|
||||
memset( &SectorInfo, 0, sizeof( SECTORINFO ) * 256 );
|
||||
//memset( &SectorInfo, 0, sizeof( SECTORINFO ) * 256 );
|
||||
for (std::vector<SECTORINFO>::iterator secIter = SectorInfo.begin(); secIter != SectorInfo.end(); ++secIter) {
|
||||
memset( &(*secIter), 0, sizeof( SECTORINFO ) );
|
||||
}
|
||||
InitStrategicMovementCosts();
|
||||
RemoveAllGroups();
|
||||
|
||||
@@ -587,7 +590,7 @@ void InitNewCampaign()
|
||||
|
||||
if (!is_networked)
|
||||
// allow overhead view of omerta A9 on game onset
|
||||
SetSectorFlag( 9, 1, 0, SF_ALREADY_VISITED ); //hayden
|
||||
SetSectorFlag( startingX, startingY, startingZ, SF_ALREADY_VISITED ); //hayden
|
||||
|
||||
//Generates the initial forces in a new campaign. The idea is to randomize numbers and sectors
|
||||
//so that no two games are the same.
|
||||
|
||||
@@ -2,11 +2,25 @@
|
||||
#define __CAMPAIGN_TYPES_H
|
||||
|
||||
#include "types.h"
|
||||
#include "DEBUG.H"
|
||||
|
||||
const int MAXIMUM_VALID_X_COORDINATE = 16;
|
||||
const int MINIMUM_VALID_X_COORDINATE = 1;
|
||||
const int MAXIMUM_VALID_Y_COORDINATE = 16;
|
||||
const int MINIMUM_VALID_Y_COORDINATE = 1;
|
||||
const int MAXIMUM_VALID_Z_COORDINATE = 3;
|
||||
const int MINIMUM_VALID_Z_COORDINATE = 0;
|
||||
|
||||
//Macro to convert sector coordinates (1-16,1-16) to 0-255
|
||||
#define SECTOR(x,y) (UINT8)((y-1)*16+x-1)
|
||||
#define SECTORX(SectorID) (UINT8)((SectorID % 16) + 1)
|
||||
#define SECTORY(SectorID) (UINT8)((SectorID / 16) + 1)
|
||||
#define SECTOR(x,y) (UINT8)(AssertGE(x, MINIMUM_VALID_X_COORDINATE), \
|
||||
AssertLE(x, MAXIMUM_VALID_X_COORDINATE), \
|
||||
AssertGE(y, MINIMUM_VALID_Y_COORDINATE), \
|
||||
AssertLE(y, MAXIMUM_VALID_Y_COORDINATE), \
|
||||
((y-1)*16+x-1))
|
||||
#define SECTORX(SectorID) (UINT8)(AssertLE(SectorID, MAXIMUM_VALID_X_COORDINATE*MAXIMUM_VALID_Y_COORDINATE), \
|
||||
((SectorID % 16) + 1))
|
||||
#define SECTORY(SectorID) (UINT8)(AssertLE(SectorID, MAXIMUM_VALID_X_COORDINATE*MAXIMUM_VALID_Y_COORDINATE), \
|
||||
((SectorID / 16) + 1))
|
||||
|
||||
//Sector enumerations
|
||||
//
|
||||
@@ -264,7 +278,9 @@ typedef struct UNDERGROUND_SECTORINFO
|
||||
|
||||
//The sector information required for the strategic AI. Contains the number of enemy troops,
|
||||
//as well as intentions, etc.
|
||||
extern SECTORINFO SectorInfo[256];
|
||||
//extern SECTORINFO SectorInfo[256];
|
||||
extern std::vector<SECTORINFO> SectorInfo;
|
||||
|
||||
extern UNDERGROUND_SECTORINFO *gpUndergroundSectorInfoHead;
|
||||
|
||||
#endif
|
||||
@@ -496,10 +496,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
|
||||
}
|
||||
}
|
||||
else if( giHabitatedDistance > iDistance )
|
||||
{ //we are within the "safe" habitated area of the creature's area of influence. The chance of
|
||||
{
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
//we are within the "safe" habitated area of the creature's area of influence. The chance of
|
||||
//increasing the population inside this sector depends on how deep we are within the sector.
|
||||
if( node->pLevel->ubNumCreatures < gGameExternalOptions.iMaxEnemyGroupSize ||
|
||||
node->pLevel->ubNumCreatures < 32 && node->pLevel->ubCreatureHabitat == QUEEN_LAIR )
|
||||
node->pLevel->ubNumCreatures < gGameExternalOptions.ubGameMaximumNumberOfCreatures && node->pLevel->ubCreatureHabitat == QUEEN_LAIR )
|
||||
{ //there is ALWAYS a chance to habitate an interior sector, though the chances are slim for
|
||||
//highly occupied sectors. This chance is modified by the type of area we are in.
|
||||
INT32 iAbsoluteMaxPopulation;
|
||||
@@ -508,7 +510,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
|
||||
switch( node->pLevel->ubCreatureHabitat )
|
||||
{
|
||||
case QUEEN_LAIR: //Defend the queen bonus
|
||||
iAbsoluteMaxPopulation = 32;
|
||||
iAbsoluteMaxPopulation = gGameExternalOptions.ubGameMaximumNumberOfCreatures;
|
||||
break;
|
||||
case LAIR: //Smaller defend the queen bonus
|
||||
iAbsoluteMaxPopulation = 18;
|
||||
|
||||
@@ -412,7 +412,7 @@ void StartTimeCompression( void )
|
||||
|
||||
// check that we can start compressing
|
||||
if ( !AllowedToTimeCompress( ) )
|
||||
{
|
||||
{
|
||||
// not allowed to compress time
|
||||
TellPlayerWhyHeCantCompressTime();
|
||||
return;
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "Interface Panels.h"
|
||||
#endif
|
||||
|
||||
#include "Vehicles.h"
|
||||
#include "text.h"
|
||||
#include "connect.h"
|
||||
class OBJECTTYPE;
|
||||
@@ -76,7 +77,6 @@ extern UINT32 uiMeanWhileFlags;
|
||||
extern BOOLEAN gfGamePaused;
|
||||
|
||||
extern UNDERGROUND_SECTORINFO* FindUnderGroundSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ );
|
||||
extern void InitVehicles( );
|
||||
|
||||
|
||||
UINT8 gubScreenCount=0;
|
||||
@@ -109,6 +109,8 @@ void InitNPCs( void )
|
||||
pProfile->sSectorY = MAP_ROW_C;
|
||||
pProfile->bSectorZ = 0;
|
||||
break;
|
||||
default:
|
||||
AssertMsg(false, "Skyrider was not set up properly");
|
||||
}
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
@@ -311,7 +313,7 @@ void InitStrategicLayer( void )
|
||||
// Init Squad Lists
|
||||
InitSquads();
|
||||
// Init vehicles
|
||||
InitVehicles( );
|
||||
InitAllVehicles( );
|
||||
// init town loyalty
|
||||
InitTownLoyalty();
|
||||
// init the mine management system
|
||||
@@ -342,7 +344,7 @@ void InitStrategicLayer( void )
|
||||
SetGameTimeCompressionLevel( TIME_COMPRESS_X0 );
|
||||
|
||||
// select A9 Omerta as the initial selected sector
|
||||
ChangeSelectedMapSector( 9, 1, 0 );
|
||||
ChangeSelectedMapSector( startingX, startingY, startingZ );
|
||||
|
||||
// Reset these flags or mapscreen could be disabled and cause major headache.
|
||||
fDisableDueToBattleRoster = FALSE;
|
||||
@@ -559,7 +561,7 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
|
||||
if ( gubScreenCount == 2 )
|
||||
{
|
||||
|
||||
if ( !SetCurrentWorldSector( 9, 1, 0 ) )
|
||||
if ( !SetCurrentWorldSector( startingX, startingY, startingZ ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
#include "finances.h"
|
||||
#include "history.h"
|
||||
#include "Dialogue Control.h"
|
||||
#include "Strategic AI.h"
|
||||
#endif
|
||||
|
||||
#include "SaveLoadGame.h"
|
||||
#include "GameSettings.h"
|
||||
#include "connect.h"
|
||||
|
||||
void HourlyQuestUpdate( void );
|
||||
void HourlyLarryUpdate( void );
|
||||
|
||||
@@ -74,13 +78,20 @@ void HandleHourlyUpdate()
|
||||
|
||||
HourlyCheckIfSlayAloneSoHeCanLeave();
|
||||
|
||||
PayOffSkyriderDebtIfAny();
|
||||
// WDS - New AI
|
||||
HourlyCheckStrategicAI();
|
||||
|
||||
PayOffSkyriderDebtIfAny();
|
||||
|
||||
if ( GetWorldHour() % 6 == 0 ) // 4 times a day
|
||||
{
|
||||
UpdateRegenCounters();
|
||||
}
|
||||
|
||||
if ((gGameExternalOptions.autoSaveTime != 0) &&
|
||||
(GetWorldHour() % gGameExternalOptions.autoSaveTime == 0)) {
|
||||
SaveGame( SAVE__TIMED_AUTOSAVE, L"Auto Save" );
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateRegenCounters( void )
|
||||
|
||||
@@ -314,7 +314,7 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||
if ( DoesSkyriderNoticeEnemiesInSector( ubNumEnemies ) == TRUE )
|
||||
{
|
||||
// if just passing through (different quotes are used below if it's his final destination)
|
||||
if( !EndOfHelicoptersPath( ) )
|
||||
if( !EndOfHelicoptersPath( ) && gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
{
|
||||
// stop time compression and inform player that there are enemies in the sector below
|
||||
StopTimeCompression();
|
||||
@@ -358,7 +358,7 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||
{
|
||||
// if he has passengers, or he's not going straight to base, tell player he's arrived
|
||||
// (i.e. don't say anything nor stop time compression if he's empty and just returning to base)
|
||||
if ( ( GetNumberOfPassengersInHelicopter() > 0 ) || !fHeliReturnStraightToBase )
|
||||
if ( ( GetNumberOfPassengersInHelicopter() > 0 ) /*|| !fHeliReturnStraightToBase*/ )
|
||||
{
|
||||
// arrived at destination
|
||||
if(gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE) HeliCharacterDialogue( pSkyRider, ARRIVED_IN_NON_HOSTILE_SECTOR );
|
||||
|
||||
@@ -2267,10 +2267,9 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
|
||||
BOOLEAN CanPlayerUseSectorInventory( SOLDIERTYPE *pSelectedSoldier )
|
||||
{
|
||||
INT16 sSectorX, sSectorY, sSectorZ;
|
||||
BOOLEAN fInCombat;
|
||||
|
||||
//Get the sector that has a battle
|
||||
fInCombat = GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( &sSectorX, &sSectorY, &sSectorZ );
|
||||
BOOLEAN fInCombat = GetCurrentBattleSectorXYZAndReturnTRUEIfThereIsABattle( &sSectorX, &sSectorY, &sSectorZ );
|
||||
|
||||
//if there is a battle going on
|
||||
if( fInCombat )
|
||||
|
||||
@@ -43,8 +43,10 @@
|
||||
#include "Tactical Save.h"
|
||||
#include "Map Information.h"
|
||||
#include "Air Raid.h"
|
||||
#include "Auto Resolve.h"
|
||||
#endif
|
||||
|
||||
#include "Quests.h"
|
||||
#include "connect.h"
|
||||
|
||||
// zoom x and y coords for map scrolling
|
||||
@@ -901,6 +903,8 @@ UINT32 DrawMap( void )
|
||||
|
||||
RestoreClipRegionToFullScreen( );
|
||||
|
||||
CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors();
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -4067,19 +4071,19 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
||||
|
||||
sDest = sSource;
|
||||
|
||||
if( ( iCounter == 0 ) && sY > 1 )
|
||||
if( ( iCounter == 0 ) && sY > MINIMUM_VALID_Y_COORDINATE )
|
||||
{
|
||||
sDest += NORTH_MOVE;
|
||||
}
|
||||
else if( ( iCounter == 1 ) && ( sX < MAP_WORLD_X - 1 ) )
|
||||
else if( ( iCounter == 1 ) && ( sX < MAXIMUM_VALID_X_COORDINATE ) )
|
||||
{
|
||||
sDest += EAST_MOVE;
|
||||
}
|
||||
else if( ( iCounter == 2 ) && ( sY < MAP_WORLD_Y - 1 ) )
|
||||
else if( ( iCounter == 2 ) && ( sY < MAXIMUM_VALID_Y_COORDINATE ) )
|
||||
{
|
||||
sDest += SOUTH_MOVE;
|
||||
}
|
||||
else if( ( iCounter == 3 ) && ( sX > 1 ) )
|
||||
else if( ( iCounter == 3 ) && ( sX > MINIMUM_VALID_X_COORDINATE ) )
|
||||
{
|
||||
sDest += WEST_MOVE;
|
||||
}
|
||||
@@ -4087,7 +4091,11 @@ void ShowPeopleInMotion( INT16 sX, INT16 sY )
|
||||
// if not at edge of map
|
||||
if ( sDest != sSource )
|
||||
{
|
||||
if( PlayersBetweenTheseSectors( ( INT16 ) SECTOR( sSource % MAP_WORLD_X, sSource / MAP_WORLD_X ) , ( INT16 ) SECTOR( sDest % MAP_WORLD_X, sDest / MAP_WORLD_X ), &sExiting, &sEntering, &fAboutToEnter ) )
|
||||
int tXS = sSource % MAP_WORLD_X;
|
||||
int tYS = sSource / MAP_WORLD_X;
|
||||
int tXD = sDest % MAP_WORLD_X;
|
||||
int tYD = sDest / MAP_WORLD_X;
|
||||
if( PlayersBetweenTheseSectors( ( INT16 ) SECTOR(tXS, tYS) , ( INT16 ) SECTOR(tXD, tYD), &sExiting, &sEntering, &fAboutToEnter ) )
|
||||
{
|
||||
// someone is leaving
|
||||
|
||||
@@ -4307,7 +4315,6 @@ void DisplayDistancesForHelicopter( void )
|
||||
// sTotalCanTravel = ( INT16 )GetTotalDistanceHelicopterCanTravel( );
|
||||
sDistanceToGo = ( INT16 )DistanceOfIntendedHelicopterPath( );
|
||||
sTotalOfTrip = sDistanceToGo; // + ( INT16 ) ( DistanceToNearestRefuelPoint( ( INT16 )( LastSectorInHelicoptersPath() % MAP_WORLD_X ), ( INT16 ) ( LastSectorInHelicoptersPath() / MAP_WORLD_X ) ) );
|
||||
|
||||
sNumSafeSectors = GetNumSafeSectorsInPath( );
|
||||
sNumUnSafeSectors = GetNumUnSafeSectorsInPath( );
|
||||
|
||||
@@ -4411,81 +4418,59 @@ void DisplayPositionOfHelicopter( void )
|
||||
INT32 iNumberOfPeopleInHelicopter = 0;
|
||||
CHAR16 sString[ 4 ];
|
||||
|
||||
|
||||
AssertMsg( ( sOldMapX >= 0 ) && ( sOldMapX < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid sOldMapX = %d", sOldMapX ) );
|
||||
AssertMsg( ( sOldMapY >= 0 ) && ( sOldMapY < SCREEN_HEIGHT ), String( "DisplayPositionOfHelicopter: Invalid sOldMapY = %d", sOldMapY ) );
|
||||
|
||||
// restore background on map where it is
|
||||
if( sOldMapX != 0 )
|
||||
{
|
||||
if( sOldMapX != 0 ) {
|
||||
RestoreExternBackgroundRect( sOldMapX, sOldMapY, HELI_ICON_WIDTH, HELI_ICON_HEIGHT );
|
||||
sOldMapX = 0;
|
||||
}
|
||||
|
||||
|
||||
if( iHelicopterVehicleId != -1 )
|
||||
{
|
||||
if( iHelicopterVehicleId != -1 ) {
|
||||
// draw the destination icon first, so when they overlap, the real one is on top!
|
||||
DisplayDestinationOfHelicopter( );
|
||||
|
||||
// check if mvt group
|
||||
if( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup != 0 )
|
||||
{
|
||||
|
||||
if( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup != 0 ) {
|
||||
pGroup = GetGroup( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
|
||||
// this came up in one bug report!
|
||||
Assert( pGroup->uiTraverseTime != -1 );
|
||||
|
||||
if( ( pGroup->uiTraverseTime > 0 ) && ( pGroup->uiTraverseTime != 0xffffffff ) )
|
||||
{
|
||||
if (!pGroup) {
|
||||
// Something is really goofed up, there's no group for the helicopter. Re-create it.
|
||||
static bool heliMsg1Given = false;
|
||||
if (!heliMsg1Given) {
|
||||
DoScreenIndependantMessageBox( L"The helicopter data is corrupted. Attempting to repair it...", MSG_BOX_FLAG_OK, NULL );
|
||||
heliMsg1Given = true;
|
||||
}
|
||||
RemoveVehicleFromList (iHelicopterVehicleId);
|
||||
InitAVehicle (iHelicopterVehicleId, 13, MAP_ROW_B);
|
||||
fSkyRiderSetUp = FALSE;
|
||||
SetUpHelicopterForPlayer( 13, MAP_ROW_B );
|
||||
pGroup = GetGroup( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
if (!pGroup) {
|
||||
static bool heliMsg2Given = false;
|
||||
if (!heliMsg2Given) {
|
||||
DoScreenIndependantMessageBox( L"The helicopter data is corrupted beyond repair. Please report this and send a save file and your .ini file. You can continue playing but the helicopter will not work properly.", MSG_BOX_FLAG_OK, NULL );
|
||||
heliMsg2Given = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( ( pGroup->uiTraverseTime > 0 ) && ( pGroup->uiTraverseTime != 0xffffffff ) ) {
|
||||
flRatio = ( ( pGroup->uiTraverseTime + GetWorldTotalMin() ) - pGroup->uiArrivalTime ) / ( float ) pGroup->uiTraverseTime;
|
||||
}
|
||||
|
||||
/*
|
||||
AssertMsg( ( flRatio >= 0 ) && ( flRatio <= 100 ), String( "DisplayPositionOfHelicopter: Invalid flRatio = %6.2f, trav %d, arr %d, time %d",
|
||||
flRatio, pGroup->uiTraverseTime, pGroup->uiArrivalTime, GetWorldTotalMin() ) );
|
||||
*/
|
||||
|
||||
if ( flRatio < 0 )
|
||||
{
|
||||
if ( flRatio < 0 ) {
|
||||
flRatio = 0;
|
||||
}
|
||||
else if ( flRatio > 100 )
|
||||
{
|
||||
} else if ( flRatio > 100 ) {
|
||||
flRatio = 100;
|
||||
}
|
||||
|
||||
// if( !fZoomFlag )
|
||||
{
|
||||
// grab min and max locations to interpolate sub sector position
|
||||
minX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubSectorX );
|
||||
maxX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubNextX );
|
||||
minY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubSectorY );
|
||||
maxY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubNextY );
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
|
||||
// grab coords for nextx,y and current x,y
|
||||
|
||||
// zoomed in, takes a little more work
|
||||
GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubSectorX)),((UINT16)(pGroup->ubSectorY)) , &sX, &sY );
|
||||
sY=sY-MAP_GRID_Y;
|
||||
sX=sX-MAP_GRID_X;
|
||||
|
||||
minX = ( sX );
|
||||
minY = ( sY );
|
||||
|
||||
GetScreenXYFromMapXYStationary( ((UINT16)(pGroup->ubNextX)),((UINT16)(pGroup->ubNextY)) , &sX, &sY );
|
||||
sY=sY-MAP_GRID_Y;
|
||||
sX=sX-MAP_GRID_X;
|
||||
|
||||
maxX = ( sX );
|
||||
maxY = ( sY );
|
||||
}
|
||||
*/
|
||||
// grab min and max locations to interpolate sub sector position
|
||||
minX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubSectorX );
|
||||
maxX = MAP_VIEW_START_X + MAP_GRID_X * ( pGroup->ubNextX );
|
||||
minY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubSectorY );
|
||||
maxY = MAP_VIEW_START_Y + MAP_GRID_Y * ( pGroup->ubNextY );
|
||||
|
||||
AssertMsg( ( minX >= 0 ) && ( minX < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid minX = %d", minX ) );
|
||||
AssertMsg( ( maxX >= 0 ) && ( maxX < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid maxX = %d", maxX ) );
|
||||
@@ -4496,25 +4481,13 @@ void DisplayPositionOfHelicopter( void )
|
||||
x = ( UINT32 )( minX + flRatio * ( ( INT16 ) maxX - ( INT16 ) minX ) );
|
||||
y = ( UINT32 )( minY + flRatio * ( ( INT16 ) maxY - ( INT16 ) minY ) );
|
||||
|
||||
/*
|
||||
if( fZoomFlag )
|
||||
{
|
||||
x += 13;
|
||||
y += 8;
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
x += 1;
|
||||
y += 3;
|
||||
}
|
||||
x += 1;
|
||||
y += 3;
|
||||
|
||||
AssertMsg( ( x >= 0 ) && ( x < (UINT32)SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid x = %d. At %d,%d. Next %d,%d. Min/Max X = %d/%d",
|
||||
x, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minX, maxX ) );
|
||||
|
||||
x, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minX, maxX ) );
|
||||
AssertMsg( ( y >= 0 ) && ( y < (UINT32)SCREEN_HEIGHT ), String( "DisplayPositionOfHelicopter: Invalid y = %d. At %d,%d. Next %d,%d. Min/Max Y = %d/%d",
|
||||
y, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minY, maxY ) );
|
||||
|
||||
y, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minY, maxY ) );
|
||||
|
||||
// clip blits to mapscreen region
|
||||
ClipBlitsToMapViewRegion( );
|
||||
@@ -5985,7 +5958,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
|
||||
}
|
||||
|
||||
// if this sector is currently loaded
|
||||
if( sSector == SECTOR( gWorldSectorX, gWorldSectorY ) && gWorldSectorY != 0 )
|
||||
if( (gWorldSectorX != 0) &&
|
||||
(gWorldSectorY != 0) &&
|
||||
(sSector == SECTOR( gWorldSectorX, gWorldSectorY )) )
|
||||
{
|
||||
gfStrategicMilitiaChangesMade = TRUE;
|
||||
}
|
||||
@@ -6212,8 +6187,8 @@ void DrawTownMilitiaForcesOnMap( void )
|
||||
}*/
|
||||
|
||||
// now handle militia for sam sectors
|
||||
for( sSectorX = 0; sSectorX < 16 ; ++sSectorX )
|
||||
for( sSectorY = 0; sSectorY < 16 ; ++sSectorY )
|
||||
for( sSectorX = MINIMUM_VALID_X_COORDINATE; sSectorX <= MAXIMUM_VALID_X_COORDINATE ; ++sSectorX )
|
||||
for( sSectorY = MINIMUM_VALID_Y_COORDINATE; sSectorY <= MAXIMUM_VALID_Y_COORDINATE ; ++sSectorY )
|
||||
//for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ )
|
||||
{
|
||||
// sSectorX = SECTORX( pSamList[ iCounter ] );
|
||||
@@ -6623,7 +6598,7 @@ UINT8 NumActiveCharactersInSector( INT16 sSectorX, INT16 sSectorY, INT16 bSector
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
UINT8 ubNumberOnTeam = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid )
|
||||
{
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "HelpScreen.h"
|
||||
#include "Map Screen Helicopter.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "GameSettings.h"
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -94,6 +96,12 @@ void MinWidthOfTownMineInfoBox( void );
|
||||
void DisplayTownInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
{
|
||||
// will display town info for a particular town
|
||||
AssertGE( sMapX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sMapX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sMapY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sMapY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
AssertGE( bMapZ, bMapZ );
|
||||
AssertLE( bMapZ, bMapZ );
|
||||
|
||||
// set current sector
|
||||
if( ( bCurrentTownMineSectorX != sMapX ) || ( bCurrentTownMineSectorY != sMapY ) || ( bCurrentTownMineSectorZ != bMapZ ) )
|
||||
@@ -646,6 +654,8 @@ void AddCommonInfoToBox(void)
|
||||
|
||||
// how many are there, really?
|
||||
ubNumEnemies = NumEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
|
||||
AssertGE(gGameExternalOptions.ubGameMaximumNumberOfEnemies, NumFreeEnemySlots());
|
||||
unsigned numEnemiesOnMap = gGameExternalOptions.ubGameMaximumNumberOfEnemies - NumFreeEnemySlots();
|
||||
|
||||
switch ( WhatPlayerKnowsAboutEnemiesInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
|
||||
{
|
||||
@@ -670,7 +680,10 @@ void AddCommonInfoToBox(void)
|
||||
|
||||
case KNOWS_HOW_MANY:
|
||||
// show exactly how many
|
||||
swprintf( wString, L"%d", ubNumEnemies );
|
||||
if (numEnemiesOnMap != ubNumEnemies)
|
||||
swprintf( wString, L"%d (%d)", numEnemiesOnMap, ubNumEnemies );
|
||||
else
|
||||
swprintf( wString, L"%d", ubNumEnemies );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,9 @@ class SOLDIERTYPE;
|
||||
// the number of help region messages
|
||||
#define NUMBER_OF_MAPSCREEN_HELP_MESSAGES 5
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// number of LINKED LISTS for sets of leave items (each slot holds an unlimited # of items)
|
||||
#define NUM_LEAVE_LIST_SLOTS 20
|
||||
#define NUM_LEAVE_LIST_SLOTS CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS
|
||||
|
||||
#define SELECTED_CHAR_ARROW_X 1 //8
|
||||
|
||||
@@ -115,7 +116,7 @@ enum{
|
||||
UINT16 usVehicleY = 0;
|
||||
|
||||
// waiting list for update box
|
||||
INT32 iUpdateBoxWaitingList[ MAX_CHARACTER_COUNT ];
|
||||
INT32 iUpdateBoxWaitingList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
FASTHELPREGION pFastHelpMapScreenList[ MAX_MAPSCREEN_FAST_HELP ];
|
||||
|
||||
@@ -194,8 +195,8 @@ extern INT32 giCharInfoButton[];
|
||||
extern STR16 pUpdatePanelButtons[];
|
||||
|
||||
// the list of soldiers that are moving
|
||||
SOLDIERTYPE * pSoldierMovingList[ MAX_CHARACTER_COUNT ];
|
||||
BOOLEAN fSoldierIsMoving[ MAX_CHARACTER_COUNT ];
|
||||
SOLDIERTYPE * pSoldierMovingList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
BOOLEAN fSoldierIsMoving[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
SOLDIERTYPE *pUpdateSoldierBox[ SIZE_OF_UPDATE_BOX ];
|
||||
|
||||
@@ -226,7 +227,7 @@ BOOLEAN fMapInventoryPoolInited = FALSE;
|
||||
BOOLEAN fShowMapScreenMovementList = FALSE;
|
||||
|
||||
|
||||
MapScreenCharacterSt gCharactersList[ MAX_CHARACTER_COUNT+1];
|
||||
MapScreenCharacterSt gCharactersList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS+1];
|
||||
|
||||
extern MOUSE_REGION gCharInfoHandRegion;
|
||||
MOUSE_REGION gMapStatusBarsRegion;
|
||||
@@ -234,7 +235,7 @@ MOUSE_REGION gMapStatusBarsRegion;
|
||||
SGPPoint MovePosition={450, 100 };
|
||||
|
||||
// which lines are selected? .. for assigning groups of mercs to the same thing
|
||||
BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
||||
BOOLEAN fSelectedListOfMercsForMapScreen[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
BOOLEAN fResetTimerForFirstEntryIntoMapScreen = FALSE;
|
||||
INT32 iReasonForSoldierUpDate = NO_REASON_FOR_UPDATE;
|
||||
|
||||
@@ -246,7 +247,7 @@ UINT32 guiSAMICON;
|
||||
BOOLEAN fDisableDueToBattleRoster = FALSE;
|
||||
|
||||
// track old contract times
|
||||
INT32 iOldContractTimes[ MAX_CHARACTER_COUNT ];
|
||||
INT32 iOldContractTimes[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
// position of pop up box
|
||||
INT32 giBoxY = 0;
|
||||
@@ -431,7 +432,7 @@ void InitalizeVehicleAndCharacterList( void )
|
||||
|
||||
void SetEntryInSelectedCharacterList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < MAX_CHARACTER_COUNT ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// set this entry to selected
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = TRUE ;
|
||||
@@ -441,7 +442,7 @@ void SetEntryInSelectedCharacterList( INT8 bEntry )
|
||||
|
||||
void ResetEntryForSelectedList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < MAX_CHARACTER_COUNT ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// set this entry to selected
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = FALSE;
|
||||
@@ -451,8 +452,9 @@ void ResetEntryForSelectedList( INT8 bEntry )
|
||||
|
||||
void ResetSelectedListForMapScreen( void )
|
||||
{
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// set all the entries int he selected list to false
|
||||
memset( &fSelectedListOfMercsForMapScreen, FALSE, MAX_CHARACTER_COUNT * sizeof( BOOLEAN ) );
|
||||
memset( fSelectedListOfMercsForMapScreen, FALSE, sizeof(fSelectedListOfMercsForMapScreen) );
|
||||
|
||||
// if we still have a valid dude selected
|
||||
if ( ( bSelectedInfoChar != -1 ) && ( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) )
|
||||
@@ -467,7 +469,7 @@ void ResetSelectedListForMapScreen( void )
|
||||
|
||||
BOOLEAN IsEntryInSelectedListSet( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < MAX_CHARACTER_COUNT ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// is this entry in the selected list set?
|
||||
|
||||
@@ -478,7 +480,7 @@ BOOLEAN IsEntryInSelectedListSet( INT8 bEntry )
|
||||
|
||||
void ToggleEntryInSelectedList( INT8 bEntry )
|
||||
{
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < MAX_CHARACTER_COUNT ) );
|
||||
Assert( ( bEntry >= 0 ) && ( bEntry < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
// toggle the value in the selected list
|
||||
fSelectedListOfMercsForMapScreen[ bEntry ] = !( fSelectedListOfMercsForMapScreen[ bEntry ] );
|
||||
@@ -520,7 +522,7 @@ BOOLEAN MultipleCharacterListEntriesSelected( void )
|
||||
INT32 iCounter = 0;
|
||||
|
||||
// check if more than one person is selected in the selected list
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[iCounter] == TRUE )
|
||||
{
|
||||
@@ -545,7 +547,7 @@ void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( INT8 bAssignme
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -577,7 +579,7 @@ void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX,
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -610,7 +612,7 @@ void PlotPathForSelectedCharacterList( INT16 sX, INT16 sY )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
// run through list and build paths for each character
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )&&( bSelectedDestChar != iCounter ) )
|
||||
{
|
||||
@@ -630,7 +632,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier )
|
||||
|
||||
|
||||
// deselect any other selected mercs that can't travel together with pSoldier
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -725,7 +727,7 @@ void SelectUnselectedMercsWhoMustMoveWithThisGuy( void )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -757,7 +759,7 @@ BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier )
|
||||
SOLDIERTYPE *pSoldier2 = NULL;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -836,7 +838,7 @@ void RestoreBackgroundForAssignmentGlowRegionList( void )
|
||||
if( iOldAssignmentLine != giAssignHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 66, Y_START - 1, 118 + 1 - 67, ( INT16 )( ( ( MAX_CHARACTER_COUNT + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
RestoreExternBackgroundRect( 66, Y_START - 1, 118 + 1 - 67, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -864,7 +866,7 @@ void RestoreBackgroundForDestinationGlowRegionList( void )
|
||||
if( iOldDestinationLine != giDestHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 182, Y_START - 1, 217 + 1 - 182, ( INT16 )( ( ( MAX_CHARACTER_COUNT + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
RestoreExternBackgroundRect( 182, Y_START - 1, 217 + 1 - 182, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) );
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -892,7 +894,7 @@ void RestoreBackgroundForContractGlowRegionList( void )
|
||||
if( iOldContractLine != giContractHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 222, Y_START - 1, 250 + 1 - 222, ( INT16 )( ( ( MAX_CHARACTER_COUNT + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
RestoreExternBackgroundRect( 222, Y_START - 1, 250 + 1 - 222, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -924,7 +926,7 @@ void RestoreBackgroundForSleepGlowRegionList( void )
|
||||
if( iOldSleepHighLine != giSleepHighLine )
|
||||
{
|
||||
// restore background
|
||||
RestoreExternBackgroundRect( 123, Y_START - 1, 142 + 1 - 123, ( INT16 )( ( ( MAX_CHARACTER_COUNT + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
RestoreExternBackgroundRect( 123, Y_START - 1, 142 + 1 - 123, ( INT16 )( ( ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1 ) * ( Y_SIZE + 2 ) ) + 1 ) ) ;
|
||||
|
||||
// ARM: not good enough! must reblit the whole panel to erase glow chunk restored by help text disappearing!!!
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -965,7 +967,7 @@ void PlayGlowRegionSound( void )
|
||||
INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= MAX_CHARACTER_COUNT ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1007,7 +1009,7 @@ INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber )
|
||||
BOOLEAN IsCharacterSelectedForAssignment( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= MAX_CHARACTER_COUNT ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1044,7 +1046,7 @@ BOOLEAN IsCharacterSelectedForAssignment( INT16 sCharNumber )
|
||||
BOOLEAN IsCharacterSelectedForSleep( INT16 sCharNumber )
|
||||
{
|
||||
// valid character number?
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= MAX_CHARACTER_COUNT ) )
|
||||
if( ( sCharNumber < 0 ) || ( sCharNumber >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1104,7 +1106,7 @@ void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, I
|
||||
INT8 bCharacter = -1;
|
||||
|
||||
|
||||
for( bCounter = 0; bCounter < MAX_CHARACTER_COUNT; bCounter++ )
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
if( gCharactersList[ bCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -1247,7 +1249,7 @@ void CheckAndUpdateBasedOnContractTimes( void )
|
||||
INT32 iCounter = 0;
|
||||
INT32 iTimeRemaining = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -1343,7 +1345,7 @@ void HandleDisplayOfSelectedMercArrows( void )
|
||||
BltVideoObject( guiSAVEBUFFER , hHandle, 0,SELECTED_CHAR_ARROW_X, sYPosition , VO_BLT_SRCTRANSPARENCY,NULL );
|
||||
|
||||
// now run through the selected list of guys, an arrow for each
|
||||
for( ubCount = 0; ubCount < MAX_CHARACTER_COUNT; ubCount++ )
|
||||
for( ubCount = 0; ubCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; ubCount++ )
|
||||
{
|
||||
if( gCharactersList[ ubCount ].fValid == TRUE )
|
||||
{
|
||||
@@ -1974,7 +1976,7 @@ INT32 GetNumberOfCharactersOnPlayersTeam( void )
|
||||
{
|
||||
INT32 iNumberOfPeople = 0, iCounter = 0;
|
||||
|
||||
for(iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for(iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -2109,7 +2111,7 @@ void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier )
|
||||
|
||||
fShowContractMenu = FALSE;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -2297,7 +2299,7 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum )
|
||||
{
|
||||
PLAYERGROUP *pPlayer;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
UINT8 ubMercsInGroup[ 20 ];
|
||||
UINT8 ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
UINT8 ubNumMercs = 0;
|
||||
UINT8 ubChosenMerc;
|
||||
|
||||
@@ -2343,7 +2345,7 @@ INT32 GetNumberOfPeopleInCharacterList( void )
|
||||
INT32 iCounter = 0, iCount = 0;
|
||||
|
||||
// get the number of valid mercs in the mapscreen character list
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -2511,7 +2513,7 @@ void GoToNextCharacterInList( void )
|
||||
}
|
||||
|
||||
// is the current guy invalid or the first one?
|
||||
if( ( bSelectedInfoChar == -1 )|| ( bSelectedInfoChar == MAX_CHARACTER_COUNT ) )
|
||||
if( ( bSelectedInfoChar == -1 )|| ( bSelectedInfoChar == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
iCount = 0;
|
||||
}
|
||||
@@ -2520,9 +2522,9 @@ void GoToNextCharacterInList( void )
|
||||
iCount = bSelectedInfoChar + 1;
|
||||
}
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < MAX_CHARACTER_COUNT ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
{
|
||||
ChangeSelectedInfoChar( ( INT8 )iCount, TRUE );
|
||||
break;
|
||||
@@ -2531,7 +2533,7 @@ void GoToNextCharacterInList( void )
|
||||
{
|
||||
iCount++;
|
||||
|
||||
if( iCount >= MAX_CHARACTER_COUNT )
|
||||
if( iCount >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
iCount = 0;
|
||||
}
|
||||
@@ -2558,7 +2560,7 @@ void GoToPrevCharacterInList( void )
|
||||
// is the current guy invalid or the first one?
|
||||
if( ( bSelectedInfoChar == -1 ) || ( bSelectedInfoChar == 0 ) )
|
||||
{
|
||||
iCount = MAX_CHARACTER_COUNT;
|
||||
iCount = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2566,9 +2568,9 @@ void GoToPrevCharacterInList( void )
|
||||
}
|
||||
|
||||
// now run through the list and find first prev guy
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < MAX_CHARACTER_COUNT ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) )
|
||||
{
|
||||
ChangeSelectedInfoChar( ( INT8 )iCount, TRUE );
|
||||
break;
|
||||
@@ -2580,7 +2582,7 @@ void GoToPrevCharacterInList( void )
|
||||
if( iCount < 0 )
|
||||
{
|
||||
// was FIRST_VEHICLE
|
||||
iCount = MAX_CHARACTER_COUNT;
|
||||
iCount = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3297,7 +3299,7 @@ void DeselectVehicleForMovement( INT32 iVehicleId )
|
||||
fVehicleIsMoving[ iCounter ] = FALSE;
|
||||
|
||||
// now deselect everyone in vehicle
|
||||
for( iCount = 0; iCount < 10 ; iCount++ )
|
||||
for( iCount = 0; iCount < MAXPASSENGERS ; iCount++ )
|
||||
{
|
||||
pPassenger = pVehicleList[ iVehicleId ].pPassengers[ iCount ];
|
||||
|
||||
@@ -3361,7 +3363,7 @@ void AddSoldierToMovingLists( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( pSoldierMovingList[ iCounter ] == pSoldier )
|
||||
{
|
||||
@@ -3457,7 +3459,7 @@ void InitializeMovingLists( void )
|
||||
giNumberOfVehiclesInSectorMoving = 0;
|
||||
|
||||
// init the soldiers
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// soldier is NOT moving
|
||||
pSoldierMovingList[ iCounter ] = NULL;
|
||||
@@ -3495,7 +3497,7 @@ BOOLEAN IsAnythingSelectedForMoving( void )
|
||||
|
||||
|
||||
// check soldiers
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if ( ( pSoldierMovingList[ iCounter ] != NULL ) && fSoldierIsMoving[ iCounter ] )
|
||||
{
|
||||
@@ -3578,7 +3580,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
|
||||
// note that Skyrider can't be moved using the move box, and won't appear because the helicoprer is not in the char list
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid )
|
||||
{
|
||||
@@ -4440,7 +4442,7 @@ void HandleSettingTheSelectedListOfMercs( void )
|
||||
bSelectedDestChar = -1;
|
||||
|
||||
// run through the list of grunts
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// is the current guy a valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
@@ -5597,7 +5599,7 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void )
|
||||
|
||||
if (!is_networked)
|
||||
// select starting sector (A9 - Omerta)
|
||||
ChangeSelectedMapSector( 9, 1, 0 );
|
||||
ChangeSelectedMapSector( startingX, startingY, startingZ );
|
||||
|
||||
if (is_networked)
|
||||
{
|
||||
@@ -5613,13 +5615,13 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void )
|
||||
else
|
||||
{
|
||||
// load starting sector
|
||||
if ( !SetCurrentWorldSector( 9, 1, 0 ) )
|
||||
if ( !SetCurrentWorldSector( startingX, startingY, startingZ ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
gubPBSectorX = 9;
|
||||
gubPBSectorY = 1;
|
||||
gubPBSectorX = startingX;
|
||||
gubPBSectorY = startingY;
|
||||
}
|
||||
|
||||
|
||||
@@ -6105,7 +6107,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError
|
||||
// even if group is 0 (not that that should happen, should it?) still loop through for other mercs selected to move
|
||||
|
||||
// if anyone in the merc's group or also selected cannot move for whatever reason return false
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -6423,6 +6425,11 @@ BOOLEAN LoadLeaveItemList( HWFILE hFile )
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
if (uiCount > 1000) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
// allocate space
|
||||
gpLeaveListHead[ iCounter ] = new MERC_LEAVE_ITEM;
|
||||
if( gpLeaveListHead[ iCounter ] == NULL )
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "Soldier Control.h"
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "Font Control.h"
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
#include "Squads.h"
|
||||
|
||||
|
||||
typedef struct FASTHELPREGION {
|
||||
@@ -39,11 +41,6 @@ typedef struct FASTHELPREGION {
|
||||
#define CHAR_ICON_HEIGHT 10
|
||||
#define CHAR_ICON_SPACING 13
|
||||
|
||||
// max number of characters and vehicles
|
||||
//Character List Length
|
||||
#define MAX_CHARACTER_COUNT 20
|
||||
#define MAX_VEHICLE_COUNT 20
|
||||
|
||||
// map screen font
|
||||
#define MAP_SCREEN_FONT BLOCKFONT2
|
||||
|
||||
@@ -228,8 +225,9 @@ enum{
|
||||
#define TACT_UPDATE_MERC_X_OFFSET 4
|
||||
|
||||
|
||||
// the first vehicle slot int he list
|
||||
#define FIRST_VEHICLE 18
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// the first vehicle slot in the list
|
||||
#define FIRST_VEHICLE CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS
|
||||
|
||||
class OLD_MERC_LEAVE_ITEM_101
|
||||
{
|
||||
|
||||
+26
-10
@@ -78,8 +78,9 @@ SOLDIERTYPE *pContractReHireSoldier = NULL;
|
||||
UINT8 gubContractLength = 0; //used when extending a mercs insurance contract
|
||||
SOLDIERTYPE *gpInsuranceSoldier=NULL;
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
// The values need to be saved!
|
||||
CONTRACT_NEWAL_LIST_NODE ContractRenewalList[ 20 ];
|
||||
std::vector<CONTRACT_NEWAL_LIST_NODE> ContractRenewalList (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS);
|
||||
UINT8 ubNumContractRenewals = 0;
|
||||
// end
|
||||
UINT8 ubCurrentContractRenewal = 0;
|
||||
@@ -97,11 +98,18 @@ BOOLEAN SaveContractRenewalDataToSaveGameFile( HWFILE hFile )
|
||||
{
|
||||
UINT32 uiNumBytesWritten;
|
||||
|
||||
FileWrite( hFile, ContractRenewalList, sizeof( ContractRenewalList ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( ContractRenewalList ) )
|
||||
{
|
||||
return( FALSE );
|
||||
for (int idx=0; idx < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
FileWrite( hFile, &ContractRenewalList[idx], sizeof( CONTRACT_NEWAL_LIST_NODE ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( CONTRACT_NEWAL_LIST_NODE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
//FileWrite( hFile, ContractRenewalList, sizeof( ContractRenewalList ), &uiNumBytesWritten );
|
||||
//if( uiNumBytesWritten != sizeof( ContractRenewalList ) )
|
||||
//{
|
||||
// return( FALSE );
|
||||
//}
|
||||
|
||||
FileWrite( hFile, &ubNumContractRenewals, sizeof( ubNumContractRenewals ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( ubNumContractRenewals ) )
|
||||
@@ -118,11 +126,18 @@ BOOLEAN LoadContractRenewalDataFromSaveGameFile( HWFILE hFile )
|
||||
{
|
||||
UINT32 uiNumBytesRead;
|
||||
|
||||
FileRead( hFile, ContractRenewalList, sizeof( ContractRenewalList ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( ContractRenewalList ) )
|
||||
{
|
||||
return( FALSE );
|
||||
for (int idx=0; idx < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) {
|
||||
FileRead( hFile, &ContractRenewalList[idx], sizeof( CONTRACT_NEWAL_LIST_NODE ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( CONTRACT_NEWAL_LIST_NODE ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
//FileRead( hFile, ContractRenewalList, sizeof( ContractRenewalList ), &uiNumBytesRead );
|
||||
//if( uiNumBytesRead != sizeof( ContractRenewalList ) )
|
||||
//{
|
||||
// return( FALSE );
|
||||
//}
|
||||
|
||||
FileRead( hFile, &ubNumContractRenewals, sizeof( ubNumContractRenewals ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( ubNumContractRenewals ) )
|
||||
@@ -1323,7 +1338,8 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void )
|
||||
// find out is something was said
|
||||
SOLDIERTYPE *pSoldier = NULL, *pSoldierWhoWillQuit = NULL;
|
||||
INT32 iCounter= 0, iNumberOnTeam = 0;
|
||||
UINT8 ubPotentialMercs[ 20 ] = { 0 };
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
UINT8 ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 };
|
||||
UINT8 ubNumMercs = 0;
|
||||
UINT8 ubChosenMerc;
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ typedef struct
|
||||
} CONTRACT_NEWAL_LIST_NODE;
|
||||
|
||||
|
||||
extern CONTRACT_NEWAL_LIST_NODE ContractRenewalList[ 20 ];
|
||||
extern UINT8 ubNumContractRenewals;
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
//extern CONTRACT_NEWAL_LIST_NODE ContractRenewalList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
//extern UINT8 ubNumContractRenewals;
|
||||
extern BOOLEAN gfContractRenewalSquenceOn;
|
||||
extern UINT8 ubCurrentContractRenewal;
|
||||
//extern UINT8 ubCurrentContractRenewal;
|
||||
extern BOOLEAN gfInContractMenuFromRenewSequence;
|
||||
|
||||
|
||||
|
||||
@@ -270,8 +270,8 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir )
|
||||
}
|
||||
|
||||
//for( uiSector = 0 ; uiSector < 256 ; ++uiSector )
|
||||
for( sLMX = 0; sLMX < 16 ; ++sLMX )
|
||||
for( sLMY = 0; sLMY < 16 ; ++sLMY )
|
||||
for( sLMX = MINIMUM_VALID_X_COORDINATE; sLMX <= MAXIMUM_VALID_X_COORDINATE ; ++sLMX )
|
||||
for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY )
|
||||
{
|
||||
// SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] );
|
||||
UINT8 uiSumOfEnemyTroops = NumEnemiesInSector( sLMX, sLMY );
|
||||
@@ -810,7 +810,7 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY )
|
||||
sMSMapX = sMapX;
|
||||
sMSMapY = sMapY;
|
||||
|
||||
if( !gGameExternalOptions.gfAllowMilitiaGroups )
|
||||
if( !gGameExternalOptions.gfAllowReinforcements )
|
||||
return;
|
||||
|
||||
gTacticalStatus.uiFlags &= (~WANT_MILITIA_REINFORCEMENTS);
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "PreBattle Interface.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "interface Dialogue.h"
|
||||
#include "Random.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -173,6 +175,9 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
|
||||
// if player took control away from enemy
|
||||
if( fWasEnemyControlled && fContested )
|
||||
{
|
||||
// WDS - New AI
|
||||
// Hook in here for some stuff
|
||||
|
||||
// and it's a town
|
||||
if ((bTownId >= FIRST_TOWN) && (bTownId < NUM_TOWNS))
|
||||
{
|
||||
|
||||
@@ -82,16 +82,18 @@ enum //GraphicIDs for the panel
|
||||
UNINVOLVED_HEADER
|
||||
};
|
||||
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
//The height of each row
|
||||
#define ROW_HEIGHT 10
|
||||
//The start of the black space
|
||||
#define TOP_Y 113
|
||||
//The end of the black space
|
||||
#define BOTTOM_Y 349
|
||||
#define BOTTOM_Y (349+(gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs-18)*ROW_HEIGHT)
|
||||
//#define BOTTOM_Y 349
|
||||
//The internal height of the uninvolved panel
|
||||
#define INTERNAL_HEIGHT 27
|
||||
//The actual height of the uninvolved panel
|
||||
#define ACTUAL_HEIGHT 34
|
||||
//The height of each row
|
||||
#define ROW_HEIGHT 10
|
||||
|
||||
BOOLEAN gfDisplayPotentialRetreatPaths = FALSE;
|
||||
UINT16 gusRetreatButtonLeft, gusRetreatButtonTop, gusRetreatButtonRight, gusRetreatButtonBottom;
|
||||
@@ -122,16 +124,17 @@ SOLDIERTYPE* UninvolvedSoldier( INT32 index );
|
||||
|
||||
MOUSE_REGION PBInterfaceBlanket;
|
||||
BOOLEAN gfPreBattleInterfaceActive = FALSE;
|
||||
UINT32 iPBButton[3];
|
||||
UINT32 iPBButtonImage[3];
|
||||
UINT32 uiInterfaceImages;
|
||||
BOOLEAN gfRenderPBInterface;
|
||||
BOOLEAN gfPBButtonsHidden;
|
||||
UINT32 iPBButton[3] = {0,0,0};
|
||||
UINT32 iPBButtonImage[3] = {0,0,0};
|
||||
// WDS Graphics bug die to uninitialized variable
|
||||
UINT32 uiInterfaceImages = 0;
|
||||
BOOLEAN gfRenderPBInterface = FALSE;
|
||||
BOOLEAN gfPBButtonsHidden = FALSE;
|
||||
BOOLEAN fDisableMapInterfaceDueToBattle = FALSE;
|
||||
|
||||
void DoTransitionFromMapscreenToPreBattleInterface();
|
||||
|
||||
BOOLEAN gfBlinkHeader;
|
||||
BOOLEAN gfBlinkHeader = FALSE;
|
||||
|
||||
// mouse regions in mapscreen proper than must have thier help text disabled then re-enabled
|
||||
extern MOUSE_REGION gMapStatusBarsRegion;
|
||||
@@ -145,8 +148,8 @@ extern void UpdateTheStateOfTheNextPrevMapScreenCharacterButtons( void );
|
||||
// were we showing the mapscreen inventory when the prebattle interface came up
|
||||
extern BOOLEAN fShowInventoryFlag;
|
||||
|
||||
UINT32 guiNumInvolved;
|
||||
UINT32 guiNumUninvolved;
|
||||
UINT32 guiNumInvolved = 0;
|
||||
UINT32 guiNumUninvolved = 0;
|
||||
|
||||
//SAVE START
|
||||
|
||||
@@ -177,9 +180,10 @@ extern UINT8 gubPBSectorZ = 0;
|
||||
BOOLEAN gfCantRetreatInPBI = FALSE;
|
||||
//SAVE END
|
||||
|
||||
BOOLEAN gfUsePersistantPBI;
|
||||
BOOLEAN gfUsePersistantPBI = FALSE;
|
||||
|
||||
INT32 giHilitedInvolved, giHilitedUninvolved;
|
||||
INT32 giHilitedInvolved = 0;
|
||||
INT32 giHilitedUninvolved = 0;
|
||||
|
||||
extern void CalculateGroupRetreatSector( GROUP *pGroup );
|
||||
|
||||
@@ -259,7 +263,6 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
BOOLEAN fRetreatAnOption = TRUE;
|
||||
SECTORINFO *pSector;
|
||||
|
||||
|
||||
// ARM: Feb01/98 - Cancel out of mapscreen movement plotting if PBI subscreen is coming up
|
||||
if( ( bSelectedDestChar != -1 ) || ( fPlotForHelicopter == TRUE ) )
|
||||
{
|
||||
@@ -506,8 +509,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
}
|
||||
guiNumInvolved ++;
|
||||
}
|
||||
else
|
||||
else {
|
||||
guiNumUninvolved++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +1003,7 @@ void RenderPreBattleInterface()
|
||||
if( gusMouseXPos < gusRetreatButtonLeft || gusMouseXPos > gusRetreatButtonRight ||
|
||||
gusMouseYPos < gusRetreatButtonTop || gusMouseYPos > gusRetreatButtonBottom )
|
||||
fMouseInRetreatButtonArea = FALSE;
|
||||
else
|
||||
else
|
||||
fMouseInRetreatButtonArea = TRUE;
|
||||
if( fMouseInRetreatButtonArea != gfDisplayPotentialRetreatPaths )
|
||||
{
|
||||
@@ -1106,7 +1110,8 @@ void RenderPreBattleInterface()
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, BOTTOM_COLUMN, 161, y, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
}
|
||||
|
||||
for( i = 0; i < (INT32)(21 - max( guiNumUninvolved, 1 )); i++ )
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
for( i = 0; i < (INT32)(/*21*/3+gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs - max( guiNumUninvolved, 1 )); i++ )
|
||||
{
|
||||
y = TOP_Y + ROW_HEIGHT * i;
|
||||
BltVideoObject( guiSAVEBUFFER, hVObject, TOP_COLUMN, 186, y, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
+134
-76
@@ -52,10 +52,13 @@
|
||||
#include "connect.h"
|
||||
#include "Reinforcement.h"
|
||||
#include "MilitiaSquads.h"
|
||||
#include <vector>
|
||||
|
||||
//The sector information required for the strategic AI. Contains the number of enemy troops,
|
||||
//as well as intentions, etc.
|
||||
SECTORINFO SectorInfo[256];
|
||||
//SECTORINFO SectorInfo[256];
|
||||
std::vector<SECTORINFO> SectorInfo (256);
|
||||
|
||||
UNDERGROUND_SECTORINFO *gpUndergroundSectorInfoHead = NULL;
|
||||
extern UNDERGROUND_SECTORINFO* gpUndergroundSectorInfoTail;
|
||||
BOOLEAN gfPendingEnemies = FALSE;
|
||||
@@ -95,6 +98,11 @@ void ValidateEnemiesHaveWeapons()
|
||||
{
|
||||
iNumInvalid++;
|
||||
}
|
||||
// WDS DEBUG
|
||||
// Uncommenting the following two lines will cause all the PLACED soldiers to instantly drop dead,
|
||||
// which is useful for debugging some things
|
||||
//pSoldier->bBleeding = 10;
|
||||
//pSoldier->stats.bLife = 1;
|
||||
}
|
||||
|
||||
// do message box and return
|
||||
@@ -112,9 +120,12 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
{
|
||||
UINT8 ubNumHostiles = 0;
|
||||
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
Assert( sSectorZ >= 0 && sSectorZ <= 3 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
AssertGE( sSectorZ, MINIMUM_VALID_Z_COORDINATE );
|
||||
AssertLE( sSectorZ, MAXIMUM_VALID_Z_COORDINATE );
|
||||
|
||||
if( sSectorZ )
|
||||
{
|
||||
@@ -153,9 +164,12 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
{
|
||||
UINT8 ubNumEnemies = 0;
|
||||
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
Assert( sSectorZ >= 0 && sSectorZ <= 3 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
AssertGE( sSectorZ, MINIMUM_VALID_Z_COORDINATE );
|
||||
AssertLE( sSectorZ, MAXIMUM_VALID_Z_COORDINATE );
|
||||
|
||||
if( sSectorZ )
|
||||
{
|
||||
@@ -196,8 +210,10 @@ UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
GROUP *pGroup;
|
||||
UINT8 ubNumTroops;
|
||||
|
||||
//Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
//Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
|
||||
ubNumTroops = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites);
|
||||
@@ -220,8 +236,10 @@ UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
|
||||
|
||||
if( pSector->ubGarrisonID == NO_GARRISON )
|
||||
@@ -246,8 +264,10 @@ UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
GROUP *pGroup;
|
||||
SECTORINFO *pSector;
|
||||
UINT8 ubNumTroops;
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
ubNumTroops = 0;
|
||||
pGroup = gpGroupList;
|
||||
@@ -273,8 +293,10 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
||||
{
|
||||
GROUP *pGroup;
|
||||
SECTORINFO *pSector;
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
//Now count the number of mobile groups in the sector.
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = 0;
|
||||
@@ -303,8 +325,10 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu
|
||||
void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites )
|
||||
{
|
||||
GROUP *pGroup;
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
|
||||
//Now count the number of mobile groups in the sector.
|
||||
*pubNumTroops = *pubNumElites = *pubNumAdmins = 0;
|
||||
@@ -325,8 +349,10 @@ void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSe
|
||||
void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites )
|
||||
{
|
||||
SECTORINFO *pSector;
|
||||
Assert( sSectorX >= 1 && sSectorX <= 16 );
|
||||
Assert( sSectorY >= 1 && sSectorY <= 16 );
|
||||
AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE );
|
||||
AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE( sSectorY, MAXIMUM_VALID_Y_COORDINATE );
|
||||
pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ];
|
||||
|
||||
//grab the number of each type in the stationary sector
|
||||
@@ -428,6 +454,7 @@ UINT8 NumFreeEnemySlots()
|
||||
return ubNumFreeSlots;
|
||||
}
|
||||
|
||||
|
||||
//Called when entering a sector so the campaign AI can automatically insert the
|
||||
//correct number of troops of each type based on the current number in the sector
|
||||
//in global focus (gWorldSectorX/Y)
|
||||
@@ -436,11 +463,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
SECTORINFO *pSector;
|
||||
GROUP *pGroup;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
UINT8 ubNumAdmins, ubNumTroops, ubNumElites;
|
||||
UINT8 ubTotalAdmins, ubTotalElites, ubTotalTroops;
|
||||
UINT8 ubStationaryEnemies;
|
||||
INT32 i, num;
|
||||
INT16 sNumSlots;
|
||||
unsigned ubNumAdmins, ubNumTroops, ubNumElites;
|
||||
unsigned ubTotalAdmins, ubTotalElites, ubTotalTroops;
|
||||
unsigned totalCountOfStationaryEnemies = 0;
|
||||
unsigned totalCountOfMobileEnemies = 0;
|
||||
int sNumSlots;
|
||||
|
||||
gfPendingEnemies = FALSE;
|
||||
|
||||
@@ -459,7 +486,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) )
|
||||
{
|
||||
UINT16 pusMoveDir[4][3];
|
||||
UINT8 ubDirNumber = 0, ubIndex;
|
||||
UINT8 ubDirNumber = 0;
|
||||
GROUP *pGroup;
|
||||
SECTORINFO *pThisSector;
|
||||
|
||||
@@ -469,7 +496,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir,
|
||||
( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES );
|
||||
|
||||
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||
for( unsigned ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
|
||||
{
|
||||
while ( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) )
|
||||
{
|
||||
@@ -505,19 +532,27 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
return ( ( BOOLEAN) ( gpBattleGroup->ubGroupSize > 0 ) );
|
||||
}
|
||||
|
||||
if( !gbWorldSectorZ )
|
||||
{
|
||||
if( NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) > 32 )
|
||||
{
|
||||
gfPendingEnemies = TRUE;
|
||||
// WDS Count the number of placements. This will limit the maximum number of enemies we can place on the map
|
||||
SOLDIERINITNODE *curr = gSoldierInitHead;
|
||||
unsigned mapMaximumNumberOfEnemies = 0;
|
||||
while( curr ) {
|
||||
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM ) {
|
||||
++mapMaximumNumberOfEnemies;
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
AssertGE (mapMaximumNumberOfEnemies, 0);
|
||||
|
||||
if (mapMaximumNumberOfEnemies > gGameExternalOptions.ubGameMaximumNumberOfEnemies)
|
||||
mapMaximumNumberOfEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
|
||||
|
||||
gfPendingEnemies = (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) > mapMaximumNumberOfEnemies );
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
if( pSector->uiFlags & SF_USE_MAP_SETTINGS )
|
||||
{ //count the number of enemy placements in a map and use those
|
||||
SOLDIERINITNODE *curr;
|
||||
curr = gSoldierInitHead;
|
||||
SOLDIERINITNODE *curr = gSoldierInitHead;
|
||||
ubTotalAdmins = ubTotalTroops = ubTotalElites = 0;
|
||||
while( curr )
|
||||
{
|
||||
@@ -526,8 +561,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
switch( curr->pBasicPlacement->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR: ubTotalAdmins++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
|
||||
case SOLDIER_CLASS_ARMY: ubTotalTroops++; break;
|
||||
case SOLDIER_CLASS_ELITE: ubTotalElites++; break;
|
||||
}
|
||||
}
|
||||
curr = curr->next;
|
||||
@@ -541,23 +576,25 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
else
|
||||
{
|
||||
ubTotalAdmins = (UINT8)(pSector->ubNumAdmins - pSector->ubAdminsInBattle);
|
||||
ubTotalTroops = (UINT8)(pSector->ubNumTroops - pSector->ubTroopsInBattle);
|
||||
ubTotalElites = (UINT8)(pSector->ubNumElites - pSector->ubElitesInBattle);
|
||||
ubTotalAdmins = pSector->ubNumAdmins - pSector->ubAdminsInBattle;
|
||||
ubTotalTroops = pSector->ubNumTroops - pSector->ubTroopsInBattle;
|
||||
ubTotalElites = pSector->ubNumElites - pSector->ubElitesInBattle;
|
||||
}
|
||||
|
||||
ubStationaryEnemies = (UINT8)(ubTotalAdmins + ubTotalTroops + ubTotalElites);
|
||||
totalCountOfStationaryEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites;
|
||||
|
||||
if( ubStationaryEnemies > 32 )
|
||||
if( totalCountOfStationaryEnemies > mapMaximumNumberOfEnemies )
|
||||
{
|
||||
/*
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)",
|
||||
gWorldSectorY + 'A' - 1, gWorldSectorX, ubTotalAdmins + ubTotalTroops + ubTotalElites, 32 );
|
||||
gWorldSectorY + 'A' - 1, gWorldSectorX, ubTotalAdmins + ubTotalTroops + ubTotalElites, mapMaximumNumberOfEnemies );
|
||||
#endif
|
||||
*/
|
||||
|
||||
ubTotalAdmins = min( 32, ubTotalAdmins );
|
||||
ubTotalTroops = min( 32-ubTotalAdmins, ubTotalTroops );
|
||||
ubTotalElites = min( 32-ubTotalAdmins+ubTotalTroops, ubTotalElites );
|
||||
ubTotalAdmins = min( mapMaximumNumberOfEnemies, ubTotalAdmins );
|
||||
ubTotalTroops = min( mapMaximumNumberOfEnemies-ubTotalAdmins, ubTotalTroops );
|
||||
ubTotalElites = min( mapMaximumNumberOfEnemies-ubTotalAdmins-ubTotalTroops, ubTotalElites );
|
||||
}
|
||||
|
||||
pSector->ubAdminsInBattle += ubTotalAdmins;
|
||||
@@ -578,6 +615,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
|
||||
//Search for movement groups that happen to be in the sector.
|
||||
sNumSlots = NumFreeEnemySlots();
|
||||
if (sNumSlots > (int)mapMaximumNumberOfEnemies)
|
||||
sNumSlots = mapMaximumNumberOfEnemies;
|
||||
|
||||
/*
|
||||
* WDS - this test no longer valid with the above change
|
||||
//Test: All slots should be free at this point!
|
||||
if( sNumSlots != gTacticalStatus.Team[ENEMY_TEAM].bLastID - gTacticalStatus.Team[ENEMY_TEAM].bFirstID + 1 )
|
||||
{
|
||||
@@ -587,6 +629,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
ubTotalAdmins, ubTotalTroops, ubTotalElites );
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
//Subtract the total number of stationary enemies from the available slots, as stationary forces take
|
||||
//precendence in combat. The mobile forces that could also be in the same sector are considered later if
|
||||
@@ -606,7 +649,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
{ //Process enemy group in sector.
|
||||
if( sNumSlots > 0 )
|
||||
{
|
||||
ubNumAdmins = (UINT8)(pGroup->pEnemyGroup->ubNumAdmins - pGroup->pEnemyGroup->ubAdminsInBattle);
|
||||
AssertGE(pGroup->pEnemyGroup->ubNumAdmins, pGroup->pEnemyGroup->ubAdminsInBattle);
|
||||
ubNumAdmins = pGroup->pEnemyGroup->ubNumAdmins - pGroup->pEnemyGroup->ubAdminsInBattle;
|
||||
sNumSlots -= ubNumAdmins;
|
||||
if( sNumSlots < 0 )
|
||||
{ //adjust the value to zero
|
||||
@@ -619,7 +663,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
if( sNumSlots > 0 )
|
||||
{ //Add regular army forces.
|
||||
ubNumTroops = (UINT8)(pGroup->pEnemyGroup->ubNumTroops - pGroup->pEnemyGroup->ubTroopsInBattle);
|
||||
AssertGE(pGroup->pEnemyGroup->ubNumTroops, pGroup->pEnemyGroup->ubTroopsInBattle);
|
||||
ubNumTroops = pGroup->pEnemyGroup->ubNumTroops - pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||
sNumSlots -= ubNumTroops;
|
||||
if( sNumSlots < 0 )
|
||||
{ //adjust the value to zero
|
||||
@@ -632,7 +677,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
if( sNumSlots > 0 )
|
||||
{ //Add elite troops
|
||||
ubNumElites = (UINT8)(pGroup->pEnemyGroup->ubNumElites - pGroup->pEnemyGroup->ubElitesInBattle);
|
||||
AssertGE(pGroup->pEnemyGroup->ubNumElites, pGroup->pEnemyGroup->ubElitesInBattle);
|
||||
ubNumElites = pGroup->pEnemyGroup->ubNumElites - pGroup->pEnemyGroup->ubElitesInBattle;
|
||||
sNumSlots -= ubNumElites;
|
||||
if( sNumSlots < 0 )
|
||||
{ //adjust the value to zero
|
||||
@@ -673,10 +719,10 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
|
||||
//Now, we have to go through all of the enemies in the new map, and assign their respective groups if
|
||||
//in a mobile group, but only for the ones that were assigned from the
|
||||
sNumSlots = 32 - ubStationaryEnemies;
|
||||
sNumSlots = mapMaximumNumberOfEnemies - totalCountOfStationaryEnemies;
|
||||
|
||||
pGroup = gpGroupList;
|
||||
while( pGroup && sNumSlots )
|
||||
while( pGroup && sNumSlots > 0 )
|
||||
{
|
||||
if( !pGroup->fPlayer && !pGroup->fVehicle &&
|
||||
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
|
||||
@@ -684,16 +730,18 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
ubNumAdmins = pGroup->pEnemyGroup->ubAdminsInBattle;
|
||||
ubNumTroops = pGroup->pEnemyGroup->ubTroopsInBattle;
|
||||
ubNumElites = pGroup->pEnemyGroup->ubElitesInBattle;
|
||||
num = ubNumAdmins + ubNumTroops + ubNumElites;
|
||||
unsigned num = ubNumAdmins + ubNumTroops + ubNumElites;
|
||||
|
||||
for (i= gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
||||
i<= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID && num;
|
||||
i++)
|
||||
unsigned firstSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID;
|
||||
unsigned lastSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID;
|
||||
unsigned slotsAvailable = lastSlot-firstSlot+1;
|
||||
AssertGE((int)slotsAvailable, sNumSlots);
|
||||
|
||||
for (unsigned slot = firstSlot;
|
||||
(slot <= lastSlot) && (num > 0);
|
||||
++slot)
|
||||
{
|
||||
// At this point we should not have added more soldiers than are in slots
|
||||
Assert( sNumSlots);
|
||||
|
||||
pSoldier = &Menptr[ i ];
|
||||
pSoldier = &Menptr[ slot ];
|
||||
|
||||
// Skip inactive and already grouped soldiers
|
||||
if (!pSoldier->bActive || pSoldier->ubGroupID)
|
||||
@@ -701,6 +749,9 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
continue;
|
||||
}
|
||||
|
||||
// At this point we should not have added more soldiers than are in slots
|
||||
AssertGT( sNumSlots, 0 );
|
||||
|
||||
switch( pSoldier->ubSoldierClass )
|
||||
{
|
||||
case SOLDIER_CLASS_ADMINISTRATOR:
|
||||
@@ -733,7 +784,10 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
}
|
||||
}
|
||||
|
||||
Assert( ubNumElites + ubNumTroops + ubNumAdmins + num == 0);
|
||||
AssertEQ( ubNumElites , 0);
|
||||
AssertEQ( ubNumTroops , 0);
|
||||
AssertEQ( ubNumAdmins , 0);
|
||||
AssertEQ( num , 0);
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
@@ -746,7 +800,8 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
BOOLEAN PrepareEnemyForUndergroundBattle()
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pUnderground;
|
||||
UINT8 ubTotalAdmins, ubTotalTroops, ubTotalElites;
|
||||
unsigned ubTotalAdmins, ubTotalTroops, ubTotalElites;
|
||||
|
||||
pUnderground = gpUndergroundSectorInfoHead;
|
||||
while( pUnderground )
|
||||
{
|
||||
@@ -780,9 +835,10 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT32 iNumEnemiesInSector;
|
||||
SECTORINFO *pSector;
|
||||
// CHAR16 str[128];
|
||||
INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize;
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
|
||||
AssertNotNIL (pSoldier);
|
||||
|
||||
EvaluateDeathEffectsToSoldierInitList( pSoldier );
|
||||
|
||||
@@ -861,7 +917,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( pGroup->ubGroupSize <= iMaxEnemyGroupSize && pGroup->pEnemyGroup->ubNumElites != pGroup->pEnemyGroup->ubElitesInBattle && !gfPendingEnemies ||
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize || pGroup->pEnemyGroup->ubNumElites > 50 || pGroup->pEnemyGroup->ubElitesInBattle > 50 )
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize /* || pGroup->pEnemyGroup->ubNumElites > 50 || pGroup->pEnemyGroup->ubElitesInBattle > 50*/ )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Group elite counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
@@ -887,7 +943,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( pGroup->ubGroupSize <= iMaxEnemyGroupSize && pGroup->pEnemyGroup->ubNumTroops != pGroup->pEnemyGroup->ubTroopsInBattle && !gfPendingEnemies ||
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize || pGroup->pEnemyGroup->ubNumTroops > 50 || pGroup->pEnemyGroup->ubTroopsInBattle > 50 )
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize /*|| pGroup->pEnemyGroup->ubNumTroops > 50 || pGroup->pEnemyGroup->ubTroopsInBattle > 50*/ )
|
||||
{
|
||||
// haydent
|
||||
if (!is_client)
|
||||
@@ -918,7 +974,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( pGroup->ubGroupSize <= iMaxEnemyGroupSize && pGroup->pEnemyGroup->ubNumAdmins != pGroup->pEnemyGroup->ubAdminsInBattle && !gfPendingEnemies ||
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize || pGroup->pEnemyGroup->ubNumAdmins > 50 || pGroup->pEnemyGroup->ubAdminsInBattle > 50 )
|
||||
pGroup->ubGroupSize > iMaxEnemyGroupSize /*|| pGroup->pEnemyGroup->ubNumAdmins > 50 || pGroup->pEnemyGroup->ubAdminsInBattle > 50*/ )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Group admin counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
@@ -970,9 +1026,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
#ifdef JA2BETAVERSION
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( ubTotalEnemies <= 32 && pSector->ubNumAdmins != pSector->ubAdminsInBattle ||
|
||||
if( ubTotalEnemies <= gGameExternalOptions.ubGameMaximumNumberOfEnemies && pSector->ubNumAdmins != pSector->ubAdminsInBattle ||
|
||||
!pSector->ubNumAdmins || !pSector->ubAdminsInBattle ||
|
||||
pSector->ubNumAdmins > 100 || pSector->ubAdminsInBattle > 32 )
|
||||
pSector->ubNumAdmins > gGameExternalOptions.ubGameMaximumNumberOfEnemies || pSector->ubAdminsInBattle > gGameExternalOptions.ubGameMaximumNumberOfEnemies )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Sector admin counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
@@ -991,9 +1047,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
#ifdef JA2BETAVERSION
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( ubTotalEnemies <= 32 && pSector->ubNumTroops != pSector->ubTroopsInBattle ||
|
||||
if( ubTotalEnemies <= gGameExternalOptions.ubGameMaximumNumberOfEnemies && pSector->ubNumTroops != pSector->ubTroopsInBattle ||
|
||||
!pSector->ubNumTroops || !pSector->ubTroopsInBattle ||
|
||||
pSector->ubNumTroops > 100 || pSector->ubTroopsInBattle > 32 )
|
||||
pSector->ubNumTroops > gGameExternalOptions.ubGameMaximumNumberOfEnemies || pSector->ubTroopsInBattle > gGameExternalOptions.ubGameMaximumNumberOfEnemies )
|
||||
{
|
||||
if(!is_client)DoScreenIndependantMessageBox( L"Sector troop counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
//disabled: hayden.
|
||||
@@ -1013,9 +1069,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
#ifdef JA2BETAVERSION
|
||||
if( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
if( ubTotalEnemies <= 32 && pSector->ubNumElites != pSector->ubElitesInBattle ||
|
||||
if( ubTotalEnemies <= gGameExternalOptions.ubGameMaximumNumberOfEnemies && pSector->ubNumElites != pSector->ubElitesInBattle ||
|
||||
!pSector->ubNumElites || !pSector->ubElitesInBattle ||
|
||||
pSector->ubNumElites > 100 || pSector->ubElitesInBattle > 32 )
|
||||
pSector->ubNumElites > gGameExternalOptions.ubGameMaximumNumberOfEnemies || pSector->ubElitesInBattle > gGameExternalOptions.ubGameMaximumNumberOfEnemies )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Sector elite counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
@@ -1133,7 +1189,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand");
|
||||
#ifdef JA2BETAVERSION
|
||||
if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle ||
|
||||
!pSector->ubNumCreatures || !pSector->ubCreaturesInBattle ||
|
||||
pSector->ubNumCreatures > 50 || pSector->ubCreaturesInBattle > 50 )
|
||||
pSector->ubNumCreatures > gGameExternalOptions.ubGameMaximumNumberOfCreatures || pSector->ubCreaturesInBattle > gGameExternalOptions.ubGameMaximumNumberOfCreatures )
|
||||
{
|
||||
DoScreenIndependantMessageBox( L"Underground sector creature counters are bad. What were the last 2-3 things to die, and how? Save game and send to KM with info!!!", MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
@@ -1191,11 +1247,15 @@ 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
|
||||
//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.
|
||||
//essentially allows for an infinite number of troops, though only gGameExternalOptions.ubGameMaximumNumberOfEnemies 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.
|
||||
void AddPossiblePendingEnemiesToBattle()
|
||||
{
|
||||
// check if no world is loaded
|
||||
if ( !gWorldSectorX && !gWorldSectorY && (gbWorldSectorZ == -1) )
|
||||
return;
|
||||
|
||||
UINT8 ubSlots, ubNumAvailable;
|
||||
UINT8 ubNumElites, ubNumTroops, ubNumAdmins;
|
||||
UINT8 ubNumGroupsInSector;
|
||||
@@ -1214,10 +1274,6 @@ void AddPossiblePendingEnemiesToBattle()
|
||||
}
|
||||
}
|
||||
|
||||
// check if no world is loaded
|
||||
if ( !gWorldSectorX && !gWorldSectorY && (gbWorldSectorZ == -1) )
|
||||
return;
|
||||
|
||||
if( ( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
||||
|
||||
@@ -1811,6 +1867,8 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
||||
|
||||
static INT16 sInterrogationItemGridNo[] = { 12089, 12089, 12089 };
|
||||
|
||||
AssertNotNIL(pSoldier);
|
||||
|
||||
|
||||
// ATE: Check first if ! in player captured sequence already
|
||||
// CJC Dec 1 2002: fixing multiple captures
|
||||
|
||||
@@ -332,7 +332,7 @@ UINT8 NumFreeMilitiaSlots()
|
||||
if( !pSoldier->bActive )
|
||||
ubNumFreeSlots++;
|
||||
}
|
||||
return max( 0 , ubNumFreeSlots - ( 32 - gGameExternalOptions.guiMaxMilitiaSquadSize ) );
|
||||
return max( 0 , ubNumFreeSlots - ( gGameExternalOptions.ubGameMaximumNumberOfRebels - gGameExternalOptions.guiMaxMilitiaSquadSize ) );
|
||||
}
|
||||
|
||||
UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank )
|
||||
@@ -403,9 +403,9 @@ void AddPossiblePendingMilitiaToBattle()
|
||||
|
||||
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
|
||||
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
|
||||
if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 )
|
||||
if( (PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) == 0)
|
||||
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|
||||
|| !NumEnemiesInSector( gWorldSectorX, gWorldSectorY )
|
||||
|| (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) == 0)
|
||||
)
|
||||
return;
|
||||
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );
|
||||
|
||||
+168
-9
@@ -830,6 +830,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic2");
|
||||
void ValidateLargeGroup( GROUP *pGroup )
|
||||
{
|
||||
#ifdef JA2BETAVERSION
|
||||
/* WDS - this code is no longer applicable with changes to group sizes
|
||||
if( pGroup->ubGroupSize > 25 )
|
||||
{
|
||||
CHAR16 str[ 512 ];
|
||||
@@ -840,6 +841,7 @@ void ValidateLargeGroup( GROUP *pGroup )
|
||||
pGroup->ubSectorY + 'A' - 1, pGroup->ubSectorX );
|
||||
SAIReportError( str );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2326,6 +2328,7 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
return FALSE;
|
||||
if( !EnemyPermittedToAttackSector( NULL, (UINT8)SECTOR( pPlayerGroup->ubSectorX, pPlayerGroup->ubSectorY ) ) )
|
||||
return FALSE;
|
||||
// WDS BAD BUG FIX - 12/25/2008 - some of the +1/-1 in the following were goofed up
|
||||
if( pPlayerGroup->ubSectorY > 1 )
|
||||
{
|
||||
pEnemyGroup = FindMovementGroupInSector( pPlayerGroup->ubSectorX, (UINT8)(pPlayerGroup->ubSectorY-1), FALSE );
|
||||
@@ -2350,11 +2353,11 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
return FALSE;
|
||||
}
|
||||
pSector = &SectorInfo[ SECTOR( pPlayerGroup->ubSectorX-1, pPlayerGroup->ubSectorY ) ];
|
||||
pSector = &SectorInfo[ SECTOR( pPlayerGroup->ubSectorX+1, pPlayerGroup->ubSectorY ) ];
|
||||
ubNumEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
|
||||
if( ubNumEnemies && pSector->ubGarrisonID != NO_GARRISON && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX-1, pPlayerGroup->ubSectorY ) );
|
||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX+1, pPlayerGroup->ubSectorY ) );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -2382,11 +2385,11 @@ BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
|
||||
HandlePlayerGroupNoticedByPatrolGroup( pPlayerGroup, pEnemyGroup );
|
||||
return FALSE;
|
||||
}
|
||||
pSector = &SectorInfo[ SECTOR( pPlayerGroup->ubSectorX+1, pPlayerGroup->ubSectorY ) ];
|
||||
pSector = &SectorInfo[ SECTOR( pPlayerGroup->ubSectorX-1, pPlayerGroup->ubSectorY ) ];
|
||||
ubNumEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
|
||||
if( ubNumEnemies && pSector->ubGarrisonID != NO_GARRISON && AttemptToNoticeAdjacentGroupSucceeds() )
|
||||
{
|
||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX+1, pPlayerGroup->ubSectorY ) );
|
||||
HandlePlayerGroupNoticedByGarrison( pPlayerGroup, (UINT8)SECTOR( pPlayerGroup->ubSectorX-1, pPlayerGroup->ubSectorY ) );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -2790,7 +2793,7 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints
|
||||
UINT8 ubGroupSize;
|
||||
BOOLEAN fLimitMaxTroopsAllowable = FALSE;
|
||||
|
||||
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
|
||||
Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */
|
||||
ValidateWeights( 8 );
|
||||
|
||||
if( gGarrisonGroup[ iDstGarrisonID ].ubSectorID == SEC_B13 ||
|
||||
@@ -2928,7 +2931,9 @@ void SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoints
|
||||
else
|
||||
{
|
||||
iSrcGarrisonID = ChooseSuitableGarrisonToProvideReinforcements( iDstGarrisonID, iReinforcementsRequested );
|
||||
if( iSrcGarrisonID == -1 )
|
||||
// WDS 08/01/2008 - Fix 0 reinforcement problem
|
||||
iReinforcementsAvailable = ReinforcementsAvailable( iSrcGarrisonID );
|
||||
if( (iSrcGarrisonID == -1) || (iReinforcementsAvailable == 0) )
|
||||
{
|
||||
ValidateWeights( 15 );
|
||||
goto QUEEN_POOL;
|
||||
@@ -4154,14 +4159,15 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7");
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSectorY )
|
||||
void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSectorY,
|
||||
INT32 option1, INT32 option2 )
|
||||
{
|
||||
GROUP *pGroup, *pGroup0, *pGroup1, *pGroup2, *pGroup3, *pPendingGroup = NULL;
|
||||
SECTORINFO *pSector;
|
||||
UINT8 ubSectorID;
|
||||
UINT8 ubSourceSectorID;
|
||||
UINT8 ubTargetSectorID;
|
||||
UINT8 ubNumSoldiers;
|
||||
unsigned ubNumSoldiers;
|
||||
|
||||
switch( usActionCode )
|
||||
{
|
||||
@@ -4318,7 +4324,151 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
|
||||
{
|
||||
MoveSAIGroupToSector( &pGroup, ubSectorID, EVASIVE, PURSUIT );
|
||||
}
|
||||
break;
|
||||
|
||||
// WDS - New AI
|
||||
case NPC_ACTION_SEND_WEIGHTED_ASSAULT_TO_LOCATION: // USES OPTIONAL PARAMETERS
|
||||
if (gGameExternalOptions.useNewAI) {
|
||||
// Send troops to assault the specified location.
|
||||
|
||||
// ** 1st optional parm is a "direness" rating from the queens point of view
|
||||
// that ranges from 0 to 100. It it used to determine the number of troops and
|
||||
// their composition
|
||||
// ** If 2nd optional parm is specified that is used as the groups "intention"
|
||||
unsigned direness = (unsigned) option1;
|
||||
Assert(direness >= 0 && direness <= 100);
|
||||
unsigned intention = (unsigned) option2;
|
||||
Assert(intention < NUM_ENEMY_INTENTIONS);
|
||||
|
||||
ubNumSoldiers = ( gubMinEnemyGroupSize +
|
||||
gGameOptions.ubDifficultyLevel * 3 +
|
||||
Random(HighestPlayerProgressPercentage() / 5) +
|
||||
Random(option1 / 5)
|
||||
);
|
||||
|
||||
if ( !gfUnlimitedTroops )
|
||||
giReinforcementPool -= ubNumSoldiers;
|
||||
|
||||
giReinforcementPool = max( giReinforcementPool, 0 );
|
||||
|
||||
ubSourceSectorID = SEC_H13;
|
||||
ubTargetSectorID = (UINT8)SECTOR( sSectorX, sSectorY );
|
||||
|
||||
if ( !(SectorInfo[ ubSourceSectorID ].ubNumTroops > 0) )
|
||||
{
|
||||
ubSourceSectorID = SEC_P3;
|
||||
}
|
||||
|
||||
int groupCnt = 0;
|
||||
while (ubNumSoldiers != 0) {
|
||||
++groupCnt;
|
||||
unsigned soldiersThisSquad = ubNumSoldiers;
|
||||
if (soldiersThisSquad > (unsigned)gGameExternalOptions.iMaxEnemyGroupSize) {
|
||||
soldiersThisSquad = (unsigned)gGameExternalOptions.iMaxEnemyGroupSize;
|
||||
}
|
||||
ubNumSoldiers -= soldiersThisSquad;
|
||||
unsigned adminsThisSquad = 0;
|
||||
unsigned troopsThisSquad = 0;
|
||||
unsigned elitesThisSquad = 0;
|
||||
if (direness < 25) {
|
||||
adminsThisSquad = soldiersThisSquad * (40 + Random(20)) / 100; // 40-60% of total
|
||||
troopsThisSquad = soldiersThisSquad - adminsThisSquad; // The rest
|
||||
} else if (direness < 50) {
|
||||
adminsThisSquad = soldiersThisSquad * (20 + Random(10)) / 100; // 20-30% of total
|
||||
troopsThisSquad = soldiersThisSquad * (30 + Random(20)) / 100; // 30-50% of total
|
||||
elitesThisSquad = soldiersThisSquad - troopsThisSquad - adminsThisSquad; // The rest
|
||||
} else if (direness < 75) {
|
||||
adminsThisSquad = soldiersThisSquad * (10 + Random(10)) / 100; // 10-20% of total
|
||||
troopsThisSquad = soldiersThisSquad * (20 + Random(20)) / 100; // 20-40% of total
|
||||
elitesThisSquad = soldiersThisSquad - troopsThisSquad - adminsThisSquad; // The rest
|
||||
} else /* direness >=75 */ {
|
||||
adminsThisSquad = 0; // 0% of total
|
||||
troopsThisSquad = soldiersThisSquad * (30 + Random(20)) / 100; // 30-50% of total
|
||||
elitesThisSquad = soldiersThisSquad - troopsThisSquad - adminsThisSquad; // The rest
|
||||
}
|
||||
Assert(adminsThisSquad + troopsThisSquad + elitesThisSquad == soldiersThisSquad);
|
||||
pGroup0 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, adminsThisSquad, soldiersThisSquad, elitesThisSquad );
|
||||
if( !gGarrisonGroup[ SectorInfo[ ubTargetSectorID ].ubGarrisonID ].ubPendingGroupID ) {
|
||||
pGroup0->pEnemyGroup->ubIntention = STAGE;
|
||||
if (groupCnt > 2) {
|
||||
pGroup0->pEnemyGroup->ubIntention = REINFORCEMENTS;
|
||||
gGarrisonGroup[ SectorInfo[ ubTargetSectorID ].ubGarrisonID ].ubPendingGroupID = pGroup0->ubGroupID;
|
||||
}
|
||||
} else {
|
||||
pGroup0->pEnemyGroup->ubIntention = PURSUIT;
|
||||
}
|
||||
MoveSAIGroupToSector( &pGroup0, ubTargetSectorID, EVASIVE, pGroup0->pEnemyGroup->ubIntention );
|
||||
} // while
|
||||
} // if (gGameExternalOptions.useNewAI)
|
||||
break;
|
||||
|
||||
// WDS - New AI
|
||||
case NPC_ACTION_SEND_SPECIFIC_ASSAULT_TO_LOCATION: // USES OPTIONAL PARAMETERS
|
||||
if (gGameExternalOptions.useNewAI) {
|
||||
// Send specific troops to assauat the specified location.
|
||||
|
||||
// Note: 1st optional parm is a count of troops to send
|
||||
// 2nd optional parm is the composition of troops
|
||||
if (option1 > 0 && option1 < 256) {
|
||||
ubNumSoldiers = (UINT8)(option1);
|
||||
} else {
|
||||
// Something is goofy, just send a default sized squad
|
||||
ubNumSoldiers = gubMinEnemyGroupSize;
|
||||
}
|
||||
unsigned adminsPercentage = 0;
|
||||
unsigned troopsPercentage = 0;
|
||||
unsigned elitesPercentage = 0;
|
||||
// option2: value is eettaa
|
||||
if (option2 > 0 && option2 < 99+99*100+99*100*100) {
|
||||
adminsPercentage = option2 % 100;
|
||||
troopsPercentage = (option2 / 100) % 100;
|
||||
elitesPercentage = (option2 / 10000) % 100;
|
||||
} else {
|
||||
// Something is goofy, just use a default composition
|
||||
adminsPercentage = 25;
|
||||
troopsPercentage = 50;
|
||||
elitesPercentage = 25;
|
||||
}
|
||||
Assert(adminsPercentage + troopsPercentage + elitesPercentage == 100);
|
||||
|
||||
if ( !gfUnlimitedTroops )
|
||||
giReinforcementPool -= ubNumSoldiers;
|
||||
giReinforcementPool = max( giReinforcementPool, 0 );
|
||||
|
||||
ubSourceSectorID = SEC_H13;
|
||||
ubTargetSectorID = (UINT8)SECTOR( sSectorX, sSectorY );
|
||||
|
||||
if ( !(SectorInfo[ ubSourceSectorID ].ubNumTroops > 0) )
|
||||
{
|
||||
ubSourceSectorID = SEC_P3;
|
||||
}
|
||||
|
||||
int groupCnt = 0;
|
||||
while (ubNumSoldiers != 0) {
|
||||
++groupCnt;
|
||||
unsigned soldiersThisSquad = ubNumSoldiers;
|
||||
if (soldiersThisSquad > (unsigned)gGameExternalOptions.iMaxEnemyGroupSize) {
|
||||
soldiersThisSquad = (unsigned)gGameExternalOptions.iMaxEnemyGroupSize;
|
||||
}
|
||||
ubNumSoldiers -= soldiersThisSquad;
|
||||
unsigned adminsThisSquad = soldiersThisSquad * adminsPercentage / 100;
|
||||
unsigned troopsThisSquad = soldiersThisSquad * troopsPercentage / 100;
|
||||
unsigned elitesThisSquad = soldiersThisSquad - troopsThisSquad - adminsThisSquad; // The rest
|
||||
|
||||
Assert(adminsThisSquad + troopsThisSquad + elitesThisSquad == soldiersThisSquad);
|
||||
pGroup0 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, adminsThisSquad, soldiersThisSquad, elitesThisSquad );
|
||||
if( !gGarrisonGroup[ SectorInfo[ ubTargetSectorID ].ubGarrisonID ].ubPendingGroupID ) {
|
||||
pGroup0->pEnemyGroup->ubIntention = STAGE;
|
||||
if (groupCnt > 2) {
|
||||
pGroup0->pEnemyGroup->ubIntention = REINFORCEMENTS;
|
||||
gGarrisonGroup[ SectorInfo[ ubTargetSectorID ].ubGarrisonID ].ubPendingGroupID = pGroup0->ubGroupID;
|
||||
}
|
||||
} else {
|
||||
pGroup0->pEnemyGroup->ubIntention = PURSUIT;
|
||||
}
|
||||
MoveSAIGroupToSector( &pGroup0, ubTargetSectorID, EVASIVE, pGroup0->pEnemyGroup->ubIntention );
|
||||
} // while
|
||||
} // if (gGameExternalOptions.useNewAI)
|
||||
break;
|
||||
|
||||
case NPC_ACTION_SEND_SOLDIERS_TO_OMERTA:
|
||||
@@ -4403,6 +4553,14 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// WDS - New AI
|
||||
void HourlyCheckStrategicAI()
|
||||
{
|
||||
// Nothing (yet!)
|
||||
}
|
||||
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
|
||||
void LogStrategicMsg( STR8 str, ... )
|
||||
@@ -5233,7 +5391,8 @@ void UpgradeAdminsToTroops()
|
||||
for( i = 0; i < giGarrisonArraySize; i++ )
|
||||
{
|
||||
// skip sector if it's currently loaded, we'll never upgrade guys in those
|
||||
if ( SECTOR( gWorldSectorX, gWorldSectorY ) == gGarrisonGroup[ i ].ubSectorID )
|
||||
if ( (gWorldSectorX != 0) && (gWorldSectorY != 0) &&
|
||||
(SECTOR( gWorldSectorX, gWorldSectorY ) == gGarrisonGroup[ i ].ubSectorID) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,14 @@ enum
|
||||
|
||||
};
|
||||
|
||||
|
||||
void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSectorY );
|
||||
// WDS - New AI
|
||||
void ExecuteStrategicAIAction(
|
||||
UINT16 usActionCode, // See list in "interface Dialogue.h"
|
||||
INT16 sSectorX, // Target X location of strategic action
|
||||
INT16 sSectorY, // Target Y location of strategic action
|
||||
INT32 option1 = 0, // Option 1, vaies with action
|
||||
INT32 option2 = 0 // Option 2, vaies with action
|
||||
);
|
||||
|
||||
void CheckEnemyControlledSector( UINT8 ubSectorID );
|
||||
void EvaluateQueenSituation();
|
||||
@@ -40,6 +46,9 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY,
|
||||
|
||||
void InvestigateSector( UINT8 ubSectorID );
|
||||
|
||||
// WDS - New AI
|
||||
void HourlyCheckStrategicAI();
|
||||
|
||||
void WakeUpQueen();
|
||||
|
||||
void StrategicHandleMineThatRanOut( UINT8 ubSectorID );
|
||||
|
||||
@@ -160,7 +160,8 @@ smctableEndElementHandle(void *userData, const XML_Char *name)
|
||||
// We've read in a complete section. Process the contents of pData into the
|
||||
// SectionInfo array
|
||||
SECTORINFO *pSector;
|
||||
pSector = &SectorInfo[ ((pData->uiRowNumber - 1) * 16) + (pData->uiColNumber - 1) ];
|
||||
int sectorID = ((pData->uiRowNumber - 1) * 16) + (pData->uiColNumber - 1);
|
||||
pSector = &SectorInfo[ sectorID ];
|
||||
pSector->ubTravelRating = pData->travRating;
|
||||
pSector->ubTraversability[ NORTH_STRATEGIC_MOVE ] = pData->travNorth;
|
||||
pSector->ubTraversability[ EAST_STRATEGIC_MOVE ] = pData->travEast;
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#endif
|
||||
|
||||
#include "MilitiaSquads.h"
|
||||
#include "Vehicles.h"
|
||||
|
||||
#include "connect.h"
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
@@ -76,7 +78,6 @@ extern BOOLEAN gfUsePersistantPBI;
|
||||
|
||||
extern BOOLEAN gubNumAwareBattles;
|
||||
extern INT8 SquadMovementGroups[ ];
|
||||
extern INT8 gubVehicleMovementGroups[ ];
|
||||
|
||||
BOOLEAN gfDelayAutoResolveStart = FALSE;
|
||||
|
||||
@@ -740,6 +741,8 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
L"with a save close to this event, that would really help me! -- KM:0" );
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
/*
|
||||
* Not valid
|
||||
else if( pNew->ubGroupSize > 25 )
|
||||
{
|
||||
swprintf( str, L"Strategic AI warning: Creating an enemy group containing %d soldiers "
|
||||
@@ -749,6 +752,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin
|
||||
pNew->ubSectorY + 'A' - 1, pNew->ubSectorX );
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, NULL );
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -767,10 +771,22 @@ UINT8 AddGroupToList( GROUP *pGroup )
|
||||
{
|
||||
GROUP *curr;
|
||||
UINT32 bit, index, mask;
|
||||
UINT8 ID = 0;
|
||||
unsigned ID = 0;
|
||||
|
||||
AssertNotNIL (pGroup);
|
||||
AssertGE (pGroup->ubSectorX, MINIMUM_VALID_X_COORDINATE);
|
||||
AssertLE (pGroup->ubSectorX, MAXIMUM_VALID_X_COORDINATE);
|
||||
AssertGE (pGroup->ubSectorY, MINIMUM_VALID_Y_COORDINATE);
|
||||
AssertLE (pGroup->ubSectorY, MAXIMUM_VALID_Y_COORDINATE);
|
||||
AssertGE (pGroup->ubSectorZ, MINIMUM_VALID_Z_COORDINATE);
|
||||
AssertLE (pGroup->ubSectorZ, MAXIMUM_VALID_Z_COORDINATE);
|
||||
//AssertGT (pGroup->ubGroupSize, 0);
|
||||
|
||||
//First, find a unique ID
|
||||
while( ++ID )
|
||||
{
|
||||
AssertLT (ID, 256);
|
||||
|
||||
index = ID / 32;
|
||||
bit = ID % 32;
|
||||
mask = 1 << bit;
|
||||
@@ -898,15 +914,18 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
|
||||
// ATE; Changed alogrithm here...
|
||||
// We first loop through the group and save ubID's ov valid guys to talk....
|
||||
// ( Can't if sleeping, unconscious, and EPC, etc....
|
||||
UINT8 ubMercsInGroup[ 20 ] = { 0 };
|
||||
UINT8 ubNumMercs = 0;
|
||||
UINT8 ubChosenMerc;
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
unsigned ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 };
|
||||
unsigned ubNumMercs = 0;
|
||||
unsigned ubChosenMerc;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
PLAYERGROUP *pPlayer;
|
||||
|
||||
if( fDisableMapInterfaceDueToBattle )
|
||||
{
|
||||
AssertMsg( 0, "fDisableMapInterfaceDueToBattle is set before attempting to bring up PBI. Please send PRIOR save if possible and details on anything that just happened before this battle." );
|
||||
// WDS Note: This can validly happen when multiple teams retreat and then immediately return to a sector.
|
||||
// Just returning causes no problems.
|
||||
// AssertMsg( 0, "fDisableMapInterfaceDueToBattle is set before attempting to bring up PBI. Please send PRIOR save if possible and details on anything that just happened before this battle." );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1094,7 +1113,8 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
{
|
||||
pPlayerDialogGroup = pGroup;
|
||||
|
||||
if( NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) )
|
||||
if( NumEnemiesInSector( pGroup->ubSectorX, pGroup->ubSectorY ) &&
|
||||
(!IsGroupTheHelicopterGroup( pGroup ) || (gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE)))
|
||||
{
|
||||
fBattlePending = TRUE;
|
||||
StopTimeCompression();
|
||||
@@ -1392,7 +1412,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
||||
}
|
||||
pPlayer = pPlayer->next;
|
||||
}
|
||||
while( pGroup->ubGroupSize && curr->ubGroupSize < 6 )
|
||||
while( pGroup->ubGroupSize && curr->ubGroupSize < NUMBER_OF_SOLDIERS_PER_SQUAD )
|
||||
{ //while there is room in the new group, move one soldier at a time automatically.
|
||||
#ifdef JA2BETAVERSION
|
||||
counter++;
|
||||
@@ -1425,7 +1445,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
||||
curr = curr->next;
|
||||
}
|
||||
}
|
||||
else if( pGroup->ubGroupSize < 6 )
|
||||
else if( pGroup->ubGroupSize < NUMBER_OF_SOLDIERS_PER_SQUAD )
|
||||
{ //Search for other groups looking to join our group.
|
||||
while( curr )
|
||||
{
|
||||
@@ -1449,7 +1469,7 @@ BOOLEAN AttemptToMergeSeparatedGroups( GROUP *pGroup, BOOLEAN fDecrementTraversa
|
||||
}
|
||||
pPlayer = pPlayer->next;
|
||||
}
|
||||
while( curr->ubGroupSize && pGroup->ubGroupSize < 6 )
|
||||
while( curr->ubGroupSize && pGroup->ubGroupSize < NUMBER_OF_SOLDIERS_PER_SQUAD )
|
||||
{ //while there is room in the new group, move one soldier at a time automatically.
|
||||
#ifdef JA2BETAVERSION
|
||||
counter++;
|
||||
@@ -1969,15 +1989,18 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
// check if sector had been visited previously
|
||||
fFirstTimeInSector = !GetSectorFlagStatus( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, SF_ALREADY_VISITED );
|
||||
|
||||
if (fFirstTimeInSector) {
|
||||
AddExtraItems( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ );
|
||||
}
|
||||
|
||||
// on foot, or in a vehicle other than the chopper
|
||||
if ( !pGroup->fVehicle || !IsGroupTheHelicopterGroup( pGroup ) )
|
||||
{
|
||||
|
||||
// ATE: Add a few corpse to the bloodcat lair...
|
||||
if ( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) == SEC_I16 && fFirstTimeInSector )
|
||||
{
|
||||
AddCorpsesToBloodcatLair( pGroup->ubSectorX, pGroup->ubSectorY );
|
||||
}
|
||||
// ATE: Add a few corpse to the bloodcat lair...
|
||||
if ( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) == SEC_I16 && fFirstTimeInSector )
|
||||
{
|
||||
AddCorpsesToBloodcatLair( pGroup->ubSectorX, pGroup->ubSectorY );
|
||||
}
|
||||
|
||||
// mark the sector as visited already
|
||||
SetSectorFlag( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, SF_ALREADY_VISITED );
|
||||
@@ -2005,7 +2028,8 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
while( gubNumGroupsArrivedSimultaneously && pGroup )
|
||||
{
|
||||
next = pGroup->next;
|
||||
if( pGroup->uiFlags & GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY )
|
||||
// WDS - Fix bug with 0 size group arriving at 0,0,0
|
||||
if( (pGroup->ubGroupSize > 0) && pGroup->uiFlags & GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY )
|
||||
{
|
||||
gubNumGroupsArrivedSimultaneously--;
|
||||
HandleNonCombatGroupArrival( pGroup, FALSE, FALSE );
|
||||
@@ -2375,9 +2399,11 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup )
|
||||
dx = wp->x - pGroup->ubSectorX;
|
||||
dy = wp->y - pGroup->ubSectorY;
|
||||
if( dx && dy )
|
||||
{ //Can't move diagonally!
|
||||
AssertMsg( 0, String("Attempting to move to waypoint in a diagonal direction from sector %d,%d to sector %d,%d",
|
||||
pGroup->ubSectorX, pGroup->ubSectorY, wp->x, wp->y ) );
|
||||
{ //Shouldn't move diagonally!
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("Attempting to move to waypoint in a diagonal direction from sector %d,%d to sector %d,%d",
|
||||
pGroup->ubSectorX, pGroup->ubSectorY, wp->x, wp->y ));
|
||||
//AssertMsg( 0, String("Attempting to move to waypoint in a diagonal direction from sector %d,%d to sector %d,%d",
|
||||
// pGroup->ubSectorX, pGroup->ubSectorY, wp->x, wp->y ) );
|
||||
}
|
||||
if( !dx && !dy ) //Can't move to position currently at!
|
||||
AssertMsg( 0, String("Attempting to move to waypoint %d, %d that you are already at!", wp->x, wp->y ) );
|
||||
@@ -3317,48 +3343,44 @@ BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnt
|
||||
fMayRetreatFromBattle = FALSE;
|
||||
fRetreatingFromBattle = FALSE;
|
||||
|
||||
if( ( sBattleSector == sSource ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sSource ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sDest ) )
|
||||
{
|
||||
fMayRetreatFromBattle = TRUE;
|
||||
}
|
||||
|
||||
if( ( sBattleSector == sDest ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sSource ) )
|
||||
{
|
||||
fRetreatingFromBattle = TRUE;
|
||||
}
|
||||
|
||||
ubMercsInGroup = curr->ubGroupSize;
|
||||
|
||||
if( ( ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sSource ) && ( SECTOR( curr->ubNextX, curr->ubNextY ) == sDest) ) || ( fMayRetreatFromBattle == TRUE ) )
|
||||
{
|
||||
// if it's a valid vehicle, but not the helicopter (which can fly empty)
|
||||
if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) )
|
||||
{
|
||||
// make sure empty vehicles (besides helicopter) aren't in motion!
|
||||
Assert( ubMercsInGroup > 0 );
|
||||
// subtract 1, we don't wanna count the vehicle itself for purposes of showing a number on the map
|
||||
ubMercsInGroup--;
|
||||
if ((curr->ubSectorX != 0) && (curr->ubSectorY != 0) &&
|
||||
(curr->ubNextX != 0) && (curr->ubNextY != 0)) {
|
||||
if( ( sBattleSector == sSource ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sSource ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sDest ) ) {
|
||||
fMayRetreatFromBattle = TRUE;
|
||||
}
|
||||
if( ( sBattleSector == sDest ) && ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest ) && ( SECTOR( curr->ubPrevX, curr->ubPrevY ) == sSource ) ) {
|
||||
fRetreatingFromBattle = TRUE;
|
||||
}
|
||||
|
||||
*iCountEnter += ubMercsInGroup;
|
||||
ubMercsInGroup = curr->ubGroupSize;
|
||||
|
||||
if( ( curr->uiArrivalTime - GetWorldTotalMin( ) <= ABOUT_TO_ARRIVE_DELAY ) || ( fMayRetreatFromBattle == TRUE ) )
|
||||
{
|
||||
*fAboutToArriveEnter = TRUE;
|
||||
if (((SECTOR(curr->ubSectorX, curr->ubSectorY) == sSource) &&
|
||||
(SECTOR(curr->ubNextX, curr->ubNextY) == sDest)) ||
|
||||
(fMayRetreatFromBattle)) {
|
||||
// if it's a valid vehicle, but not the helicopter (which can fly empty)
|
||||
if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) ) {
|
||||
// make sure empty vehicles (besides helicopter) aren't in motion!
|
||||
Assert( ubMercsInGroup > 0 );
|
||||
// subtract 1, we don't wanna count the vehicle itself for purposes of showing a number on the map
|
||||
ubMercsInGroup--;
|
||||
}
|
||||
*iCountEnter += ubMercsInGroup;
|
||||
if( ( curr->uiArrivalTime - GetWorldTotalMin( ) <= ABOUT_TO_ARRIVE_DELAY ) || ( fMayRetreatFromBattle ) ) {
|
||||
*fAboutToArriveEnter = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( ( SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest )&&( SECTOR( curr->ubNextX, curr->ubNextY ) == sSource) || ( fRetreatingFromBattle == TRUE ) )
|
||||
{
|
||||
// if it's a valid vehicle, but not the helicopter (which can fly empty)
|
||||
if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) )
|
||||
{
|
||||
// make sure empty vehicles (besides helicopter) aren't in motion!
|
||||
Assert( ubMercsInGroup > 0 );
|
||||
// subtract 1, we don't wanna count the vehicle itself for purposes of showing a number on the map
|
||||
ubMercsInGroup--;
|
||||
else if ((SECTOR( curr->ubSectorX, curr->ubSectorY ) == sDest) &&
|
||||
(SECTOR( curr->ubNextX, curr->ubNextY ) == sSource) ||
|
||||
(fRetreatingFromBattle)) {
|
||||
// if it's a valid vehicle, but not the helicopter (which can fly empty)
|
||||
if ( curr->fVehicle && !fHelicopterGroup && ( GivenMvtGroupIdFindVehicleId( curr->ubGroupID ) != -1 ) ) {
|
||||
// make sure empty vehicles (besides helicopter) aren't in motion!
|
||||
Assert( ubMercsInGroup > 0 );
|
||||
// subtract 1, we don't wanna count the vehicle itself for purposes of showing a number on the map
|
||||
ubMercsInGroup--;
|
||||
}
|
||||
*iCountExit += ubMercsInGroup;
|
||||
}
|
||||
|
||||
*iCountExit += ubMercsInGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,9 @@ typedef struct ENEMYGROUP
|
||||
UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc.
|
||||
UINT8 ubTroopsInBattle; //number of soldiers currently in battle.
|
||||
UINT8 ubElitesInBattle; //number of elite soldiers currently in battle.
|
||||
INT8 bPadding[20];
|
||||
// WDS - New AI
|
||||
UINT8 numTanks;
|
||||
INT8 bPadding[19];
|
||||
}ENEMYGROUP;
|
||||
|
||||
//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE
|
||||
|
||||
@@ -284,7 +284,8 @@ void IncrementTownLoyalty( INT8 bTownId, UINT32 uiLoyaltyIncrease )
|
||||
INT16 sThisIncrement;
|
||||
|
||||
|
||||
Assert( ( bTownId >= FIRST_TOWN ) && ( bTownId < NUM_TOWNS ) );
|
||||
AssertGE (bTownId, BLANK_SECTOR);
|
||||
AssertLT (bTownId, NUM_TOWNS);
|
||||
|
||||
// doesn't affect towns where player hasn't established a "presence" yet
|
||||
if (!gTownLoyalty[ bTownId ].fStarted)
|
||||
|
||||
+12
-10
@@ -51,10 +51,10 @@ INT32 giListOfMercsInSectorsCompletedMilitiaTraining[ SIZE_OF_MILITIA_COMPLETED_
|
||||
SOLDIERTYPE *pMilitiaTrainerSoldier = NULL;
|
||||
|
||||
// note that these sector values are STRATEGIC INDEXES, not 0-255!
|
||||
INT16 gsUnpaidStrategicSector[ MAX_CHARACTER_COUNT ];
|
||||
INT16 gsUnpaidStrategicSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
// the selected list of mercs
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
// towns with militia training allowed
|
||||
BOOLEAN gfMilitiaAllowedInTown[MAX_TOWNS] =
|
||||
@@ -532,7 +532,8 @@ UINT8 CountAllMilitiaInSector(INT16 sMapX, INT16 sMapY)
|
||||
|
||||
UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank)
|
||||
{
|
||||
return( SectorInfo[ SECTOR( sMapX, sMapY ) ].ubNumberOfCivsAtLevel[ ubRank ] );
|
||||
unsigned count = SectorInfo[ SECTOR( sMapX, sMapY ) ].ubNumberOfCivsAtLevel[ ubRank ];
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,7 +1163,7 @@ void HandleCompletionOfTownTrainingByGroupWithTrainer( SOLDIERTYPE *pTrainer )
|
||||
sSectorY = pTrainer->sSectorY;
|
||||
bSectorZ = pTrainer->bSectorZ;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
@@ -1292,11 +1293,12 @@ void BuildListOfUnpaidTrainableSectors( void )
|
||||
INT32 iCounter = 0, iCounterB = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
memset( gsUnpaidStrategicSector, 0, sizeof( INT16 ) * MAX_CHARACTER_COUNT );
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
memset( gsUnpaidStrategicSector, 0, sizeof(gsUnpaidStrategicSector) );
|
||||
|
||||
if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN )
|
||||
{
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// valid character?
|
||||
if( gCharactersList[ iCounter ].fValid )
|
||||
@@ -1335,11 +1337,11 @@ void BuildListOfUnpaidTrainableSectors( void )
|
||||
}
|
||||
|
||||
// now clean out repeated sectors
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT - 1; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
for( iCounterB = iCounter + 1 ; iCounterB < MAX_CHARACTER_COUNT; iCounterB++ )
|
||||
for( iCounterB = iCounter + 1 ; iCounterB < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterB++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounterB ] == gsUnpaidStrategicSector[ iCounter ] )
|
||||
{
|
||||
@@ -1360,7 +1362,7 @@ INT32 GetNumberOfUnpaidTrainableSectors( void )
|
||||
BuildListOfUnpaidTrainableSectors();
|
||||
|
||||
// now count up the results
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
@@ -1385,7 +1387,7 @@ void StartTrainingInAllUnpaidTrainableSectors()
|
||||
BuildListOfUnpaidTrainableSectors();
|
||||
|
||||
// pay up in each sector
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gsUnpaidStrategicSector[ iCounter ] > 0 )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
#include "builddefines.h"
|
||||
#include <stdio.h>
|
||||
#include "XML.h"
|
||||
#include "expat.h"
|
||||
#include "DEBUG.h"
|
||||
#include "string.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "FileMan.h"
|
||||
#include "MemMan.h"
|
||||
#include "Debug Control.h"
|
||||
#include "GameSettings.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EXTRAITEMS_ELEMENT_NONE = 0,
|
||||
EXTRAITEMS_ELEMENT_EXTRAITEMS,
|
||||
EXTRAITEMS_ELEMENT_ITEM
|
||||
} EXTRAITEMS_PARSE_STAGE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
EXTRAITEMS_PARSE_STAGE curElement;
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
|
||||
UINT32 item;
|
||||
UINT32 quantity;
|
||||
UINT32 condition;
|
||||
UINT32 gridno;
|
||||
} ExtraItemsParseData;
|
||||
|
||||
|
||||
static bool gSectorIsLoaded = false;
|
||||
static UINT8 gX = 0;
|
||||
static UINT8 gY = 0;
|
||||
static UINT8 gZ = 0;
|
||||
|
||||
/** Process the opening tag in this expat callback.
|
||||
*/
|
||||
static void XMLCALL
|
||||
ExtraItemsStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
ExtraItemsParseData * pData = (ExtraItemsParseData *) userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "ExtraItems") == 0 && pData->curElement == EXTRAITEMS_ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = EXTRAITEMS_ELEMENT_EXTRAITEMS;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "Item") == 0 && pData->curElement == EXTRAITEMS_ELEMENT_EXTRAITEMS)
|
||||
{
|
||||
pData->curElement = EXTRAITEMS_ELEMENT_ITEM;
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
|
||||
// Extract the attributes
|
||||
// defaults
|
||||
pData->quantity = 1;
|
||||
pData->condition = 100;
|
||||
pData->gridno = 0;
|
||||
for(unsigned uiAttrIndex = 0;atts[uiAttrIndex] != NULL;uiAttrIndex += 2)
|
||||
{
|
||||
if(strcmp(atts[uiAttrIndex], "quantity") == 0)
|
||||
{
|
||||
pData->quantity = atol(atts[uiAttrIndex+1]);
|
||||
if (pData->quantity < 1 || pData->quantity > 100) {
|
||||
pData->quantity = 1;
|
||||
}
|
||||
}
|
||||
else if(strcmp(atts[uiAttrIndex], "condition") == 0)
|
||||
{
|
||||
pData->condition = atol(atts[uiAttrIndex+1]);
|
||||
if (pData->condition < 1 || pData->condition > 100) {
|
||||
pData->condition = 100;
|
||||
}
|
||||
}
|
||||
else if(strcmp(atts[uiAttrIndex], "gridno") == 0)
|
||||
{
|
||||
pData->gridno = atol(atts[uiAttrIndex+1]);
|
||||
//if (pData->gridno < ???? || pData->gridno > ????) {
|
||||
// pData->gridno = 0;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
pData->currentDepth++;
|
||||
}
|
||||
|
||||
/** Process any text content in this callback.
|
||||
*/
|
||||
static void XMLCALL
|
||||
ExtraItemsCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
ExtraItemsParseData * pData = (ExtraItemsParseData *) userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth && strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
|
||||
/** Process the closing tag in this expat callback.
|
||||
*/
|
||||
static void XMLCALL
|
||||
ExtraItemsEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
ExtraItemsParseData * pData = (ExtraItemsParseData *) userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "ExtraItems") == 0 && pData->curElement == EXTRAITEMS_ELEMENT_EXTRAITEMS)
|
||||
{
|
||||
pData->curElement = EXTRAITEMS_ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "Item") == 0 && pData->curElement == EXTRAITEMS_ELEMENT_ITEM)
|
||||
{
|
||||
pData->item = atol(pData->szCharData);
|
||||
OBJECTTYPE object;
|
||||
CreateItem(pData->item, pData->condition, &object);
|
||||
for (unsigned cnt=1; cnt <= pData->quantity; ++cnt) {
|
||||
if (gSectorIsLoaded) {
|
||||
AddItemToPool( pData->gridno, &object, 1, 0, WORLD_ITEM_REACHABLE, 0 );
|
||||
} else {
|
||||
AddItemsToUnLoadedSector( gX, gY, gZ, pData->gridno, 1, &object, 0, WORLD_ITEM_REACHABLE, 0, 1, 0 );
|
||||
}
|
||||
}
|
||||
pData->curElement = EXTRAITEMS_ELEMENT_EXTRAITEMS;
|
||||
}
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded)
|
||||
{
|
||||
char fileName[MAX_PATH];
|
||||
strcpy(fileName, TABLEDATA_DIRECTORY);
|
||||
if (x < 10) {
|
||||
strcat(fileName, EXTRAITEMSFILENAME);
|
||||
char* spot = strstr(fileName, "A9_0");
|
||||
Assert(spot);
|
||||
if (!spot)
|
||||
return;
|
||||
*spot = 'A' + y-1;
|
||||
*(spot+1) = '0' + x;
|
||||
*(spot+3) = '0' + z;
|
||||
} else {
|
||||
strcat(fileName, EXTRAITEMSFILENAME2);
|
||||
char* spot = strstr(fileName, "A11_0");
|
||||
Assert(spot);
|
||||
if (!spot)
|
||||
return;
|
||||
*spot = 'A' + y-1;
|
||||
*(spot+1) = '0' + x / 10;
|
||||
*(spot+2) = '0' + x % 10;
|
||||
*(spot+4) = '0' + z;
|
||||
}
|
||||
|
||||
// Remember the base file name length
|
||||
int baseFNLength = strlen(fileName);
|
||||
|
||||
// Append a suffix based on the difficulty
|
||||
switch (gGameOptions.ubDifficultyLevel) {
|
||||
case DIF_LEVEL_ZERO:
|
||||
break;
|
||||
case DIF_LEVEL_EASY:
|
||||
strcat(fileName, "_Novice");
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
strcat(fileName, "_Experienced");
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
strcat(fileName, "_Expert");
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
strcat(fileName, "_Insane");
|
||||
break;
|
||||
case DIF_LEVEL_FIVE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Open extra items file
|
||||
HWFILE hFile;
|
||||
// Try "special" difficulty level file first
|
||||
if (!(hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ))) {
|
||||
// OK, that didn't work so try the "plain" file
|
||||
fileName[baseFNLength] = '\0';
|
||||
if (!(hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ))) {
|
||||
// There isn't a file for this sector, just return
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gSectorIsLoaded = sectorIsLoaded;
|
||||
gX = x;
|
||||
gY = y;
|
||||
gZ = z;
|
||||
|
||||
UINT32 uiBytesRead;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
ExtraItemsParseData pData;
|
||||
|
||||
UINT32 uiFSize = FileGetSize(hFile);
|
||||
CHAR8 * lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) {
|
||||
MemFree(lpcBuffer);
|
||||
XML_ParserFree(parser);
|
||||
return;
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
// Setup expat callbacks
|
||||
XML_SetElementHandler(parser, ExtraItemsStartElementHandle, ExtraItemsEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, ExtraItemsCharacterDataHandle);
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in ExtraItems.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
XML_ParserFree(parser);
|
||||
return;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
XML_ParserFree(parser);
|
||||
return;
|
||||
}
|
||||
+99
-72
@@ -643,18 +643,18 @@ MOUSE_REGION gMapScreenMaskRegion;
|
||||
MOUSE_REGION gTrashCanRegion;
|
||||
|
||||
// mouse regions for team info panel
|
||||
MOUSE_REGION gTeamListNameRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListAssignmentRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListSleepRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListLocationRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListDestinationRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListContractRegion[ MAX_CHARACTER_COUNT ];
|
||||
MOUSE_REGION gTeamListNameRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
MOUSE_REGION gTeamListAssignmentRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
MOUSE_REGION gTeamListSleepRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
MOUSE_REGION gTeamListLocationRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
MOUSE_REGION gTeamListDestinationRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
MOUSE_REGION gTeamListContractRegion[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
|
||||
OBJECTTYPE gItemPointer;
|
||||
SOLDIERTYPE *gpItemPointerSoldier;
|
||||
|
||||
PathStPtr gpCharacterPreviousMercPath[ MAX_CHARACTER_COUNT ];
|
||||
PathStPtr gpCharacterPreviousMercPath[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
PathStPtr gpHelicopterPreviousMercPath = NULL;
|
||||
|
||||
|
||||
@@ -673,7 +673,7 @@ extern BOOLEAN gfUsePersistantPBI;
|
||||
extern BOOLEAN gfOneFramePauseOnExit;
|
||||
|
||||
// the selected list of mercs
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
|
||||
extern INT32 iDialogueBox;
|
||||
extern INT32 giMapInvDescButton;
|
||||
@@ -1764,7 +1764,7 @@ BOOLEAN SetInfoChar( UINT8 ubID )
|
||||
{
|
||||
INT8 bCounter;
|
||||
|
||||
for ( bCounter = 0; bCounter < MAX_CHARACTER_COUNT; bCounter++)
|
||||
for ( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++)
|
||||
{
|
||||
// skip invalid characters
|
||||
if ( gCharactersList[ bCounter ].fValid == TRUE )
|
||||
@@ -3034,7 +3034,7 @@ BOOLEAN CharacterIsInTransitAndHasItemPickedUp( INT8 bCharacterNumber )
|
||||
|
||||
void DisplayCharacterInfo( void )
|
||||
{
|
||||
Assert( bSelectedInfoChar < MAX_CHARACTER_COUNT );
|
||||
Assert( bSelectedInfoChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
Assert( gCharactersList[ bSelectedInfoChar ].fValid );
|
||||
|
||||
// set font buffer
|
||||
@@ -3098,6 +3098,7 @@ INT32 GetPathTravelTimeDuringPlotting( PathStPtr pPath )
|
||||
// get vehicle id
|
||||
ubGroupId = pVehicleList[ Menptr[gCharactersList[bSelectedDestChar].usSolID].iVehicleId ].ubMovementGroup;
|
||||
pGroup = GetGroup( ubGroupId );
|
||||
AssertNotNIL(pGroup);
|
||||
}
|
||||
}
|
||||
else if( Menptr[gCharactersList[bSelectedDestChar].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
@@ -3112,23 +3113,23 @@ INT32 GetPathTravelTimeDuringPlotting( PathStPtr pPath )
|
||||
// get vehicle id
|
||||
ubGroupId = pVehicleList[ Menptr[gCharactersList[bSelectedDestChar].usSolID].bVehicleID ].ubMovementGroup;
|
||||
pGroup = GetGroup( ubGroupId );
|
||||
AssertNotNIL(pGroup);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ubGroupId = Menptr[gCharactersList[bSelectedDestChar].usSolID].ubGroupID;
|
||||
pGroup = GetGroup( ( UINT8 )( ubGroupId ) );
|
||||
AssertNotNIL(pGroup);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ubGroupId = pVehicleList[ iHelicopterVehicleId ].ubMovementGroup;
|
||||
pGroup = GetGroup( ubGroupId );
|
||||
AssertNotNIL(pGroup);
|
||||
}
|
||||
|
||||
Assert(pGroup);
|
||||
|
||||
|
||||
// if between sectors
|
||||
if ( pGroup->fBetweenSectors )
|
||||
{
|
||||
@@ -3225,7 +3226,7 @@ void HighLightAssignLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
INT16 usCount = 0;
|
||||
UINT16 usX;
|
||||
UINT16 usY;
|
||||
@@ -3235,7 +3236,7 @@ void HighLightAssignLine()
|
||||
// is this a valid line?
|
||||
if( ( giAssignHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3266,7 +3267,7 @@ void HighLightAssignLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ )
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( IsCharacterSelectedForAssignment( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3289,7 +3290,7 @@ void HighLightAssignLine()
|
||||
LineDraw( TRUE, usX, usY, usX+ASSIGN_WIDTH, usY, usColor,pDestBuf);
|
||||
}
|
||||
|
||||
if( ( ( usCount == MAX_CHARACTER_COUNT - 1 ) ) || ( usCount != ( MAX_CHARACTER_COUNT - 1 ) ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForAssignment( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+ASSIGN_WIDTH, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3309,7 +3310,7 @@ void HighLightDestLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
UINT16 usCount = 0;
|
||||
UINT16 usX;
|
||||
UINT16 usY;
|
||||
@@ -3318,7 +3319,7 @@ void HighLightDestLine()
|
||||
|
||||
if( ( giDestHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3350,7 +3351,7 @@ void HighLightDestLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ )
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( CharacterIsGettingPathPlotted( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3369,7 +3370,7 @@ void HighLightDestLine()
|
||||
{
|
||||
LineDraw( TRUE, usX+4, usY, usX+DEST_ETA_WIDTH+4, usY, usColor,pDestBuf);
|
||||
}
|
||||
if( ( ( usCount == MAX_CHARACTER_COUNT - 1 ) ) || ( usCount != ( MAX_CHARACTER_COUNT - 1 ) ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( CharacterIsGettingPathPlotted( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX+DEST_ETA_WIDTH+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3395,7 +3396,7 @@ void HighLightSleepLine()
|
||||
UINT16 usColor;
|
||||
static INT32 iColorNum = STARTING_COLOR_NUM;
|
||||
static BOOLEAN fDelta=FALSE;
|
||||
static INT32 uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
static INT32 uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
UINT16 usCount = 0;
|
||||
UINT16 usX, usX2;
|
||||
UINT16 usY;
|
||||
@@ -3405,7 +3406,7 @@ void HighLightSleepLine()
|
||||
// is this a valid line?
|
||||
if( ( giSleepHighLine == -1 ) || fShowInventoryFlag )
|
||||
{
|
||||
uiOldHighlight = MAX_CHARACTER_COUNT + 1;
|
||||
uiOldHighlight = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3437,7 +3438,7 @@ void HighLightSleepLine()
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
for( usCount = 0; usCount < MAX_CHARACTER_COUNT; usCount++ )
|
||||
for( usCount = 0; usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; usCount++ )
|
||||
{
|
||||
if( IsCharacterSelectedForSleep( usCount ) == TRUE )
|
||||
{
|
||||
@@ -3458,7 +3459,7 @@ void HighLightSleepLine()
|
||||
{
|
||||
LineDraw( TRUE, usX+4, usY, usX2, usY, usColor,pDestBuf);
|
||||
}
|
||||
if( ( ( usCount == MAX_CHARACTER_COUNT - 1 ) ) || ( usCount != ( MAX_CHARACTER_COUNT - 1 ) ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
if( ( ( usCount == CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ) || ( usCount != ( CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS - 1 ) ? !( IsCharacterSelectedForSleep( ( UINT16 )( usCount + 1 ) ) ) : 0) || ( usCount == FIRST_VEHICLE - 1 ) )
|
||||
{
|
||||
LineDraw(TRUE, usX+4, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usX2, usY+GetFontHeight(MAP_SCREEN_FONT)+2, usColor, pDestBuf);
|
||||
}
|
||||
@@ -3495,11 +3496,11 @@ void AddCharacter( SOLDIERTYPE *pCharacter )
|
||||
// adding a vehicle?
|
||||
if( pCharacter->flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
while( usVehicleLoop < MAX_CHARACTER_COUNT )
|
||||
while( usVehicleLoop < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
if ( gCharactersList[ usVehicleLoop ].fValid )
|
||||
{
|
||||
if ( Menptr[ usVehicleLoop ].flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
if ( Menptr[ gCharactersList[ usVehicleLoop ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
usVehicleCount++;
|
||||
}
|
||||
@@ -3512,15 +3513,15 @@ void AddCharacter( SOLDIERTYPE *pCharacter )
|
||||
else
|
||||
{
|
||||
// go through character list until a blank is reached
|
||||
while( (gCharactersList[usCount].fValid)&&(usCount < MAX_CHARACTER_COUNT) )
|
||||
while( (gCharactersList[usCount].fValid)&&(usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS) )
|
||||
{
|
||||
usCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Assert( usCount < MAX_CHARACTER_COUNT );
|
||||
if (usCount >= MAX_CHARACTER_COUNT )
|
||||
Assert( usCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
if (usCount >= CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3619,7 +3620,7 @@ void DisplayCharacterList()
|
||||
SetFontBackground(FONT_BLACK);
|
||||
|
||||
|
||||
for (sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++)
|
||||
for (sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
{
|
||||
// skip invalid characters
|
||||
if ( gCharactersList[sCount].fValid == TRUE )
|
||||
@@ -4055,7 +4056,7 @@ UINT32 MapScreenHandle(void)
|
||||
if( AnyMercsHired( ) == FALSE )
|
||||
{
|
||||
// select starting sector (A9 - Omerta)
|
||||
ChangeSelectedMapSector( 9, 1, 0 );
|
||||
ChangeSelectedMapSector( startingX, startingY, startingZ );
|
||||
}
|
||||
else if( ( gWorldSectorX > 0 ) && ( gWorldSectorY > 0 ) && ( gbWorldSectorZ != -1 ) )
|
||||
{
|
||||
@@ -4067,7 +4068,7 @@ UINT32 MapScreenHandle(void)
|
||||
// only select A9 - Omerta IF there is no current selection, otherwise leave it as is
|
||||
if ( ( sSelMapX == 0 ) || ( sSelMapY == 0 ) || ( iCurrentMapSectorZ == -1 ) )
|
||||
{
|
||||
ChangeSelectedMapSector( 9, 1, 0 );
|
||||
ChangeSelectedMapSector( startingX, startingY, startingZ );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4589,7 +4590,7 @@ UINT32 MapScreenHandle(void)
|
||||
|
||||
|
||||
// handle display of inventory pop up
|
||||
HandleDisplayOfItemPopUpForSector( 9, 1, 0 );
|
||||
HandleDisplayOfItemPopUpForSector( startingX, startingY, startingZ );
|
||||
|
||||
// Display Framerate
|
||||
DisplayFrameRate( );
|
||||
@@ -5726,11 +5727,11 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
{
|
||||
StopMapScreenHelpText( );
|
||||
}
|
||||
else if ( gpCurrentTalkingFace != NULL && gpCurrentTalkingFace->fTalking )
|
||||
{
|
||||
// ATE: We want to stop speech if somebody is talking...
|
||||
StopAnyCurrentlyTalkingSpeech( );
|
||||
}
|
||||
else if ( gpCurrentTalkingFace != NULL && gpCurrentTalkingFace->fTalking )
|
||||
{
|
||||
// ATE: We want to stop speech if somebody is talking...
|
||||
StopAnyCurrentlyTalkingSpeech( );
|
||||
}
|
||||
else if( fShowUpdateBox )
|
||||
{
|
||||
if( fShowUpdateBox )
|
||||
@@ -5903,7 +5904,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
break;
|
||||
|
||||
case BACKSPACE:
|
||||
StopAnyCurrentlyTalkingSpeech( );
|
||||
StopAnyCurrentlyTalkingSpeech( );
|
||||
break;
|
||||
|
||||
// multiplayer: Roman: Should be changed, because the keys are already bount to another feature
|
||||
@@ -8241,6 +8242,30 @@ void MAPBeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos )
|
||||
// Remove all from soldier's slot
|
||||
numToMove = ALL_OBJECTS;
|
||||
}
|
||||
/* This needs work
|
||||
// WDS 08/17/2008 - Cntrl-Click drops all items
|
||||
else if (_KeyDown( CTRL ))
|
||||
{
|
||||
// Remove all from soldier's slot
|
||||
numToMove = ALL_OBJECTS;
|
||||
pSoldier->inv[ubHandPos].MoveThisObjectTo(gItemPointer, numToMove, pSoldier, ubHandPos);
|
||||
if ( gItemPointer.exists() == false )
|
||||
{
|
||||
//oops, the move failed. It might have failed because the object was force placed
|
||||
//to a slot where the ItemSizeLimit is 0, try again
|
||||
//this method won't work with LBEs in LBE pockets
|
||||
pSoldier->inv[ubHandPos].MoveThisObjectTo(gItemPointer, numToMove);
|
||||
}
|
||||
|
||||
if ( gItemPointer.exists() == true )
|
||||
{
|
||||
SoldierHandleDropItem (pSoldier);
|
||||
// AddItemToPool( pSoldier->sGridNo, &gItemPointer, 1, pSoldier->pathing.bLevel, WORLD_ITEM_REACHABLE, -1 );
|
||||
// InternalMAPBeginItemPointer( pSoldier );
|
||||
}
|
||||
return;
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
numToMove = 1;
|
||||
@@ -8616,7 +8641,7 @@ void CreateMouseRegionsForTeamList( void )
|
||||
|
||||
// the info region...is the background for the list itself
|
||||
|
||||
for( sCounter = 0; sCounter < MAX_CHARACTER_COUNT; sCounter++ )
|
||||
for( sCounter = 0; sCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCounter++ )
|
||||
{
|
||||
if( sCounter >= FIRST_VEHICLE )
|
||||
{
|
||||
@@ -8708,7 +8733,7 @@ void DestroyMouseRegionsForTeamList( void )
|
||||
// will destroy mouse regions overlaying the team list area
|
||||
INT32 sCounter = 0;
|
||||
|
||||
for( sCounter = 0; sCounter < MAX_CHARACTER_COUNT; sCounter++ )
|
||||
for( sCounter = 0; sCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCounter++ )
|
||||
{
|
||||
MSYS_RemoveRegion( &gTeamListNameRegion[ sCounter ]);
|
||||
MSYS_RemoveRegion( &gTeamListAssignmentRegion[ sCounter ]);
|
||||
@@ -10109,14 +10134,14 @@ void ReBuildCharactersList( void )
|
||||
|
||||
|
||||
// add in characters
|
||||
for ( sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++)
|
||||
for ( sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
{
|
||||
// clear this slot
|
||||
gCharactersList[ sCount ].fValid = FALSE;
|
||||
gCharactersList[ sCount ].usSolID = 0;
|
||||
}
|
||||
|
||||
for ( sCount = 0; sCount < MAX_CHARACTER_COUNT; sCount++)
|
||||
for ( sCount = 0; sCount < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; sCount++)
|
||||
{
|
||||
// add character into the cleared slot
|
||||
AddCharacter( &Menptr[ gTacticalStatus.Team[ OUR_TEAM ].bFirstID + sCount ] );
|
||||
@@ -10211,7 +10236,7 @@ void EnableDisableTeamListRegionsAndHelpText( void )
|
||||
INT8 bCharNum;
|
||||
|
||||
|
||||
for( bCharNum = 0; bCharNum < MAX_CHARACTER_COUNT; bCharNum++ )
|
||||
for( bCharNum = 0; bCharNum < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCharNum++ )
|
||||
{
|
||||
if( gCharactersList[ bCharNum ].fValid == FALSE )
|
||||
{
|
||||
@@ -10406,7 +10431,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone )
|
||||
}
|
||||
|
||||
// otherwise, find this character
|
||||
for( bCounter = 0; bCounter < MAX_CHARACTER_COUNT; bCounter++ )
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
if( gCharactersList[bCounter].fValid == TRUE )
|
||||
{
|
||||
@@ -10433,7 +10458,7 @@ void HandleSpontanousTalking( )
|
||||
|
||||
if( DialogueActive() == FALSE )
|
||||
{
|
||||
if( ( bSelectedInfoChar != -1 ) && ( bSelectedInfoChar < MAX_CHARACTER_COUNT ) )
|
||||
if( ( bSelectedInfoChar != -1 ) && ( bSelectedInfoChar < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) )
|
||||
{
|
||||
ContinueDialogue( ( &Menptr[gCharactersList[bSelectedInfoChar].usSolID] ), TRUE );
|
||||
}
|
||||
@@ -10569,7 +10594,7 @@ void RebuildWayPointsForAllSelectedCharsGroups( void )
|
||||
|
||||
memset( fGroupIDRebuilt, FALSE, sizeof( fGroupIDRebuilt ) );
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -10985,7 +11010,7 @@ INT8 GetLastValidCharacterInTeamPanelList( void )
|
||||
INT8 iCounter = 0, iValue = 0;
|
||||
|
||||
// run through the list and find the last valid guy in the list
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -11080,7 +11105,7 @@ INT8 GetNextValidCharacterInTeamPanelList( INT8 bCurrentIndex )
|
||||
INT8 iCounter = bCurrentIndex, iValue = 0;
|
||||
|
||||
// run through the list and find the last valid guy in the list
|
||||
for( iCounter = bCurrentIndex; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = bCurrentIndex; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -11293,7 +11318,7 @@ void UpdateBadAssignments( void )
|
||||
{
|
||||
UINT32 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -11351,7 +11376,7 @@ BOOLEAN AnyMercsLeavingRealSoon()
|
||||
UINT32 uiTimeInMin = GetWorldTotalMin();
|
||||
BOOLEAN fFoundOne = FALSE;
|
||||
|
||||
for( uiCounter = 0; uiCounter < MAX_CHARACTER_COUNT; uiCounter++ )
|
||||
for( uiCounter = 0; uiCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; uiCounter++ )
|
||||
{
|
||||
if( gCharactersList[ uiCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -12057,7 +12082,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse
|
||||
INT16 sEndSectorA, sEndSectorB;
|
||||
INT32 iExpiryTime, iExpiryTimeA;
|
||||
UINT8 uiID, uiIDA;
|
||||
SOLDIERTYPE *pSelectedSoldier[ MAX_CHARACTER_COUNT ];
|
||||
SOLDIERTYPE *pSelectedSoldier[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
SOLDIERTYPE *pCurrentSoldier = NULL;
|
||||
SOLDIERTYPE *pPreviousSelectedInfoChar = NULL;
|
||||
|
||||
@@ -12071,7 +12096,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse
|
||||
}
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// set current entry to null
|
||||
pSelectedSoldier[ iCounter ] = NULL;
|
||||
@@ -12308,11 +12333,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse
|
||||
|
||||
|
||||
// now select all the soldiers that were selected before
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( pSelectedSoldier[ iCounter ] )
|
||||
{
|
||||
for( iCounterA = 0; iCounterA < MAX_CHARACTER_COUNT; iCounterA++ )
|
||||
for( iCounterA = 0; iCounterA < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ )
|
||||
{
|
||||
// is this entry even valid
|
||||
if( gCharactersList[ iCounterA ].fValid == FALSE )
|
||||
@@ -12434,7 +12459,7 @@ void HandleAssignmentsDoneAndAwaitingFurtherOrders( void )
|
||||
// update timer so that we only run check so often
|
||||
giFlashAssignBaseTime = iCurrentTime;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
{
|
||||
@@ -12472,7 +12497,7 @@ void DisplayIconsForMercsAsleep( void )
|
||||
|
||||
GetVideoObject(&hHandle, guiSleepIcon );
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -12589,7 +12614,7 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber )
|
||||
|
||||
|
||||
Assert( bCharNumber >= 0 );
|
||||
Assert( bCharNumber < MAX_CHARACTER_COUNT );
|
||||
Assert( bCharNumber < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
|
||||
// invalid character slot selected?
|
||||
if( gCharactersList[ bCharNumber ].fValid == FALSE )
|
||||
@@ -12963,7 +12988,7 @@ INT32 GetContractExpiryTime( SOLDIERTYPE *pSoldier )
|
||||
|
||||
void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList )
|
||||
{
|
||||
Assert( ( bCharNumber >= -1 ) && ( bCharNumber < MAX_CHARACTER_COUNT ) );
|
||||
Assert( ( bCharNumber >= -1 ) && ( bCharNumber < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ) );
|
||||
|
||||
if( ( bCharNumber != -1 ) && ( gCharactersList[ bCharNumber ].fValid == FALSE ) )
|
||||
return;
|
||||
@@ -13039,7 +13064,7 @@ void CopyPathToAllSelectedCharacters( PathStPtr pPath )
|
||||
|
||||
|
||||
// run through list and copy paths for each selected character
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -13077,7 +13102,7 @@ void CancelPathsOfAllSelectedCharacters()
|
||||
|
||||
|
||||
// cancel destination for the clicked and ALL other valid & selected characters with a route set
|
||||
for( bCounter = 0; bCounter < MAX_CHARACTER_COUNT; bCounter++ )
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
// if we've clicked on a selected valid character
|
||||
if( ( gCharactersList[ bCounter ].fValid == TRUE ) && IsEntryInSelectedListSet( bCounter ) )
|
||||
@@ -13160,7 +13185,7 @@ INT16 CalcLocationValueForChar( INT32 iCounter )
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
INT16 sLocValue = 0;
|
||||
|
||||
Assert( iCounter < MAX_CHARACTER_COUNT );
|
||||
Assert( iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS );
|
||||
|
||||
if( gCharactersList[ iCounter ].fValid == FALSE )
|
||||
return( sLocValue );
|
||||
@@ -13380,6 +13405,7 @@ UINT8 PlayerMercsInHelicopterSector( void )
|
||||
|
||||
Assert( iHelicopterVehicleId != -1);
|
||||
pGroup = GetGroup( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
AssertNotNIL(pGroup);
|
||||
|
||||
if ( pGroup->fBetweenSectors )
|
||||
{
|
||||
@@ -13457,13 +13483,14 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void )
|
||||
{
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
INT32 iCounter;
|
||||
UINT8 ubSelectedMercID[ 20 ];
|
||||
UINT8 ubSelectedMercIndex[ 20 ];
|
||||
// WDS - make number of mercenaries, etc. be configurable
|
||||
UINT8 ubSelectedMercID[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
UINT8 ubSelectedMercIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ];
|
||||
UINT8 ubNumMercs = 0;
|
||||
UINT8 ubChosenMerc;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -13691,7 +13718,7 @@ void WakeUpAnySleepingSelectedMercsOnFootOrDriving( void )
|
||||
BOOLEAN fSuccess = FALSE;
|
||||
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) )
|
||||
{
|
||||
@@ -13928,7 +13955,7 @@ void InitPreviousPaths( void )
|
||||
INT32 iCounter = 0;
|
||||
|
||||
// init character previous paths
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
gpCharacterPreviousMercPath[ iCounter ] = NULL;
|
||||
}
|
||||
@@ -13943,7 +13970,7 @@ void RememberPreviousPathForAllSelectedChars( void )
|
||||
INT32 iCounter = 0;
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -14010,7 +14037,7 @@ void RestorePreviousPaths( void )
|
||||
}
|
||||
else // character(s) plotting
|
||||
{
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
// if selected
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
@@ -14083,7 +14110,7 @@ void ClearPreviousPaths( void )
|
||||
{
|
||||
INT32 iCounter = 0;
|
||||
|
||||
for( iCounter = 0; iCounter < MAX_CHARACTER_COUNT; iCounter++ )
|
||||
for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
{
|
||||
if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )
|
||||
{
|
||||
@@ -14110,7 +14137,7 @@ void SelectAllCharactersInSquad( INT8 bSquadNumber )
|
||||
ChangeSelectedInfoChar( -1, TRUE );
|
||||
|
||||
// now select all the soldiers that are in this squad
|
||||
for( bCounter = 0; bCounter < MAX_CHARACTER_COUNT; bCounter++ )
|
||||
for( bCounter = 0; bCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++ )
|
||||
{
|
||||
// is this entry is valid
|
||||
if( gCharactersList[ bCounter ].fValid == TRUE )
|
||||
|
||||
+34
-24
@@ -4629,12 +4629,18 @@ BOOLEAN SaveStrategicInfoToSavedFile( HWFILE hFile )
|
||||
}
|
||||
|
||||
// Save the Sector Info
|
||||
uiSize = sizeof( SECTORINFO ) * 256;
|
||||
FileWrite( hFile, SectorInfo, uiSize, &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != uiSize)
|
||||
{
|
||||
return(FALSE);
|
||||
for (int sectorID = 0; sectorID <= 255; ++ sectorID) {
|
||||
FileWrite( hFile, &SectorInfo[sectorID], sizeof( SECTORINFO ), &uiNumBytesWritten );
|
||||
if( uiNumBytesWritten != sizeof( SECTORINFO )) {
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
// uiSize = sizeof( SECTORINFO ) * 256;
|
||||
// FileWrite( hFile, SectorInfo, uiSize, &uiNumBytesWritten );
|
||||
// if( uiNumBytesWritten != uiSize)
|
||||
// {
|
||||
// return(FALSE);
|
||||
// }
|
||||
|
||||
// Save the SAM Controlled Sector Information
|
||||
uiSize = MAP_WORLD_X * MAP_WORLD_Y;
|
||||
@@ -4675,12 +4681,18 @@ BOOLEAN LoadStrategicInfoFromSavedFile( HWFILE hFile )
|
||||
}
|
||||
|
||||
// Load the Sector Info
|
||||
uiSize = sizeof( SECTORINFO ) * 256;
|
||||
FileRead( hFile, SectorInfo, uiSize, &uiNumBytesRead );
|
||||
if( uiNumBytesRead != uiSize)
|
||||
{
|
||||
return(FALSE);
|
||||
for (int sectorID = 0; sectorID <= 255; ++ sectorID) {
|
||||
FileRead( hFile, &SectorInfo[sectorID], sizeof( SECTORINFO ), &uiNumBytesRead );
|
||||
if( uiNumBytesRead != sizeof( SECTORINFO )) {
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
// uiSize = sizeof( SECTORINFO ) * 256;
|
||||
// FileRead( hFile, SectorInfo, uiSize, &uiNumBytesRead );
|
||||
// if( uiNumBytesRead != uiSize)
|
||||
// {
|
||||
// return(FALSE);
|
||||
// }
|
||||
|
||||
// Load the SAM Controlled Sector Information
|
||||
uiSize = MAP_WORLD_X * MAP_WORLD_Y;
|
||||
@@ -5527,35 +5539,33 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( )
|
||||
BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle(int pSectorX, int pSectorY, int pSectorZ)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
//We don't have mercs in the sector. Now, we check to see if there are BOTH enemies and militia. If both
|
||||
//co-exist in the sector, then make them fight for control of the sector via autoresolve.
|
||||
for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
|
||||
for( int i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ )
|
||||
{
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife )
|
||||
{
|
||||
if( MercPtrs[ i ]->sSectorX == gWorldSectorX &&
|
||||
MercPtrs[ i ]->sSectorY == gWorldSectorY &&
|
||||
MercPtrs[ i ]->bSectorZ == gbWorldSectorZ )
|
||||
if( MercPtrs[ i ]->sSectorX == pSectorX &&
|
||||
MercPtrs[ i ]->sSectorY == pSectorY &&
|
||||
MercPtrs[ i ]->bSectorZ == pSectorZ )
|
||||
{ //We have enemies, now look for militia!
|
||||
for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ )
|
||||
{
|
||||
if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && MercPtrs[ i ]->bSide == OUR_TEAM )
|
||||
{
|
||||
if( MercPtrs[ i ]->sSectorX == gWorldSectorX &&
|
||||
MercPtrs[ i ]->sSectorY == gWorldSectorY &&
|
||||
MercPtrs[ i ]->bSectorZ == gbWorldSectorZ )
|
||||
if( MercPtrs[ i ]->sSectorX == pSectorX &&
|
||||
MercPtrs[ i ]->sSectorY == pSectorY &&
|
||||
MercPtrs[ i ]->bSectorZ == pSectorZ )
|
||||
{ //We have militia and enemies and no mercs! Let's finish this battle in autoresolve.
|
||||
gfEnteringMapScreen = TRUE;
|
||||
gfEnteringMapScreenToEnterPreBattleInterface = TRUE;
|
||||
gfAutomaticallyStartAutoResolve = TRUE;
|
||||
gfUsePersistantPBI = FALSE;
|
||||
gubPBSectorX = (UINT8)gWorldSectorX;
|
||||
gubPBSectorY = (UINT8)gWorldSectorY;
|
||||
gubPBSectorZ = (UINT8)gbWorldSectorZ;
|
||||
gubPBSectorX = (UINT8)pSectorX;
|
||||
gubPBSectorY = (UINT8)pSectorY;
|
||||
gubPBSectorZ = (UINT8)pSectorZ;
|
||||
gfBlitBattleSectorLocator = TRUE;
|
||||
gfTransferTacticalOppositionToAutoResolve = TRUE;
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
@@ -5639,7 +5649,7 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld()
|
||||
// Added logic to prevent a crash when player mercs would retreat from a battle involving militia and enemies.
|
||||
// Without the return here, it would proceed to trash the world, and then when autoresolve would come up to
|
||||
// finish the tactical battle, it would fail to find the existing soldier information (because it was trashed).
|
||||
if( HandlePotentialBringUpAutoresolveToFinishBattle( ) )
|
||||
if( HandlePotentialBringUpAutoresolveToFinishBattle( sBattleSectorX, sBattleSectorY, sBattleSectorZ ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ INT8 GetSAMIdFromSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
|
||||
void SetupProfileInsertionDataForSoldier( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( );
|
||||
BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSectorY, int pSectorZ );
|
||||
|
||||
//Used for determining the type of error message that comes up when you can't traverse to
|
||||
//an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED!
|
||||
|
||||
Reference in New Issue
Block a user