CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

RADAR.H (8728B)


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