CnC_Remastered_Collection

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

TACTION.H (7385B)


      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/TACTION.H 1     3/03/97 10:25a 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 : ACTION.H                                                     *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 11/28/95                                                     *
     28  *                                                                                             *
     29  *                  Last Update : November 28, 1995 [JLB]                                      *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 
     36 #ifndef ACTION_H
     37 #define ACTION_H
     38 
     39 typedef enum TActionType : unsigned char {
     40 	TACTION_NONE,
     41 
     42 	TACTION_WIN,								// player wins!
     43 	TACTION_LOSE,								// player loses.
     44 	TACTION_BEGIN_PRODUCTION,				// computer begins factory production.
     45 	TACTION_CREATE_TEAM,						// computer creates a certain type of team
     46 	TACTION_DESTROY_TEAM,
     47 	TACTION_ALL_HUNT,							// all enemy units go into hunt mode (teams destroyed).
     48 	TACTION_REINFORCEMENTS,					// player gets reinforcements
     49 													// (house that gets them is determined by
     50 													// the Reinforcement instance)
     51 	TACTION_DZ,									// Deploy drop zone smoke.
     52 	TACTION_FIRE_SALE,						// Sell all buildings and go on rampage.
     53 	TACTION_PLAY_MOVIE,						//	Play movie (temporarily suspend game).
     54 	TACTION_TEXT_TRIGGER,					// Triggers a text message display.
     55 	TACTION_DESTROY_TRIGGER,				// Destroy specified trigger.
     56 	TACTION_AUTOCREATE,						// Computer to autocreate teams.
     57 	TACTION_WINLOSE,							// Win if captured, lose if destroyed.
     58 	TACTION_ALLOWWIN,							// Allows winning if triggered.
     59 
     60 	TACTION_REVEAL_ALL,						// Reveal the entire map.
     61 	TACTION_REVEAL_SOME,						// Reveal map around cell #.
     62 	TACTION_REVEAL_ZONE,						// Reveal all of specified zone.
     63 	TACTION_PLAY_SOUND,						// Play sound effect.
     64 	TACTION_PLAY_MUSIC,						// Play musical score.
     65 	TACTION_PLAY_SPEECH,						// Play EVA speech.
     66 	TACTION_FORCE_TRIGGER,					// Force trigger to activate.
     67 	TACTION_START_TIMER,						// Start mission timer.
     68 	TACTION_STOP_TIMER,						// Stop mission timer.
     69 	TACTION_ADD_TIMER,						// Increase mission timer time.
     70 	TACTION_SUB_TIMER,						// Decrease mission timer time.
     71 	TACTION_SET_TIMER,						// Set and start the mission timer.
     72 	TACTION_SET_GLOBAL,						// Set global variable.
     73 	TACTION_CLEAR_GLOBAL,					// Clear global variable.
     74 	TACTION_BASE_BUILDING,					// Automated base building.
     75 	TACTION_CREEP_SHADOW,					// Shadow grows back one 'step'.
     76 
     77 	TACTION_DESTROY_OBJECT,					// Destroys the building this trigger is attached to.
     78 	TACTION_1_SPECIAL,						// Add a one-time special weapon ability to house.
     79 	TACTION_FULL_SPECIAL,					// Add a repeating special weapon ability to house.
     80 
     81 	TACTION_PREFERRED_TARGET,				// Designates preferred target for house.
     82 	TACTION_LAUNCH_NUKES,					// Launch fake nuclear missiles from all silos
     83 
     84 	TACTION_COUNT,
     85 	TACTION_FIRST=0
     86 } TActionType;
     87 
     88 TActionType Action_From_Name(char const * name);
     89 char const * Name_From_Action(TActionType action);
     90 NeedType Action_Needs(TActionType action);
     91 
     92 class TriggerTypeClass;
     93 class TeamTypeClass;
     94 
     95 /*
     96 **	This elaborates the information necessary to carry out
     97 **	a trigger's action.
     98 */
     99 struct TActionClass {
    100 	TActionType		Action;	// Action to perform.
    101 
    102 	CCPtr<TeamTypeClass> Team;	// Team type pointer for this action (if needed).
    103 
    104 	CCPtr<TriggerTypeClass> Trigger;	// Trigger type pointer for this action (if needed).
    105 
    106 	union {
    107 		ThemeType			Theme;		// Musical theme.
    108 		VocType				Sound;		// Sound effect.
    109 		VoxType				Speech;		// Speech identifier.
    110 		HousesType			House;		// House to be affected.
    111 		SpecialWeaponType Special;		// Special weapon ability.
    112 		QuarryType			Quarry;		// Preferred target for attack.
    113 		VQType				Movie;		// The movie to play.
    114 		bool					Bool;			// Boolean value.
    115 		long					Value;
    116 	} Data;
    117 
    118 	TActionClass(void) : Action(TACTION_NONE) {
    119 		Data.Theme = THEME_NONE;
    120 		Data.Value = -1;
    121 	};
    122 	TActionClass(NoInitClass const & x) : Team(x), Trigger(x) {};
    123 
    124 	void Detach(TARGET target);
    125 	void Code_Pointers(void);
    126 	void Decode_Pointers(void);
    127 	void Read_INI(void);
    128 	void Build_INI_Entry(char * buffer) const;
    129 
    130 	bool operator() (HousesType house, ObjectClass * object, int id, CELL cell);
    131 };
    132 
    133 
    134 class ActionChoiceClass {
    135 	public:
    136 		ActionChoiceClass(TActionType event=TACTION_NONE) : Action(event) {}
    137 
    138 		operator TActionType (void) const {return(Action);}
    139 		bool operator == (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action);}
    140 		bool operator != (ActionChoiceClass const & rvalue) const {return(Action != rvalue.Action);}
    141 		bool operator > (ActionChoiceClass const & rvalue) const {return(stricmp(Description(), rvalue.Description()) > 0);}
    142 		bool operator < (ActionChoiceClass const & rvalue) const {return(stricmp(Description(), rvalue.Description()) < 0);}
    143 		bool operator <= (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action || stricmp(Description(), rvalue.Description()) < 0);}
    144 		bool operator >= (ActionChoiceClass const & rvalue) const {return(Action == rvalue.Action || stricmp(Description(), rvalue.Description()) > 0);}
    145 		char const * Description(void) const {return(Name_From_Action(Action));}
    146 		void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const;
    147 
    148 		TActionType Action;
    149 };
    150 
    151 
    152 extern ActionChoiceClass ActionChoices[TACTION_COUNT];
    153 
    154 #endif