TERRAIN.H 5.3 KB

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