CnC_Remastered_Collection

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

MAP.H (6973B)


      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/MAP.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 : MAP.H                                                        *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : April 29, 1994                                               *
     28  *                                                                                             *
     29  *                  Last Update : April 29, 1994   [JLB]                                       *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 #ifndef MAP_H
     36 #define MAP_H
     37 
     38 #include	"gscreen.h"
     39 #include	"crate.h"
     40 
     41 class MapClass: public GScreenClass
     42 {
     43 	public:
     44 
     45 		MapClass(void) {};
     46 		MapClass(NoInitClass const & x) : GScreenClass(x), Array(x) {};
     47 
     48 		/*
     49 		** Initialization
     50 		*/
     51 		virtual void One_Time(void);						// Theater-specific inits
     52 		virtual void Init_Clear(void);						// Clears all to known state
     53 		virtual void Alloc_Cells(void);						// Allocates buffers
     54 		virtual void Free_Cells(void);							// Frees buffers
     55 		virtual void Init_Cells(void);							// Frees buffers
     56 
     57 		/*--------------------------------------------------------
     58 		** Main functions that deal with groupings of cells within the map or deals with the cell
     59 		** as it relates to the map - not what the cell contains.
     60 		*/
     61 		CELL Pick_Random_Location(void) const;
     62 		int Intact_Bridge_Count(void) const;
     63 		bool Base_Region(CELL cell, HousesType & house, ZoneType & zone) const;
     64 		CELL Nearby_Location(CELL cell, SpeedType speed, int zone=-1, MZoneType check=MZONE_NORMAL, bool checkflagged=false, int locationmod=0) const;
     65 		ObjectClass * Close_Object(COORDINATE coord) const;
     66 		virtual void Detach(ObjectClass * ) {};
     67 		int Cell_Region(CELL cell);
     68 		int Cell_Threat(CELL cell, HousesType house);
     69 		bool In_Radar(CELL cell) const;
     70 		void Sight_From(CELL cell, int sightrange, HouseClass *house, bool incremental=false);
     71 		void Jam_From(CELL cell, int jamrange, HouseClass *house);
     72 		void Shroud_From(CELL cell, int sightrange, HouseClass *house);
     73 		void UnJam_From(CELL cell, int jamrange, HouseClass *house);
     74 		void Place_Down(CELL cell, ObjectClass * object);
     75 		void Pick_Up(CELL cell, ObjectClass * object);
     76 		void Overlap_Down(CELL cell, ObjectClass * object);
     77 		void Overlap_Up(CELL cell, ObjectClass * object);
     78 		bool Read_Binary(Straw & straw);
     79 		int Write_Binary(Pipe & pipe);
     80 		bool Place_Random_Crate(void);
     81 		bool Remove_Crate(CELL cell);
     82 		bool Zone_Reset(int method);
     83 		bool Zone_Cell(CELL cell, int zone);
     84 		int Zone_Span(CELL cell, int zone, MZoneType check);
     85 		bool Destroy_Bridge_At(CELL cell);
     86 		void Detach(TARGET target, bool all=true);
     87 		void Shroud_The_Map(HouseClass *house);
     88 
     89 		long Overpass(void);
     90 
     91 		virtual void Logic(void);
     92 		virtual void Set_Map_Dimensions(int x, int y, int w, int h);
     93 
     94 		/*
     95 		**	File I/O.
     96 		*/
     97 		virtual void Code_Pointers(void);
     98 		virtual void Decode_Pointers(void);
     99 
    100 		/*
    101 		** Debug routine
    102 		*/
    103 		int Validate(void);
    104 
    105 		/*
    106 		**	This is the dimensions and position of the sub section of the global map.
    107 		**	It is this region that appears on the radar map and constrains normal
    108 		**	movement.
    109 		*/
    110 		int MapCellX;
    111 		int MapCellY;
    112 		int MapCellWidth;
    113 		int MapCellHeight;
    114 
    115 		/*
    116 		**	This is the total value of all harvestable Tiberium on the map.
    117 		*/
    118 		long TotalValue;
    119 
    120 		CellClass & operator [] (COORDINATE coord) {return(Array[Coord_Cell(coord)]);};
    121 		CellClass & operator [] (CELL cell) {return(Array[cell]);};
    122 		CellClass const & operator [] (COORDINATE coord) const {return(Array[Coord_Cell(coord)]);};
    123 		CellClass const & operator [] (CELL cell) const {return(Array[cell]);};
    124 		int ID(CellClass const * ptr) {return(Array.ID(ptr));};
    125 		int ID(CellClass const & ptr) {return(Array.ID(ptr));};
    126 
    127 	protected:
    128 
    129 		/*
    130 		**	This is the array of cell objects.
    131 		*/
    132 		VectorClass<CellClass> Array;
    133 
    134 		/*
    135 		**	These are the size dimensions of the underlying array of cell objects.
    136 		**	This is the dimensions of the "map" that the tactical view is
    137 		**	restricted to.
    138 		*/
    139 		int	XSize;
    140 		int	YSize;
    141 		int	Size;
    142 
    143 		static int const RadiusCount[11];
    144 		static int const RadiusOffset[];
    145 
    146 		/*
    147 		**	This specifies the information for the various crates in the game.
    148 		*/
    149 		CrateClass Crates[256];
    150 
    151 	private:
    152 		friend class CellClass;
    153 
    154 		/*
    155 		**	Tiberium growth potential cells are recorded here.
    156 		*/
    157 		CELL TiberiumGrowth[MAP_CELL_W/2];
    158 		int TiberiumGrowthCount;
    159 		int TiberiumGrowthExcess;
    160 
    161 		/*
    162 		**	List of cells that are full enough strength that they could spread
    163 		**	Tiberium to adjacent cells.
    164 		*/
    165 		CELL TiberiumSpread[MAP_CELL_W/2];
    166 		int TiberiumSpreadCount;
    167 		int TiberiumSpreadExcess;
    168 
    169 		/*
    170 		**	This is the current cell number in the incremental map scan process.
    171 		*/
    172 		CELL TiberiumScan;
    173 
    174 		enum MapEnum {SCAN_AMOUNT=MAP_CELL_TOTAL};
    175 
    176 		/*
    177 		** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
    178 		*/
    179 		unsigned char SaveLoadPadding[1024];
    180 
    181 };
    182 
    183 #endif