RADAR.H 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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/RADAR.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 : RADAR.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 12/15/94 *
  30. * *
  31. * Last Update : December 15, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef RADAR_H
  37. #define RADAR_H
  38. #include "display.h"
  39. class RadarClass: public DisplayClass
  40. {
  41. public:
  42. RadarClass(void);
  43. RadarClass(NoInitClass const & x) : DisplayClass(x) {};
  44. /*
  45. ** The dimensions and coordinates of the radar map.
  46. */
  47. int RadX;
  48. int RadOffX;
  49. int RadY;
  50. int RadOffY;
  51. int RadWidth;
  52. int RadHeight;
  53. int RadIWidth;
  54. int RadIHeight;
  55. int RadPWidth;
  56. int RadPHeight;
  57. /*
  58. ** Initialization
  59. */
  60. virtual void One_Time(void); // One-time inits
  61. virtual void Init_Clear(void); // Clears all to known state
  62. virtual void Flag_Cell(CELL cell);
  63. virtual bool Map_Cell(CELL cell, HouseClass * house);
  64. virtual bool Jam_Cell(CELL cell, HouseClass * house);
  65. virtual bool UnJam_Cell(CELL cell, HouseClass * house);
  66. virtual CELL Click_Cell_Calc(int x, int y) const;
  67. virtual void AI(KeyNumType &input, int x, int y);
  68. virtual void Draw_It(bool complete=false);
  69. virtual void Refresh_Cells(CELL cell, short const *list);
  70. virtual void Set_Map_Dimensions(int x, int y, int w, int h);
  71. virtual void Set_Tactical_Position(COORDINATE coord);
  72. void Zoom_Mode(CELL cell);
  73. int Click_In_Radar(int &x, int &y, bool change=false) const;
  74. void Cell_XY_To_Radar_Pixel(int cellx, int celly, int &x, int &y);
  75. bool Is_Zoomable(void) const;
  76. void Set_Radar_Position(CELL cell);
  77. CELL Radar_Position(void);
  78. bool Radar_Activate(int control);
  79. void Plot_Radar_Pixel(CELL cell);
  80. void Radar_Pixel(CELL cell);
  81. void Coord_To_Radar_Pixel(COORDINATE coord, int &x, int &y);
  82. void Cursor_Cell(CELL cell, int value);
  83. void RadarClass::Mark_Radar(int x1, int y1, int x2, int y2, int value, int barlen);
  84. void Radar_Cursor(int forced = false);
  85. void Render_Terrain(CELL cell, int x, int y, int size);
  86. bool Cell_On_Radar(CELL cell);
  87. void Render_Infantry(CELL cell, int x, int y, int size);
  88. void Render_Overlay(CELL cell, int x, int y, int size);
  89. void Radar_Anim(void);
  90. bool Is_Radar_Active(void);
  91. bool Is_Radar_Existing(void);
  92. /*
  93. ** Toggles player names on & off
  94. */
  95. void Player_Names(bool on);
  96. int Is_Player_Names(void) {return IsPlayerNames;}
  97. bool Spying_On_House(void) {return IsHouseSpy;}
  98. void Draw_Names(void);
  99. bool Draw_House_Info(void);
  100. int Is_Zoomed(void) {return IsZoomed;}
  101. bool Get_Jammed(void);
  102. void Set_Jammed(bool jam) {IsRadarJammed = jam;}
  103. bool Spy_Next_House(void);
  104. void Activate_Pulse(void);
  105. protected:
  106. /*
  107. ** Radar map constant values.
  108. */
  109. enum RadarClassEnums {
  110. RADAR_ACTIVATED_FRAME=22,
  111. MAX_RADAR_FRAMES = 41
  112. };
  113. /*
  114. ** If the radar map must be completely redrawn, then this flag will be true.
  115. ** Typical causes of this would be when the radar first appears, or when the
  116. ** screen has been damaged.
  117. */
  118. unsigned IsToRedraw:1;
  119. unsigned RadarCursorRedraw:1;
  120. /*
  121. ** If the radar map is visible then this flag is true.
  122. */
  123. unsigned DoesRadarExist:1;
  124. unsigned IsRadarActive:1;
  125. unsigned IsRadarActivating:1;
  126. unsigned IsRadarDeactivating:1;
  127. unsigned IsRadarJammed:1;
  128. /*
  129. ** Flag to tell whether sonar pulse should be displayed on radar map
  130. */
  131. unsigned IsPulseActive:1;
  132. int RadarPulseFrame;
  133. /*
  134. ** Special radar frame is set when a new location is selected on the
  135. ** radar map. It counts down through the special radar cursors until
  136. ** either the radar cursor becomes normal or the radar cursor is moved
  137. ** again.
  138. */
  139. int SpecialRadarFrame;
  140. int RadarAnimFrame;
  141. static void const * RadarAnim;
  142. static void const * RadarPulse;
  143. static void const * RadarFrame;
  144. /*
  145. ** This gadget class is used for capturing input to the tactical map. All mouse input
  146. ** will be routed through this gadget.
  147. */
  148. class RTacticalClass : public GadgetClass {
  149. public:
  150. RTacticalClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {};
  151. protected:
  152. virtual int Action(unsigned flags, KeyNumType & key);
  153. friend class RadarClass;
  154. };
  155. friend class RTacticalClass;
  156. /*
  157. ** This is the "button" that tracks all input to the tactical map.
  158. ** It must be available to derived classes, for Save/Load purposes.
  159. */
  160. static RTacticalClass RadarButton;
  161. private:
  162. /*
  163. ** The current radar position as the upper left corner cell for the
  164. ** radar map display. The width and height is controlled by the
  165. ** actual dimensions of the radar map display box (in pixels).
  166. */
  167. unsigned RadarX;
  168. unsigned RadarY;
  169. unsigned RadarCellWidth;
  170. unsigned RadarCellHeight;
  171. unsigned RadarCell;
  172. /*
  173. ** This is the origin (pixel offsets) for the upper left corner
  174. ** of the radar map within the full radar map area of the screen.
  175. ** This is biased so that the radar map, when smaller than full
  176. ** size will appear centered.
  177. */
  178. unsigned BaseX;
  179. unsigned BaseY;
  180. unsigned RadarWidth;
  181. unsigned RadarHeight;
  182. /*
  183. ** If the radar map is in zoom mode, then this value will be true.
  184. */
  185. unsigned IsZoomed:1;
  186. /*
  187. ** This flag is true if the radar map is in its special show-the-player
  188. ** names mode.
  189. */
  190. unsigned IsPlayerNames:1;
  191. /*
  192. ** This flag is true if the radar map is in its special show-the-units
  193. ** of-another-house mode.
  194. */
  195. unsigned IsHouseSpy:1;
  196. /*
  197. ** This is the zoom factor to use. This value is the number of pixels wide
  198. ** each cell will occupy on the radar map. Completely zoomed out would be a
  199. ** value of 1.
  200. */
  201. int ZoomFactor;
  202. /*
  203. ** If we're spying on a house's radar facility, this field shows the
  204. ** name of the house we're spying on.
  205. */
  206. HousesType SpyingOn;
  207. /*
  208. ** This is the list of radar pixels that need to be updated. Only a partial
  209. ** list is maintained for maximum speed.
  210. */
  211. unsigned PixelPtr;
  212. enum PixelStackEnums {PIXELSTACK=400};
  213. CELL PixelStack[PIXELSTACK];
  214. };
  215. #endif