HELP.H 5.1 KB

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