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