MAP.H 6.8 KB

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