TRIGGER.H 4.7 KB

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