1 #ifndef __STRATEGIC_AI_H 2 #define __STRATEGIC_AI_H 3 4 #include "Types.h" 5 struct GROUP; 6 7 #define SAVED_ARMY_COMPOSITIONS 60 8 #define SAVED_GARRISON_GROUPS 100 9 #define SAVED_PATROL_GROUPS 50 10 11 void InitStrategicAI(void); 12 void KillStrategicAI(void); 13 14 void SaveStrategicAI(HWFILE); 15 void LoadStrategicAI(HWFILE); 16 17 //NPC ACTION TRIGGERS SPECIAL CASE AI 18 enum 19 { 20 STRATEGIC_AI_ACTION_WAKE_QUEEN = 1, 21 STRATEGIC_AI_ACTION_KINGPIN_DEAD, 22 STRATEGIC_AI_ACTION_QUEEN_DEAD, 23 24 }; 25 26 27 void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSectorY ); 28 29 void CheckEnemyControlledSector( UINT8 ubSectorID ); 30 void EvaluateQueenSituation(void); 31 32 extern BOOLEAN gfUseAlternateQueenPosition; 33 34 //returns TRUE if the group was deleted. 35 BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup ); 36 void RemoveGroupFromStrategicAILists(GROUP const&); 37 void RecalculateSectorWeight( UINT8 ubSectorID ); 38 void RecalculateGroupWeight(GROUP const&); 39 40 BOOLEAN OkayForEnemyToMoveThroughSector( UINT8 ubSectorID ); 41 42 void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); 43 44 void WakeUpQueen(void); 45 46 void StrategicHandleMineThatRanOut( UINT8 ubSectorID ); 47 48 size_t FindPatrolGroupIndexForGroupID( UINT8 ubGroupID ); 49 size_t FindPatrolGroupIndexForGroupIDPending( UINT8 ubGroupID ); 50 size_t FindGarrisonIndexForGroupIDPending( UINT8 ubGroupID ); 51 52 GROUP* FindPendingGroupInSector( UINT8 ubSectorID ); 53 54 55 void RepollSAIGroup( GROUP *pGroup ); 56 57 58 extern BOOLEAN gfDisplayStrategicAILogs; 59 extern BOOLEAN gfFirstBattleMeanwhileScenePending; 60 61 extern UINT8 gubSAIVersion; 62 63 64 65 //These enumerations define all of the various types of stationary garrison 66 //groups, and index their compositions for forces, etc. 67 enum 68 { 69 QUEEN_DEFENCE, //The most important sector, the queen's palace. 70 MEDUNA_DEFENCE, //The town surrounding the queen's palace. 71 MEDUNA_SAMSITE, //A sam site within Meduna (higher priority) 72 LEVEL1_DEFENCE, //The sectors immediately adjacent to Meduna (defence and spawning area) 73 LEVEL2_DEFENCE, //Two sectors away from Meduna (defence and spawning area) 74 LEVEL3_DEFENCE, //Three sectors away from Meduna (defence and spawning area) 75 ORTA_DEFENCE, //The top secret military base containing lots of elites 76 EAST_GRUMM_DEFENCE, //The most-industrial town in Arulco (more mine income) 77 WEST_GRUMM_DEFENCE, //The most-industrial town in Arulco (more mine income) 78 GRUMM_MINE, 79 OMERTA_WELCOME_WAGON,//Small force that greets the player upon arrival in game. 80 BALIME_DEFENCE, //Rich town, paved roads, close to Meduna (in queen's favor) 81 TIXA_PRISON, //Prison, well defended, but no point in retaking 82 TIXA_SAMSITE, //The central-most sam site (important for queen to keep) 83 ALMA_DEFENCE, //The military town of Meduna. Also very important for queen. 84 ALMA_MINE, //Mine income AND administrators 85 CAMBRIA_DEFENCE, //Medical town, large, central. 86 CAMBRIA_MINE, 87 CHITZENA_DEFENCE, //Small town, small mine, far away. 88 CHITZENA_MINE, 89 CHITZENA_SAMSITE, //Sam site near Chitzena. 90 DRASSEN_AIRPORT, //Very far away, a supply depot of little importance. 91 DRASSEN_DEFENCE, //Medium town, normal. 92 DRASSEN_MINE, 93 DRASSEN_SAMSITE, //Sam site near Drassen (least importance to queen of all samsites) 94 ROADBLOCK, //General outside city roadblocks -- enhance chance of ambush? 95 SANMONA_SMALL, 96 NUM_ARMY_COMPOSITIONS 97 }; 98 99 100 struct ARMY_COMPOSITION 101 { 102 INT32 iReadability; //contains the enumeration which is useless, but helps readability. 103 INT8 bPriority; 104 INT8 bElitePercentage; 105 INT8 bTroopPercentage; 106 INT8 bAdminPercentage; 107 INT8 bDesiredPopulation; 108 INT8 bStartPopulation; 109 INT8 bPadding[10]; // XXX HACK000B 110 emptyARMY_COMPOSITION111 bool empty() 112 { 113 return iReadability == 0 && bPriority == 0 114 && bElitePercentage == 0 && bTroopPercentage == 0 && bAdminPercentage == 0 115 && bDesiredPopulation == 0 && bStartPopulation == 0; 116 } 117 118 }; 119 120 //Defines the patrol groups -- movement groups. 121 struct PATROL_GROUP 122 { 123 INT8 bSize; 124 INT8 bPriority; 125 UINT8 ubSectorID[4]; 126 INT8 bFillPermittedAfterDayMod100; 127 UINT8 ubGroupID; 128 INT8 bWeight; 129 UINT8 ubPendingGroupID; 130 INT8 bPadding[10]; // XXX HACK000B 131 }; 132 133 134 //Defines all stationary defence forces. 135 struct GARRISON_GROUP 136 { 137 UINT8 ubSectorID; 138 UINT8 ubComposition; 139 INT8 bWeight; 140 UINT8 ubPendingGroupID; 141 INT8 bPadding[10]; // XXX HACK000B 142 }; 143 144 #endif 145