CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

TRIGTYPE.H (5744B)


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