CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

SIDEBARGlyphx.H (7608B)


      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\sidebar.h_v   2.18   16 Oct 1995 16:45:24   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 : SIDEBAR.H                                                    *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : October 20, 1994                                             *
     28  *                                                                                             *
     29  *                  Last Update : October 20, 1994   [JLB]                                     *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 #ifndef SIDEBAR_GLYPHX_H
     36 #define SIDEBAR_GLYPHX_H
     37 
     38 #pragma once
     39 
     40 #include	"function.h"
     41 #include	"power.h"
     42 #include	"factory.h"
     43 
     44 
     45 /*
     46 **  ST - 3/14/2019 10:49AM
     47 ** 
     48 **  We are going to need one sidebar per player for multiplayer with GlyphX. We can't have different maps / cell arrays per 
     49 **  player though, so SidebarClass being in the middle of the map/display class hierarchy is a problem.
     50 ** 
     51 **  All the class static data will have to be made non-static so we can have multiple instances.
     52 ** 
     53 **  So, this is a stub sidebar class with the functionality we need just to support the exporting of production data to the
     54 **  GlyphX client.
     55 ** 
     56 ** 
     57 */
     58 
     59 
     60 
     61 
     62 class SidebarGlyphxClass
     63 {
     64 	public:
     65 		
     66 		enum SideBarClassEnums {
     67 			COLUMNS=2							// Number of side strips on sidebar.
     68 		};
     69 	
     70 		SidebarGlyphxClass(void);
     71 
     72 		/*
     73 		** Initialization
     74 		*/
     75 		void Init_Clear(HouseClass *player_ptr);						// Clears all to known state
     76 		void Init_IO(void);							// Inits button list
     77 
     78 		void AI(KeyNumType & input, int x, int y);
     79 
     80 		bool  Abandon_Production(RTTIType type, int factory);
     81 		bool  Add(RTTIType type, int ID, bool via_capture = false);
     82 		void  Recalc(void);
     83 		bool  Factory_Link(int factory, RTTIType type, int id);
     84 
     85 		/*
     86 		**	File I/O.
     87 		*/
     88 		void Code_Pointers(void);
     89 	  	void Decode_Pointers(void);
     90 		bool Load(FileClass & file);
     91 		bool Save(FileClass & file);
     92 
     93 		/*
     94 		**	Each side strip is managed by this class. It handles all strip specific
     95 		**	actions.
     96 		*/
     97 		class StripClass : public StageClass
     98 		{
     99 			class SelectClass : public ControlClass
    100 			{
    101 				public:
    102 					SelectClass(void);
    103 
    104 					void Set_Owner(StripClass & strip, int index);
    105 					StripClass * Strip;
    106 					int Index;
    107 
    108 				protected:
    109 					virtual int Action(unsigned flags, KeyNumType & key);
    110 			};
    111 
    112 			public:
    113 
    114 				StripClass(void);
    115 				bool  Add(RTTIType type, int ID, bool via_capture);
    116 				bool  Abandon_Production(int factory);
    117 				bool  AI(KeyNumType & input, int x, int y);
    118 				void  One_Time(int id);
    119 				void  Init_Clear(void);
    120 				void  Init_IO(int id);
    121 				void  Init_Theater(TheaterType theater);
    122 				bool  Recalc(void);
    123 				bool  Factory_Link(int factory, RTTIType type, int id);
    124 				void const * Get_Special_Cameo(int type);
    125 
    126 				void Set_Parent_Sidebar(SidebarGlyphxClass *parent) {ParentSidebar = parent;}
    127 
    128 				/*
    129 				**	File I/O.
    130 				*/
    131 				bool  Load(FileClass & file);
    132 				bool  Save(FileClass & file);
    133 				//void  Code_Pointers(void);
    134 				//void  Decode_Pointers(void);
    135 
    136 
    137 				/*
    138 				**	Working numbers used when rendering and processing the side strip.
    139 				*/
    140 				enum SideBarGeneralEnums {
    141 					MAX_BUILDABLES = 30			// Maximum number of object types in sidebar.
    142 				};
    143 
    144 				SidebarGlyphxClass *ParentSidebar;
    145 
    146 
    147 				/*
    148 				**	This is a unique identifier for the sidebar strip. Using this identifier,
    149 				**	it is possible to differentiate the button messages that arrive from the
    150 				**	common input button list.  It >MUST< be equal to the strip's index into
    151 				** the Column[] array, because the strip uses it to access the stripclass
    152 				** buttons.
    153 				*/
    154 				int ID;
    155 
    156 				/*
    157 				**	If construction is in progress (no other objects in this strip can
    158 				**	be started), then this flag will be true. It will be cleared when
    159 				**	the strip is free to start production again.
    160 				*/
    161 				unsigned IsBuilding:1;
    162 
    163 				/*
    164 				**	This is the count of the number of sidebar slots that are active.
    165 				*/
    166 				int BuildableCount;
    167 
    168 				/*
    169 				**	This is the array of buildable object types. This array is sorted in the order
    170 				**	that it is to be displayed. This array keeps track of which objects are building
    171 				**	and ready to be placed. The very nature of this method precludes simultaneous
    172 				**	construction of the same object type.
    173 				*/
    174 				typedef struct BuildType {
    175 					int BuildableID;
    176 					RTTIType BuildableType;
    177 					int Factory;								// Production manager.
    178 					bool BuildableViaCapture;							// Added for new sidebar functionality. ST - 9/24/2019 3:10PM
    179 				} BuildType;
    180 				BuildType Buildables[MAX_BUILDABLES];
    181 
    182 		} Column[COLUMNS];
    183 
    184 
    185 	private:
    186 		int  Which_Column(RTTIType type);
    187 
    188 		HouseClass *SidebarPlayerPtr;
    189 };
    190 
    191 
    192 
    193 void Sidebar_Glyphx_Init_Clear(HouseClass *player_ptr = NULL);
    194 void Sidebar_Glyphx_Init_IO(HouseClass *player_ptr = NULL);							// Inits button list
    195 bool Sidebar_Glyphx_Abandon_Production(RTTIType type, int factory, HouseClass *player_ptr = NULL);
    196 bool Sidebar_Glyphx_Add(RTTIType type, int ID, HouseClass *player_ptr = NULL, bool via_capture = false);
    197 void Sidebar_Glyphx_Recalc(HouseClass *player_ptr = NULL);
    198 bool Sidebar_Glyphx_Factory_Link(int factory, RTTIType type, int id, HouseClass *player_ptr = NULL);
    199 void Sidebar_Glyphx_AI(HouseClass *player_ptr, KeyNumType & input);
    200 bool Sidebar_Glyphx_Save(FileClass &file, SidebarGlyphxClass *sidebar);
    201 bool Sidebar_Glyphx_Load(FileClass &file, SidebarGlyphxClass *sidebar);
    202 void Sidebar_Glyphx_Code_Pointers(SidebarGlyphxClass *sidebar);
    203 void Sidebar_Glyphx_Decode_Pointers(SidebarGlyphxClass *sidebar);
    204 
    205 
    206 #endif //SIDEBAR_GLYPHX_H