MISSION.H 7.2 KB

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