TERRAIN.H (6219B)
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\terrain.h_v 2.16 16 Oct 1995 16:47:48 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 : TERRAIN.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : April 29, 1994 * 28 * * 29 * Last Update : April 29, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef TERRAIN_H 36 #define TERRAIN_H 37 38 #include "object.h" 39 #include "type.h" 40 41 42 /**************************************************************************** 43 ** Each type of terrain has certain pieces of static information associated 44 ** with it. This class elaborates this data. 45 */ 46 class TerrainClass : public ObjectClass, public StageClass 47 { 48 public: 49 TerrainTypeClass const * const Class; 50 operator TerrainType(void) const {return Class->Type;}; 51 52 /* 53 ** Constructor for terrain object class. 54 */ 55 static void * TerrainClass::operator new(size_t size); 56 static void TerrainClass::operator delete(void *ptr); 57 TerrainClass(void); 58 TerrainClass(TerrainType id, CELL cell); 59 virtual ~TerrainClass(void); 60 virtual RTTIType What_Am_I(void) const {return RTTI_TERRAIN;}; 61 62 static void Init(void); 63 64 /* 65 ** Terrain specific support functions. 66 */ 67 void Start_To_Crumble(void); 68 69 /* 70 ** Query functions. 71 */ 72 virtual ObjectTypeClass const & Class_Of(void) const {return *Class;}; 73 74 /* 75 ** Coordinate inquiry functions. These are used for both display and 76 ** combat purposes. 77 */ 78 virtual COORDINATE Center_Coord(void) const; 79 virtual COORDINATE Render_Coord(void) const {return Coord;}; 80 virtual COORDINATE Sort_Y(void) const {return Coord_Add(Coord, Class->CenterBase);}; 81 virtual COORDINATE Target_Coord(void) const {return Sort_Y();}; 82 83 /* 84 ** Object entry and exit from the game system. 85 */ 86 virtual bool Unlimbo(COORDINATE coord, DirType dir=DIR_N); 87 virtual bool Limbo(void); 88 virtual MoveType Can_Enter_Cell(CELL cell, FacingType facing = FACING_NONE) const; 89 90 /* 91 ** Display and rendering support functionality. Supports imagery and how 92 ** object interacts with the map and thus indirectly controls rendering. 93 */ 94 virtual void Draw_It(int x, int y, WindowNumberType window); 95 virtual bool Mark(MarkType mark=MARK_CHANGE); 96 unsigned char *Radar_Icon(CELL cell); 97 98 /* 99 ** User I/O. 100 */ 101 virtual void Clicked_As_Target(HousesType, int) {}; 102 103 /* 104 ** Combat related. 105 */ 106 virtual void Fire_Out(void); 107 virtual bool Catch_Fire(void); 108 virtual ResultType Take_Damage(int & damage, int distance, WarheadType warhead, TechnoClass * source); 109 virtual TARGET As_Target(void) const; 110 111 /* 112 ** AI. 113 */ 114 virtual void AI(void); 115 116 /* 117 ** Scenario and debug support. 118 */ 119 #ifdef CHEAT_KEYS 120 virtual void Debug_Dump(MonoClass *mono) const; 121 #endif 122 123 /* 124 ** File I/O. 125 */ 126 static void Read_INI(char *buffer); 127 static void Write_INI(char *buffer); 128 static char *INI_Name(void) {return "TERRAIN";}; 129 bool Load(FileClass & file); 130 bool Save(FileClass & file); 131 virtual void Code_Pointers(void); 132 virtual void Decode_Pointers(void); 133 134 /* 135 ** Dee-buggin' support. 136 */ 137 int Validate(void) const; 138 139 private: 140 141 /* 142 ** If this terrain object is on fire, then this flag will be true. 143 */ 144 unsigned IsOnFire:1; 145 146 /* 147 ** Is this a terrain object that undergoes crumbling animation and it is 148 ** in fact crumbling at this time? 149 */ 150 unsigned IsCrumbling:1; 151 152 /* 153 ** If this is a tree that becomes a blossom tree, is it currently doing so? 154 */ 155 unsigned IsBlossoming:1; 156 157 /* 158 ** If this is a blossom tree, is it barnacled? 159 */ 160 unsigned IsBarnacled:1; 161 162 /* 163 ** If this is a blossom tree that is barnacled, is it pulsing and spewing 164 ** out spores? 165 */ 166 unsigned IsSporing:1; 167 168 /* 169 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 170 */ 171 unsigned char SaveLoadPadding[8]; 172 173 /* 174 ** This contains the value of the Virtual Function Table Pointer 175 */ 176 static void * VTable; 177 }; 178 179 #endif