TRIGGER.H (4821B)
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 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/TRIGGER.H 1 3/03/97 10:26a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** 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 *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : TRIGGER.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 11/12/94 * 28 * * 29 * Last Update : November 12, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef TRIGGER_H 36 #define TRIGGER_H 37 38 class TriggerClass { 39 public: 40 RTTIType RTTI; 41 int ID; 42 43 CCPtr<TriggerTypeClass> Class; 44 45 /* 46 ** Record of the "already sprung" flag for the events. 47 */ 48 TDEventClass Event1; 49 TDEventClass Event2; 50 51 /* 52 ** Constructor/Destructor 53 */ 54 TriggerClass(TriggerTypeClass * trigtype=NULL); 55 TriggerClass(NoInitClass const & x) : Class(x), Event1(x), Event2(x) {}; 56 ~TriggerClass(void); 57 58 /* 59 ** Initialization: clears all triggers in preparation for new scenario 60 */ 61 static void Init(void); 62 63 /* 64 ** Processing routines 65 */ 66 bool Spring(TEventType event=TEVENT_ANY, ObjectClass * object=0, CELL cell=0, bool forced=false); 67 void Detach(TARGET target, bool all=true); 68 69 /* 70 ** File I/O routines 71 */ 72 bool Load(Straw & file); 73 bool Save(Pipe & file) const; 74 void Code_Pointers(void) {}; 75 void Decode_Pointers(void) {}; 76 77 /* 78 ** Utility routines 79 */ 80 TARGET As_Target(void) const; 81 char const * Description(void) const; 82 void Draw_It(int , int x, int y, int width, int height, bool selected, TextPrintType flags) const; 83 char const * Name(void) const {return(Class->Name());} 84 85 /* 86 ** Overloaded operators 87 */ 88 static void * operator new(size_t size); 89 static void * operator new(size_t, void * ptr) {return(ptr);}; 90 static void operator delete(void * ptr); 91 92 /* 93 ** If this trigger object is active, then this flag will be true. Trigger 94 ** objects that are not active are either not yet created or have been 95 ** deleted after fulfilling their action. 96 */ 97 unsigned IsActive:1; 98 99 /* 100 ** This value tells how many objects or cells this trigger is attached 101 ** to. The Read_INI routine for all classes that point to a trigger must 102 ** increment this value! 103 */ 104 int AttachCount; 105 106 /* 107 ** This value is used for triggers that can only exist in one cell. It is 108 ** needed for such triggers that the exact location of the trigger is needed 109 ** during processing but its location cannot be inferred from other data. 110 ** For all other triggers, this value is ignored. 111 */ 112 CELL Cell; 113 114 /* 115 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 116 */ 117 unsigned char SaveLoadPadding[32]; 118 }; 119 120 121 122 123 #endif