HELP.H 5.4 KB

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