TERRAIN.H (5812B)
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/TERRAIN.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 : 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 /* 50 ** This points to the constant terrain data (for this type) that gives this 51 ** terrain object its character. 52 */ 53 CCPtr<TerrainTypeClass> Class; 54 55 /* 56 ** Constructor for terrain object class. 57 */ 58 static void * operator new(size_t size); 59 static void * operator new(size_t , void * ptr) {return(ptr);}; 60 static void operator delete(void *ptr); 61 TerrainClass(TerrainType id, CELL cell); 62 TerrainClass(NoInitClass const & x) : ObjectClass(x), Class(x), StageClass(x) {}; 63 virtual ~TerrainClass(void); 64 operator TerrainType(void) const {return Class->Type;}; 65 66 static void Init(void); 67 68 /* 69 ** Terrain specific support functions. 70 */ 71 void Start_To_Crumble(void); 72 73 /* 74 ** Query functions. 75 */ 76 virtual ObjectTypeClass const & Class_Of(void) const {return *Class;}; 77 78 /* 79 ** Coordinate inquiry functions. These are used for both display and 80 ** combat purposes. 81 */ 82 virtual COORDINATE Center_Coord(void) const; 83 virtual COORDINATE Render_Coord(void) const {return Coord;}; 84 virtual COORDINATE Sort_Y(void) const {return Coord_Add(Coord, Class->CenterBase);}; 85 virtual COORDINATE Target_Coord(void) const; 86 87 /* 88 ** Object entry and exit from the game system. 89 */ 90 virtual bool Unlimbo(COORDINATE coord, DirType dir=DIR_N); 91 virtual bool Limbo(void); 92 virtual MoveType Can_Enter_Cell(CELL cell, FacingType facing = FACING_NONE) const; 93 94 /* 95 ** Display and rendering support functionality. Supports imagery and how 96 ** object interacts with the map and thus indirectly controls rendering. 97 */ 98 virtual void Draw_It(int x, int y, WindowNumberType window) const; 99 virtual bool Mark(MarkType mark=MARK_CHANGE); 100 unsigned char *Radar_Icon(CELL cell); 101 102 /* 103 ** User I/O. 104 */ 105 virtual void Clicked_As_Target(HousesType house, int) {}; // 2019/09/20 JAS - Added record of who clicked on the object 106 107 /* 108 ** Combat related. 109 */ 110 virtual void Fire_Out(void); 111 virtual bool Catch_Fire(void); 112 virtual ResultType Take_Damage(int & damage, int distance, WarheadType warhead, TechnoClass * source, bool forced=false); 113 114 /* 115 ** AI. 116 */ 117 virtual void AI(void); 118 119 /* 120 ** Scenario and debug support. 121 */ 122 #ifdef CHEAT_KEYS 123 virtual void Debug_Dump(MonoClass *mono) const; 124 #endif 125 126 /* 127 ** File I/O. 128 */ 129 static void Read_INI(CCINIClass & ini); 130 static void Write_INI(CCINIClass & ini); 131 static char *INI_Name(void) {return "TERRAIN";}; 132 bool Load(Straw & file); 133 bool Save(Pipe & file) const; 134 135 private: 136 137 /* 138 ** If this terrain object is on fire, then this flag will be true. 139 */ 140 unsigned IsOnFire:1; 141 142 /* 143 ** Is this a terrain object that undergoes crumbling animation and it is 144 ** in fact crumbling at this time? 145 */ 146 unsigned IsCrumbling:1; 147 148 /* 149 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 150 */ 151 unsigned char SaveLoadPadding[8]; 152 }; 153 154 #endif