mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
New feature: Getting and using intel allows for more spy-related roleplay.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23643&goto=352475&#msg_352475 Requires GameDir >= r2401. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8522 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+42
-4
@@ -74,7 +74,8 @@ UINT32 gASD_Flags = 0;
|
||||
// enemy heli constants
|
||||
#define ENEMYHELI_DESTROYED 0x00000001
|
||||
#define ENEMYHELI_ORDER_GOTODESTINATION 0x00000002
|
||||
#define ENEMYHELI_KNOWNTOPLAYER 0x00000008 // the player knows about this heli (it will this be displayed on the map)
|
||||
#define ENEMYHELI_KNOWNBYINTEL 0x00000004 // the player knows about this heli from intel (it will be displayed on the map)
|
||||
#define ENEMYHELI_KNOWNTOPLAYER 0x00000008 // the player knows about this heli (it will be displayed on the map)
|
||||
|
||||
#define ENEMYHELI_ORDER_DROPTROOPS 0x00000010
|
||||
#define ENEMYHELI_ORDER_PICKUPTROOPS 0x00000020
|
||||
@@ -585,7 +586,7 @@ void ENEMY_HELI::Destroy( )
|
||||
flagmask |= ENEMYHELI_DESTROYED;
|
||||
|
||||
// if the player knows about this heli, play a sound and leave a message
|
||||
if ( flagmask & ENEMYHELI_KNOWNTOPLAYER )
|
||||
if ( flagmask & (ENEMYHELI_KNOWNBYINTEL|ENEMYHELI_KNOWNTOPLAYER) )
|
||||
{
|
||||
CHAR16 pStr2[128];
|
||||
GetSectorIDString( SECTORX( sector_current ), SECTORY( sector_current ), 0, pStr2, FALSE );
|
||||
@@ -740,7 +741,7 @@ std::set<UINT8> GetEnemyHeliSectors( BOOLEAN afKnownToPlayer )
|
||||
continue;
|
||||
|
||||
// if the player doesn't know about this heli, don't add this
|
||||
if ( afKnownToPlayer && !((*it).flagmask & ENEMYHELI_KNOWNTOPLAYER) )
|
||||
if ( afKnownToPlayer && !((*it).flagmask & (ENEMYHELI_KNOWNBYINTEL|ENEMYHELI_KNOWNTOPLAYER)) )
|
||||
continue;
|
||||
|
||||
set.insert( (*it).sector_current );
|
||||
@@ -749,6 +750,39 @@ std::set<UINT8> GetEnemyHeliSectors( BOOLEAN afKnownToPlayer )
|
||||
return set;
|
||||
}
|
||||
|
||||
std::vector<INT16> GetEnemyHeliIDKnowledgeStatus()
|
||||
{
|
||||
INT16 id = -1;
|
||||
std::vector<INT16> vec;
|
||||
|
||||
std::vector<ENEMY_HELI>::iterator itend = gEnemyHeliVector.end();
|
||||
for ( std::vector<ENEMY_HELI>::iterator it = gEnemyHeliVector.begin(); it != itend; ++it )
|
||||
{
|
||||
++id;
|
||||
|
||||
if ( ( ( *it ).flagmask & ( ENEMYHELI_DESTROYED | ENEMYHELI_KNOWNBYINTEL | ENEMYHELI_KNOWNTOPLAYER ) ) )
|
||||
vec.push_back( -1 );
|
||||
else
|
||||
vec.push_back( id );
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
void BuyHeliInfoWithIntel( INT16 id )
|
||||
{
|
||||
if ( id >= 0 && id < gEnemyHeliVector.size() )
|
||||
{
|
||||
ENEMY_HELI& heli = gEnemyHeliVector[id];
|
||||
|
||||
// if the heli is already destroyed, nothing to do here
|
||||
if ( heli.flagmask & ENEMYHELI_DESTROYED )
|
||||
return;
|
||||
|
||||
heli.flagmask |= ENEMYHELI_KNOWNBYINTEL;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateEnemyHeliRepair( INT16 id )
|
||||
{
|
||||
if ( id >= 0 && id < gEnemyHeliVector.size( ) )
|
||||
@@ -1094,7 +1128,7 @@ void EnemyHeliMANPADSCheck( INT16 id )
|
||||
return;
|
||||
|
||||
// if the player doesn't know about this heli, he can't shoot it down
|
||||
if ( !(heli.flagmask & ENEMYHELI_KNOWNTOPLAYER) )
|
||||
if ( !(heli.flagmask & ( ENEMYHELI_KNOWNBYINTEL|ENEMYHELI_KNOWNTOPLAYER)) )
|
||||
return;
|
||||
|
||||
INT8 heli_x = SECTORX( heli.sector_current );
|
||||
@@ -1205,6 +1239,10 @@ void EnemyHeliCheckPlayerKnowledge( INT16 id )
|
||||
if ( id >= 0 && id < gEnemyHeliVector.size( ) )
|
||||
{
|
||||
ENEMY_HELI& heli = gEnemyHeliVector[id];
|
||||
|
||||
// if we already know about this from intel, nothing to do here
|
||||
if ( heli.flagmask & ENEMYHELI_KNOWNBYINTEL )
|
||||
return;
|
||||
|
||||
INT8 current_x = SECTORX( heli.sector_current );
|
||||
INT8 current_y = SECTORY( heli.sector_current );
|
||||
|
||||
@@ -92,6 +92,10 @@ void EnemyHeliTroopDrop( UINT8 aSector );
|
||||
|
||||
std::set<UINT8> GetEnemyHeliSectors( BOOLEAN afKnownToPlayer );
|
||||
|
||||
// returns vector of all helis, -1 if known to player, id otherwise
|
||||
std::vector<INT16> GetEnemyHeliIDKnowledgeStatus();
|
||||
|
||||
void BuyHeliInfoWithIntel( INT16 id );
|
||||
void UpdateEnemyHeliRepair( INT16 id );
|
||||
void UpdateEnemyHeliRefuel( INT16 id );
|
||||
void UpdateEnemyHeli( INT16 id );
|
||||
|
||||
+1013
-309
File diff suppressed because it is too large
Load Diff
+19
-13
@@ -92,6 +92,8 @@ enum
|
||||
FACILITY_REPAIR,
|
||||
FORTIFICATION, // Flugente: sectors can be fortified according to external layout plans
|
||||
TRAIN_WORKERS,
|
||||
CONCEALED, // Flugente: spy hides among the population
|
||||
GATHERINTEL, // gathers information while disguised in enemy territory
|
||||
NUM_ASSIGNMENTS,
|
||||
};
|
||||
|
||||
@@ -107,6 +109,8 @@ enum
|
||||
#define IS_REPAIR(assignment) ((assignment == REPAIR) || (assignment == FACILITY_REPAIR))
|
||||
#define CASE_REPAIR case REPAIR: case FACILITY_REPAIR
|
||||
|
||||
#define SPY_LOCATION(assignment) ((assignment == CONCEALED) || (assignment == GATHERINTEL) )
|
||||
|
||||
// strings for snitch exposition
|
||||
enum
|
||||
{
|
||||
@@ -176,6 +180,8 @@ BOOLEAN CanCharacterTreatSectorDisease( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN CanCharacterFortify( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN CanCharacterSpyAssignment( SOLDIERTYPE *pSoldier );
|
||||
|
||||
// can this character be assigned as a repairman?
|
||||
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pCharacter );
|
||||
|
||||
@@ -280,19 +286,12 @@ FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSecto
|
||||
|
||||
INT16 GetTrainWorkerPts(SOLDIERTYPE *pSoldier);
|
||||
|
||||
// Flugente: via various means, the player can get info on the enemy - this can be enemy positions, movement, or the position of important targets
|
||||
enum
|
||||
{
|
||||
INFO_TYPE_NORMAL,
|
||||
INFO_TYPE_VIP,
|
||||
|
||||
INFO_TYPE_MAX,
|
||||
};
|
||||
|
||||
// this function gives a random bit of information to the player. The type of info depends on aInfoType.
|
||||
// If higher-order info cannot be given (for example if all info is already known to the player), lower-order info wil be given instead
|
||||
// returns TRUE if info was given, FALSE if not
|
||||
BOOLEAN GiveInfoToPlayer( UINT8 aInfoType );
|
||||
// Flugente: intel shenanigans
|
||||
void BuildIntelInfoArray();
|
||||
void CalcIntelInfoOfferings();
|
||||
void GetIntelInfoOfferings( int aInfo[] );
|
||||
void GetIntelInfoTextAndPrice( int aInfoNumber, STR16 aString, int& arIntelCost );
|
||||
void BuyIntelInfo( int aInfoNumber );
|
||||
|
||||
// get bonus tarining pts due to an instructor for this student
|
||||
// HEADROCK HAM 3.5: Three functions below have lost an argument which is no longer required ("uiAtGunRange", which was "uiAtFacility" in HAM 3.4)
|
||||
@@ -319,6 +318,7 @@ extern INT32 ghRepairBox;
|
||||
extern INT32 ghTrainingBox;
|
||||
extern INT32 ghMoveItemBox;
|
||||
extern INT32 ghDiseaseBox;
|
||||
extern INT32 ghSpyBox;
|
||||
extern INT32 ghAttributeBox;
|
||||
extern INT32 ghRemoveMercAssignBox;
|
||||
extern INT32 ghContractBox;
|
||||
@@ -354,6 +354,7 @@ extern BOOLEAN fShownAssignmentMenu;
|
||||
extern BOOLEAN fShowRepairMenu;
|
||||
extern BOOLEAN fShowMoveItemMenu;
|
||||
extern BOOLEAN fShowDiseaseMenu;
|
||||
extern BOOLEAN fShowSpyMenu;
|
||||
|
||||
extern BOOLEAN fFirstClickInAssignmentScreenMask;
|
||||
|
||||
@@ -401,6 +402,11 @@ void CreateDestroyMouseRegionForDiseaseMenu( void );
|
||||
void DiseaseMenuMvtCallback( MOUSE_REGION * pRegion, INT32 iReason );
|
||||
void DiseaseMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason );
|
||||
|
||||
// Flugente: spy menu
|
||||
void CreateDestroyMouseRegionForSpyMenu( void );
|
||||
void SpyMenuMvtCallback( MOUSE_REGION * pRegion, INT32 iReason );
|
||||
void SpyMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason );
|
||||
|
||||
// HEADROCK HAM 3.6: Facility Menu
|
||||
void CreateDestroyMouseRegionForFacilityMenu( void );
|
||||
void FacilityMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason );
|
||||
|
||||
+12
-12
@@ -621,7 +621,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1");
|
||||
gpAR->uiPreRandomIndex = guiPreRandomIndex;
|
||||
|
||||
//Determine who gets the defensive advantage
|
||||
switch( gubEnemyEncounterCode )
|
||||
switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case ENEMY_ENCOUNTER_CODE:
|
||||
gpAR->ubPlayerDefenceAdvantage = 21; //Skewed to the player's advantage for convenience purposes.
|
||||
@@ -635,7 +635,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve1");
|
||||
default:
|
||||
//shouldn't happen
|
||||
#ifdef JA2BETAVERSION
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Autoresolving with entering enemy sector code %d -- illegal KM:1", gubEnemyEncounterCode );
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Autoresolving with entering enemy sector code %d -- illegal KM:1", GetEnemyEncounterCode() );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -750,7 +750,7 @@ void AssociateEnemiesWithStrategicGroups()
|
||||
UINT8 ubDirAmount;
|
||||
UINT8 ubCurrSI;
|
||||
|
||||
if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() == CREATURE_ATTACK_CODE )
|
||||
return;
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ];
|
||||
@@ -1100,7 +1100,7 @@ void CalculateSoldierCells( BOOLEAN fReset )
|
||||
gpEnemies[ index ].xp = (UINT16)(gpAR->sCenterStartX + 141 + 55*x);
|
||||
gpEnemies[ index ].yp = iStartY + y*47;
|
||||
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
if ( index < gpAR->ubElites )
|
||||
gpEnemies[ index ].uiFlags = CELL_ELITE;
|
||||
@@ -1671,7 +1671,7 @@ void RenderAutoResolve()
|
||||
SetFontForeground( FONT_WHITE );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
|
||||
switch( gubEnemyEncounterCode )
|
||||
switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case NO_ENCOUNTER_CODE:
|
||||
swprintf( str, gpStrategicString[STR_AR_ATTACK_HEADER] );
|
||||
@@ -1807,7 +1807,7 @@ void RenderAutoResolve()
|
||||
case BATTLE_DEFEAT:
|
||||
HandleMoraleEvent( NULL, MORALE_HEARD_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 );
|
||||
if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 );
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
}
|
||||
@@ -1833,7 +1833,7 @@ void RenderAutoResolve()
|
||||
gpAR->uiTotalElapsedBattleTimeInMilliseconds += 300000;
|
||||
|
||||
if( ProcessLoyalty() )HandleLoyaltyImplicationsOfMercRetreat( RETREAT_AUTORESOLVE, gpAR->ubSectorX, gpAR->ubSectorY, 0 );
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY );
|
||||
}
|
||||
@@ -2148,7 +2148,7 @@ void CreateAutoResolveInterface()
|
||||
|
||||
ARCreateMilitiaSquad( &cnt, ubEliteMilitia, ubRegMilitia, ubGreenMilitia, sX, sY );
|
||||
}
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
for( i = 0, index = 0; i < gpAR->ubElites; ++i, ++index )
|
||||
{
|
||||
@@ -2620,7 +2620,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
|
||||
|
||||
gpBattleGroup = NULL;
|
||||
|
||||
if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() == CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gubNumCreaturesAttackingTown = 0;
|
||||
gubSectorIDOfCreatureAttack = 0;
|
||||
@@ -2919,7 +2919,7 @@ void CalculateAutoResolveInfo()
|
||||
Assert( gpAR->ubSectorX >= 1 && gpAR->ubSectorX <= 16 );
|
||||
Assert( gpAR->ubSectorY >= 1 && gpAR->ubSectorY <= 16 );
|
||||
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
// GetNumberOfEnemiesInSector( gpAR->ubSectorX, gpAR->ubSectorY,
|
||||
GetNumberOfEnemiesInFiveSectors( gpAR->ubSectorX, gpAR->ubSectorY,
|
||||
@@ -5190,7 +5190,7 @@ BOOLEAN IsBattleOver()
|
||||
{
|
||||
if( gpEnemies[ i ].pSoldier->stats.bLife )
|
||||
{
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gpEnemies[ i ].pSoldier->DoMercBattleSound( BATTLE_SOUND_LAUGH1 );
|
||||
}
|
||||
@@ -5477,7 +5477,7 @@ void ProcessBattleFrame()
|
||||
return;
|
||||
}
|
||||
CONTINUE_BATTLE:
|
||||
if( IsBattleOver() || gubEnemyEncounterCode != CREATURE_ATTACK_CODE && AttemptPlayerCapture() )
|
||||
if( IsBattleOver() || GetEnemyEncounterCode() != CREATURE_ATTACK_CODE && AttemptPlayerCapture() )
|
||||
return;
|
||||
|
||||
iRandom = PreRandom( iTotal );
|
||||
|
||||
@@ -95,9 +95,11 @@ enum //strategic values for each sector
|
||||
#define SF_HAVE_SAID_PLAYER_QUOTE_NEW_SECTOR 0x00001000
|
||||
#endif
|
||||
|
||||
#define SF_ASSIGN_NOTICED_ENEMIES_HERE 0x00002000 // Flugente: info from assigment: enemies were found
|
||||
#define SF_ASSIGN_NOTICED_ENEMIES_KNOW_NUMBER 0x00004000 // Flugente: info from assigment: enemies were found, and we know their number
|
||||
#define SF_ASSIGN_NOTICED_ENEMIES_KNOW_DIRECTION 0x00008000 // Flugente: info from assigment: enemies were found, and we know the direction they are moving in
|
||||
#define SF_ASSIGN_NOTICED_ENEMIES_HERE 0x00002000 // Flugente: flag deleted after 1 hour, info from assigment: enemies were found
|
||||
#define SF_ASSIGN_NOTICED_ENEMIES_KNOW_NUMBER 0x00004000 // Flugente: flag deleted after 1 hour, info from assigment: enemies were found, and we know their number
|
||||
|
||||
#define SF_ASSIGN_PERMAINFO_ENEMIES_HERE 0x00008000 // Flugente: permanent flag, info from buying info: enemies were found
|
||||
#define SF_ASSIGN_PERMAINFO_ENEMIES_KNOW_NUMBER 0x00010000 // Flugente: permanent flag, info from buying info: enemies were found, and we know their number
|
||||
|
||||
#define SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS 0x00100000 //Temp File starts with sm_
|
||||
#define SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS 0x00200000 //Temp File starts with l_
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "finances.h" // added by Flugente
|
||||
#include "ASD.h" // added by Flugente
|
||||
#include "Player Command.h" // added by Flugente
|
||||
#include "LuaInitNPCs.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -502,9 +503,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
// No PCM in UB
|
||||
#else
|
||||
case EVENT_PMC_EMAIL:
|
||||
// only send the email if we hven't already visited the site, otherwise continue to spam ;-)
|
||||
if ( !IsBookMarkSet(PMC_BOOKMARK) )
|
||||
AddEmail( PMC_INTRO, PMC_INTRO_LENGTH, PMC, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
AddEmail( PMC_INTRO, PMC_INTRO_LENGTH, PMC, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -613,9 +612,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
// No Kingpin Events in UB
|
||||
#else
|
||||
case EVENT_MILITIAROSTER_EMAIL:
|
||||
// only send the email if we haven't already visited the site, otherwise continue to spam ;-)
|
||||
if ( !IsBookMarkSet( MILITIAROSTER_BOOKMARK ) )
|
||||
AddEmail( MILITIAROSTER_INTRO, MILITIAROSTER_INTRO_LENGTH, MAIL_ENRICO, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
AddEmail( MILITIAROSTER_INTRO, MILITIAROSTER_INTRO_LENGTH, MAIL_ENRICO, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -639,6 +636,14 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
case EVENT_WEATHER_SNOW:
|
||||
ChangeWeather( (UINT8)pEvent->uiParam, WEATHER_FORECAST_SNOW );
|
||||
break;
|
||||
|
||||
case EVENT_INTEL_ENRICO_EMAIL:
|
||||
AddEmail( INTEL_ENRICO_INTRO, INTEL_ENRICO_INTRO_LENGTH, MAIL_ENRICO, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
break;
|
||||
|
||||
case EVENT_INTEL_PHOTOFACT_VERIFY:
|
||||
LuaVerifyPhotoState( (INT16)pEvent->uiParam );
|
||||
break;
|
||||
}
|
||||
gfPreventDeletionOfAnyEvent = fOrigPreventFlag;
|
||||
return TRUE;
|
||||
|
||||
@@ -140,6 +140,9 @@ enum
|
||||
EVENT_WEATHER_SANDSTORM,
|
||||
EVENT_WEATHER_SNOW,
|
||||
|
||||
EVENT_INTEL_ENRICO_EMAIL, // Flugente: Enrico sends us an email introduction to intel
|
||||
EVENT_INTEL_PHOTOFACT_VERIFY, // verification of a photo fact
|
||||
|
||||
NUMBER_OF_EVENT_TYPES_PLUS_ONE,
|
||||
NUMBER_OF_EVENT_TYPES = NUMBER_OF_EVENT_TYPES_PLUS_ONE - 1
|
||||
};
|
||||
|
||||
@@ -661,7 +661,7 @@ void HourlyStealUpdate()
|
||||
pSoldier = MercPtrs[ cnt ];
|
||||
|
||||
// merc must be alive, not travelling and awake. If he is in the currently loaded sector, we may not be in tactical (we would see an item suddenly disappearing) and not in combat
|
||||
if ( pSoldier && !pSoldier->flags.fBetweenSectors && pSoldier->bActive && !pSoldier->flags.fMercAsleep && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_POW &&
|
||||
if ( pSoldier && !pSoldier->flags.fBetweenSectors && pSoldier->bActive && !pSoldier->flags.fMercAsleep && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_POW && !SPY_LOCATION( pSoldier->bAssignment ) &&
|
||||
!( ( ( gWorldSectorX == pSoldier->sSectorX ) && ( gWorldSectorY == pSoldier->sSectorY ) && (gbWorldSectorZ == pSoldier->bSectorZ ) ) && (gTacticalStatus.fEnemyInSector || guiCurrentScreen == GAME_SCREEN )) )
|
||||
{
|
||||
if ( pSoldier->HasBackgroundFlag( BACKGROUND_SCROUNGING ) )
|
||||
@@ -675,7 +675,7 @@ void HourlyStealUpdate()
|
||||
{
|
||||
pOtherSoldier = MercPtrs[ cnt2 ];
|
||||
// note - snitches stop others, but can scrounge themselves (if they have scrounging specifically set in background...)
|
||||
if( pOtherSoldier && !pOtherSoldier->flags.fBetweenSectors && pOtherSoldier->bAssignment != IN_TRANSIT && pOtherSoldier->bAssignment != ASSIGNMENT_POW &&
|
||||
if( pOtherSoldier && !pOtherSoldier->flags.fBetweenSectors && pOtherSoldier->bAssignment != IN_TRANSIT && pOtherSoldier->bAssignment != ASSIGNMENT_POW && SPY_LOCATION( pOtherSoldier->bAssignment ) &&
|
||||
pOtherSoldier->bActive && !pOtherSoldier->flags.fMercAsleep && pSoldier->ubProfile != pOtherSoldier->ubProfile )
|
||||
{
|
||||
if ( ProfileHasSkillTrait( pOtherSoldier->ubProfile, SNITCH_NT ) && !( pSoldier->usSoldierFlagMask2 & SOLDIER_PREVENT_MISBEHAVIOUR_OFF ) )
|
||||
|
||||
+143
-11
@@ -842,7 +842,7 @@ static int l_ProfilesStrategicInsertionData (lua_State *L);
|
||||
static int l_ResetBoxers( lua_State *L );
|
||||
|
||||
static int l_AddVolunteers( lua_State *L );
|
||||
static int l_AddInfo( lua_State *L );
|
||||
static int l_AddIntel( lua_State *L );
|
||||
|
||||
static int l_CreateArmedCivilain( lua_State *L );
|
||||
static int l_CreateCivilian( lua_State *L );
|
||||
@@ -871,6 +871,10 @@ static int l_SoldierSpendMoney( lua_State *L );
|
||||
|
||||
static int l_SetAdditionalDialogue( lua_State *L );
|
||||
static int l_PlaySound( lua_State *L );
|
||||
static int l_AddArmsDealerAdditionalIntelDataItem( lua_State *L );
|
||||
|
||||
static int l_SetPhotoFactLaptopData( lua_State *L );
|
||||
static int l_GetNumHostilesInSector( lua_State *L );
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -1721,7 +1725,7 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
|
||||
lua_register(L,"StartDialogueMessageBox", l_StartDialogueMessageBox);
|
||||
|
||||
lua_register( L, "AddVolunteers", l_AddVolunteers );
|
||||
lua_register( L, "AddInfo", l_AddInfo );
|
||||
lua_register( L, "AddIntel", l_AddIntel );
|
||||
|
||||
lua_register(L, "CreateArmedCivilain", l_CreateArmedCivilain );
|
||||
lua_register( L, "CreateCivilian", l_CreateCivilian );
|
||||
@@ -1750,6 +1754,10 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
|
||||
|
||||
lua_register( L, "SetAdditionalDialogue", l_SetAdditionalDialogue );
|
||||
lua_register( L, "PlaySound", l_PlaySound );
|
||||
lua_register( L, "AddArmsDealerAdditionalIntelDataItem", l_AddArmsDealerAdditionalIntelDataItem );
|
||||
|
||||
lua_register( L, "SetPhotoFactLaptopData", l_SetPhotoFactLaptopData );
|
||||
lua_register( L, "GetNumHostilesInSector", l_GetNumHostilesInSector );
|
||||
}
|
||||
#ifdef NEWMUSIC
|
||||
BOOLEAN LetLuaMusicControl(UINT8 Init)
|
||||
@@ -3620,15 +3628,13 @@ return 1;
|
||||
|
||||
static int l_CurrentPlayerProgressPercentage(lua_State *L)
|
||||
{
|
||||
UINT8 n = lua_gettop(L);
|
||||
|
||||
UINT8 val;
|
||||
|
||||
val = CurrentPlayerProgressPercentage( );
|
||||
UINT8 n = lua_gettop(L);
|
||||
|
||||
UINT8 val = CurrentPlayerProgressPercentage( );
|
||||
|
||||
lua_pushinteger(L, val);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_SetgMercProfilesbTown(lua_State *L)
|
||||
@@ -13054,13 +13060,13 @@ static int l_AddVolunteers( lua_State *L )
|
||||
}
|
||||
|
||||
// add info
|
||||
static int l_AddInfo( lua_State *L )
|
||||
static int l_AddIntel( lua_State *L )
|
||||
{
|
||||
if ( lua_gettop( L ) )
|
||||
{
|
||||
UINT8 infotype = lua_tointeger( L, 1 );
|
||||
int intel = lua_tointeger( L, 1 );
|
||||
|
||||
GiveInfoToPlayer( infotype );
|
||||
AddIntel( intel, TRUE );
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -13432,3 +13438,129 @@ void LuaHandleAdditionalDialogue( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ,
|
||||
|
||||
LuaFunction( _LS.L, "HandleAdditionalDialogue" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( ubProfile ).Param<int>( iFaceIndex ).Param<int>( usEventNr ).Param<int>( aData1 ).Param<int>( aData2 ).Param<int>( aData3 ).Call( 9 );
|
||||
}
|
||||
|
||||
void LuaAddArmsDealerAdditionalIntelData()
|
||||
{
|
||||
const char* filename = "scripts\\Overhead.lua";
|
||||
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
LuaFunction( _LS.L, "AddArmsDealerAdditionalIntelData" ).Call( 0 );
|
||||
}
|
||||
|
||||
extern void AddArmsDealerAdditionalIntelData( UINT16 ausDealer, UINT16 usItem, INT16 sIntelPrice, INT16 sOptimalNumber );
|
||||
|
||||
static int l_AddArmsDealerAdditionalIntelDataItem( lua_State *L )
|
||||
{
|
||||
if ( lua_gettop( L ) >= 4 )
|
||||
{
|
||||
UINT16 usDealer = lua_tointeger( L, 1 );
|
||||
UINT16 usItem = lua_tointeger( L, 2 );
|
||||
INT16 sIntelPrice = lua_tointeger( L, 3 );
|
||||
INT16 sOptimalNumber = lua_tointeger( L, 4 );
|
||||
|
||||
AddArmsDealerAdditionalIntelData( usDealer, usItem, sIntelPrice, sOptimalNumber );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LuaAddPhotoData( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, INT32 sGridNo, INT8 bLevel, UINT8 ubPhotographerProfile, UINT16 room, UINT8 usTargetProfile )
|
||||
{
|
||||
const char* filename = "scripts\\Overhead.lua";
|
||||
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
LuaFunction( _LS.L, "AddPhotoData" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( sGridNo ).Param<int>( bLevel ).Param<int>( ubPhotographerProfile ).Param<int>( room ).Param<int>( usTargetProfile ).Call( 6 );
|
||||
}
|
||||
|
||||
void LuaGetPhotoData( UINT8 aType )
|
||||
{
|
||||
const char* filename = "scripts\\Overhead.lua";
|
||||
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
LuaFunction( _LS.L, "GetPhotoData" ).Param<int>( aType ).Call( 1 );
|
||||
}
|
||||
|
||||
void LuaSetPhotoState( INT16 asIndex, UINT8 aState )
|
||||
{
|
||||
const char* filename = "scripts\\Overhead.lua";
|
||||
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
LuaFunction( _LS.L, "SetPhotoState" ).Param<int>( asIndex ).Param<int>( aState ).Call( 2 );
|
||||
}
|
||||
|
||||
void LuaVerifyPhotoState( INT16 asIndex )
|
||||
{
|
||||
const char* filename = "scripts\\Overhead.lua";
|
||||
|
||||
LuaScopeState _LS( true );
|
||||
|
||||
IniFunction( _LS.L(), TRUE );
|
||||
IniGlobalGameSetting( _LS.L() );
|
||||
|
||||
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
|
||||
|
||||
LuaFunction( _LS.L, "VerifyPhotoState" ).Param<int>( asIndex ).Call( 1 );
|
||||
}
|
||||
|
||||
extern void AddPhotoFactTaken( UINT8 aType, INT16 asIndex, STR16 aText );
|
||||
|
||||
static int l_SetPhotoFactLaptopData( lua_State *L )
|
||||
{
|
||||
if ( lua_gettop( L ) >= 3 )
|
||||
{
|
||||
UINT8 type = lua_tointeger( L, 1 );
|
||||
INT16 sIndex = lua_tointeger( L, 2 );
|
||||
|
||||
size_t len = 0;
|
||||
const char* str = lua_tolstring( L, 3, &len );
|
||||
|
||||
CHAR16 w_str[1000];
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, str, -1, w_str, sizeof( w_str ) / sizeof( w_str[0] ) );
|
||||
w_str[sizeof( w_str ) / sizeof( w_str[0] ) - 1] = '\0';
|
||||
|
||||
AddPhotoFactTaken( type, sIndex, w_str );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
|
||||
|
||||
static int l_GetNumHostilesInSector( lua_State *L )
|
||||
{
|
||||
if ( lua_gettop( L ) >= 3 )
|
||||
{
|
||||
INT16 sSectorX = lua_tointeger( L, 1 );
|
||||
INT16 sSectorY = lua_tointeger( L, 2 );
|
||||
INT16 sSectorZ = lua_tointeger( L, 3 );
|
||||
|
||||
lua_pushinteger( L, NumHostilesInSector( sSectorX, sSectorY, sSectorZ ) );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -93,4 +93,9 @@ extern BOOLEAN LuaIDScripts(UINT8 Init, UINT8 ubTargetNPC, UINT16 usActionCode,
|
||||
extern BOOLEAN LetLuaMusicControl(UINT8 Init);
|
||||
|
||||
void LuaHandleAdditionalDialogue( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubProfile, INT32 iFaceIndex, UINT16 usEventNr, UINT32 aData1, UINT32 aData2, UINT32 aData3 );
|
||||
void LuaAddArmsDealerAdditionalIntelData();
|
||||
void LuaAddPhotoData( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, INT32 sGridNo, INT8 bLevel, UINT8 ubPhotographerProfile, UINT16 room, UINT8 usTargetProfile );
|
||||
void LuaGetPhotoData( UINT8 aType );
|
||||
void LuaSetPhotoState( INT16 asIndex, UINT8 aState );
|
||||
void LuaVerifyPhotoState( INT16 asIndex );
|
||||
#endif
|
||||
|
||||
@@ -1222,10 +1222,11 @@ INT32 ShowAssignedTeam(INT16 sMapX, INT16 sMapY, INT32 iCount)
|
||||
|
||||
// given number of on duty members, find number of assigned chars
|
||||
// start at beginning of list, look for people who are in sector and assigned
|
||||
// Flugente: concealed mercs also show up here, to give the illusion they are present
|
||||
if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) &&
|
||||
( pSoldier->sSectorX == sMapX) &&
|
||||
( pSoldier->sSectorY == sMapY) &&
|
||||
( pSoldier->bSectorZ == iCurrentMapSectorZ ) &&
|
||||
( ( pSoldier->bSectorZ == iCurrentMapSectorZ ) || ( SPY_LOCATION( pSoldier->bAssignment) && ( pSoldier->bSectorZ - 10 == iCurrentMapSectorZ ) ) ) &&
|
||||
( pSoldier->bAssignment >= ON_DUTY ) && ( pSoldier->bAssignment != VEHICLE ) &&
|
||||
( pSoldier->bAssignment != IN_TRANSIT ) &&
|
||||
( pSoldier->bAssignment != ASSIGNMENT_POW ) &&
|
||||
@@ -6573,15 +6574,59 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
// making it easier to detect or even count enemies in distant sectors.
|
||||
// This option can be combined with either of the two above.
|
||||
|
||||
// Facilities can set a flag that allows detection in some sectors. We can read flags directly from the sector
|
||||
// data to know whether we should show the enemies there. This overrides ANYTHING else.
|
||||
if ( SectorInfo[SECTOR( sSectorX, sSectorY )].ubDetectionLevel & 1 )
|
||||
{
|
||||
fDetection = TRUE;
|
||||
fDirection = TRUE;
|
||||
}
|
||||
|
||||
if ( SectorInfo[SECTOR( sSectorX, sSectorY )].ubDetectionLevel & ( 1 << 2 ) )
|
||||
{
|
||||
fDetection = TRUE;
|
||||
fCount = TRUE;
|
||||
fDirection = TRUE;
|
||||
}
|
||||
|
||||
// Flugente: check intel sector flags
|
||||
int mapregion = ( (sSectorX - 1) / 4 ) + 4 * ( (sSectorY - 1) / 4 );
|
||||
|
||||
if ( LaptopSaveInfo.usMapIntelFlags & ( 1 << mapregion ) )
|
||||
{
|
||||
fDetection = TRUE;
|
||||
|
||||
if ( LaptopSaveInfo.usMapIntelFlags & ( 1 << (16 + mapregion) ) )
|
||||
{
|
||||
fCount = TRUE;
|
||||
fDirection = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( uiSectorFlags & ( SF_ASSIGN_NOTICED_ENEMIES_HERE | SF_ASSIGN_PERMAINFO_ENEMIES_HERE ) )
|
||||
{
|
||||
fDetection = TRUE;
|
||||
|
||||
// we know how many there are
|
||||
if ( uiSectorFlags & ( SF_ASSIGN_NOTICED_ENEMIES_KNOW_NUMBER | SF_ASSIGN_PERMAINFO_ENEMIES_KNOW_NUMBER ) )
|
||||
{
|
||||
fCount = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: we can buy info on enemy groups with intel
|
||||
GetInfoFromGroupsInSector( sSectorX, sSectorY, ENEMY_TEAM, fDetection, fCount, fDirection );
|
||||
|
||||
// Detection through active recon.
|
||||
// Mercs provide recon in the same sector they're in.
|
||||
// Militia provide recon in any adjacent sector (diagonals included)
|
||||
// There's also a special case flag used when players encounter enemies in a sector, then retreat. You can only
|
||||
// see the size of their force while the clock is paused. When unpaused, the flag is reset.
|
||||
if ( CanMercsScoutThisSector( sSectorX, sSectorY, 0 ) ||
|
||||
CanSomeoneNearbyScoutThisSector( sSectorX, sSectorY, FALSE ) || // merged militia check with scouting check - SANDRO
|
||||
( uiSectorFlags & SF_PLAYER_KNOWS_ENEMIES_ARE_HERE ) )
|
||||
// only do this check if we don't already know what's here
|
||||
if ( !(fDetection && fCount) &&
|
||||
( ( uiSectorFlags & (SF_PLAYER_KNOWS_ENEMIES_ARE_HERE| SF_ASSIGN_PERMAINFO_ENEMIES_HERE ) ) ||
|
||||
CanMercsScoutThisSector( sSectorX, sSectorY, 0 ) ||
|
||||
CanSomeoneNearbyScoutThisSector( sSectorX, sSectorY, FALSE ) ) )// merged militia check with scouting check - SANDRO
|
||||
{
|
||||
fDetection = TRUE;
|
||||
|
||||
@@ -6592,34 +6637,29 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
fCount = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// SADNRO - Scouting trait check for detection of nearby enemies
|
||||
if (CanSomeoneNearbyScoutThisSector( sSectorX, sSectorY, TRUE )) // scouting trait check
|
||||
if ( !( fDetection && fCount ) && gSkillTraitValues.fSCCanDetectEnemyPresenseAround && CanSomeoneNearbyScoutThisSector( sSectorX, sSectorY, TRUE ) ) // scouting trait check
|
||||
{
|
||||
if (gSkillTraitValues.fSCCanDetectEnemyPresenseAround)
|
||||
{
|
||||
// show their presence
|
||||
fDetection = TRUE;
|
||||
// show their numbers
|
||||
if (gSkillTraitValues.fSCCanDetermineEnemyNumbersAround)
|
||||
fCount = TRUE;
|
||||
}
|
||||
// show their presence
|
||||
fDetection = TRUE;
|
||||
|
||||
// show their numbers
|
||||
if ( gSkillTraitValues.fSCCanDetermineEnemyNumbersAround )
|
||||
fCount = TRUE;
|
||||
}
|
||||
|
||||
// Explored Sector Detection
|
||||
// Enemy can be detected in any previously-visited sector.
|
||||
// This is also enabled by some facilities, provided a merc is present and available to do it.
|
||||
if( GetSectorFlagStatus( sSectorX, sSectorY, 0, SF_ALREADY_VISITED ) == TRUE )
|
||||
// HEADROCK HAM 3.2: When enabled, this INI setting disallows detection of enemy roamers beyond merc/militia recon range.
|
||||
if( !fDetection && !gGameExternalOptions.fNoEnemyDetectionWithoutRecon && GetSectorFlagStatus( sSectorX, sSectorY, 0, SF_ALREADY_VISITED ) == TRUE )
|
||||
{
|
||||
// HEADROCK HAM 3.2: When enabled, this INI setting disallows detection of enemy roamers beyond merc/militia
|
||||
// recon range.
|
||||
if (!gGameExternalOptions.fNoEnemyDetectionWithoutRecon)
|
||||
{
|
||||
// then he always knows about any enemy presence for the remainder of the game, but not exact numbers
|
||||
fDetection = TRUE;
|
||||
}
|
||||
// then he always knows about any enemy presence for the remainder of the game, but not exact numbers
|
||||
fDetection = TRUE;
|
||||
}
|
||||
|
||||
// if Skyrider noticed the enemis in the sector recently
|
||||
// if Skyrider noticed the enemies in the sector recently
|
||||
if ( uiSectorFlags & SF_SKYRIDER_NOTICED_ENEMIES_HERE )
|
||||
{
|
||||
// and Skyrider is still in this sector, flying
|
||||
@@ -6634,38 +6674,7 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
SectorInfo[ SECTOR( sSectorX, sSectorY ) ].uiFlags &= ~SF_SKYRIDER_NOTICED_ENEMIES_HERE;
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: we know that enemies are here
|
||||
if ( uiSectorFlags & SF_ASSIGN_NOTICED_ENEMIES_HERE )
|
||||
{
|
||||
fDetection = TRUE;
|
||||
|
||||
// we know how many there are
|
||||
if ( uiSectorFlags & SF_ASSIGN_NOTICED_ENEMIES_KNOW_NUMBER )
|
||||
{
|
||||
fCount = TRUE;
|
||||
}
|
||||
|
||||
// we know the direction they are moving in
|
||||
if ( uiSectorFlags & SF_ASSIGN_NOTICED_ENEMIES_KNOW_DIRECTION )
|
||||
{
|
||||
fDirection = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Facilities can set a flag that allows detection in some sectors. We can read flags directly from the sector
|
||||
// data to know whether we should show the enemies there. This overrides ANYTHING else.
|
||||
if (SectorInfo[ SECTOR( sSectorX, sSectorY ) ].ubDetectionLevel & 1)
|
||||
{
|
||||
fDetection = TRUE;
|
||||
fDirection = TRUE;
|
||||
}
|
||||
if (SectorInfo[ SECTOR( sSectorX, sSectorY ) ].ubDetectionLevel & (1<<2) )
|
||||
{
|
||||
fCount = TRUE;
|
||||
fDirection = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// HEADROCK HAM 5: New cases below
|
||||
if (!fDetection)
|
||||
{
|
||||
@@ -6685,11 +6694,11 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY )
|
||||
else if (!fDirection)
|
||||
{
|
||||
// Accurate information
|
||||
return KNOWS_HOW_MANY;
|
||||
return KNOWS_THEYRE_THERE_AND_HOW_MANY;
|
||||
}
|
||||
|
||||
// Accurate information including direction of travel!
|
||||
return KNOWS_HOW_MANY_AND_WHERE_GOING;
|
||||
return KNOWS_THEYRE_THERE_AND_WHERE_GOING_AND_HOW_MANY;
|
||||
}
|
||||
|
||||
|
||||
@@ -6836,7 +6845,7 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
ShowNonPlayerGroupsInMotion( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
break;
|
||||
|
||||
case KNOWS_HOW_MANY:
|
||||
case KNOWS_THEYRE_THERE_AND_HOW_MANY:
|
||||
{
|
||||
// Flugente: tanks get a special icon, so we need to count them separately
|
||||
usNumEnemyArmedVehicles = NumEnemyArmedVehiclesInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
@@ -6847,7 +6856,7 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
|
||||
break;
|
||||
|
||||
// HEADROCK HAM 5: New case for showing enemy groups AND where the are headed.
|
||||
case KNOWS_HOW_MANY_AND_WHERE_GOING:
|
||||
case KNOWS_THEYRE_THERE_AND_WHERE_GOING_AND_HOW_MANY:
|
||||
{
|
||||
// Flugente: tanks get a special icon, so we need to count them separately
|
||||
usNumEnemyArmedVehicles = NumEnemyArmedVehiclesInSector( sSectorX, sSectorY, ENEMY_TEAM );
|
||||
@@ -7988,6 +7997,21 @@ void DisplayMilitiaGroupBox()
|
||||
swprintf( sString, L"%5.2f", val_armour );
|
||||
mprintf( x, y, sString );
|
||||
}
|
||||
|
||||
y -= GetFontHeight( FONT12ARIAL ) + 2;
|
||||
|
||||
if ( gGameExternalOptions.fIntelResource )
|
||||
{
|
||||
x = MapScreenRect.iLeft + 20;
|
||||
|
||||
CHAR16 sString[200];
|
||||
|
||||
FLOAT intel = GetIntel();
|
||||
|
||||
SetFontForeground( FONT_FCOLOR_GREEN );
|
||||
swprintf( sString, L"Intel: %5.2f", intel );
|
||||
mprintf( x, y, sString );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !gMilitiaGroupBoxCreated )
|
||||
|
||||
@@ -231,7 +231,6 @@ void CopyPathToCharactersSquadIfInOne( SOLDIERTYPE *pCharacter );
|
||||
void InitMapSecrets( void );
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
ABORT_PLOTTING = 0,
|
||||
PATH_CLEARED,
|
||||
@@ -243,14 +242,12 @@ enum {
|
||||
KNOWS_NOTHING = 0,
|
||||
KNOWS_THEYRE_THERE,
|
||||
KNOWS_THEYRE_THERE_AND_WHERE_GOING,
|
||||
KNOWS_HOW_MANY,
|
||||
KNOWS_HOW_MANY_AND_WHERE_GOING,
|
||||
KNOWS_THEYRE_THERE_AND_HOW_MANY,
|
||||
KNOWS_THEYRE_THERE_AND_WHERE_GOING_AND_HOW_MANY,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// scroll bounds
|
||||
#define EAST_ZOOM_BOUND 378
|
||||
#define WEST_ZOOM_BOUND 42
|
||||
|
||||
@@ -935,8 +935,8 @@ void AddCommonInfoToBox(void)
|
||||
break;
|
||||
|
||||
// HEADROCK HAM 5: New case
|
||||
case KNOWS_HOW_MANY:
|
||||
case KNOWS_HOW_MANY_AND_WHERE_GOING:
|
||||
case KNOWS_THEYRE_THERE_AND_HOW_MANY:
|
||||
case KNOWS_THEYRE_THERE_AND_WHERE_GOING_AND_HOW_MANY:
|
||||
// show exactly how many
|
||||
if (numEnemiesOnMap != ubNumEnemies)
|
||||
swprintf( wString, L"%d (%d)", numEnemiesOnMap, ubNumEnemies );
|
||||
|
||||
@@ -1612,7 +1612,11 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
||||
//INT32 iCounter = 0;
|
||||
INT32 sGridNo, sTempGridNo;
|
||||
|
||||
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ )
|
||||
INT8 sectorz = Menptr[uiMercId].bSectorZ;
|
||||
if ( SPY_LOCATION( Menptr[uiMercId].bAssignment ) )
|
||||
sectorz = max( 0, sectorz - 10 );
|
||||
|
||||
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || sectorz != gbWorldSectorZ )
|
||||
{
|
||||
// ATE: Use insertion gridno if not nowhere and insertion is gridno
|
||||
if ( Menptr[ uiMercId ].ubStrategicInsertionCode == INSERTION_CODE_GRIDNO && !TileIsOutOfBounds(Menptr[ uiMercId ].usStrategicInsertionData) )
|
||||
@@ -1649,7 +1653,7 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
||||
UINT32 uiFoundItems = 0;
|
||||
Inventory invTemporaryBeforeDrop;
|
||||
|
||||
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || Menptr[ uiMercId ].bSectorZ != gbWorldSectorZ )
|
||||
if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || sectorz != gbWorldSectorZ )
|
||||
{
|
||||
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
||||
{
|
||||
@@ -1662,7 +1666,7 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
||||
}
|
||||
}
|
||||
// anv: add all items at once (less file operations = less lag)
|
||||
AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, Menptr[ uiMercId ].bSectorZ , sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE );
|
||||
AddItemsToUnLoadedSector( Menptr[ uiMercId ].sSectorX, Menptr[ uiMercId ].sSectorY, sectorz, sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]) , Menptr[ uiMercId ].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2299,6 +2303,14 @@ void UpdateMapScreenAssignmentPositions( void )
|
||||
SetBoxPosition( ghDiseaseBox, pPoint );
|
||||
}
|
||||
|
||||
if ( fShowSpyMenu )
|
||||
{
|
||||
GetBoxPosition( ghSpyBox, &pPoint );
|
||||
pPoint.iY = giBoxY + ( GetFontHeight( MAP_SCREEN_FONT ) + 2 ) * ASSIGN_MENU_SPY;
|
||||
|
||||
SetBoxPosition( ghSpyBox, pPoint );
|
||||
}
|
||||
|
||||
// HEADROCK HAM 3.6: Facility Menu
|
||||
if( fShowFacilityMenu )
|
||||
{
|
||||
@@ -3743,7 +3755,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
|
||||
pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ];
|
||||
|
||||
if( ( pSoldier->bActive ) &&
|
||||
( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) &&
|
||||
( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && !SPY_LOCATION( pSoldier->bAssignment ) &&
|
||||
( pSoldier->sSectorX == sSectorX ) && ( pSoldier->sSectorY == sSectorY ) && ( pSoldier->bSectorZ == sSectorZ ) )
|
||||
{
|
||||
if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
|
||||
@@ -5769,12 +5781,12 @@ BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void )
|
||||
if ( NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM ) > 0 )
|
||||
{
|
||||
gfBlitBattleSectorLocator = TRUE;
|
||||
gubEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
SetEnemyEncounterCode(ENTERING_ENEMY_SECTOR_CODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gfBlitBattleSectorLocator = FALSE;
|
||||
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode(NO_ENCOUNTER_CODE);
|
||||
}
|
||||
|
||||
InitHelicopterEntranceByMercs( );
|
||||
|
||||
@@ -131,6 +131,7 @@ enum {
|
||||
ASSIGN_MENU_TRAIN,
|
||||
ASSIGN_MENU_MOVE_ITEMS, // added by Flugente
|
||||
ASSIGN_MENU_FORTIFY, // added by Flugente
|
||||
ASSIGN_MENU_SPY, // added by Flugente
|
||||
ASSIGN_MENU_FACILITY, // HEAROCK HAM 3.6: Facility List menu
|
||||
ASSIGN_MENU_CANCEL,
|
||||
MAX_ASSIGN_STRING_COUNT,
|
||||
|
||||
@@ -175,6 +175,9 @@ BOOLEAN gfPersistantPBI = FALSE;
|
||||
//dictates the header that is used at the top of the PBI.
|
||||
UINT8 gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
|
||||
UINT8 GetEnemyEncounterCode() { return gubEnemyEncounterCode;}
|
||||
void SetEnemyEncounterCode( UINT8 aCode ) { gubEnemyEncounterCode = aCode; }
|
||||
|
||||
//The autoresolve during tactical battle option needs more detailed information than the
|
||||
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
|
||||
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
|
||||
@@ -182,6 +185,9 @@ UINT8 gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
//would turn hostile, which would disable the ability to autoresolve the battle.
|
||||
BOOLEAN gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
|
||||
UINT8 GetExplicitEnemyEncounterCode() { return gubExplicitEnemyEncounterCode; }
|
||||
void SetExplicitEnemyEncounterCode( UINT8 aCode ) { gubExplicitEnemyEncounterCode = aCode; }
|
||||
|
||||
BOOLEAN gubSpecialEncounterCodeForEnemyHeli = FALSE;
|
||||
|
||||
//Location of the current battle (determines where the animated icon is blitted) and if the
|
||||
@@ -327,7 +333,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
|
||||
// InitializeTacticalStatusAtBattleStart();
|
||||
// CJC, Oct 5 98: this is all we should need from InitializeTacticalStatusAtBattleStart()
|
||||
if( gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE && gubEnemyEncounterCode != ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if( GetEnemyEncounterCode() != BLOODCAT_AMBUSH_CODE && GetEnemyEncounterCode() != ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
if ( !CheckFact( FACT_FIRST_BATTLE_FOUGHT, 0 ) )
|
||||
{
|
||||
@@ -406,40 +412,44 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
if( HostileCiviliansPresent() )
|
||||
{
|
||||
//There are hostile civilians, so no autoresolve allowed.
|
||||
gubExplicitEnemyEncounterCode = HOSTILE_CIVILIANS_CODE;
|
||||
SetExplicitEnemyEncounterCode( HOSTILE_CIVILIANS_CODE );
|
||||
}
|
||||
else if( HostileBloodcatsPresent() )
|
||||
{
|
||||
//There are bloodcats in the sector, so no autoresolve allowed
|
||||
gubExplicitEnemyEncounterCode = HOSTILE_BLOODCATS_CODE;
|
||||
SetExplicitEnemyEncounterCode( HOSTILE_BLOODCATS_CODE );
|
||||
}
|
||||
else if( gbWorldSectorZ > 0 )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pUnderGroundSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
Assert( pUnderGroundSector );
|
||||
|
||||
//We are underground, so no autoresolve allowed
|
||||
if( pSector->ubCreaturesInBattle )
|
||||
if( pUnderGroundSector->ubCreaturesInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
|
||||
SetExplicitEnemyEncounterCode( FIGHTING_CREATURES_CODE );
|
||||
}
|
||||
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
|
||||
else if( pUnderGroundSector->ubAdminsInBattle || pUnderGroundSector->ubTroopsInBattle || pUnderGroundSector->ubElitesInBattle || pUnderGroundSector->ubTanksInBattle || pUnderGroundSector->ubJeepsInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
SetExplicitEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE );
|
||||
}
|
||||
}
|
||||
else if ( pBattleGroup && pBattleGroup->usGroupTeam != OUR_TEAM && NumNonPlayerTeamMembersInSector( pBattleGroup->ubSectorX, pBattleGroup->ubSectorY, MILITIA_TEAM ) > 0 )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_ENCOUNTER_CODE );
|
||||
}
|
||||
else if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_INVASION_CODE ||
|
||||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
|
||||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_INVASION_AIRDROP_CODE )
|
||||
else if( GetEnemyEncounterCode() == ENTERING_ENEMY_SECTOR_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_ENCOUNTER_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_INVASION_CODE ||
|
||||
GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE ||
|
||||
GetEnemyEncounterCode() == CREATURE_ATTACK_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_INVASION_AIRDROP_CODE ||
|
||||
GetEnemyEncounterCode() == CONCEALINSERTION_CODE )
|
||||
{ //use same code
|
||||
gubExplicitEnemyEncounterCode = gubEnemyEncounterCode;
|
||||
SetExplicitEnemyEncounterCode( GetEnemyEncounterCode() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -596,6 +606,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
usDeploymentLeadership = max( usDeploymentLeadership, deploymentleadership );
|
||||
|
||||
gAmbushRadiusModifier = max( gAmbushRadiusModifier, ambushradiusmodifier / 100 );
|
||||
|
||||
// Flugente: if a merc is inserted from concealed state, retreat is forbidden, as at least this merc will have to extract manually
|
||||
if ( MercPtrs[i]->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION )
|
||||
fRetreatAnOption = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -616,26 +630,31 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
{
|
||||
if ( gubSpecialEncounterCodeForEnemyHeli )
|
||||
{
|
||||
if ( gubEnemyEncounterCode != ENEMY_INVASION_AIRDROP_CODE )
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_CODE;
|
||||
if ( GetEnemyEncounterCode() != ENEMY_INVASION_AIRDROP_CODE )
|
||||
SetEnemyEncounterCode( ENEMY_INVASION_CODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//creature's attacking!
|
||||
gubEnemyEncounterCode = CREATURE_ATTACK_CODE;
|
||||
SetEnemyEncounterCode( CREATURE_ATTACK_CODE);
|
||||
}
|
||||
}
|
||||
else if ( gpBattleGroup->usGroupTeam == OUR_TEAM )
|
||||
{
|
||||
if( gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE && gubEnemyEncounterCode != ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if( GetEnemyEncounterCode() != BLOODCAT_AMBUSH_CODE && GetEnemyEncounterCode() != ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
if( ubNumStationaryEnemies )
|
||||
// Flugente: if the group that causes a battle is a result of a merc no longer being concealed, special code
|
||||
if ( gpBattleGroup->pPlayerList->pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION )
|
||||
{
|
||||
gubEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
SetEnemyEncounterCode( CONCEALINSERTION_CODE );
|
||||
}
|
||||
else if( ubNumStationaryEnemies )
|
||||
{
|
||||
SetEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_ENCOUNTER_CODE );
|
||||
|
||||
// Flugente: no ambushes on an airdrop
|
||||
if ( !fAirDrop )
|
||||
@@ -648,7 +667,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
// SANDRO - Scout prevents ambushes no matter what
|
||||
if ( !fScoutPresent )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_AMBUSH_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_AMBUSH_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -663,7 +682,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
// SANDRO - Scout prevents ambushes no matter what
|
||||
if ( !fScoutPresent )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_AMBUSH_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_AMBUSH_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -733,7 +752,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
{
|
||||
if ( !fScoutPresent )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_AMBUSH_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_AMBUSH_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -746,9 +765,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
}
|
||||
|
||||
// Flugente: improved ambush: if a real squadleader is present, we may deploy our mercs instead of having them being dropped into combat randomly
|
||||
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE && usDeploymentLeadership > 120 )
|
||||
if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE && usDeploymentLeadership > 120 )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_AMBUSH_DEPLOYMENT_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_AMBUSH_DEPLOYMENT_CODE );
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
@@ -757,12 +776,18 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
else
|
||||
{ //Are enemies invading a town, or just encountered the player.
|
||||
if( GetTownIdForSector( gubPBSectorX, gubPBSectorY ) )
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_INVASION_CODE );
|
||||
//SAM sites not in towns will also be considered to be important
|
||||
else if( pSector->uiFlags & SF_SAM_SITE )
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_INVASION_CODE );
|
||||
else
|
||||
gubEnemyEncounterCode = ENEMY_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_ENCOUNTER_CODE );
|
||||
}
|
||||
|
||||
// haxx
|
||||
if ( pBattleGroup && pBattleGroup->usGroupTeam == OUR_TEAM && pBattleGroup->pPlayerList->pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION )
|
||||
{
|
||||
//SetEnemyEncounterCode( CONCEALINSERTION_CODE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +795,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SANDRO - merc records - ambush experienced
|
||||
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE || fAmbushPrevented )
|
||||
if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE || fAmbushPrevented )
|
||||
{
|
||||
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i )
|
||||
{
|
||||
@@ -778,7 +803,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
{
|
||||
if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) && MercPtrs[ i ]->ubProfile != NO_PROFILE )
|
||||
{
|
||||
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++;
|
||||
else if ( fAmbushPrevented && HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) ) // Scouts actually get this as number of prevented ambushes
|
||||
gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++;
|
||||
@@ -818,7 +843,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
}
|
||||
HideButton( giMapContractButton );
|
||||
|
||||
if( gubEnemyEncounterCode == ENEMY_ENCOUNTER_CODE )
|
||||
if( GetEnemyEncounterCode() == ENEMY_ENCOUNTER_CODE )
|
||||
{ //we know how many enemies are here, so until we leave the sector, we will continue to display the value.
|
||||
//the flag will get cleared when time advances after the fEnemyInSector flag is clear.
|
||||
|
||||
@@ -831,20 +856,29 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
//when necessary.
|
||||
if( gfPersistantPBI )
|
||||
{
|
||||
if( gubEnemyEncounterCode == ENTERING_ENEMY_SECTOR_CODE ||
|
||||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if( GetEnemyEncounterCode() == ENTERING_ENEMY_SECTOR_CODE ||
|
||||
GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{ //Don't allow autoresolve for player initiated invasion battle types
|
||||
DisableButton( iPBButton[ 0 ] );
|
||||
SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_DISABLED_AUTORESOLVE_FASTHELP ] );
|
||||
}
|
||||
else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
else if( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
{
|
||||
//Don't allow autoresolve for ambushes
|
||||
DisableButton( iPBButton[ 0 ] );
|
||||
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 3 ] );
|
||||
}
|
||||
else if ( GetEnemyEncounterCode() == CONCEALINSERTION_CODE )
|
||||
{
|
||||
// Don't allow autoresolve
|
||||
DisableButton( iPBButton[0] );
|
||||
SetButtonFastHelpText( iPBButton[0], gpStrategicString[STR_PB_DISABLED_AUTORESOLVE_FASTHELP] );
|
||||
|
||||
// No retreat possible, we must go to tactical
|
||||
fRetreatAnOption = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_AUTORESOLVE_FASTHELP ] );
|
||||
@@ -863,10 +897,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
}
|
||||
|
||||
if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption ||
|
||||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
|
||||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
|
||||
GetEnemyEncounterCode() == CREATURE_ATTACK_CODE ||
|
||||
is_client)
|
||||
{
|
||||
DisableButton( iPBButton[ 2 ] );
|
||||
@@ -891,7 +925,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
DisableButton( iPBButton[ 2 ] );
|
||||
SetButtonFastHelpText( iPBButton[ 2 ], gzNonPersistantPBIText[ 0 ] );
|
||||
SetButtonFastHelpText( iPBButton[ 1 ], gzNonPersistantPBIText[ 1 ] );
|
||||
switch( gubExplicitEnemyEncounterCode )
|
||||
switch( GetExplicitEnemyEncounterCode() )
|
||||
{
|
||||
case CREATURE_ATTACK_CODE:
|
||||
case ENEMY_ENCOUNTER_CODE:
|
||||
@@ -922,6 +956,15 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
|
||||
DisableButton( iPBButton[ 0 ] );
|
||||
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 7 ] );
|
||||
break;
|
||||
case CONCEALINSERTION_CODE:
|
||||
// Don't allow autoresolve
|
||||
DisableButton( iPBButton[0] );
|
||||
SetButtonFastHelpText( iPBButton[0], gpStrategicString[STR_PB_DISABLED_AUTORESOLVE_FASTHELP] );
|
||||
|
||||
// No retreat possible, we must go to tactical
|
||||
DisableButton( iPBButton[2] );
|
||||
SetButtonFastHelpText( iPBButton[2], gzNonPersistantPBIText[9] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1135,7 +1178,7 @@ void RenderPBHeader( INT32 *piX, INT32 *piWidth)
|
||||
{
|
||||
swprintf( str, gzNonPersistantPBIText[8] );
|
||||
}
|
||||
else switch( gubEnemyEncounterCode )
|
||||
else switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case ENEMY_INVASION_CODE:
|
||||
swprintf( str, gpStrategicString[ STR_PB_ENEMYINVASION_HEADER ] );
|
||||
@@ -1165,6 +1208,9 @@ void RenderPBHeader( INT32 *piX, INT32 *piWidth)
|
||||
case ENEMY_INVASION_AIRDROP_CODE:
|
||||
swprintf( str, gpStrategicString[STR_PB_ENEMYINVASION_AIRDROP_HEADER] );
|
||||
break;
|
||||
case CONCEALINSERTION_CODE:
|
||||
swprintf( str, gpStrategicString[STR_PB_ENEMYENCOUNTER_HEADER] );
|
||||
break;
|
||||
}
|
||||
width = StringPixLength( str, FONT10ARIALBOLD );
|
||||
x = 130 - width / 2;
|
||||
@@ -1257,18 +1303,19 @@ void RenderPreBattleInterface()
|
||||
mprintf( 65 - width + xResOffset , 17 + yResOffset, str );
|
||||
|
||||
SetFont( BLOCKFONT );
|
||||
if( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() == CREATURE_ATTACK_CODE )
|
||||
{
|
||||
swprintf( str, gpStrategicString[ STR_PB_ENEMIES ] );
|
||||
swprintf( str, gpStrategicString[STR_PB_CREATURES ] );
|
||||
}
|
||||
else if( gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
else if( GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
swprintf( str, gpStrategicString[ STR_PB_BLOODCATS ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( str, gpStrategicString[ STR_PB_CREATURES ] );
|
||||
swprintf( str, gpStrategicString[ STR_PB_ENEMIES ] );
|
||||
}
|
||||
|
||||
width = StringPixLength( str, BLOCKFONT );
|
||||
if( width > 52 )
|
||||
{
|
||||
@@ -1321,10 +1368,10 @@ void RenderPreBattleInterface()
|
||||
|
||||
//enemy
|
||||
SetFont( FONT14ARIAL );
|
||||
if( gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
|
||||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
|
||||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
|
||||
WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) < KNOWS_HOW_MANY ) // HEADROCK HAM 5: New case above this one...
|
||||
if( GetEnemyEncounterCode() == CREATURE_ATTACK_CODE ||
|
||||
GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE ||
|
||||
GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE ||
|
||||
WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) < KNOWS_THEYRE_THERE_AND_HOW_MANY ) // HEADROCK HAM 5: New case above this one...
|
||||
{
|
||||
// don't know how many
|
||||
swprintf( str, L"?" );
|
||||
@@ -1549,10 +1596,11 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
|
||||
if ( gfPersistantPBI && gpBattleGroup && gpBattleGroup->usGroupTeam == OUR_TEAM &&
|
||||
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
|
||||
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
|
||||
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE &&
|
||||
gubEnemyEncounterCode != ENEMY_INVASION_AIRDROP_CODE )
|
||||
GetEnemyEncounterCode() != ENEMY_AMBUSH_CODE &&
|
||||
GetEnemyEncounterCode() != CREATURE_ATTACK_CODE &&
|
||||
GetEnemyEncounterCode() != BLOODCAT_AMBUSH_CODE &&
|
||||
GetEnemyEncounterCode() != ENEMY_INVASION_AIRDROP_CODE &&
|
||||
GetEnemyEncounterCode() != CONCEALINSERTION_CODE )
|
||||
{
|
||||
gfEnterTacticalPlacementGUI = TRUE;
|
||||
}
|
||||
@@ -1874,46 +1922,53 @@ void CalculateNonPersistantPBIInfo()
|
||||
{ //Either the locator isn't on or the locator info is in a different sector
|
||||
|
||||
//Calculated the encounter type
|
||||
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
gubExplicitEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( NO_ENCOUNTER_CODE );
|
||||
SetExplicitEnemyEncounterCode( NO_ENCOUNTER_CODE );
|
||||
|
||||
if( HostileCiviliansPresent() )
|
||||
{ //There are hostile civilians, so no autoresolve allowed.
|
||||
gubExplicitEnemyEncounterCode = HOSTILE_CIVILIANS_CODE;
|
||||
{
|
||||
//There are hostile civilians, so no autoresolve allowed.
|
||||
SetExplicitEnemyEncounterCode( HOSTILE_CIVILIANS_CODE );
|
||||
}
|
||||
else if( HostileBloodcatsPresent() )
|
||||
{ //There are bloodcats in the sector, so no autoresolve allowed
|
||||
gubExplicitEnemyEncounterCode = HOSTILE_BLOODCATS_CODE;
|
||||
{
|
||||
//There are bloodcats in the sector, so no autoresolve allowed
|
||||
SetExplicitEnemyEncounterCode( HOSTILE_BLOODCATS_CODE );
|
||||
}
|
||||
else if( gbWorldSectorZ > 0 )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
Assert( pSector );
|
||||
|
||||
if( pSector->ubCreaturesInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
|
||||
SetExplicitEnemyEncounterCode( FIGHTING_CREATURES_CODE );
|
||||
}
|
||||
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
|
||||
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle || pSector->ubTanksInBattle || pSector->ubJeepsInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
gubEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
SetExplicitEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE );
|
||||
SetEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
Assert( pSector );
|
||||
|
||||
if( pSector->ubCreaturesInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = FIGHTING_CREATURES_CODE;
|
||||
SetExplicitEnemyEncounterCode( FIGHTING_CREATURES_CODE );
|
||||
}
|
||||
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle )
|
||||
else if( pSector->ubAdminsInBattle || pSector->ubTroopsInBattle || pSector->ubElitesInBattle || pSector->ubTanksInBattle || pSector->ubJeepsInBattle )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
gubEnemyEncounterCode = ENTERING_ENEMY_SECTOR_CODE;
|
||||
SetExplicitEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE );
|
||||
SetEnemyEncounterCode( ENTERING_ENEMY_SECTOR_CODE );
|
||||
}
|
||||
}
|
||||
if( gubExplicitEnemyEncounterCode != NO_ENCOUNTER_CODE )
|
||||
{ //Set up the location as well as turning on the blit flag.
|
||||
|
||||
if ( GetExplicitEnemyEncounterCode() != NO_ENCOUNTER_CODE )
|
||||
{
|
||||
//Set up the location as well as turning on the blit flag.
|
||||
gubPBSectorX = (UINT8)gWorldSectorX;
|
||||
gubPBSectorY = (UINT8)gWorldSectorY;
|
||||
gubPBSectorZ = (UINT8)gbWorldSectorZ;
|
||||
@@ -2347,7 +2402,7 @@ void LogBattleResults( UINT8 ubVictoryCode)
|
||||
GetCurrentBattleSectorXYZ( &sSectorX, &sSectorY, &sSectorZ );
|
||||
if( ubVictoryCode == LOG_VICTORY )
|
||||
{
|
||||
switch( gubEnemyEncounterCode )
|
||||
switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case ENEMY_INVASION_CODE:
|
||||
AddHistoryToPlayersLog( HISTORY_DEFENDEDTOWNSECTOR, 0, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
@@ -2370,6 +2425,8 @@ void LogBattleResults( UINT8 ubVictoryCode)
|
||||
case ENTERING_BLOODCAT_LAIR_CODE:
|
||||
AddHistoryToPlayersLog( HISTORY_SLAUGHTEREDBLOODCATS, 0, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
break;
|
||||
case CONCEALINSERTION_CODE:
|
||||
break;
|
||||
}
|
||||
|
||||
// Flugente: campaign stats
|
||||
@@ -2377,7 +2434,7 @@ void LogBattleResults( UINT8 ubVictoryCode)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( gubEnemyEncounterCode )
|
||||
switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case ENEMY_INVASION_CODE:
|
||||
AddHistoryToPlayersLog( HISTORY_LOSTTOWNSECTOR, 0, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
@@ -2400,10 +2457,12 @@ void LogBattleResults( UINT8 ubVictoryCode)
|
||||
case ENTERING_BLOODCAT_LAIR_CODE:
|
||||
AddHistoryToPlayersLog( HISTORY_KILLEDBYBLOODCATS, 0, GetWorldTotalMin(), sSectorX, sSectorY );
|
||||
break;
|
||||
case CONCEALINSERTION_CODE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch( gubEnemyEncounterCode )
|
||||
switch( GetEnemyEncounterCode() )
|
||||
{
|
||||
case ENEMY_INVASION_CODE:
|
||||
gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACK_ENEMY;
|
||||
|
||||
@@ -42,6 +42,7 @@ enum
|
||||
|
||||
ENEMY_AMBUSH_DEPLOYMENT_CODE, // Flugente: an ambush in which we can deploy our mercs (somewhat)
|
||||
ENEMY_INVASION_AIRDROP_CODE, // Flugente: enemy airdrop
|
||||
CONCEALINSERTION_CODE, // Flugente: a spy is no longer concealed, this causes us to drop into combat
|
||||
};
|
||||
|
||||
extern BOOLEAN gfAutoAmbush;
|
||||
@@ -64,14 +65,16 @@ extern BOOLEAN gfPersistantPBI;
|
||||
//Contains general information about the type of encounter the player is faced with. This
|
||||
//determines whether or not you can autoresolve the battle or even retreat. This code
|
||||
//dictates the header that is used at the top of the PBI.
|
||||
extern UINT8 gubEnemyEncounterCode;
|
||||
UINT8 GetEnemyEncounterCode();
|
||||
void SetEnemyEncounterCode( UINT8 aCode );
|
||||
|
||||
//The autoresolve during tactical battle option needs more detailed information than the
|
||||
//gubEnemyEncounterCode can provide. The explicit version contains possibly unique codes
|
||||
//for reasons not normally used in the PBI. For example, if we were fighting the enemy
|
||||
//in a normal situation, then shot at a civilian, the civilians associated with the victim
|
||||
//would turn hostile, which would disable the ability to autoresolve the battle.
|
||||
extern BOOLEAN gubExplicitEnemyEncounterCode;
|
||||
UINT8 GetExplicitEnemyEncounterCode();
|
||||
void SetExplicitEnemyEncounterCode( UINT8 aCode );
|
||||
|
||||
//Location of the current battle (determines where the animated icon is blitted) and if the
|
||||
//icon is to be blitted.
|
||||
|
||||
@@ -3931,13 +3931,14 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
|
||||
InitBloodCatSectors();
|
||||
//This info is used to clean up the two new codes inserted into the
|
||||
//middle of the enumeration for battle codes.
|
||||
if( gubEnemyEncounterCode > CREATURE_ATTACK_CODE )
|
||||
if( GetEnemyEncounterCode() > CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gubEnemyEncounterCode += 2;
|
||||
SetEnemyEncounterCode( GetEnemyEncounterCode() + 2 );
|
||||
}
|
||||
if( gubExplicitEnemyEncounterCode > CREATURE_ATTACK_CODE )
|
||||
|
||||
if( GetExplicitEnemyEncounterCode() > CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gubExplicitEnemyEncounterCode += 2;
|
||||
SetExplicitEnemyEncounterCode( GetExplicitEnemyEncounterCode() + 2 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ UINT32 uniqueIDMask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
UINT8 AddGroupToList( GROUP *pGroup );
|
||||
|
||||
void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ );
|
||||
void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ, GROUP* pArrivingGroup = NULL );
|
||||
BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pGroup );
|
||||
|
||||
void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNeverLeft );
|
||||
@@ -241,6 +241,11 @@ BOOLEAN AddPlayerToGroup( UINT8 ubGroupID, SOLDIERTYPE *pSoldier )
|
||||
if( !pGroup->pPlayerList )
|
||||
{
|
||||
pGroup->pPlayerList = pPlayer;
|
||||
|
||||
// Flugente: no groups in odd locations
|
||||
if ( pSoldier->bSectorZ >= 10 )
|
||||
pSoldier->bSectorZ -= 10;
|
||||
|
||||
pGroup->ubGroupSize = 1;
|
||||
pGroup->ubPrevX = SECTORX( pSoldier->ubPrevSectorID );
|
||||
pGroup->ubPrevY = SECTORY( pSoldier->ubPrevSectorID );
|
||||
@@ -1193,10 +1198,10 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
|
||||
if( !DidGameJustStart() )
|
||||
{
|
||||
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( NO_ENCOUNTER_CODE );
|
||||
}
|
||||
|
||||
HandleOtherGroupsArrivingSimultaneously( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ );
|
||||
HandleOtherGroupsArrivingSimultaneously( pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, pGroup );
|
||||
|
||||
curr = gpGroupList;
|
||||
while( curr )
|
||||
@@ -1274,7 +1279,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
StopTimeCompression();
|
||||
}
|
||||
|
||||
if( fBattlePending && (!fBloodCatAmbush || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE) )
|
||||
if( fBattlePending && (!fBloodCatAmbush || GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE) )
|
||||
{
|
||||
if( PossibleToCoordinateSimultaneousGroupArrivals( pGroup ) )
|
||||
{
|
||||
@@ -1351,7 +1356,7 @@ BOOLEAN CheckConditionsForBattle( GROUP *pGroup )
|
||||
|
||||
gpInitPrebattleGroup = pGroup;
|
||||
|
||||
if( gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if( GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
NotifyPlayerOfBloodcatBattle( pGroup->ubSectorX, pGroup->ubSectorY );
|
||||
return TRUE;
|
||||
@@ -2045,6 +2050,11 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
ubInsertionDirection = SOUTHEAST;
|
||||
ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
||||
}
|
||||
else if ( pGroup->usGroupTeam == OUR_TEAM && pGroup->pPlayerList->pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION )
|
||||
{
|
||||
ubInsertionDirection = DIRECTION_IRRELEVANT;
|
||||
ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(0);
|
||||
@@ -2260,7 +2270,7 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe
|
||||
else
|
||||
{
|
||||
//Handle cases for pre battle conditions
|
||||
pGroup->uiFlags = 0;
|
||||
pGroup->uiFlags &= ~GROUPFLAGS_TODELETE;
|
||||
|
||||
if( gubNumAwareBattles )
|
||||
{
|
||||
@@ -2449,8 +2459,9 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe
|
||||
RemovePGroup( pGroup );
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the non-persistant flags.
|
||||
pGroup->uiFlags = 0;
|
||||
pGroup->uiFlags &= ~GROUPFLAGS_TODELETE;
|
||||
}
|
||||
|
||||
|
||||
@@ -2459,7 +2470,7 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe
|
||||
//groups that may arrive at the same time -- enemies or players, and blindly add them to the sector
|
||||
//without checking for battle conditions, as it has already determined that a new battle is about to
|
||||
//start.
|
||||
void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ )
|
||||
void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ, GROUP* pArrivingGroup )
|
||||
{
|
||||
STRATEGICEVENT *pEvent;
|
||||
UINT32 uiCurrTimeStamp;
|
||||
@@ -2479,7 +2490,7 @@ void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY,
|
||||
{
|
||||
GroupArrivedAtSector( (UINT8)pEvent->uiParam, FALSE, FALSE );
|
||||
pGroup->uiFlags |= GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY;
|
||||
gubNumGroupsArrivedSimultaneously++;
|
||||
++gubNumGroupsArrivedSimultaneously;
|
||||
DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->ubGroupID );
|
||||
pEvent = gpEventList;
|
||||
continue;
|
||||
@@ -2488,6 +2499,30 @@ void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY,
|
||||
}
|
||||
pEvent = pEvent->next;
|
||||
}
|
||||
|
||||
// Flugente: concealed spies are added if a battle occurs
|
||||
if ( !IsGroupTheHelicopterGroup( pArrivingGroup ) )
|
||||
{
|
||||
UINT16 uiCnt = 0;
|
||||
SOLDIERTYPE* pSoldier = NULL;
|
||||
|
||||
for ( uiCnt = 0, pSoldier = MercPtrs[uiCnt]; uiCnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiCnt, ++pSoldier )
|
||||
{
|
||||
if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && SPY_LOCATION( pSoldier->bAssignment ) )
|
||||
{
|
||||
if ( ( pSoldier->sSectorX == ubSectorX ) && ( pSoldier->sSectorY == ubSectorY ) && ( pSoldier->bSectorZ - 10 == ubSectorZ ) )
|
||||
{
|
||||
INT8 bNewSquad = GetFirstEmptySquad();
|
||||
if ( bNewSquad == -1 )
|
||||
continue;
|
||||
|
||||
pSoldier->usSoldierFlagMask2 |= SOLDIER_CONCEALINSERTION;
|
||||
|
||||
AddCharacterToSquad( pSoldier, bNewSquad );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//The user has just approved to plan a simultaneous arrival. So we will syncronize all of the involved
|
||||
@@ -2634,7 +2669,7 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup )
|
||||
{
|
||||
pStr = gpStrategicString[ STR_DETECTED_PLURAL ];
|
||||
}
|
||||
if( gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if( GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
pEnemyType = gpStrategicString[ STR_PB_BLOODCATS ];
|
||||
}
|
||||
@@ -5361,7 +5396,7 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
|
||||
// We know about the lair
|
||||
if( gubFact[ FACT_PLAYER_KNOWS_ABOUT_BLOODCAT_LAIR ] )
|
||||
{
|
||||
gubEnemyEncounterCode = ENTERING_BLOODCAT_LAIR_CODE;
|
||||
SetEnemyEncounterCode( ENTERING_BLOODCAT_LAIR_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5373,12 +5408,12 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
|
||||
|
||||
fBloodCatAmbushPrevented = TRUE;
|
||||
|
||||
gubEnemyEncounterCode = ENTERING_BLOODCAT_LAIR_CODE;
|
||||
SetEnemyEncounterCode( ENTERING_BLOODCAT_LAIR_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ambush in the lair.
|
||||
gubEnemyEncounterCode = BLOODCAT_AMBUSH_CODE;
|
||||
SetEnemyEncounterCode( BLOODCAT_AMBUSH_CODE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5392,12 +5427,12 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_BLOODCATS_AMBUSH_PREVENTED] );
|
||||
|
||||
fBloodCatAmbushPrevented = TRUE;
|
||||
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( NO_ENCOUNTER_CODE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ambush occurs.
|
||||
gubEnemyEncounterCode = BLOODCAT_AMBUSH_CODE;
|
||||
SetEnemyEncounterCode( BLOODCAT_AMBUSH_CODE );
|
||||
}
|
||||
}
|
||||
// merc recoeds - get a point to scouts
|
||||
@@ -5417,13 +5452,13 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
|
||||
}
|
||||
}
|
||||
}
|
||||
return( ( gubEnemyEncounterCode == NO_ENCOUNTER_CODE ) ? FALSE : TRUE);
|
||||
return( ( GetEnemyEncounterCode() == NO_ENCOUNTER_CODE ) ? FALSE : TRUE);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
else
|
||||
{
|
||||
// No special bloodcat encounter. This ALWAYS happens in STATIC PLACEMENT sectors.
|
||||
gubEnemyEncounterCode = NO_ENCOUNTER_CODE;
|
||||
SetEnemyEncounterCode( NO_ENCOUNTER_CODE );
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
@@ -5433,12 +5468,12 @@ void NotifyPlayerOfBloodcatBattle( UINT8 ubSectorX, UINT8 ubSectorY )
|
||||
{
|
||||
CHAR16 str[ 256 ];
|
||||
CHAR16 zTempString[ 128 ];
|
||||
if( gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
|
||||
if( GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE )
|
||||
{
|
||||
GetSectorIDString( ubSectorX, ubSectorY, 0, zTempString, TRUE );
|
||||
swprintf( str, pMapErrorString[ 12 ], zTempString );
|
||||
}
|
||||
else if( gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
else if( GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
GetSectorIDString( ubSectorX, ubSectorY, 0, zTempString, FALSE );
|
||||
swprintf( str, pMapErrorString[ 13 ], zTempString );
|
||||
@@ -5815,8 +5850,9 @@ BOOLEAN GroupHasInTransitDeadOrPOWMercs( GROUP *pGroup )
|
||||
if ( pPlayer->pSoldier )
|
||||
{
|
||||
if( ( pPlayer->pSoldier->bAssignment == IN_TRANSIT ) ||
|
||||
( pPlayer->pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
( pPlayer->pSoldier->bAssignment == ASSIGNMENT_DEAD ) )
|
||||
( pPlayer->pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
SPY_LOCATION( pPlayer->pSoldier->bAssignment ) ||
|
||||
( pPlayer->pSoldier->bAssignment == ASSIGNMENT_DEAD ) )
|
||||
{
|
||||
// yup!
|
||||
return( TRUE );
|
||||
@@ -5923,6 +5959,29 @@ BOOLEAN ScoutIsPresentInSquad( INT16 ubSectorNumX, INT16 ubSectorNumY )
|
||||
return ( fScoutPresent );
|
||||
}
|
||||
|
||||
// Flugente: concealed mercs are in a different sector level, but we pretend they aren't... so we gain scout vision if a concealed merc is 'present'
|
||||
BOOLEAN ConcealedMercInSector( INT16 ubSectorNumX, INT16 ubSectorNumY, BOOLEAN aScoutsOnly )
|
||||
{
|
||||
if ( !gGameOptions.fNewTraitSystem )
|
||||
return FALSE;
|
||||
|
||||
for ( int i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i )
|
||||
{
|
||||
if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife >= OKLIFE && SPY_LOCATION( MercPtrs[i]->bAssignment ) )
|
||||
{
|
||||
if ( MercPtrs[i]->sSectorX == ubSectorNumX && MercPtrs[i]->sSectorY == ubSectorNumY && MercPtrs[i]->bSectorZ == 10 )
|
||||
{
|
||||
if ( !aScoutsOnly || HAS_SKILL_TRAIT( MercPtrs[i], SCOUTING_NT ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef JA2UB
|
||||
GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks )
|
||||
{
|
||||
@@ -5996,13 +6055,13 @@ void CheckCombatInSectorDueToUnusualEnemyArrival( UINT8 aTeam, INT16 sX, INT16 s
|
||||
BOOLEAN fCombatAbleMerc = FALSE;
|
||||
BOOLEAN fBloodCatAmbush = FALSE;
|
||||
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_AIRDROP_CODE;
|
||||
SetEnemyEncounterCode( ENEMY_INVASION_AIRDROP_CODE );
|
||||
|
||||
gubSectorIDOfCreatureAttack = SECTOR(sX, sY);
|
||||
|
||||
gubSpecialEncounterCodeForEnemyHeli = TRUE;
|
||||
|
||||
HandleOtherGroupsArrivingSimultaneously( sX, sY, sZ );
|
||||
HandleOtherGroupsArrivingSimultaneously( sX, sY, sZ, NULL );
|
||||
|
||||
curr = gpGroupList;
|
||||
while ( curr )
|
||||
@@ -6125,7 +6184,7 @@ void CheckCombatInSectorDueToUnusualEnemyArrival( UINT8 aTeam, INT16 sX, INT16 s
|
||||
|
||||
//gpInitPrebattleGroup = pGroup;
|
||||
|
||||
if ( gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
if ( GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENTERING_BLOODCAT_LAIR_CODE )
|
||||
{
|
||||
NotifyPlayerOfBloodcatBattle( sX, sY );
|
||||
|
||||
@@ -6175,3 +6234,18 @@ void CheckCombatInSectorDueToUnusualEnemyArrival( UINT8 aTeam, INT16 sX, INT16 s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetInfoFromGroupsInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam, BOOLEAN& arDetection, BOOLEAN& arCount, BOOLEAN& arDirection )
|
||||
{
|
||||
GROUP* pGroup = gpGroupList;
|
||||
while ( pGroup )
|
||||
{
|
||||
if ( pGroup->usGroupTeam == ubTeam && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
|
||||
{
|
||||
if ( pGroup->uiFlags & GROUPFLAG_KNOWN_POSITION ) arDetection = TRUE;
|
||||
if ( pGroup->uiFlags & GROUPFLAG_KNOWN_NUMBER ) arCount = TRUE;
|
||||
if ( pGroup->uiFlags & GROUPFLAG_KNOWN_DIRECTION ) arDirection = TRUE;
|
||||
}
|
||||
pGroup = pGroup->next;
|
||||
}
|
||||
}
|
||||
@@ -80,19 +80,25 @@ typedef struct ENEMYGROUP
|
||||
|
||||
//NOTE: ALL FLAGS ARE CLEARED WHENEVER A GROUP ARRIVES IN A SECTOR, OR ITS WAYPOINTS ARE
|
||||
// DELETED!!!
|
||||
#define GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED 0x00000001
|
||||
#define GROUPFLAG_SIMULTANEOUSARRIVAL_APPROVED 0x00000001
|
||||
#define GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED 0x00000002
|
||||
//I use this flag when traversing through a list to determine which groups meet whatever conditions,
|
||||
//then add this marker flag. The second time I traverse the list, I simply check for this flag,
|
||||
//apply my modifications to the group, and remove the flag. If you decide to use it, make sure the
|
||||
//flag is cleared.
|
||||
#define GROUPFLAG_MARKER 0x00000004
|
||||
#define GROUPFLAG_MARKER 0x00000004
|
||||
//Set whenever a group retreats from battle. If the group arrives in the next sector and enemies are there
|
||||
//retreat will not be an option.
|
||||
#define GROUPFLAG_JUST_RETREATED_FROM_BATTLE 0x00000008
|
||||
#define GROUPFLAG_HIGH_POTENTIAL_FOR_AMBUSH 0x00000010
|
||||
#define GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY 0x00000020
|
||||
#define GROUPFLAG_GROUP_ARRIVED_SIMULTANEOUSLY 0x00000020
|
||||
|
||||
#define GROUPFLAGS_TODELETE 0x0000003F
|
||||
|
||||
// Flugente: these flags determine whether a group will always be visible on the map
|
||||
#define GROUPFLAG_KNOWN_POSITION 0x00000040
|
||||
#define GROUPFLAG_KNOWN_DIRECTION 0x00000080
|
||||
#define GROUPFLAG_KNOWN_NUMBER 0x00000100
|
||||
|
||||
typedef struct GROUP
|
||||
{
|
||||
@@ -320,6 +326,11 @@ BOOLEAN GroupHasInTransitDeadOrPOWMercs( GROUP *pGroup );
|
||||
|
||||
BOOLEAN ScoutIsPresentInSquad( INT16 ubSectorNumX, INT16 ubSectorNumY ); // added by SANDRO
|
||||
|
||||
// Flugente: concealed mercs are in a different sector level, but we pretend they aren't... so we gain scout vision if a concealed merc is 'present'
|
||||
BOOLEAN ConcealedMercInSector( INT16 ubSectorNumX, INT16 ubSectorNumY, BOOLEAN aScoutsOnly );
|
||||
|
||||
void CheckCombatInSectorDueToUnusualEnemyArrival( UINT8 aTeam, INT16 sX, INT16 sY, INT8 sZ );
|
||||
|
||||
void GetInfoFromGroupsInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam, BOOLEAN& arDetection, BOOLEAN& arCount, BOOLEAN& arDirection );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "Game Event Hook.h" // added by Flugente
|
||||
#include "MilitiaIndividual.h" // added by Flugente
|
||||
#include "Campaign.h" // added by Flugente
|
||||
#include "message.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
// HEADROCK HAM 3: include these files so that a militia trainer's Effective Leadership can be determined. Used
|
||||
@@ -432,10 +433,11 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
}
|
||||
|
||||
// Flugente: if we trained militia, the PMC notices us and offers their services
|
||||
if ( gGameExternalOptions.fPMC )
|
||||
if ( gGameExternalOptions.fPMC && !IsBookMarkSet( PMC_BOOKMARK ) )
|
||||
AddStrategicEvent( EVENT_PMC_EMAIL, GetWorldTotalMin() + 60 * (1 + Random(6)), 0 );
|
||||
|
||||
AddStrategicEvent( EVENT_MILITIAROSTER_EMAIL, GetWorldTotalMin( ) + 60 * (1 + Random( 4 )), 0 );
|
||||
if ( !IsBookMarkSet( MILITIAROSTER_BOOKMARK ) )
|
||||
AddStrategicEvent( EVENT_MILITIAROSTER_EMAIL, GetWorldTotalMin( ) + 60 * (1 + Random( 4 )), 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -1382,6 +1384,9 @@ BOOLEAN CanSomeoneNearbyScoutThisSector( INT16 sSectorX, INT16 sSectorY, BOOLEAN
|
||||
UINT8 ubScoutingRange = 1;
|
||||
BOOLEAN bScout = FALSE;
|
||||
|
||||
if ( ConcealedMercInSector( sSectorX, sSectorY, FALSE ) )
|
||||
return TRUE;
|
||||
|
||||
// get the sector value
|
||||
sSector = sSectorX + sSectorY * MAP_WORLD_X;
|
||||
|
||||
@@ -1404,7 +1409,7 @@ BOOLEAN CanSomeoneNearbyScoutThisSector( INT16 sSectorX, INT16 sSectorY, BOOLEAN
|
||||
}
|
||||
|
||||
// SANDRO - STOMP traits - Scouting check
|
||||
if (fScoutTraitCheck && gGameOptions.fNewTraitSystem && ScoutIsPresentInSquad( sCounterA, sCounterB ))
|
||||
if (fScoutTraitCheck && gGameOptions.fNewTraitSystem && ( ScoutIsPresentInSquad( sCounterA, sCounterB ) || ConcealedMercInSector( sCounterA, sCounterB, TRUE ) ) )
|
||||
{
|
||||
// if diagonal sector and not allowed
|
||||
if (!gSkillTraitValues.fSCDetectionInDiagonalSectors &&
|
||||
@@ -2809,3 +2814,25 @@ void DevalueResources( UINT8 aOldProgress, UINT8 aNewProgress )
|
||||
LaptopSaveInfo.dMilitiaArmourPool *= modifier;
|
||||
LaptopSaveInfo.dMilitiaMiscPool *= modifier;
|
||||
}
|
||||
|
||||
// Flugente: intel
|
||||
void AddIntel( FLOAT aValue, BOOLEAN aDoMessage )
|
||||
{
|
||||
LaptopSaveInfo.dIntelPool = max( 0, LaptopSaveInfo.dIntelPool + aValue );
|
||||
|
||||
if ( aDoMessage )
|
||||
{
|
||||
if ( aValue >= 0.0f )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Gained %.2f intel.", aValue );
|
||||
else
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Spent %.2f intel.", -aValue );
|
||||
}
|
||||
|
||||
if ( !IsBookMarkSet( INTELMARKET_BOOKMARK ) )
|
||||
AddStrategicEvent( EVENT_INTEL_ENRICO_EMAIL, GetWorldTotalMin() + 60 * ( 1 + Random( 3 ) ), 0 );
|
||||
}
|
||||
|
||||
FLOAT GetIntel()
|
||||
{
|
||||
return LaptopSaveInfo.dIntelPool;
|
||||
}
|
||||
|
||||
@@ -133,4 +133,8 @@ void GetResources( FLOAT& arValue_Gun, FLOAT& arValue_Armour, FLOAT& arValue_Mis
|
||||
FLOAT ResourceProgressModifier( UINT8 aProgress );
|
||||
void DevalueResources(UINT8 aOldProgress, UINT8 aNewProgress);
|
||||
|
||||
// Flugente: intel
|
||||
void AddIntel( FLOAT aValue, BOOLEAN aDoMessage = FALSE );
|
||||
FLOAT GetIntel();
|
||||
|
||||
#endif
|
||||
+35
-52
@@ -6926,8 +6926,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
{
|
||||
case ESC:
|
||||
gfDontStartTransitionFromLaptop = TRUE;
|
||||
|
||||
|
||||
|
||||
if( gfPreBattleInterfaceActive && !gfPersistantPBI )
|
||||
{ //Non persistant PBI. Allow ESC to close it and return to mapscreen.
|
||||
KillPreBattleInterface();
|
||||
@@ -6977,47 +6976,17 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
|
||||
fMapPanelDirty = TRUE;
|
||||
fCharacterInfoPanelDirty = TRUE;
|
||||
|
||||
// stop showing current assignment box
|
||||
if( fShowAttributeMenu == TRUE )
|
||||
{
|
||||
fShowAttributeMenu = FALSE;
|
||||
fMapPanelDirty = TRUE;
|
||||
}
|
||||
// stop showing current assignment box
|
||||
if( fShowFacilityAssignmentMenu == TRUE )
|
||||
{
|
||||
fShowFacilityAssignmentMenu = FALSE;
|
||||
fMapPanelDirty = TRUE;
|
||||
}
|
||||
else if( fShowTrainingMenu == TRUE )
|
||||
{
|
||||
fShowTrainingMenu = FALSE;
|
||||
}
|
||||
else if( fShowSquadMenu == TRUE )
|
||||
{
|
||||
fShowSquadMenu = FALSE;
|
||||
}
|
||||
else if( fShowRepairMenu == TRUE )
|
||||
{
|
||||
fShowRepairMenu = FALSE;
|
||||
}
|
||||
else if( fShowMoveItemMenu == TRUE )
|
||||
{
|
||||
fShowMoveItemMenu = FALSE;
|
||||
}
|
||||
else if ( fShowDiseaseMenu == TRUE )
|
||||
{
|
||||
fShowDiseaseMenu = FALSE;
|
||||
}
|
||||
// HEADROCK HAM 3.6: Facility Menu
|
||||
else if( fShowFacilityMenu == TRUE )
|
||||
{
|
||||
fShowFacilityMenu = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fShowAssignmentMenu = FALSE;
|
||||
}
|
||||
fShowAttributeMenu = FALSE;
|
||||
fShowFacilityAssignmentMenu = FALSE;
|
||||
fShowTrainingMenu = FALSE;
|
||||
fShowSquadMenu = FALSE;
|
||||
fShowRepairMenu = FALSE;
|
||||
fShowMoveItemMenu = FALSE;
|
||||
fShowDiseaseMenu = FALSE;
|
||||
fShowSpyMenu = FALSE;
|
||||
fShowFacilityMenu = FALSE;
|
||||
fShowAssignmentMenu = FALSE;
|
||||
|
||||
giAssignHighLine = -1;
|
||||
// restore background to glow region
|
||||
RestoreBackgroundForAssignmentGlowRegionList( );
|
||||
@@ -10833,7 +10802,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason )
|
||||
fPlotForMilitia = FALSE;
|
||||
|
||||
// if not dead or POW, select his sector
|
||||
if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) )
|
||||
if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) )//&& !SPY_LOCATION( pSoldier->bAssignment ) )
|
||||
{
|
||||
ChangeSelectedMapSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
|
||||
}
|
||||
@@ -10886,7 +10855,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason )
|
||||
fPlotForMilitia = FALSE;
|
||||
|
||||
// if not dead or POW, select his sector
|
||||
if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) )
|
||||
if( ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && !SPY_LOCATION( pSoldier->bAssignment ) )
|
||||
{
|
||||
ChangeSelectedMapSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
|
||||
}
|
||||
@@ -11075,7 +11044,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason )
|
||||
// Select all characters in squad
|
||||
INT16 iCounter;
|
||||
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ )
|
||||
for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter )
|
||||
{
|
||||
if( gCharactersList[ iCounter ].fValid == TRUE )
|
||||
{
|
||||
@@ -14605,6 +14574,10 @@ void ChangeSelectedMapSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
// disallow going underground while plotting (surface) movement
|
||||
if ( ( bMapZ != 0 ) && ( ( bSelectedDestChar != -1 ) || fPlotForHelicopter ) )
|
||||
return;
|
||||
|
||||
// make sure we don' try to display bad levels
|
||||
if ( bMapZ >= 10 )
|
||||
bMapZ -= 10;
|
||||
|
||||
sSelMapX = sMapX;
|
||||
sSelMapY = sMapY;
|
||||
@@ -15364,9 +15337,10 @@ BOOLEAN AnyMovableCharsInOrBetweenThisSector( INT16 sSectorX, INT16 sSectorY, IN
|
||||
|
||||
// POWs, dead guys, guys in transit can't move
|
||||
if ( ( pSoldier->bAssignment == IN_TRANSIT ) ||
|
||||
( pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
( pSoldier->bAssignment == ASSIGNMENT_DEAD ) ||
|
||||
( pSoldier->stats.bLife == 0 ) )
|
||||
( pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
SPY_LOCATION( pSoldier->bAssignment ) ||
|
||||
( pSoldier->bAssignment == ASSIGNMENT_DEAD ) ||
|
||||
( pSoldier->stats.bLife == 0 ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -15957,11 +15931,19 @@ void GetMapscreenMercLocationString( SOLDIERTYPE *pSoldier, CHAR16 sString[] )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pSoldier->bAssignment == ASSIGNMENT_POW )
|
||||
// Flugente: if we have intel on a POW, DO show their location
|
||||
if ( pSoldier->bAssignment == ASSIGNMENT_POW && !( pSoldier->usSoldierFlagMask2 & SOLDIER_MERC_POW_LOCATIONKNOWN ))
|
||||
{
|
||||
// POW - location unknown
|
||||
swprintf( sString, L"%s", pPOWStrings[ 1 ] );
|
||||
}
|
||||
else if ( SPY_LOCATION( pSoldier->bAssignment ) )
|
||||
{
|
||||
swprintf( pTempString, L"%s%s%s",
|
||||
pMapVertIndex[pSoldier->sSectorY], pMapHortIndex[pSoldier->sSectorX], pMapDepthIndex[max(0, pSoldier->bSectorZ - 10)] );
|
||||
|
||||
swprintf( sString, L"%s*", pTempString );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( pTempString, L"%s%s%s",
|
||||
@@ -15993,8 +15975,9 @@ void GetMapscreenMercDestinationString( SOLDIERTYPE *pSoldier, CHAR16 sString[]
|
||||
|
||||
// if dead or POW - has no destination (no longer part of a group, for that matter)
|
||||
if( ( pSoldier->bAssignment == ASSIGNMENT_DEAD ) ||
|
||||
( pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
( pSoldier->stats.bLife == 0 ) )
|
||||
( pSoldier->bAssignment == ASSIGNMENT_POW ) ||
|
||||
SPY_LOCATION( pSoldier->bAssignment ) ||
|
||||
( pSoldier->stats.bLife == 0 ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+42
-35
@@ -2222,7 +2222,7 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
|
||||
// GridNo = NOWHERE, which causes this assertion to fail
|
||||
//CHRISL: There's also an issue with vehicles. Soldiers in any vehicle are considered to be in sGridNo = NOWHERE
|
||||
// This will result in an assertion error, so let's skip the assertion if the merc is assigned to a vehicle
|
||||
if ( !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE )
|
||||
if ( !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && !SPY_LOCATION( MercPtrs[i]->bAssignment ) )
|
||||
{
|
||||
//Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
|
||||
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds( MercPtrs[i]->sGridNo ) || MercPtrs[i]->bVehicleID == iHelicopterVehicleId );
|
||||
@@ -2729,7 +2729,7 @@ void PrepareLoadedSector( )
|
||||
PostSchedules( );
|
||||
}
|
||||
|
||||
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE )
|
||||
{
|
||||
if ( gMapInformation.sCenterGridNo != NOWHERE )
|
||||
{
|
||||
@@ -3221,37 +3221,44 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
|
||||
|
||||
if ( pSoldier->bActive )
|
||||
{
|
||||
if ( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME) )
|
||||
{
|
||||
if ( gMapInformation.sCenterGridNo != NOWHERE && gfBlitBattleSectorLocator &&
|
||||
(gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) && pSoldier->bTeam != CIV_TEAM )
|
||||
{
|
||||
// Flugente: improved ambush
|
||||
if ( gGameExternalOptions.fAmbushSpreadMercs )
|
||||
{
|
||||
UINT8 ubDirection;
|
||||
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = FindRandomGridNoFromSweetSpotExcludingSweetSpot( pSoldier, gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushSpreadRadiusMercs, &ubDirection );
|
||||
|
||||
// have the merc look outward. We add + 100 because later on we use this to signify that we want really enforce this direction
|
||||
pSoldier->ubInsertionDirection = (UINT8)GetDirectionToGridNoFromGridNo( gMapInformation.sCenterGridNo, pSoldier->usStrategicInsertionData ) + 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gMapInformation.sCenterGridNo;
|
||||
}
|
||||
}
|
||||
else if ( gfOverrideInsertionWithExitGrid )
|
||||
{
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gExitGrid.usGridNo;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ && !pSoldier->flags.fBetweenSectors )
|
||||
{
|
||||
if ( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
|
||||
{
|
||||
if ( gMapInformation.sCenterGridNo != NOWHERE && gfBlitBattleSectorLocator &&
|
||||
( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE ) && pSoldier->bTeam != CIV_TEAM )
|
||||
{
|
||||
// Flugente: improved ambush
|
||||
if ( gGameExternalOptions.fAmbushSpreadMercs )
|
||||
{
|
||||
UINT8 ubDirection;
|
||||
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = FindRandomGridNoFromSweetSpotExcludingSweetSpot( pSoldier, gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushSpreadRadiusMercs, &ubDirection );
|
||||
|
||||
// have the merc look outward. We add + 100 because later on we use this to signify that we want really enforce this direction
|
||||
pSoldier->ubInsertionDirection = (UINT8)GetDirectionToGridNoFromGridNo( gMapInformation.sCenterGridNo, pSoldier->usStrategicInsertionData ) + 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gMapInformation.sCenterGridNo;
|
||||
}
|
||||
}
|
||||
else if ( gfOverrideInsertionWithExitGrid )
|
||||
{
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = gExitGrid.usGridNo;
|
||||
}
|
||||
|
||||
// Flugente: override if entering from concealment
|
||||
if ( pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION )
|
||||
{
|
||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
pSoldier->usStrategicInsertionData = pSoldier->sMTActionGridNo;
|
||||
}
|
||||
}
|
||||
|
||||
gbMercIsNewInThisSector[pSoldier->ubID] = 1;
|
||||
|
||||
UpdateMercInSector( pSoldier, sSectorX, sSectorY, bSectorZ );
|
||||
@@ -3297,10 +3304,10 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
/*else
|
||||
{
|
||||
pSoldier->bInSector = FALSE;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6521,9 +6528,9 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSect
|
||||
gubPBSectorZ = (UINT8)pSectorZ;
|
||||
gfBlitBattleSectorLocator = TRUE;
|
||||
gfTransferTacticalOppositionToAutoResolve = TRUE;
|
||||
if ( gubEnemyEncounterCode != CREATURE_ATTACK_CODE )
|
||||
if ( GetEnemyEncounterCode() != CREATURE_ATTACK_CODE )
|
||||
{
|
||||
gubEnemyEncounterCode = ENEMY_INVASION_CODE; //has to be, if militia are here.
|
||||
SetEnemyEncounterCode( ENEMY_INVASION_CODE ); //has to be, if militia are here.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user