MISSION.H 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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/MISSION.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 : MISSION.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : April 23, 1994 *
  30. * *
  31. * Last Update : April 23, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef MISSION_H
  37. #define MISSION_H
  38. #include "object.h"
  39. #include "monoc.h"
  40. /****************************************************************************
  41. ** This handles order assignment and tracking. The order is used to guide
  42. ** overall AI processing.
  43. */
  44. class MissionClass : public ObjectClass
  45. {
  46. public:
  47. /*
  48. ** This the tactical strategy to use. It is used by the unit script. This
  49. ** is a general guide for unit AI processing.
  50. */
  51. MissionType Mission;
  52. MissionType SuspendedMission;
  53. /*
  54. ** The order queue is used for orders that should take effect when the vehicle
  55. ** has reached the center point of a cell. The queued order number is +1 when stored here
  56. ** so that 0 will indicated there is no queued order.
  57. */
  58. MissionType MissionQueue;
  59. int Status;
  60. /*---------------------------------------------------------------------
  61. ** Constructors, Destructors, and overloaded operators.
  62. */
  63. MissionClass(RTTIType rtti, int id);
  64. MissionClass(NoInitClass const & x) : ObjectClass(x), Timer(x) {};
  65. virtual ~MissionClass(void) {};
  66. /*---------------------------------------------------------------------
  67. ** Member function prototypes.
  68. */
  69. #ifdef CHEAT_KEYS
  70. void Debug_Dump(MonoClass *mono) const;
  71. #endif
  72. void Shorten_Mission_Timer(void) {Timer = 0;}
  73. virtual MissionType Get_Mission(void) const;
  74. virtual void Assign_Mission(MissionType mission);
  75. virtual bool Commence(void);
  76. virtual void AI(void);
  77. /*
  78. ** Support functions.
  79. */
  80. virtual int Mission_Sleep(void);
  81. virtual int Mission_Ambush(void);
  82. virtual int Mission_Attack(void);
  83. virtual int Mission_Capture(void);
  84. virtual int Mission_Guard(void);
  85. virtual int Mission_Guard_Area(void);
  86. virtual int Mission_Harvest(void);
  87. virtual int Mission_Hunt(void);
  88. // virtual int Mission_Timed_Hunt(void);
  89. virtual int Mission_Move(void);
  90. virtual int Mission_Retreat(void);
  91. virtual int Mission_Return(void);
  92. virtual int Mission_Stop(void);
  93. virtual int Mission_Unload(void);
  94. virtual int Mission_Enter(void);
  95. virtual int Mission_Construction(void);
  96. virtual int Mission_Deconstruction(void);
  97. virtual int Mission_Repair(void);
  98. virtual int Mission_Missile(void);
  99. virtual void Set_Mission(MissionType mission);
  100. static bool Is_Recruitable_Mission(MissionType mission);
  101. static char const * Mission_Name(MissionType order);
  102. static MissionType Mission_From_Name(char const *name);
  103. virtual void Override_Mission(MissionType mission, TARGET, TARGET);
  104. virtual bool Restore_Mission(void);
  105. private:
  106. /*
  107. ** This the thread processing timer. When this value counts down to zero, then
  108. ** more script processing may occur.
  109. */
  110. CDTimerClass<FrameTimerClass> Timer;
  111. };
  112. /****************************************************************************
  113. ** This is the mission control (pun) that controls how each mission behaves
  114. ** when it comes to interacting with the game world. Example; some
  115. ** missions allow the object to scatter from threats, while others require
  116. ** the object to remain in place. This kind of characteristics are specfied
  117. ** by this class.
  118. */
  119. class MissionControlClass
  120. {
  121. public:
  122. MissionControlClass(void);
  123. bool Read_INI(CCINIClass & ini);
  124. int Normal_Delay(void) const {return(TICKS_PER_MINUTE * Rate);}
  125. int AA_Delay(void) const {return(TICKS_PER_MINUTE * AARate);}
  126. /*
  127. ** This is the mission identifier that this mission represents.
  128. */
  129. MissionType Mission;
  130. char const * Name(void) const;
  131. /*
  132. ** If the object should not be considered a threat when it
  133. ** comes to target scanning, then this will be true.
  134. */
  135. unsigned IsNoThreat:1;
  136. /*
  137. ** If objects in this mission should avoid targeting the enemy and
  138. ** also avoid responding to the enemy, then this will be true.
  139. */
  140. unsigned IsZombie:1;
  141. /*
  142. ** An ojbect that can be recruited into a team must be on a mission
  143. ** of this type.
  144. */
  145. unsigned IsRecruitable:1;
  146. /*
  147. ** If the object can behave normally except that it cannot
  148. ** move to another location, then this flag will be true.
  149. */
  150. unsigned IsParalyzed:1;
  151. /*
  152. ** If an object on this mission is damaged, it is allowed to
  153. ** retaliate?
  154. */
  155. unsigned IsRetaliate:1;
  156. /*
  157. ** Is the object allowed to scatter from immediate threats?
  158. */
  159. unsigned IsScatter:1;
  160. /*
  161. ** This specifies the time to delay between calls to the mission handler for those cases
  162. ** where the delay could be indefinate. The exception would be when timing is critical.
  163. ** Typical use of this would be to regulate the delay between mundane mission processing
  164. ** in order to achieve less game overhead.
  165. */
  166. fixed Rate;
  167. /*
  168. ** Anti-Aircraft buildings (and units) in guard or guard area mode will use this override
  169. ** delay interval instead of the normal "Rate" value.
  170. */
  171. fixed AARate;
  172. };
  173. #endif