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