UNIT.H (7945B)
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: F:\projects\c&c\vcs\code\unit.h_v 2.19 16 Oct 1995 16:45:56 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 : UNIT.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : April 14, 1994 * 28 * * 29 * Last Update : April 14, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef UNIT_H 36 #define UNIT_H 37 38 #include "tarcom.h" 39 #include "radio.h" 40 #include "cargo.h" 41 #include "mission.h" 42 #include "target.h" 43 44 45 /**************************************************************************** 46 ** For each instance of a unit (vehicle) in the game, there is one of 47 ** these structures. This structure holds information that is specific 48 ** and dynamic for a particular unit. 49 */ 50 class UnitClass : public TarComClass 51 { 52 public: 53 54 /* 55 ** This records the house flag that this object is currently carrying. 56 */ 57 HousesType Flagged; 58 59 /*--------------------------------------------------------------------- 60 ** Constructors, Destructors, and overloaded operators. 61 */ 62 static void * operator new(size_t size); 63 static void operator delete(void *ptr); 64 UnitClass(void) {}; 65 UnitClass(UnitType classid, HousesType house); 66 operator UnitType(void) const {return Class->Type;}; 67 virtual ~UnitClass(void); 68 virtual RTTIType What_Am_I(void) const; 69 70 /*--------------------------------------------------------------------- 71 ** Member function prototypes. 72 */ 73 static void Init(void); 74 75 bool Goto_Clear_Spot(void); 76 bool Try_To_Deploy(void); 77 78 int Tiberium_Check(CELL ¢er, int x, int y); 79 bool Flag_Attach(HousesType house); 80 bool Flag_Remove(void); 81 void Find_LZ(void); 82 bool Unload_Hovercraft_Process(void); 83 bool Goto_Tiberium(void); 84 bool Harvesting(void); 85 void APC_Close_Door(void); 86 void APC_Open_Door(void); 87 virtual BuildingClass* Find_Best_Refinery(void) const; 88 89 /* 90 ** Query functions. 91 */ 92 virtual bool Can_Player_Move(void) const; 93 virtual int Pip_Count(void) const; 94 virtual InfantryType Crew_Type(void) const; 95 96 /* 97 ** Coordinate inquiry functions. These are used for both display and 98 ** combat purposes. 99 */ 100 virtual COORDINATE Sort_Y(void) const; 101 102 /* 103 ** Object entry and exit from the game system. 104 */ 105 virtual bool Unlimbo(COORDINATE , DirType facing=DIR_N); 106 virtual bool Limbo(void); 107 108 /* 109 ** Display and rendering support functionality. Supports imagery and how 110 ** object interacts with the map and thus indirectly controls rendering. 111 */ 112 virtual void const * Remap_Table(void); 113 virtual void Look(bool incremental=false); 114 virtual short const * Overlap_List(void) const; 115 virtual void Draw_It(int x, int y, WindowNumberType window); 116 117 /* 118 ** ST Added 1/15/2019 2:44PM 119 */ 120 //virtual bool Get_Draw_Parameters(void); 121 122 /* 123 ** User I/O. 124 */ 125 virtual ActionType What_Action(CELL cell) const; 126 virtual ActionType What_Action(ObjectClass * object) const; 127 virtual void Active_Click_With(ActionType action, ObjectClass * object); 128 virtual void Active_Click_With(ActionType action, CELL cell); 129 virtual void Player_Assign_Mission(MissionType mission, TARGET target=TARGET_NONE, TARGET destination=TARGET_NONE); 130 virtual void Response_Select(void); 131 virtual void Response_Move(void); 132 virtual void Response_Attack(void); 133 134 /* 135 ** Combat related. 136 */ 137 virtual COORDINATE Target_Coord(void) const; 138 virtual ResultType Take_Damage(int & damage, int distance, WarheadType warhead, TechnoClass * source=0); 139 virtual TARGET As_Target(void) const; 140 virtual void Stun(void); 141 142 /* 143 ** Driver control support functions. These are used to control cell 144 ** occupation flags and driver instructions. 145 */ 146 virtual bool Stop_Driver(void); 147 virtual bool Start_Driver(COORDINATE & coord); 148 149 /* 150 ** AI. 151 */ 152 virtual DirType Desired_Load_Dir(ObjectClass * passenger, CELL & moveto) const; 153 virtual RadioMessageType Receive_Message(RadioClass * from, RadioMessageType message, long & param); 154 virtual void AI(void); 155 virtual int Mission_Attack(void); 156 virtual int Mission_Unload(void); 157 virtual int Mission_Guard(void); 158 virtual int Mission_Harvest(void); 159 virtual int Mission_Hunt(void); 160 virtual int Mission_Enter(void); 161 virtual int UnitClass::Mission_Move(void); 162 virtual FireErrorType Can_Fire(TARGET, int which) const; 163 164 /* 165 ** Scenario and debug support. 166 */ 167 #ifdef CHEAT_KEYS 168 virtual void Debug_Dump(MonoClass *mono) const; 169 #endif 170 171 /* 172 ** Movement and animation. 173 */ 174 virtual void Enter_Idle_Mode(bool initial=false); 175 virtual MoveType Can_Enter_Cell(CELL cell, FacingType facing=FACING_NONE) const; 176 virtual void Per_Cell_Process(bool center); 177 virtual void Scatter(COORDINATE threat, bool forced=false, bool nokidding=false); 178 void Exit_Repair(void); 179 // MoveType Blocking_Object(TechnoClass const *techno, CELL cell) const; 180 181 /* 182 ** File I/O. 183 */ 184 static void Read_INI(char *buffer); 185 static void Write_INI(char *buffer); 186 static char *INI_Name(void) {return "UNITS";}; 187 bool Load(FileClass & file); 188 bool Save(FileClass & file); 189 virtual void Code_Pointers(void); 190 virtual void Decode_Pointers(void); 191 192 /* 193 ** Dee-buggin' support. 194 */ 195 int Validate(void) const; 196 197 private: 198 199 /* 200 ** Timer to prevent Harvesters from collecting too often 201 */ 202 TCountDownTimerClass HarvestTimer; 203 204 /* 205 ** This is the refinery a harvester is interested in unloading at. 206 */ 207 mutable BuildingClass* TiberiumUnloadRefinery; 208 209 /* 210 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 211 */ 212 unsigned char SaveLoadPadding[28]; 213 214 /* 215 ** This contains the value of the Virtual Function Table Pointer 216 */ 217 static void * VTable; 218 }; 219 220 #endif