TEAMTYPE.H (9306B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/TEAMTYPE.H 1 3/03/97 10:25a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : TEAMTYPE.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 07/02/96 * 28 * * 29 * Last Update : July 2, 1996 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef TEAMTYPE_H 36 #define TEAMTYPE_H 37 38 /* 39 ** TeamMissionType: the various missions that a team can have. 40 */ 41 typedef enum TeamMissionType : char { 42 TMISSION_NONE=-1, 43 TMISSION_ATTACK, // Attack specified quarry type. 44 TMISSION_ATT_WAYPT, // Attack specified waypoint 45 TMISSION_FORMATION, // Change formation of team. 46 TMISSION_MOVE, // moves to waypoint specified. 47 TMISSION_MOVECELL, // moves to cell # specified. 48 TMISSION_GUARD, // works like an infantry's guard mission 49 TMISSION_LOOP, // loop back to start of mission list 50 TMISSION_ATTACKTARCOM, // attack tarcom 51 TMISSION_UNLOAD, // Unload at current location. 52 TMISSION_DEPLOY, // Deploy mobile building type. 53 TMISSION_HOUND_DOG, // Follow nearest friendly unit. 54 TMISSION_DO, // Do guard, sticky, area guard (mission sticks on this). 55 TMISSION_SET_GLOBAL, // Set global variable. 56 TMISSION_INVULNERABLE, // Magical invulnerability. 57 TMISSION_LOAD, // Load onto transport member of team. 58 TMISSION_SPY, // Spy enter the building at specified waypoint 59 TMISSION_PATROL, // Move but look for enemies as well. 60 61 TMISSION_COUNT, 62 TMISSION_FIRST=0 63 } TeamMissionType; 64 65 66 /* 67 ** Forward declarations. 68 */ 69 class TechnoTypeClass; 70 71 72 /* 73 ** This structure contains one team mission value & its argument. 74 */ 75 class TeamMissionClass 76 { 77 public: 78 #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR) 79 char const * Description(int index) const; 80 operator const char * () const {return(Description(0));}; 81 #endif 82 void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags); 83 84 TeamMissionType Mission; // Mission type. 85 union { 86 FormationType Formation; // Formation to use. 87 QuarryType Quarry; // Combat quarry type. 88 MissionType Mission; // General mission orders. 89 int Value; // Usually a waypoint number. 90 } Data; 91 }; 92 93 94 /* 95 ** This class specifies the quantity and type of members desired for the 96 ** team. 97 */ 98 class TeamMemberClass 99 { 100 public: 101 int Quantity; // Number of objects desired for this type. 102 TechnoTypeClass const * Class; // The type of object desired. 103 }; 104 105 106 /* 107 ** TeamTypeClass declaration 108 */ 109 class TeamTypeClass : public AbstractTypeClass 110 { 111 public: 112 enum TeamTypeClassEnums { 113 MAX_TEAM_CLASSCOUNT=5, 114 MAX_TEAM_MISSIONS=20 115 }; 116 117 /* 118 ** Constructor/Destructor 119 */ 120 TeamTypeClass(void); 121 TeamTypeClass(NoInitClass const & x) : AbstractTypeClass(x), Trigger(x) {}; 122 virtual ~TeamTypeClass(void) {}; 123 124 static void * operator new(size_t ); 125 static void * operator new(size_t, void * ptr) {return(ptr);}; 126 static void operator delete(void *ptr); 127 128 /* 129 ** Initialization: clears all team types in preparation for new scenario 130 */ 131 static void Init(void); 132 133 /* 134 ** File I/O routines 135 */ 136 void Build_INI_Entry(char * buffer); 137 static void Read_INI(CCINIClass & ini); 138 void Fill_In(char *name, char *entry); 139 static void Write_INI(CCINIClass & ini); 140 static char * INI_Name(void) {return "TeamTypes";}; 141 bool Load(Straw & file); 142 bool Save(Pipe & file) const; 143 void Code_Pointers(void); 144 void Decode_Pointers(void); 145 146 /* 147 ** As_Pointer gets a pointer to the trigger object give its name 148 */ 149 static TeamTypeClass *As_Pointer(char const * name); 150 151 /* 152 ** Processing routines 153 */ 154 TeamClass * Create_One_Of(void) const; 155 void Destroy_All_Of(void) const; 156 void Detach(TARGET target, bool all=true); 157 158 /* 159 ** Utility routines 160 */ 161 void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const; 162 static char const * Name_From_Mission(TeamMissionType order); 163 static TeamMissionType Mission_From_Name(char const *name); 164 static TeamTypeClass const * Suggested_New_Team(HouseClass * house, long atypes, long utypes, long itypes, long vtypes, bool alerted); 165 static TeamTypeClass * From_Name(char const * name); 166 bool Edit(void); 167 #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR) 168 char const * Member_Description(void) const; 169 char const * Description(void) const; 170 operator const char * (void) const {return(Description());}; 171 #endif 172 173 /* 174 ** If this teamtype object is active, then this flag will be true. 175 ** TeamType objects that are not active are either not yet created or have 176 ** been deleted after fulfilling their action. 177 */ 178 unsigned IsActive:1; 179 180 /* 181 ** If RoundAbout, the team avoids high-threat areas 182 */ 183 unsigned IsRoundAbout:1; 184 185 /* 186 ** If Suicide, the team won't stop until it achieves its mission or it's 187 ** dead 188 */ 189 unsigned IsSuicide:1; 190 191 /* 192 ** Is this team type allowed to be created automatically by the computer 193 ** when the appropriate trigger indicates? 194 */ 195 unsigned IsAutocreate:1; 196 197 /* 198 ** This flag tells the computer that it should build members to fill 199 ** a team of this type regardless of whether there actually is a team 200 ** of this type active. 201 */ 202 unsigned IsPrebuilt:1; 203 204 /* 205 ** If this team should allow recruitment of new members, then this flag 206 ** will be true. A false value results in a team that fights until it 207 ** is dead. This is similar to IsSuicide, but they will defend themselves. 208 */ 209 unsigned IsReinforcable:1; 210 211 /* 212 ** A transient team type was created exclusively to bring on reinforcements 213 ** as a result of some special event. As soon as there are no teams 214 ** existing of this type, then this team type should be deleted. 215 */ 216 unsigned IsTransient:1; 217 218 /* 219 ** Priority given the team for recruiting purposes; higher priority means 220 ** it can steal members from other teams (scale: 0 - 15) 221 */ 222 int RecruitPriority; 223 224 /* 225 ** Initial # of this type of team 226 */ 227 unsigned char InitNum; 228 229 /* 230 ** Max # of this type of team allowed at one time 231 */ 232 unsigned char MaxAllowed; 233 234 /* 235 ** Fear level of this team 236 */ 237 unsigned char Fear; 238 239 /* 240 ** House the team belongs to 241 */ 242 HousesType House; 243 244 /* 245 ** Trigger to assign to each object as it joins this team. 246 */ 247 CCPtr<TriggerTypeClass> Trigger; 248 249 /* 250 ** This is the waypoint origin to use when creating this team or 251 ** when bringing the team on as a reinforcement. 252 */ 253 WAYPOINT Origin; 254 255 /* 256 ** This records the number of teams of this type that are currently 257 ** active. 258 */ 259 int Number; 260 261 /* 262 ** Number and list of missions that this team will follow. 263 */ 264 int MissionCount; 265 TeamMissionClass MissionList[MAX_TEAM_MISSIONS]; 266 267 /* 268 ** Number and type of members desired for this team. 269 */ 270 int ClassCount; 271 TeamMemberClass Members[MAX_TEAM_CLASSCOUNT]; 272 273 /* 274 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 275 */ 276 unsigned char SaveLoadPadding[32]; 277 278 static char const * TMissions[TMISSION_COUNT]; 279 }; 280 281 282 #endif