TEAMTYPE.H 9.1 KB

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