CnC_Remastered_Collection

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

HELP.H (5483B)


      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/HELP.H 1     3/03/97 10:24a 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 : HELP.H                                                       *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 11/18/94                                                     *
     28  *                                                                                             *
     29  *                  Last Update : November 18, 1994 [JLB]                                      *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 #ifndef HELP_H
     36 #define HELP_H
     37 
     38 #include	"tab.h"
     39 
     40 #define HELP_TEXT_COLOR 80	//158		//Goldy/orange
     41 
     42 class HelpClass: public TabClass
     43 {
     44 	public:
     45 		HelpClass(void);
     46 		HelpClass(NoInitClass const & x) : TabClass(x) {};
     47 
     48 		/*
     49 		** Initialization
     50 		*/
     51 		virtual void Init_Clear(void);						// Clears all to known state
     52 
     53 		virtual void Draw_It(bool complete=false);
     54 		virtual void AI(KeyNumType &input, int x, int y);
     55 		virtual bool Scroll_Map(DirType facing, int &distance, bool really);
     56 		virtual void Set_Tactical_Position(COORDINATE coord);
     57 
     58 		void Help_Text(int text, int x=-1, int y=-1, int color=LTGREY, bool quick=false);
     59 		void Set_Cost(int cost);
     60 		short const * Overlap_List(void) const;
     61 
     62 	private:
     63 
     64 		static char const *HelpText;
     65 		int HelpX;
     66 		int HelpY;
     67 		int HelpWidth;
     68 
     69 
     70 		void Set_Text(int text);
     71 
     72 		/*
     73 		**	If the help text is right justified (as with the help text that pops up over the
     74 		**	sidebar icons), then this flag is set to true.
     75 		*/
     76 		unsigned IsRight:1;
     77 
     78 		/*
     79 		**	If the optional second line of text that displays cost is desired, then this
     80 		**	value will be non-zero. Typically, this is true when the help text is associated
     81 		**	with one of the sidebar construction icons.
     82 		*/
     83 		int Cost;
     84 
     85 		/*
     86 		**	This is the recorded position of the cursor at the time the help text
     87 		**	pops up. The help text is rendered as an offset from this pixel position.
     88 		*/
     89 		int X;
     90 		int Y;
     91 
     92 		/*
     93 		**	This is the draw X and Y coordinate. This position is relative to the X and
     94 		**	Y coordinates but adjusted for screen edges as necessary.
     95 		*/
     96 		int DrawX;
     97 		int DrawY;
     98 
     99 		/*
    100 		**	The width of the help text (in pixels) is stored here. This is a convenience
    101 		**	since calculating the width takes a bit of time.
    102 		*/
    103 		int Width;
    104 
    105 		/*
    106 		**	The text number of the help text to display is held here. If no text is to be
    107 		**	displayed, then this value will be TXT_NONE.
    108 		*/
    109 		int Text;
    110 
    111 		/*
    112 		**	This is the background color to use for the help text. It can change according
    113 		**	to the message displayed.
    114 		*/
    115 		int Color;
    116 
    117 		/*
    118 		**	This countdown timer controls when the help text will pop up. If the mouse
    119 		**	remains stationary while this countdown timer expires, then the help text
    120 		**	will pop up.
    121 		*/
    122 		CDTimerClass<SystemTimerClass> CountDownTimer;
    123 
    124 		/*
    125 		**	This is a calculated cell offset list (from the Map.TacticalCell) that indicates
    126 		**	which cells are under the help text and thus which cells need to be redrawn if
    127 		**	the help text is to be erased.
    128 		*/
    129 		//static short const OverlapList[60];  // Can't be const - it's expected to be written to. ST - 2/7/2019 5:16PM		
    130 		static short OverlapList[60];
    131 
    132 		enum HelpClassEnum {
    133 			HELP_DELAY=TIMER_SECOND*1,				// The countdown timer delay before help text pops up.
    134 			Y_OFFSET=0,					// The Y pixel offset from cursor for help text print.
    135 			X_OFFSET=12					// The X pixel offset from cursor for help text print.
    136 		};
    137 };
    138 
    139 
    140 #endif