TRIGGER.H 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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/TRIGGER.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 : TRIGGER.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 11/12/94 *
  30. * *
  31. * Last Update : November 12, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef TRIGGER_H
  37. #define TRIGGER_H
  38. class TriggerClass {
  39. public:
  40. RTTIType RTTI;
  41. int ID;
  42. CCPtr<TriggerTypeClass> Class;
  43. /*
  44. ** Record of the "already sprung" flag for the events.
  45. */
  46. TDEventClass Event1;
  47. TDEventClass Event2;
  48. /*
  49. ** Constructor/Destructor
  50. */
  51. TriggerClass(TriggerTypeClass * trigtype=NULL);
  52. TriggerClass(NoInitClass const & x) : Class(x), Event1(x), Event2(x) {};
  53. ~TriggerClass(void);
  54. /*
  55. ** Initialization: clears all triggers in preparation for new scenario
  56. */
  57. static void Init(void);
  58. /*
  59. ** Processing routines
  60. */
  61. bool Spring(TEventType event=TEVENT_ANY, ObjectClass * object=0, CELL cell=0, bool forced=false);
  62. void Detach(TARGET target, bool all=true);
  63. /*
  64. ** File I/O routines
  65. */
  66. bool Load(Straw & file);
  67. bool Save(Pipe & file) const;
  68. void Code_Pointers(void) {};
  69. void Decode_Pointers(void) {};
  70. /*
  71. ** Utility routines
  72. */
  73. TARGET As_Target(void) const;
  74. char const * Description(void) const;
  75. void Draw_It(int , int x, int y, int width, int height, bool selected, TextPrintType flags) const;
  76. char const * Name(void) const {return(Class->Name());}
  77. /*
  78. ** Overloaded operators
  79. */
  80. static void * operator new(size_t size);
  81. static void * operator new(size_t, void * ptr) {return(ptr);};
  82. static void operator delete(void * ptr);
  83. /*
  84. ** If this trigger object is active, then this flag will be true. Trigger
  85. ** objects that are not active are either not yet created or have been
  86. ** deleted after fulfilling their action.
  87. */
  88. unsigned IsActive:1;
  89. /*
  90. ** This value tells how many objects or cells this trigger is attached
  91. ** to. The Read_INI routine for all classes that point to a trigger must
  92. ** increment this value!
  93. */
  94. int AttachCount;
  95. /*
  96. ** This value is used for triggers that can only exist in one cell. It is
  97. ** needed for such triggers that the exact location of the trigger is needed
  98. ** during processing but its location cannot be inferred from other data.
  99. ** For all other triggers, this value is ignored.
  100. */
  101. CELL Cell;
  102. };
  103. #endif