TACTION.H 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/TACTION.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 : ACTION.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 11/28/95 *
  30. * *
  31. * Last Update : November 28, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef ACTION_H
  37. #define ACTION_H
  38. typedef enum TActionType {
  39. TACTION_NONE,
  40. TACTION_WIN, // player wins!
  41. TACTION_LOSE, // player loses.
  42. TACTION_BEGIN_PRODUCTION, // computer begins factory production.
  43. TACTION_CREATE_TEAM, // computer creates a certain type of team
  44. TACTION_DESTROY_TEAM,
  45. TACTION_ALL_HUNT, // all enemy units go into hunt mode (teams destroyed).
  46. TACTION_REINFORCEMENTS, // player gets reinforcements
  47. // (house that gets them is determined by
  48. // the Reinforcement instance)
  49. TACTION_DZ, // Deploy drop zone smoke.
  50. TACTION_FIRE_SALE, // Sell all buildings and go on rampage.
  51. TACTION_PLAY_MOVIE, // Play movie (temporarily suspend game).
  52. TACTION_TEXT_TRIGGER, // Triggers a text message display.
  53. TACTION_DESTROY_TRIGGER, // Destroy specified trigger.
  54. TACTION_AUTOCREATE, // Computer to autocreate teams.
  55. TACTION_WINLOSE, // Win if captured, lose if destroyed.
  56. TACTION_ALLOWWIN, // Allows winning if triggered.
  57. TACTION_REVEAL_ALL, // Reveal the entire map.
  58. TACTION_REVEAL_SOME, // Reveal map around cell #.
  59. TACTION_REVEAL_ZONE, // Reveal all of specified zone.
  60. TACTION_PLAY_SOUND, // Play sound effect.
  61. TACTION_PLAY_MUSIC, // Play musical score.
  62. TACTION_PLAY_SPEECH, // Play EVA speech.
  63. TACTION_FORCE_TRIGGER, // Force trigger to activate.
  64. TACTION_START_TIMER, // Start mission timer.
  65. TACTION_STOP_TIMER, // Stop mission timer.
  66. TACTION_ADD_TIMER, // Increase mission timer time.
  67. TACTION_SUB_TIMER, // Decrease mission timer time.
  68. TACTION_SET_TIMER, // Set and start the mission timer.
  69. TACTION_SET_GLOBAL, // Set global variable.
  70. TACTION_CLEAR_GLOBAL, // Clear global variable.
  71. TACTION_BASE_BUILDING, // Automated base building.
  72. TACTION_CREEP_SHADOW, // Shadow grows back one 'step'.
  73. TACTION_DESTROY_OBJECT, // Destroys the building this trigger is attached to.
  74. TACTION_1_SPECIAL, // Add a one-time special weapon ability to house.
  75. TACTION_FULL_SPECIAL, // Add a repeating special weapon ability to house.
  76. TACTION_PREFERRED_TARGET, // Designates preferred target for house.
  77. TACTION_LAUNCH_NUKES, // Launch fake nuclear missiles from all silos
  78. TACTION_COUNT,
  79. TACTION_FIRST=0
  80. } TActionType;
  81. TActionType Action_From_Name(char const * name);
  82. char const * Name_From_Action(TActionType action);
  83. NeedType Action_Needs(TActionType action);
  84. class TriggerTypeClass;
  85. class TeamTypeClass;
  86. /*
  87. ** This elaborates the information necessary to carry out
  88. ** a trigger's action.
  89. */
  90. struct TActionClass {
  91. TActionType Action; // Action to perform.
  92. CCPtr<TeamTypeClass> Team; // Team type pointer for this action (if needed).
  93. CCPtr<TriggerTypeClass> Trigger; // Trigger type pointer for this action (if needed).
  94. union {
  95. ThemeType Theme; // Musical theme.
  96. VocType Sound; // Sound effect.
  97. VoxType Speech; // Speech identifier.
  98. HousesType House; // House to be affected.
  99. SpecialWeaponType Special; // Special weapon ability.
  100. QuarryType Quarry; // Preferred target for attack.
  101. VQType Movie; // The movie to play.
  102. bool Bool; // Boolean value.
  103. long Value;
  104. } Data;
  105. TActionClass(void) : Action(TACTION_NONE) {
  106. Data.Theme = THEME_NONE;
  107. Data.Value = -1;
  108. };
  109. TActionClass(NoInitClass const & x) : Team(x), Trigger(x) {};
  110. void Detach(TARGET target);
  111. void Code_Pointers(void);
  112. void Decode_Pointers(void);
  113. void Read_INI(void);
  114. void Build_INI_Entry(char * buffer) const;
  115. bool operator() (HousesType house, ObjectClass * object, int id, CELL cell);
  116. };
  117. class ActionChoiceClass {
  118. public:
  119. ActionChoiceClass(TActionType event=TACTION_NONE) : Action(event) {}
  120. operator TActionType (void) const {return(Action);}
  121. bool operator == (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action);}
  122. bool operator != (ActionChoiceClass const & rvalue) const {return(Action != rvalue.Action);}
  123. bool operator > (ActionChoiceClass const & rvalue) const {return(stricmp(Description(), rvalue.Description()) > 0);}
  124. bool operator < (ActionChoiceClass const & rvalue) const {return(stricmp(Description(), rvalue.Description()) < 0);}
  125. bool operator <= (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action || stricmp(Description(), rvalue.Description()) < 0);}
  126. bool operator >= (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action || stricmp(Description(), rvalue.Description()) > 0);}
  127. char const * Description(void) const {return(Name_From_Action(Action));}
  128. void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const;
  129. TActionType Action;
  130. };
  131. extern ActionChoiceClass ActionChoices[TACTION_COUNT];
  132. #endif