TRIGTYPE.H 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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/TRIGTYPE.H 1 3/03/97 10:26a 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 : TRIGTYPE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 06/05/96 *
  30. * *
  31. * Last Update : June 5, 1996 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef TRIGTYPE_H
  37. #define TRIGTYPE_H
  38. #include "tevent.h"
  39. #include "taction.h"
  40. class TriggerClass;
  41. /*
  42. ** There can be multiple trigger events and trigger actions. This enumeration is used to
  43. ** indicate if there are multiple events/actions and what their relationship is.
  44. */
  45. typedef enum MultiStyleType {
  46. MULTI_ONLY, // "Only" main trigger action/event?
  47. MULTI_AND, // "And" secondary trigger action/event?
  48. MULTI_OR, // "Or" secondary event?
  49. MULTI_LINKED // Cause and effect pairs are linked?
  50. } MultiStyleType;
  51. class TriggerTypeClass : public AbstractTypeClass
  52. {
  53. public:
  54. unsigned IsActive:1;
  55. typedef enum PersistantType {
  56. VOLATILE = 0,
  57. SEMIPERSISTANT = 1,
  58. PERSISTANT = 2
  59. } PersistantType;
  60. /*
  61. ** This flag controls whether the trigger destroys itself after it goes
  62. ** off.
  63. ** 0 = trigger destroys itself immediately after going off, and removes
  64. ** itself from all objects it's attached to
  65. ** 1 = trigger is "Semi-Persistent"; it maintains a count of all objects
  66. ** it's attached to, and only actually "springs" after its been
  67. ** triggered from all the objects; then, it removes itself.
  68. ** 2 = trigger is Fully Persistent; it just won't go away.
  69. */
  70. PersistantType IsPersistant;
  71. /*
  72. ** For house-specific events, this is the house for that event.
  73. */
  74. HousesType House;
  75. /*
  76. ** Each trigger must have an event which activates it. This is the event that is
  77. ** used to activate this trigger.
  78. */
  79. TEventClass Event1;
  80. TEventClass Event2;
  81. MultiStyleType EventControl;
  82. /*
  83. ** This is the action to perform when the trigger event occurs.
  84. */
  85. TActionClass Action1;
  86. TActionClass Action2;
  87. MultiStyleType ActionControl;
  88. TriggerTypeClass(void);
  89. TriggerTypeClass(NoInitClass const & x) : AbstractTypeClass(x), Event1(x), Event2(x), Action1(x), Action2(x) {};
  90. virtual ~TriggerTypeClass(void);
  91. static void * operator new(size_t );
  92. static void * operator new(size_t, void * ptr) {return(ptr);};
  93. static void operator delete(void *ptr);
  94. /*
  95. ** Initialization: clears all trigger types in preparation for new scenario
  96. */
  97. static void Init(void);
  98. /*
  99. ** File I/O routines
  100. */
  101. static void Read_INI(CCINIClass & ini);
  102. static void Write_INI(CCINIClass & ini);
  103. void Fill_In(char * name, char * entry);
  104. void Build_INI_Entry(char * buf) const;
  105. static char * INI_Name(void) {return "Trigs";};
  106. bool Load(Straw & file);
  107. bool Save(Pipe & file) const;
  108. void Code_Pointers(void);
  109. void Decode_Pointers(void);
  110. /*
  111. ** Processing routines
  112. */
  113. TriggerClass * Create_One_Of(void) const;
  114. void Destroy_All_Of(void) const;
  115. /*
  116. ** Utility routines
  117. */
  118. void Detach(TARGET target, bool all=true);
  119. AttachType Attaches_To(void) const;
  120. TARGET As_Target(void) const;
  121. static TriggerTypeClass * From_Name(char const * name);
  122. bool Edit(void);
  123. #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR)
  124. char const * Description(void) const;
  125. operator const char * (void) const {return(Description());};
  126. #endif
  127. void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const;
  128. };
  129. #endif