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	  : OCONFIG.H
22 //Description : Header file for Game Config class
23 
24 #ifndef __OCONFIG_H
25 #define __OCONFIG_H
26 
27 #ifndef __OFILE_H
28 #include <OFILE.h>
29 #endif
30 
31 #include <storage_constants.h>
32 
33 //------------- Define constant -------------//
34 
35 enum { OPTION_NONE=0, OPTION_LOW, OPTION_MODERATE, OPTION_HIGH, OPTION_VERY_HIGH };
36 
37 enum { OPTION_MONSTER_NONE=0, OPTION_MONSTER_DEFENSIVE, OPTION_MONSTER_OFFENSIVE };
38 
39 enum { OPTION_VERY_EASY, OPTION_EASY, OPTION_MEDIUM, OPTION_HARD, OPTION_VERY_HARD, OPTION_CUSTOM };
40 
41 enum { OPTION_DISPLAY_MAJOR_NEWS, OPTION_DISPLAY_ALL_NEWS };
42 
43 //------------- Define constant -------------//
44 
45 enum { SMALL_STARTUP_RESOURCE  = 4000,
46 		 MEDIUM_STARTUP_RESOURCE = 7000,
47 		 LARGE_STARTUP_RESOURCE  = 12000,
48 		 VERY_LARGE_STARTUP_RESOURCE = 20000 };
49 
50 //---------- Define class Config -----------//
51 
52 #pragma pack(1)
53 class Config
54 {
55 public:
56 	void			init();
57 	void			deinit();
58 
59 	void			default_game_setting();
60 	void			default_cheat_setting();
61 	void			default_local_game_setting();
62 	void			default_preference();
63 	void			change_game_setting( Config & );
64 	void			change_preference( Config & );
65 	void			change_difficulty(int);
66 
67 	int			single_player_difficulty();
68 	int			multi_player_difficulty(int remotePlayers);
69 
70 	int 			write_file(File* filePtr);
71 	int			read_file(File* filePtr, int keepSysSettings=0);
72 	int			save(const char *);		// save to file
73 	int			load(const char *);		// load from file
74 
75 	void			reset_cheat_setting();
76 	void			enable_weather_visual();
77 	void			disable_weather_visual();
78 	void			enable_weather_audio();
79 	void			disable_weather_audio();
80 
81 public:
82 	//--------- GLOBAL GAME SETTING --------//
83 	//
84 	// parameters under GLOBAL GAME SETTING should remain unchange
85 	// after the game starts, and are the same across other players
86 	// in a multiplayer game
87 	// (i.e. change_game_setting() should updates all these setting )
88 	//
89 	//--------------------------------------//
90 
91 	//------- parameter settings --------//
92 
93 	short			difficulty_rating;
94 
95 	char			ai_nation_count;			// no. of AI nations in the game
96 	short			start_up_cash;
97 //	short			start_up_food;
98 	short			ai_start_up_cash;
99 //	short			ai_start_up_food;
100 	char			ai_aggressiveness;
101 	short			start_up_independent_town;
102 	short			start_up_raw_site;
103 	char			difficulty_level;
104 
105 	//-------- option settings  ---------//
106 
107 	char			explore_whole_map;			// whether the map is explored at first place
108 	char			fog_of_war;						// fog of war option
109 
110 	short			terrain_set;
111 	short			latitude;
112 	char			weather_effect;
113 	char			land_mass;
114 
115 	char			new_independent_town_emerge;
116 	char		 	independent_town_resistance; 	// whether independent towns' defenders have higher combat levels
117 	char			random_event_frequency;
118 	char			new_nation_emerge;
119 	char			monster_type;
120 	char			start_up_has_mine_nearby;
121 	char			random_start_up;
122 
123 	//--------- goal ----------//
124 
125 	char			goal_destroy_monster;
126 	char			goal_population_flag;
127 	char			goal_economic_score_flag;
128 	char			goal_total_score_flag;
129 	char			goal_year_limit_flag;
130 
131 	int			goal_population;
132 	int  			goal_economic_score;
133 	int			goal_total_score;
134 	int			goal_year_limit;
135 
136 	//------- game setting on fire ---------//
137 
138 	char			fire_spread_rate;          // 0 to disable, 10 for normal
139 	char			wind_spread_fire_rate;     // 0 to disable, 5 for normal
140 	char			fire_fade_rate;            // 1 for slow, 2 for fast
141 	char			fire_restore_prob;         // 0 to 100, 5 for normal
142 	char			rain_reduce_fire_rate;     // 0 to 20, 5 for normal
143 	char			fire_damage;               // 0 to disable 2 for normal
144 
145 	//--------- CHEAT GAME SETTING --------//
146 	//
147 	// parameters under CHEAT GAME SETTING can be changed
148 	// after the game starts, and must be reset in in a multiplayer game
149 	// (i.e. reset_cheat_setting() can reset all these setting )
150 	//
151 	//--------------------------------------//
152 	char			show_ai_info;
153 	char			fast_build;							// fast building everything
154 	char			disable_ai_flag;
155 	char			king_undie_flag;					// for testing game only
156 
157 	//--------- LOCAL GAME SETTING --------//
158 	//
159 	// parameters under LOCAL GAME SETTING should remain unchange
160 	// after the game starts, may not be the same across other players
161 	//
162 	//-------------------------------------//
163 
164 	char			race_id;
165 	char			player_name[HUMAN_NAME_LEN+1];
166 	char			player_nation_color;
167 
168 	char			expired_flag;
169 
170 	//--------- PREFERENCE --------//
171 	//
172 	// parameters under PREFERENCE are changeable during the game
173 	// the game will not be affect at any setting
174 	//
175 	//-------------------------------------//
176 
177 	char			opaque_report;
178 	char			disp_news_flag;
179 
180 	short			scroll_speed;					// map scrolling speed. 1-slowest, 10-fastest
181 	short			frame_speed;					// game speed, the desired frames per second
182 
183 	char			help_mode;
184 	char			disp_town_name;
185 	char			disp_spy_sign;
186 	char			show_all_unit_icon;			// 0:show icon when pointed, 1:always
187 	char			show_unit_path;				// bit 0 show unit path on ZoomMatrix, bit 1 for MapMatrix
188 
189 	//------- sound effect --------//
190 
191 	char			music_flag;
192 	short			cd_music_volume;    	// a value from 0 to 100
193 	short			wav_music_volume;		// a value from 0 to 100
194 
195 	char			sound_effect_flag;
196 	short			sound_effect_volume; 	// a value from 0 to 100
197 
198 	char			pan_control;                            // mono speaker should disable pan_control
199 
200 	//------- weather visual effect flags -------//
201 
202 	char			lightning_visual;
203 	char			earthquake_visual;
204 	char			rain_visual;
205 	char			snow_visual;
206 	char			snow_ground;			// 0=disable, 1=i_snow, 2=snow_res
207 
208 	//-------- weather audio effect flags -------//
209 
210 	char			lightning_audio;
211 	char			earthquake_audio;
212 	char			rain_audio;
213 	char			snow_audio;				// not used
214 	char			wind_audio;
215 
216 	//--------- weather visual effect parameters --------//
217 
218 	int			lightning_brightness;	// 0, 20, 40 or 60
219 	int			cloud_darkness;		// 0 to 5, 0 to disable cloud darkness
220 
221 	//-------- weather audio effect parameters ----------//
222 
223 	int32_t			lightning_volume;		// default 100
224 	int32_t			earthquake_volume;		// default 100
225 	int32_t			rain_volume;			// default 90
226 	int32_t			snow_volume;			// default 100
227 	int32_t			wind_volume;			// default 70
228 
229 	//------------ map prefernce -------------//
230 
231 	char			blacken_map;				// whether the map is blackened at the first place
232 	char			explore_mask_method;		// 0 for none, 1 for masking, 2 for remapping
233 	char			fog_mask_method;			// 1 for fast masking, 2 for slow remapping
234 };
235 #pragma pack()
236 
237 //------------------------------------------//
238 
239 extern Config config;
240 
241 #endif
242