CnC_Remastered_Collection

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

RADAR.H (7521B)


      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:   F:\projects\c&c\vcs\code\radar.h_v   2.17   16 Oct 1995 16:48:04   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 		int	RadX;
     44 		int	RadOffX;
     45 		int	RadY;
     46 		int	RadOffY;
     47 		int	RadWidth;
     48 		int   RadHeight;
     49 		int	RadIWidth;
     50 		int	RadIHeight;
     51 		int	RadPWidth;
     52 		int	RadPHeight;
     53 
     54 		RadarClass(void);
     55 
     56 		/*
     57 		** Initialization
     58 		*/
     59 		virtual void One_Time(void);							// One-time inits
     60 		virtual void Init_Clear(void);						// Clears all to known state
     61 
     62 		virtual bool Map_Cell(CELL cell, HouseClass * house, bool and_for_allies);
     63 		virtual CELL Click_Cell_Calc(int x, int y);
     64 		virtual void AI(KeyNumType &input, int x, int y);
     65 		virtual void Draw_It(bool complete=false);
     66 		virtual void Refresh_Cells(CELL cell, short const *list);
     67 		virtual void Set_Map_Dimensions(int x, int y, int w, int h);
     68 //		virtual void Set_Tactical_Position(int x, int y, int leptonx=0, int leptony=0);
     69 //		virtual void Set_Tactical_Position(CELL cell);
     70 		virtual void Set_Tactical_Position(COORDINATE coord);
     71 		void	Zoom_Mode(CELL cell);
     72 		int Click_In_Radar(int &x, int &y, bool change=false);
     73 		void Cell_XY_To_Radar_Pixel(int cellx, int celly, int &x, int &y);
     74 
     75 		void Set_Radar_Position(CELL cell);
     76 		CELL Radar_Position(void);
     77 		bool Radar_Activate(int control);
     78 		void Plot_Radar_Pixel(CELL cell);
     79 		void Radar_Pixel(CELL cell);
     80 		void Coord_To_Radar_Pixel(COORDINATE coord, int &x, int &y);
     81 		void Cursor_Cell(CELL cell, int value);
     82 		void RadarClass::Mark_Radar(int x1, int y1, int x2, int y2, int value, int barlen);
     83 		void Radar_Cursor(int forced = false);
     84 		void Render_Terrain(CELL cell, int x, int y, int size);
     85 		bool Cell_On_Radar(CELL cell);
     86 		void Render_Infantry(CELL cell, int x, int y, int size);
     87 		void Render_Overlay(CELL cell, int x, int y, int size);
     88 		void Radar_Anim(void);
     89 		bool Is_Radar_Active(void) {return IsRadarActive;};
     90 		bool Is_Radar_Activating(void) {return IsRadarActivating;};
     91 		bool Is_Radar_Existing(void) {return(DoesRadarExist);};
     92 
     93 		/*
     94 		**	File I/O.
     95 		*/
     96 		virtual void Code_Pointers(void);
     97 		virtual void Decode_Pointers(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 		void Draw_Names(void);
    105 		int Is_Zoomed(void) {return IsZoomed;}
    106 
    107 	protected:
    108 
    109 		/*
    110 		**	Radar map constant values.
    111 		*/
    112 		enum RadarClassEnums {
    113 			RADAR_ACTIVATED_FRAME=22,
    114 			MAX_RADAR_FRAMES = 41
    115 		};
    116 
    117 		/*
    118 		**	If the radar map must be completely redrawn, then this flag will be true.
    119 		**	Typical causes of this would be when the radar first appears, or when the
    120 		**	screen has been damaged.
    121 		*/
    122 		unsigned IsToRedraw:1;
    123 		unsigned RadarCursorRedraw:1;
    124 
    125 		/*
    126 		**	If the radar map is visible then this flag is true.
    127 		*/
    128 		unsigned DoesRadarExist:1;
    129 		unsigned IsRadarActive:1;
    130 		unsigned IsRadarActivating:1;
    131 		unsigned IsRadarDeactivating:1;
    132 
    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 		unsigned SpecialRadarFrame:3;
    140 		unsigned RadarAnimFrame:6;
    141 
    142 		static void const * RadarAnim;
    143 
    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 TacticalClass : public GadgetClass {
    149 			public:
    150 				TacticalClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {};
    151 
    152 			protected:
    153 				virtual int Action(unsigned flags, KeyNumType & key);
    154 			friend class RadarClass;
    155 		};
    156 		friend class TacticalClass;
    157 
    158 		/*
    159 		**	This is the "button" that tracks all input to the tactical map.
    160 		** It must be available to derived classes, for Save/Load purposes.
    161 		*/
    162 		static TacticalClass RadarButton;
    163 
    164 	private:
    165 
    166 		/*
    167 		**	The current radar position as the upper left corner cell for the
    168 		**	radar map display. The width and height is controlled by the
    169 		**	actual dimensions of the radar map display box (in pixels).
    170 		*/
    171 		unsigned RadarX;
    172 		unsigned RadarY;
    173 		unsigned RadarCell;
    174 
    175 		/*
    176 		**	This is the origin (pixel offsets) for the upper left corner
    177 		**	of the radar map within the full radar map area of the screen.
    178 		**	This is biased so that the radar map, when smaller than full
    179 		**	size will appear centered.
    180 		*/
    181 		unsigned BaseX;
    182 		unsigned BaseY;
    183 
    184 		unsigned RadarWidth;
    185 		unsigned RadarCellWidth;
    186 		unsigned RadarHeight;
    187 		unsigned RadarCellHeight;
    188 
    189 		/*
    190 		**	If the radar map is in zoom mode, then this value will be true.
    191 		*/
    192 		unsigned IsZoomed:1;
    193 
    194 		/*
    195 		** This flag is true if the radar map is in its special show-the-player
    196 		** names mode.
    197 		*/
    198 		unsigned IsPlayerNames:1;
    199 
    200 		/*
    201 		**	This is the list of radar pixels that need to be updated. Only a partial
    202 		**	list is maintained for maximum speed.
    203 		*/
    204 		unsigned PixelPtr;
    205 		int ZoomFactor;
    206 		enum PixelStackEnums {PIXELSTACK=200};
    207 		CELL PixelStack[PIXELSTACK];
    208 };
    209 
    210 
    211 #endif