TACTION.H 7.2 KB

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