MAP.H 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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/MAP.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 : MAP.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 MAP_H
  37. #define MAP_H
  38. #include "gscreen.h"
  39. #include "crate.h"
  40. class MapClass: public GScreenClass
  41. {
  42. public:
  43. MapClass(void) {};
  44. MapClass(NoInitClass const & x) : GScreenClass(x), Array(x) {};
  45. /*
  46. ** Initialization
  47. */
  48. virtual void One_Time(void); // Theater-specific inits
  49. virtual void Init_Clear(void); // Clears all to known state
  50. virtual void Alloc_Cells(void); // Allocates buffers
  51. virtual void Free_Cells(void); // Frees buffers
  52. virtual void Init_Cells(void); // Frees buffers
  53. /*--------------------------------------------------------
  54. ** Main functions that deal with groupings of cells within the map or deals with the cell
  55. ** as it relates to the map - not what the cell contains.
  56. */
  57. CELL Pick_Random_Location(void) const;
  58. int Intact_Bridge_Count(void) const;
  59. bool Base_Region(CELL cell, HousesType & house, ZoneType & zone) const;
  60. CELL Nearby_Location(CELL cell, SpeedType speed, int zone=-1, MZoneType check=MZONE_NORMAL) const;
  61. ObjectClass * Close_Object(COORDINATE coord) const;
  62. virtual void Detach(ObjectClass * ) {};
  63. int Cell_Region(CELL cell);
  64. int Cell_Threat(CELL cell, HousesType house);
  65. bool In_Radar(CELL cell) const;
  66. void Sight_From(CELL cell, int sightrange, HouseClass *house, bool incremental=false);
  67. void Jam_From(CELL cell, int jamrange, HouseClass *house);
  68. void Shroud_From(CELL cell, int sightrange);
  69. void UnJam_From(CELL cell, int jamrange, HouseClass *house);
  70. void Place_Down(CELL cell, ObjectClass * object);
  71. void Pick_Up(CELL cell, ObjectClass * object);
  72. void Overlap_Down(CELL cell, ObjectClass * object);
  73. void Overlap_Up(CELL cell, ObjectClass * object);
  74. bool Read_Binary(Straw & straw);
  75. int Write_Binary(Pipe & pipe);
  76. bool Place_Random_Crate(void);
  77. bool Remove_Crate(CELL cell);
  78. bool Zone_Reset(int method);
  79. bool Zone_Cell(CELL cell, int zone);
  80. int Zone_Span(CELL cell, int zone, MZoneType check);
  81. bool Destroy_Bridge_At(CELL cell);
  82. void Detach(TARGET target, bool all=true);
  83. void Shroud_The_Map(void);
  84. long Overpass(void);
  85. virtual void Logic(void);
  86. virtual void Set_Map_Dimensions(int x, int y, int w, int h);
  87. /*
  88. ** File I/O.
  89. */
  90. virtual void Code_Pointers(void);
  91. virtual void Decode_Pointers(void);
  92. /*
  93. ** Debug routine
  94. */
  95. int Validate(void);
  96. /*
  97. ** This is the dimensions and position of the sub section of the global map.
  98. ** It is this region that appears on the radar map and constrains normal
  99. ** movement.
  100. */
  101. int MapCellX;
  102. int MapCellY;
  103. int MapCellWidth;
  104. int MapCellHeight;
  105. /*
  106. ** This is the total value of all harvestable Tiberium on the map.
  107. */
  108. long TotalValue;
  109. CellClass & operator [] (COORDINATE coord) {return(Array[Coord_Cell(coord)]);};
  110. CellClass & operator [] (CELL cell) {return(Array[cell]);};
  111. CellClass const & operator [] (COORDINATE coord) const {return(Array[Coord_Cell(coord)]);};
  112. CellClass const & operator [] (CELL cell) const {return(Array[cell]);};
  113. int ID(CellClass const * ptr) {return(Array.ID(ptr));};
  114. int ID(CellClass const & ptr) {return(Array.ID(ptr));};
  115. protected:
  116. /*
  117. ** This is the array of cell objects.
  118. */
  119. VectorClass<CellClass> Array;
  120. /*
  121. ** These are the size dimensions of the underlying array of cell objects.
  122. ** This is the dimensions of the "map" that the tactical view is
  123. ** restricted to.
  124. */
  125. int XSize;
  126. int YSize;
  127. int Size;
  128. static int const RadiusCount[11];
  129. static int const RadiusOffset[];
  130. /*
  131. ** This specifies the information for the various crates in the game.
  132. */
  133. CrateClass Crates[256];
  134. private:
  135. friend class CellClass;
  136. /*
  137. ** Tiberium growth potential cells are recorded here.
  138. */
  139. CELL TiberiumGrowth[MAP_CELL_W/2];
  140. int TiberiumGrowthCount;
  141. int TiberiumGrowthExcess;
  142. /*
  143. ** List of cells that are full enough strength that they could spread
  144. ** Tiberium to adjacent cells.
  145. */
  146. CELL TiberiumSpread[MAP_CELL_W/2];
  147. int TiberiumSpreadCount;
  148. int TiberiumSpreadExcess;
  149. /*
  150. ** This is the current cell number in the incremental map scan process.
  151. */
  152. CELL TiberiumScan;
  153. enum MapEnum {SCAN_AMOUNT=MAP_CELL_TOTAL};
  154. };
  155. #endif