1 #ifndef _SQUADS_H 2 #define _SQUADS_H 3 4 #include "JA2Types.h" 5 6 7 // header for squad management system 8 #define NUMBER_OF_SOLDIERS_PER_SQUAD 6 9 10 // enums for squads 11 enum{ 12 FIRST_SQUAD=0, 13 SECOND_SQUAD, 14 THIRD_SQUAD, 15 FOURTH_SQUAD, 16 FIFTH_SQUAD, 17 SIXTH_SQUAD, 18 SEVENTH_SQUAD, 19 EIGTH_SQUAD, 20 NINTH_SQUAD, 21 TENTH_SQUAD, 22 ELEVENTH_SQUAD, 23 TWELTH_SQUAD, 24 THIRTEENTH_SQUAD, 25 FOURTEENTH_SQUAD, 26 FIFTHTEEN_SQUAD, 27 SIXTEENTH_SQUAD, 28 SEVENTEENTH_SQUAD, 29 EIGTHTEENTH_SQUAD, 30 NINTEENTH_SQUAD, 31 TWENTYTH_SQUAD, 32 NUMBER_OF_SQUADS, 33 }; 34 35 36 // ATE: Added so we can have no current squad 37 // happens in we move off sector via tactical, but nobody is left! 38 #define NO_CURRENT_SQUAD NUMBER_OF_SQUADS 39 40 41 // ptrs to soldier types of squads and their members 42 43 // squads 44 extern SOLDIERTYPE *Squad[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; 45 46 #define FOR_EACH_SLOT_IN_SQUAD(iter, squad) \ 47 for (SOLDIERTYPE** iter = Squad[(squad)], *const * const iter##__end = endof(Squad[(squad)]); iter != iter##__end; ++iter) 48 49 #define FOR_EACH_IN_SQUAD(iter, squad) \ 50 FOR_EACH_SLOT_IN_SQUAD(iter, squad) \ 51 if (!*iter) continue; else 52 53 extern INT32 iCurrentTacticalSquad; 54 55 56 57 58 // will initialize the squad lists for game initalization 59 void InitSquads( void ); 60 61 // add character to squad 62 BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ); 63 64 65 // find the first slot the guy will fit in, return true if he is in a squad or has been put in one 66 void AddCharacterToAnySquad(SOLDIERTYPE*); 67 68 // remove character from squads 69 BOOLEAN RemoveCharacterFromSquads( SOLDIERTYPE *pCharacter ); 70 71 72 // return number of people in this squad 73 INT8 NumberOfPeopleInSquad( INT8 bSquadValue ); 74 75 INT8 NumberOfNonEPCsInSquad( INT8 bSquadValue ); 76 77 BOOLEAN IsRobotControllerInSquad( INT8 bSquadValue ); 78 79 INT8 NumberOfPlayerControllableMercsInSquad( INT8 bSquadValue ); 80 81 // what sector is the squad currently in?..return if anyone in squad 82 BOOLEAN SectorSquadIsIn(INT8 bSquadValue, INT16* sMapX, INT16* sMapY, INT8* sMapZ); 83 84 // rebuild current squad list 85 void RebuildCurrentSquad( void ); 86 87 // copy path from character back to squad 88 void CopyPathOfCharacterToSquad(SOLDIERTYPE* pCharacter, INT8 bSquadValue); 89 90 // what is the id of the current squad? 91 INT32 CurrentSquad( void ); 92 93 // add character to unique squad, returns the squad # 94 INT8 AddCharacterToUniqueSquad( SOLDIERTYPE *pCharacter ); 95 96 // is this squad empty? 97 BOOLEAN SquadIsEmpty( INT8 bSquadValue ); 98 99 // is this squad in the current tactical sector? 100 BOOLEAN IsSquadOnCurrentTacticalMap( INT32 iCurrentSquad ); 101 102 103 // set this squad as the current tatcical squad 104 BOOLEAN SetCurrentSquad( INT32 iCurrentSquad, BOOLEAN fForce ); 105 106 // set default squad in sector 107 void SetDefaultSquadOnSectorEntry( BOOLEAN fForce ); 108 109 // get last squad that has active mercs 110 INT32 GetLastSquadActive( void ); 111 112 void ExamineCurrentSquadLights( void ); 113 114 115 //Save the squad information to the saved game file 116 void SaveSquadInfoToSavedGameFile(HWFILE); 117 118 //Load all the squad info from the saved game file 119 void LoadSquadInfoFromSavedGameFile(HWFILE); 120 121 // get squad id of first free squad 122 INT8 GetFirstEmptySquad( void ); 123 124 // dead soldier was on squad 125 BOOLEAN SoldierIsDeadAndWasOnSquad( SOLDIERTYPE *pSoldier, INT8 bSquadValue ); 126 127 // now reset the table for these mercs 128 void ResetDeadSquadMemberList(INT32 iSquadValue); 129 130 // this passed soldier on the current squad int he tactical map 131 BOOLEAN IsMercOnCurrentSquad(const SOLDIERTYPE* pSoldier); 132 133 // is this squad filled up? 134 BOOLEAN IsThisSquadFull( INT8 bSquadValue ); 135 136 // is this squad moving? 137 BOOLEAN IsThisSquadOnTheMove( INT8 bSquadValue ); 138 139 // is there a vehicle in this squad? 140 BOOLEAN DoesVehicleExistInSquad( INT8 bSquadValue ); 141 142 // re-create any trashed squad movement groups 143 void CheckSquadMovementGroups( void ); 144 145 #endif 146