POWER.H 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/POWER.H 1 3/03/97 10:25a 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 : POWER.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 12/15/94 *
  30. * *
  31. * Last Update : December 15, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef POWER_H
  37. #define POWER_H
  38. #include "radar.h"
  39. class PowerClass : public RadarClass
  40. {
  41. public:
  42. PowerClass(void);
  43. PowerClass(NoInitClass const & x) : RadarClass(x), FlashTimer(x) {};
  44. /*
  45. ** Initialization
  46. */
  47. virtual void One_Time(void); // One-time inits
  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 void Refresh_Cells(CELL cell, short const *list);
  52. void Flash_Power(void);
  53. unsigned IsToRedraw:1;
  54. protected:
  55. /*
  56. ** This gadget is used to capture mouse input on the power bar.
  57. */
  58. class PowerButtonClass : public GadgetClass {
  59. public:
  60. PowerButtonClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {};
  61. protected:
  62. virtual int Action(unsigned flags, KeyNumType & key);
  63. friend class PowerClass;
  64. };
  65. /*
  66. ** This is the "button" that tracks all input to the tactical map.
  67. ** It must be available to derived classes, for Save/Load purposes.
  68. */
  69. static PowerButtonClass PowerButton;
  70. enum PowerEnums {
  71. POWER_X=10*ICON_PIXEL_W,
  72. #ifdef WIN32
  73. POWER_Y= (7+70+13),
  74. POWER_HEIGHT=(200-(7+70+13)),
  75. #else
  76. POWER_Y= (88+9),
  77. POWER_HEIGHT=80,
  78. #endif
  79. POWER_WIDTH=8,
  80. POWER_LINE_SPACE=5,
  81. POWER_LINE_WIDTH=3,
  82. POWER_STEP_LEVEL=100,
  83. POWER_STEP_FACTOR=5
  84. };
  85. private:
  86. int Power_Height(int value);
  87. unsigned IsActive:1;
  88. /*
  89. ** If the power bar should be rendered with some flash effect then
  90. ** this specifies the duration that the flash will occur.
  91. */
  92. CDTimerClass<FrameTimerClass> FlashTimer;
  93. int RecordedDrain;
  94. int RecordedPower;
  95. int DesiredDrainHeight;
  96. int DesiredPowerHeight;
  97. int DrainHeight;
  98. int PowerHeight;
  99. int DrainBounce;
  100. int PowerBounce;
  101. short PowerDir;
  102. short DrainDir;
  103. /*
  104. ** Points to the shape to use for the "desired" power level indicator.
  105. */
  106. static void const * PowerShape;
  107. static void const * PowerBarShape;
  108. };
  109. #endif