TERRAIN.H 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/TERRAIN.H 1 3/03/97 10:25a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : TERRAIN.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : April 29, 1994 *
  26. * *
  27. * Last Update : April 29, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef TERRAIN_H
  33. #define TERRAIN_H
  34. #include "object.h"
  35. #include "type.h"
  36. /****************************************************************************
  37. ** Each type of terrain has certain pieces of static information associated
  38. ** with it. This class elaborates this data.
  39. */
  40. class TerrainClass : public ObjectClass, public StageClass
  41. {
  42. public:
  43. /*
  44. ** This points to the constant terrain data (for this type) that gives this
  45. ** terrain object its character.
  46. */
  47. CCPtr<TerrainTypeClass> Class;
  48. /*
  49. ** Constructor for terrain object class.
  50. */
  51. static void * operator new(size_t size);
  52. static void * operator new(size_t , void * ptr) {return(ptr);};
  53. static void operator delete(void *ptr);
  54. TerrainClass(TerrainType id, CELL cell);
  55. TerrainClass(NoInitClass const & x) : ObjectClass(x), Class(x), StageClass(x) {};
  56. virtual ~TerrainClass(void);
  57. operator TerrainType(void) const {return Class->Type;};
  58. static void Init(void);
  59. /*
  60. ** Terrain specific support functions.
  61. */
  62. void Start_To_Crumble(void);
  63. /*
  64. ** Query functions.
  65. */
  66. virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
  67. /*
  68. ** Coordinate inquiry functions. These are used for both display and
  69. ** combat purposes.
  70. */
  71. virtual COORDINATE Center_Coord(void) const;
  72. virtual COORDINATE Render_Coord(void) const {return Coord;};
  73. virtual COORDINATE Sort_Y(void) const {return Coord_Add(Coord, Class->CenterBase);};
  74. virtual COORDINATE Target_Coord(void) const;
  75. /*
  76. ** Object entry and exit from the game system.
  77. */
  78. virtual bool Unlimbo(COORDINATE coord, DirType dir=DIR_N);
  79. virtual bool Limbo(void);
  80. virtual MoveType Can_Enter_Cell(CELL cell, FacingType facing = FACING_NONE) const;
  81. /*
  82. ** Display and rendering support functionality. Supports imagery and how
  83. ** object interacts with the map and thus indirectly controls rendering.
  84. */
  85. virtual void Draw_It(int x, int y, WindowNumberType window) const;
  86. virtual bool Mark(MarkType mark=MARK_CHANGE);
  87. unsigned char *Radar_Icon(CELL cell);
  88. /*
  89. ** User I/O.
  90. */
  91. virtual void Clicked_As_Target(HousesType house, int) {}; // 2019/09/20 JAS - Added record of who clicked on the object
  92. /*
  93. ** Combat related.
  94. */
  95. virtual void Fire_Out(void);
  96. virtual bool Catch_Fire(void);
  97. virtual ResultType Take_Damage(int & damage, int distance, WarheadType warhead, TechnoClass * source, bool forced=false);
  98. /*
  99. ** AI.
  100. */
  101. virtual void AI(void);
  102. /*
  103. ** Scenario and debug support.
  104. */
  105. #ifdef CHEAT_KEYS
  106. virtual void Debug_Dump(MonoClass *mono) const;
  107. #endif
  108. /*
  109. ** File I/O.
  110. */
  111. static void Read_INI(CCINIClass & ini);
  112. static void Write_INI(CCINIClass & ini);
  113. static char *INI_Name(void) {return "TERRAIN";};
  114. bool Load(Straw & file);
  115. bool Save(Pipe & file) const;
  116. private:
  117. /*
  118. ** If this terrain object is on fire, then this flag will be true.
  119. */
  120. unsigned IsOnFire:1;
  121. /*
  122. ** Is this a terrain object that undergoes crumbling animation and it is
  123. ** in fact crumbling at this time?
  124. */
  125. unsigned IsCrumbling:1;
  126. /*
  127. ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
  128. */
  129. unsigned char SaveLoadPadding[8];
  130. };
  131. #endif