CnC_Remastered_Collection

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

MAP.H (6337B)


      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\map.h_v   2.19   16 Oct 1995 16:46:12   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 
     40 #define	BIGMAP	0
     41 
     42 
     43 class MapClass: public GScreenClass
     44 {
     45 	public:
     46 
     47 		/*
     48 		** Initialization
     49 		*/
     50 		virtual void One_Time(void);						// Theater-specific inits
     51 		virtual void Init_Clear(void);						// Clears all to known state
     52 		virtual void Alloc_Cells(void);						// Allocates buffers
     53 		virtual void Free_Cells(void);							// Frees buffers
     54 		virtual void Init_Cells(void);							// Frees buffers
     55 
     56 		// Added this function to allow the editor to setup the map without setting up the entire system. - 06/18/2019 JAS
     57 		void One_Time_Editor(void);
     58 
     59 		/*--------------------------------------------------------
     60 		** Main functions that deal with groupings of cells within the map or deals with the cell
     61 		** as it relates to the map - not what the cell contains.
     62 		*/
     63 		ObjectClass *  Close_Object(COORDINATE coord) const;
     64 		virtual void Detach(ObjectClass * ) {};
     65 		int  Cell_Region(CELL cell);
     66 		int  Cell_Threat(CELL cell, HousesType house);
     67 		int  Cell_Distance(CELL cell1, CELL cell2);
     68 		bool  In_Radar(CELL cell) const;
     69 		void  Sight_From(HouseClass *house, CELL cell, int sightrange, bool incremental=false);		// Added house pointer parameter. ST - 3/6/2019 10:23AM
     70 		void  Place_Down(CELL cell, ObjectClass * object);
     71 		void  Pick_Up(CELL cell, ObjectClass * object);
     72 		void  Overlap_Down(CELL cell, ObjectClass * object);
     73 		void  Overlap_Up(CELL cell, ObjectClass * object);
     74 		bool  Read_Binary(char const *root, unsigned long *crc);
     75 		bool  Write_Binary(char const *root);
     76 		bool  Place_Random_Crate(void);
     77 
     78 		//Added for loading custom maps - 2019/10/28 JAS
     79 		bool Read_Binary_File(char const *fname, unsigned long *crc);
     80 
     81 		long  Overpass(void);
     82 
     83 		virtual void Logic(void);
     84 		virtual void Set_Map_Dimensions(int x, int y, int w, int h);
     85 
     86 		/*
     87 		**	File I/O.
     88 		*/
     89 		virtual void Code_Pointers(void);
     90 		virtual void Decode_Pointers(void);
     91 
     92 		/*
     93 		** Debug routine
     94 		*/
     95 		int Validate(void);
     96 
     97 		/*
     98 		** Catch-all for bad overlappers
     99 		*/
    100 		void Clean(void);
    101 
    102 #ifdef USE_RA_AI
    103 		/*
    104 		** Pulled in from RA for AI. ST - 7/24/2019 5:53PM
    105 		*/
    106 		CELL Nearby_Location(CELL cell) const;	//, SpeedType speed, int zone, MZoneType check) const
    107 #endif //USE_RA_AI
    108 
    109 		/*
    110 		**	This is the dimensions and position of the sub section of the global map.
    111 		**	It is this region that appears on the radar map and constrains normal
    112 		**	movement.
    113 		*/
    114 		int MapCellX;
    115 		int MapCellY;
    116 		int MapCellWidth;
    117 		int MapCellHeight;
    118 
    119 		/*
    120 		**	This is the total value of all harvestable Tiberium on the map.
    121 		*/
    122 		long TotalValue;
    123 
    124 	protected:
    125 
    126 		/*
    127 		**	These are the size dimensions of the underlying array of cell objects.
    128 		**	This is the dimensions of the "map" that the tactical view is
    129 		**	restricted to.
    130 		*/
    131 		int	XSize;
    132 		int	YSize;
    133 		int	Size;
    134 
    135 		static int const RadiusCount[11];
    136 		static int const RadiusOffset[];
    137 
    138 	private:
    139 		friend class CellClass;
    140 
    141 		/*
    142 		**	Tiberium growth potiential cells are recorded here.
    143 		*/
    144 		CELL TiberiumGrowth[50];
    145 		int TiberiumGrowthCount;
    146 
    147 		/*
    148 		**	List of cells that are full enough strength that they could spread
    149 		**	Tiberium to adjacent cells.
    150 		*/
    151 		CELL TiberiumSpread[50];
    152 		int TiberiumSpreadCount;
    153 
    154 		/*
    155 		**	This is the current cell number in the incremental map scan process.
    156 		*/
    157 		CELL TiberiumScan;
    158 
    159 		/*
    160 		**	If the Tiberium map scan is processing forward, then this flag
    161 		**	will be true. It alternates between forward and backward scanning
    162 		**	in order to avoid the "Tiberium Creep".
    163 		*/
    164 		unsigned IsForwardScan:1;
    165 
    166 		enum MapEnum {SCAN_AMOUNT=MAP_CELL_TOTAL};
    167 
    168 		/*
    169 		** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
    170 		*/
    171 		unsigned char SaveLoadPadding[1024];
    172 };
    173 
    174 #endif