POWER.H (4585B)
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 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/POWER.H 1 3/03/97 10:25a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** 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 *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : POWER.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : 12/15/94 * 28 * * 29 * Last Update : December 15, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef POWER_H 36 #define POWER_H 37 38 #include "radar.h" 39 40 class PowerClass : public RadarClass 41 { 42 public: 43 PowerClass(void); 44 PowerClass(NoInitClass const & x) : RadarClass(x), FlashTimer(x) {}; 45 46 /* 47 ** Initialization 48 */ 49 virtual void One_Time(void); // One-time inits 50 51 virtual void Init_Clear(void); // Clears all to known state 52 virtual void Draw_It(bool complete=false); 53 virtual void AI(KeyNumType &input, int x, int y); 54 virtual void Refresh_Cells(CELL cell, short const *list); 55 void Flash_Power(void); 56 57 unsigned IsToRedraw:1; 58 59 protected: 60 /* 61 ** This gadget is used to capture mouse input on the power bar. 62 */ 63 class PowerButtonClass : public GadgetClass { 64 public: 65 PowerButtonClass(void) : GadgetClass(0,0,0,0,LEFTPRESS|LEFTRELEASE|LEFTHELD|LEFTUP|RIGHTPRESS,true) {}; 66 67 protected: 68 virtual int Action(unsigned flags, KeyNumType & key); 69 friend class PowerClass; 70 }; 71 72 /* 73 ** This is the "button" that tracks all input to the tactical map. 74 ** It must be available to derived classes, for Save/Load purposes. 75 */ 76 static PowerButtonClass PowerButton; 77 78 enum PowerEnums { 79 POWER_X=10*ICON_PIXEL_W, 80 #ifdef WIN32 81 POWER_Y= (7+70+13), 82 POWER_HEIGHT=(200-(7+70+13)), 83 #else 84 POWER_Y= (88+9), 85 POWER_HEIGHT=80, 86 #endif 87 POWER_WIDTH=8, 88 POWER_LINE_SPACE=5, 89 POWER_LINE_WIDTH=3, 90 POWER_STEP_LEVEL=100, 91 POWER_STEP_FACTOR=5 92 }; 93 94 private: 95 int Power_Height(int value); 96 97 unsigned IsActive:1; 98 99 /* 100 ** If the power bar should be rendered with some flash effect then 101 ** this specifies the duration that the flash will occur. 102 */ 103 CDTimerClass<FrameTimerClass> FlashTimer; 104 105 int RecordedDrain; 106 int RecordedPower; 107 int DesiredDrainHeight; 108 int DesiredPowerHeight; 109 int DrainHeight; 110 int PowerHeight; 111 int DrainBounce; 112 int PowerBounce; 113 short PowerDir; 114 short DrainDir; 115 116 /* 117 ** Points to the shape to use for the "desired" power level indicator. 118 */ 119 static void const * PowerShape; 120 static void const * PowerBarShape; 121 }; 122 123 #endif