1 #ifndef _MAP_SCREEN_INTERFACE_MAP_H
2 #define _MAP_SCREEN_INTERFACE_MAP_H
3 
4 #include "Types.h"
5 #include "UILayout.h"
6 struct SOLDIERTYPE;
7 struct VEHICLETYPE;
8 
9 
10 void InitMapScreenInterfaceMap();
11 
12 // functions
13 void DrawMapIndexBigMap( BOOLEAN fSelectedCursorIsYellow );
14 //void DrawMapIndexSmallMap( BOOLEAN fSelectedCursorIsYellow );
15 
16 void DrawMap(void);
17 
18 void GetScreenXYFromMapXY( INT16 sMapX, INT16 sMapY, INT16 *psX, INT16 *psY );
19 
20 void InitializePalettesForMap(void);
21 void ShutDownPalettesForMap( void );
22 
23 // plot path for helicopter
24 void PlotPathForHelicopter( INT16 sX, INT16 sY );
25 
26 // the temp path, where the helicopter could go
27 void PlotATemporaryPathForHelicopter( INT16 sX, INT16 sY );
28 
29 // show arrows for this char
30 void DisplayPathArrows(UINT16 usCharNum, HVOBJECT hMapHandle);
31 
32 // build path for character
33 void PlotPathForCharacter(SOLDIERTYPE&, INT16 x, INT16 y, bool tactical_traversal);
34 
35 // build temp path for character
36 void PlotATemporaryPathForCharacter(const SOLDIERTYPE* s, INT16 sX, INT16 sY);
37 
38 
39 // display current/temp paths
40 void DisplaySoldierPath( SOLDIERTYPE *pCharacter );
41 void DisplaySoldierTempPath(void);
42 void DisplayHelicopterPath( void );
43 void DisplayHelicopterTempPath( void );
44 
45 
46 // clear path after this sector
47 UINT32 ClearPathAfterThisSectorForCharacter( SOLDIERTYPE *pCharacter, INT16 sX, INT16 sY );
48 
49 // cancel path : clear the path completely and gives player feedback message that the route was canceled
50 void CancelPathForCharacter( SOLDIERTYPE *pCharacter );
51 void CancelPathForVehicle(VEHICLETYPE&, BOOLEAN fAlreadyReversed);
52 
53 // check if we have waited long enought o update temp path
54 void DisplayThePotentialPathForHelicopter(INT16 sMapX, INT16 sMapY );
55 
56 // clear out helicopter list after this sector
57 UINT32 ClearPathAfterThisSectorForHelicopter( INT16 sX, INT16 sY );
58 
59 
60 // check to see if sector is highlightable
61 bool IsTheCursorAllowedToHighLightThisSector(INT16 x, INT16 y);
62 
63 // restore background for map grids
64 void RestoreBackgroundForMapGrid( INT16 sMapX, INT16 sMapY );
65 
66 // clip blits to map view region
67 void ClipBlitsToMapViewRegion( void );
68 void ClipBlitsToMapViewRegionForRectangleAndABit( UINT32 uiDestPitchBYTES );
69 
70 // clip blits to full screen....restore after use of ClipBlitsToMapViewRegion( )
71 void RestoreClipRegionToFullScreen( void );
72 void RestoreClipRegionToFullScreenForRectangle( UINT32 uiDestPitchBYTES );
73 
74 // last sector in helicopter's path
75 INT16 GetLastSectorOfHelicoptersPath( void );
76 
77 // display info about helicopter path
78 void DisplayDistancesForHelicopter( void );
79 
80 // display where hei is
81 void DisplayPositionOfHelicopter( void );
82 
83 // check for click
84 BOOLEAN CheckForClickOverHelicopterIcon( INT16 sX, INT16 sY );
85 
86 void LoadMapScreenInterfaceMapGraphics();
87 void DeleteMapScreenInterfaceMapGraphics();
88 
89 
90 // grab the total number of militia in sector
91 INT32 GetNumberOfMilitiaInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
92 
93 
94 // create destroy
95 void CreateDestroyMilitiaPopUPRegions( void );
96 
97 // draw the militia box
98 void DrawMilitiaPopUpBox();
99 
100 
101 //Returns true if the player knows how many enemies are in the sector if that number is greater than 0.
102 //Returns false for all other cases.
103 UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY );
104 
105 //There is a special case flag used when players encounter enemies in a sector, then retreat.  The number of enemies
106 //will display on mapscreen until time is compressed.  When time is compressed, the flag is cleared, and
107 //a question mark is displayed to reflect that the player no longer knows.  This is the function that clears that
108 //flag.
109 void ClearAnySectorsFlashingNumberOfEnemies(void);
110 
111 
112 enum {
113 	ABORT_PLOTTING = 0,
114 	PATH_CLEARED,
115 	PATH_SHORTENED,
116 };
117 
118 // what the player knows about the enemies in a given sector
119 enum {
120 	KNOWS_NOTHING = 0,
121 	KNOWS_THEYRE_THERE,
122 	KNOWS_HOW_MANY,
123 };
124 
125 
126 // size of squares on the map
127 #define MAP_GRID_X		21
128 #define MAP_GRID_Y		18
129 
130 
131 // map view region
132 #define MAP_VIEW_START_X	(STD_SCREEN_X + 270)
133 #define MAP_VIEW_START_Y	(STD_SCREEN_Y + 10)
134 #define MAP_VIEW_WIDTH		336
135 #define MAP_VIEW_HEIGHT		298
136 
137 
138 // number of units wide
139 #define WORLD_MAP_X		18
140 
141 // dirty regions for the map
142 #define DMAP_GRID_X		( MAP_GRID_X + 1 )
143 #define DMAP_GRID_Y		( MAP_GRID_Y + 1 )
144 
145 
146 // Tixa position on the map
147 #define TIXA_SECTOR_X		9
148 #define TIXA_SECTOR_Y		10
149 
150 
151 // wait time until temp path is drawn, from placing cursor on a map grid
152 #define MIN_WAIT_TIME_FOR_TEMP_PATH 200
153 
154 
155 // the number of militia on the cursor
156 extern INT16 sGreensOnCursor;
157 extern INT16 sRegularsOnCursor;
158 extern INT16 sElitesOnCursor;
159 
160 // highlighted sectors
161 extern INT16 gsHighlightSectorX;
162 extern INT16 gsHighlightSectorY;
163 
164 // the viewable map bound region
165 extern SGPRect MapScreenRect;
166 
167 // draw temp path
168 extern BOOLEAN fDrawTempHeliPath;
169 
170 // selected destination char
171 extern INT8 bSelectedDestChar;
172 
173 // current assignment character
174 extern INT8 bSelectedAssignChar;
175 
176 // the contract char
177 extern INT8 bSelectedContractChar;
178 
179 // has temp path for character path or helicopter been already drawn
180 extern BOOLEAN  fTempPathAlreadyDrawn;
181 
182 // the currently selected town militia
183 extern INT16 sSelectedMilitiaTown;
184 
185 // the selected sectors
186 extern UINT16	sSelMapX;
187 extern UINT16	sSelMapY;
188 
189 
190 void    CreateDestroyMilitiaSectorButtons(void);
191 BOOLEAN CanRedistributeMilitiaInSector(INT16 sClickedSectorX, INT16 sClickedSectorY, INT8 bClickedTownId);
192 
193 #endif
194