TEAMTYPE.H 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /CounterStrike/TEAMTYPE.H 1 3/03/97 10:25a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** 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 ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : TEAMTYPE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 07/02/96 *
  30. * *
  31. * Last Update : July 2, 1996 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef TEAMTYPE_H
  37. #define TEAMTYPE_H
  38. /*
  39. ** TeamMissionType: the various missions that a team can have.
  40. */
  41. typedef enum TeamMissionType {
  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. TMISSION_COUNT,
  61. TMISSION_FIRST=0
  62. } TeamMissionType;
  63. /*
  64. ** Forward declarations.
  65. */
  66. class TechnoTypeClass;
  67. /*
  68. ** This structure contains one team mission value & its argument.
  69. */
  70. class TeamMissionClass
  71. {
  72. public:
  73. #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR)
  74. char const * Description(int index) const;
  75. operator const char * () const {return(Description(0));};
  76. #endif
  77. void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags);
  78. TeamMissionType Mission; // Mission type.
  79. union {
  80. FormationType Formation; // Formation to use.
  81. QuarryType Quarry; // Combat quarry type.
  82. MissionType Mission; // General mission orders.
  83. int Value; // Usually a waypoint number.
  84. } Data;
  85. };
  86. /*
  87. ** This class specifies the quantity and type of members desired for the
  88. ** team.
  89. */
  90. class TeamMemberClass
  91. {
  92. public:
  93. int Quantity; // Number of objects desired for this type.
  94. TechnoTypeClass const * Class; // The type of object desired.
  95. };
  96. /*
  97. ** TeamTypeClass declaration
  98. */
  99. class TeamTypeClass : public AbstractTypeClass
  100. {
  101. public:
  102. enum TeamTypeClassEnums {
  103. MAX_TEAM_CLASSCOUNT=5,
  104. MAX_TEAM_MISSIONS=20
  105. };
  106. /*
  107. ** Constructor/Destructor
  108. */
  109. TeamTypeClass(void);
  110. TeamTypeClass(NoInitClass const & x) : AbstractTypeClass(x), Trigger(x) {};
  111. virtual ~TeamTypeClass(void) {};
  112. static void * operator new(size_t );
  113. static void * operator new(size_t, void * ptr) {return(ptr);};
  114. static void operator delete(void *ptr);
  115. /*
  116. ** Initialization: clears all team types in preparation for new scenario
  117. */
  118. static void Init(void);
  119. /*
  120. ** File I/O routines
  121. */
  122. void Build_INI_Entry(char * buffer);
  123. static void Read_INI(CCINIClass & ini);
  124. void Fill_In(char *name, char *entry);
  125. static void Write_INI(CCINIClass & ini);
  126. static char * INI_Name(void) {return "TeamTypes";};
  127. bool Load(Straw & file);
  128. bool Save(Pipe & file) const;
  129. void Code_Pointers(void);
  130. void Decode_Pointers(void);
  131. /*
  132. ** As_Pointer gets a pointer to the trigger object give its name
  133. */
  134. static TeamTypeClass *As_Pointer(char const * name);
  135. /*
  136. ** Processing routines
  137. */
  138. TeamClass * Create_One_Of(void) const;
  139. void Destroy_All_Of(void) const;
  140. void Detach(TARGET target, bool all=true);
  141. /*
  142. ** Utility routines
  143. */
  144. void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const;
  145. static char const * Name_From_Mission(TeamMissionType order);
  146. static TeamMissionType Mission_From_Name(char const *name);
  147. static TeamTypeClass const * Suggested_New_Team(HouseClass * house, long atypes, long utypes, long itypes, long vtypes, bool alerted);
  148. static TeamTypeClass * From_Name(char const * name);
  149. bool Edit(void);
  150. #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR)
  151. char const * Member_Description(void) const;
  152. char const * Description(void) const;
  153. operator const char * (void) const {return(Description());};
  154. #endif
  155. /*
  156. ** If this teamtype object is active, then this flag will be true.
  157. ** TeamType objects that are not active are either not yet created or have
  158. ** been deleted after fulfilling their action.
  159. */
  160. unsigned IsActive:1;
  161. /*
  162. ** If RoundAbout, the team avoids high-threat areas
  163. */
  164. unsigned IsRoundAbout:1;
  165. /*
  166. ** If Suicide, the team won't stop until it achieves its mission or it's
  167. ** dead
  168. */
  169. unsigned IsSuicide:1;
  170. /*
  171. ** Is this team type allowed to be created automatically by the computer
  172. ** when the appropriate trigger indicates?
  173. */
  174. unsigned IsAutocreate:1;
  175. /*
  176. ** This flag tells the computer that it should build members to fill
  177. ** a team of this type regardless of whether there actually is a team
  178. ** of this type active.
  179. */
  180. unsigned IsPrebuilt:1;
  181. /*
  182. ** If this team should allow recruitment of new members, then this flag
  183. ** will be true. A false value results in a team that fights until it
  184. ** is dead. This is similar to IsSuicide, but they will defend themselves.
  185. */
  186. unsigned IsReinforcable:1;
  187. /*
  188. ** A transient team type was created exclusively to bring on reinforcements
  189. ** as a result of some special event. As soon as there are no teams
  190. ** existing of this type, then this team type should be deleted.
  191. */
  192. unsigned IsTransient:1;
  193. /*
  194. ** Priority given the team for recruiting purposes; higher priority means
  195. ** it can steal members from other teams (scale: 0 - 15)
  196. */
  197. int RecruitPriority;
  198. /*
  199. ** Initial # of this type of team
  200. */
  201. unsigned char InitNum;
  202. /*
  203. ** Max # of this type of team allowed at one time
  204. */
  205. unsigned char MaxAllowed;
  206. /*
  207. ** Fear level of this team
  208. */
  209. unsigned char Fear;
  210. /*
  211. ** House the team belongs to
  212. */
  213. HousesType House;
  214. /*
  215. ** Trigger to assign to each object as it joins this team.
  216. */
  217. CCPtr<TriggerTypeClass> Trigger;
  218. /*
  219. ** This is the waypoint origin to use when creating this team or
  220. ** when bringing the team on as a reinforcement.
  221. */
  222. WAYPOINT Origin;
  223. /*
  224. ** This records the number of teams of this type that are currently
  225. ** active.
  226. */
  227. int Number;
  228. /*
  229. ** Number and list of missions that this team will follow.
  230. */
  231. int MissionCount;
  232. TeamMissionClass MissionList[MAX_TEAM_MISSIONS];
  233. /*
  234. ** Number and type of members desired for this team.
  235. */
  236. int ClassCount;
  237. TeamMemberClass Members[MAX_TEAM_CLASSCOUNT];
  238. static char const * TMissions[TMISSION_COUNT];
  239. };
  240. #endif