POWER.H 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. ** Command & Conquer(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: F:\projects\c&c\vcs\code\power.h_v 2.16 16 Oct 1995 16:48:06 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. int PowX;
  43. int PowY;
  44. int PowWidth;
  45. int PowHeight;
  46. int PowLineSpace;
  47. int PowLineWidth;
  48. PowerClass();
  49. /*
  50. ** Initialization
  51. */
  52. virtual void One_Time(void); // One-time inits
  53. virtual void Init_Clear(void); // Clears all to known state
  54. virtual void Draw_It(bool complete=false);
  55. virtual void AI(KeyNumType &input, int x, int y);
  56. virtual void Refresh_Cells(CELL cell, short const *list);
  57. // virtual void Must_Redraw_Sidebar(void);
  58. /*
  59. ** File I/O.
  60. */
  61. virtual void Code_Pointers(void);
  62. virtual void Decode_Pointers(void);
  63. unsigned IsToRedraw:1;
  64. protected:
  65. /*
  66. ** This gadget is used to capture mouse input on the power bar.
  67. */
  68. class PowerButtonClass : public GadgetClass {
  69. public:
  70. PowerButtonClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {};
  71. protected:
  72. virtual int Action(unsigned flags, KeyNumType & key);
  73. friend class PowerClass;
  74. };
  75. /*
  76. ** This is the "button" that tracks all input to the tactical map.
  77. ** It must be available to derived classes, for Save/Load purposes.
  78. */
  79. static PowerButtonClass PowerButton;
  80. enum PowerEnums {
  81. POWER_STEP_LEVEL=100,
  82. POWER_STEP_FACTOR=6,
  83. };
  84. private:
  85. int Power_Height(int value);
  86. unsigned IsActive:1;
  87. int RecordedDrain;
  88. int RecordedPower;
  89. int DesiredDrainHeight;
  90. int DesiredPowerHeight;
  91. int DrainHeight;
  92. int PowerHeight;
  93. int DrainBounce;
  94. int PowerBounce;
  95. short PowerDir;
  96. short DrainDir;
  97. /*
  98. ** Points to the shape to use for the "desired" power level indicator.
  99. */
  100. static void const * PowerShape;
  101. /*
  102. ** Points to the shapes to be used for drawing the power bar
  103. */
  104. static void const * PowerBarShape;
  105. };
  106. #endif