POWER.H 4.5 KB

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