1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  *
4  * Copyright 1997,1998 Enlight Software Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 //Filename    : OWORLDMT.H
22 //Description : Header file for World Matrix WorldMap & WorldZoom
23 
24 #ifndef __OWORLDMT_H
25 #define __OWORLDMT_H
26 
27 #ifndef __OMATRIX_H
28 #include <OMATRIX.h>
29 #endif
30 
31 #ifndef __ODYNARR_H
32 #include <ODYNARR.h>
33 #endif
34 
35 //-------- World matrix size ------------//
36 
37 #define MAX_WORLD_X_LOC  (World::max_x_loc)
38 #define MAX_WORLD_Y_LOC  (World::max_y_loc)
39 
40 //------------- Map window -------------//
41 
42 #define MAP_WIDTH       MAX_WORLD_X_LOC
43 #define MAP_HEIGHT      MAX_WORLD_Y_LOC
44 
45 #define MAX_MAP_WIDTH	200
46 #define MAX_MAP_HEIGHT	200
47 
48 #define MAP_X1          (588+(MAX_MAP_WIDTH-MAP_WIDTH)/2)
49 #define MAP_Y1          (56 +(MAX_MAP_HEIGHT-MAP_HEIGHT)/2)
50 #define MAP_X2          (MAP_X1+MAP_WIDTH-1)
51 #define MAP_Y2          (MAP_Y1+MAP_HEIGHT-1)
52 
53 #define MAP_LOC_HEIGHT   1 		// when MAP_VIEW_ENTIRE
54 #define MAP_LOC_WIDTH    1
55 
56 #define MAP2_LOC_HEIGHT  2			// when MAP_VIEW_SECTION
57 #define MAP2_LOC_WIDTH   2
58 
59 //----------- Zoom window -------------//
60 
61 #define ZOOM_X1           0     // World Zoom Window
62 #define ZOOM_Y1          56
63 #define ZOOM_X2         575
64 #define ZOOM_Y2         599
65 
66 #define ZOOM_WIDTH      576     // ZOOM_LOC_WIDTH(32)  * 18 = 576
67 #define ZOOM_HEIGHT     544     // ZOOM_LOC_HEIGHT(32) * 17 = 544
68 
69 #define ZOOM_LOC_HEIGHT  32     // in world zoom window
70 #define ZOOM_LOC_WIDTH   32
71 
72 #define ZOOM_X_SHIFT_COUNT  5    // x>>5 = xLoc
73 #define ZOOM_Y_SHIFT_COUNT  5    // y>>5 = yLoc
74 
75 #define ZOOM_X_PIXELS  (MAX_WORLD_X_LOC * ZOOM_LOC_WIDTH)
76 #define ZOOM_Y_PIXELS  (MAX_WORLD_Y_LOC * ZOOM_LOC_HEIGHT)
77 
78 //---------- define map modes -----------//
79 
80 #define MAP_MODE_COUNT  3
81 
82 enum { MAP_MODE_TERRAIN=0,
83 		 MAP_MODE_POWER,
84 		 MAP_MODE_SPOT,
85 	  };
86 
87 //-------- Define class MapMatrix -------//
88 
89 class MapMatrix : public Matrix
90 {
91 public:
92 	char  last_map_mode;
93 	char	map_mode;
94 	char	power_mode;		// 1-also display power regions on the zoom map, 0-only display power regions on the mini map
95 
96 public:
97 	MapMatrix();
98    ~MapMatrix();
99 
100 	void init_para();
101 	void draw();
102 	void paint();
103 	void disp();
104 	void draw_square();
105 	int  detect();
106 	void toggle_map_mode(int modeId);
107 	void cycle_map_mode();
108 
109 protected:
110 	void draw_map();
111 	int  detect_area();
112 
113 	void disp_mode_button(int putFront=0);
114 };
115 
116 //-------- Define class ZoomMatrix -------//
117 
118 class ZoomMatrix : public Matrix
119 {
120 public:
121 	DynArray land_disp_sort_array;     // an array for displaying objects in a sorted order
122 	DynArray air_disp_sort_array;
123 	DynArray land_top_disp_sort_array;
124 	DynArray land_bottom_disp_sort_array;
125 
126 	int	init_rain;
127 	int	rain_channel_id;
128 	int	wind_channel_id;
129 	int	fire_channel_id;
130 	int	last_fire_vol;
131 	int	init_lightning; // reset on new game, save on save game
132 	int	init_snow;
133 	short	last_brightness;
134 	int	vibration; // reset on new game, save on save game
135 	short	lightning_x1, lightning_y1, lightning_x2, lightning_y2; // save on save game
136 
137 public:
138    ZoomMatrix();
139 
140 	void init_para();
141 	void draw();
142 	void draw_frame();
143 	void scroll(int,int);
144 	void draw_white_site();
145 	void put_bitmap_clip(int x, int y, char* bitmapPtr,int compressedFlag=0);
146 	void put_bitmap_remap_clip(int x, int y, char* bitmapPtr, char* colorRemapTable=NULL,int compressedFlag=0);
147 	int  detect_bitmap_clip(int x, int y, char* bitmapPtr);
148 	bool is_bitmap_clip(int x, int y, char* bitmapPtr);
149 
150 protected:
151 	void draw_objects();
152 	void draw_objects_now(DynArray* unitArray, int = 0);
153 
154 	void draw_weather_effects();
155 
156 	void draw_build_marker();
157 	void draw_god_cast_range();
158 
159 	void blacken_unexplored();
160 	void blacken_fog_of_war();
161 
162 	void disp_text();
163 	void put_center_text(int x, int y, const char* str);
164 };
165 
166 //------------------------------------------------//
167 
168 #endif
169