1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2003
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D 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 //    Scorched3D 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 Scorched3D; if not, write to the Free Software
18 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #include "Display-def.cpp"
22 
createMainControls(wxWindow * parent,wxSizer * sizer)23 static void createMainControls(wxWindow *parent, wxSizer *sizer)
24 {
25 	{
26 	// Display settings
27 	wxStaticBox *displayBox = new wxStaticBox(parent, -1, wxT("&Display"));
28 	wxStaticBoxSizer *displaySizer = new wxStaticBoxSizer(displayBox, wxVERTICAL);
29 	wxFlexGridSizer *displaySizer2 = new wxFlexGridSizer(2, 3, 5, 5);
30 	wxStaticText *resText = new wxStaticText(parent, -1, wxT("&Resolution :"));
31 	IDC_DISPLAY_CTRL =
32 		new wxComboBox(parent, -1,
33 		wxT(""),
34 		wxDefaultPosition, wxSize(315, -1),
35 		0, 0, wxCB_READONLY);
36 	IDC_FULLSCREEN_CTRL =
37 		new wxCheckBox(parent, -1, wxT("Full Screen"));
38 	IDC_MORERES_CTRL =
39 		new wxCheckBox(parent, ID_MORERES, wxT("More Resolutions"));
40 	displaySizer2->Add(resText, 0, wxALIGN_CENTER_VERTICAL);
41 	displaySizer2->Add(IDC_DISPLAY_CTRL, 0);
42 	displaySizer2->Add(IDC_FULLSCREEN_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
43 	wxStaticText *brightText = new wxStaticText(parent, -1, wxT("&Brightness :"));
44 	IDC_SLIDER1_CTRL =
45 		new wxSlider(parent, -1,
46 		0,0,0,
47 		wxDefaultPosition, wxSize(315, -1),
48 		wxSL_HORIZONTAL | wxSL_AUTOTICKS);
49 	displaySizer2->Add(brightText, 0, wxALIGN_CENTER_VERTICAL);
50 	displaySizer2->Add(IDC_SLIDER1_CTRL, 0);
51 	displaySizer2->Add(IDC_MORERES_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
52 	displaySizer->Add(displaySizer2, 0);
53 
54 	wxFlexGridSizer *displaySizer3 = new wxFlexGridSizer(1, 7, 5, 5);
55 
56 	displaySizer3->Add(new wxStaticText(parent, -1, wxT("&UI/HUD Scale :")));
57 	IDC_TINYDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Tiny"),
58 		wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
59 	IDC_SMALLDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Small"));
60 	IDC_MEDIUMDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
61 	IDC_LARGEDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Large"));
62         wxStaticText *frameLimitText = new wxStaticText(parent, -1, wxT("     Limit Framerate :"));
63 	IDC_FRAMELIMIT_CTRL =
64 		new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(60, -1));
65 	displaySizer3->Add(IDC_TINYDIALOGS_CTRL);
66 	displaySizer3->Add(IDC_SMALLDIALOGS_CTRL);
67 	displaySizer3->Add(IDC_MEDIUMDIALOGS_CTRL);
68 	displaySizer3->Add(IDC_LARGEDIALOGS_CTRL);
69 	displaySizer3->Add(frameLimitText, -1, wxALIGN_CENTRE_VERTICAL);
70 	displaySizer3->Add(IDC_FRAMELIMIT_CTRL);
71 	displaySizer->Add(displaySizer3, 0, wxTOP | wxBOTTOM, 10);
72 	sizer->Add(displaySizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
73 
74 	wxStaticText *aliasText = new wxStaticText(parent, -1, wxT("Anti Aliasing :"));
75 	displaySizer2->Add(aliasText, 0);
76 	IDC_ANTIALIAS_CTRL = new wxComboBox(parent, -1,
77 		wxT(""),
78 		wxDefaultPosition, wxSize(60, -1),
79 		0, 0, wxCB_READONLY);
80 	displaySizer2->Add(IDC_ANTIALIAS_CTRL, 0);
81 	IDC_FOCUSPAUSE_CTRL =
82 		new wxCheckBox(parent, -1, wxT("Pause graphics when not focused"));
83 	displaySizer2->Add(IDC_FOCUSPAUSE_CTRL, 0);
84 
85 	}
86 
87 	{
88 	// Sound settings
89 	wxStaticBox *soundBox = new wxStaticBox(parent, -1, wxT("&Sound"));
90 	wxStaticBoxSizer *soundSizerMain = new wxStaticBoxSizer(soundBox, wxVERTICAL);
91 	wxFlexGridSizer *soundSizer1 = new wxFlexGridSizer(4, 2);
92 	wxStaticText *volumeText = new wxStaticText(parent, -1, wxT("Sound Volume :"));
93 	wxStaticText *musicVolumeText = new wxStaticText(parent, -1, wxT("Music Volume :"));
94 	wxStaticText *ambientVolumeText = new wxStaticText(parent, -1, wxT("Ambient Volume :"));
95 	IDC_VOLUME_CTRL =
96 		new wxSlider(parent, -1,
97 		0,0,0,
98 		wxDefaultPosition, wxSize(315, -1),
99 		wxSL_HORIZONTAL | wxSL_AUTOTICKS);
100 	IDC_SOUNDCHANNELS_CTRL =
101 		new wxComboBox(parent, -1,
102 			wxT(""),
103 			wxDefaultPosition, wxSize(55, -1),
104 			0, 0, wxCB_READONLY);
105 	IDC_MUSICVOLUME_CTRL =
106 		new wxSlider(parent, -1,
107 		0,0,0,
108 		wxDefaultPosition, wxSize(315, -1),
109 		wxSL_HORIZONTAL | wxSL_AUTOTICKS);
110 	IDC_AMBIENTVOLUME_CTRL =
111 		new wxSlider(parent, -1,
112 		0,0,0,
113 		wxDefaultPosition, wxSize(315, -1),
114 		wxSL_HORIZONTAL | wxSL_AUTOTICKS);
115 	IDC_NOSOUND_CTRL =
116 		new wxCheckBox(parent, -1, wxT("No Sound"));
117 	IDC_NOMUSIC_CTRL =
118 		new wxCheckBox(parent, -1, wxT("No Music"));
119 	soundSizer1->Add(volumeText, 0, wxRIGHT, 10);
120 	soundSizer1->Add(IDC_VOLUME_CTRL, 0, wxRIGHT, 10);
121 	soundSizer1->Add(IDC_SOUNDCHANNELS_CTRL, 0, wxRIGHT, 5);
122 	soundSizer1->Add(new wxStaticText(parent, -1, wxT("Channels")), 0, wxALIGN_CENTRE_VERTICAL);
123 	soundSizer1->Add(ambientVolumeText, 0, wxRIGHT, 10);
124 	soundSizer1->Add(IDC_AMBIENTVOLUME_CTRL, 0, wxRIGHT, 10);
125 	soundSizer1->Add(IDC_NOSOUND_CTRL, 0, wxRIGHT, 0);
126 	soundSizer1->Add(new wxStaticText(parent, -1, wxT("")), 0, wxRIGHT, 0);
127 	soundSizer1->Add(musicVolumeText, 0, wxRIGHT, 10);
128 	soundSizer1->Add(IDC_MUSICVOLUME_CTRL, 0, wxRIGHT, 10);
129 	soundSizer1->Add(IDC_NOMUSIC_CTRL, 0, wxRIGHT, 0);
130 	soundSizerMain->Add(soundSizer1, 0, wxGROW | wxTOP, 5);
131 	sizer->Add(soundSizerMain, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
132 	}
133 
134 	{
135 	// Load settings
136 	wxStaticBox *speedBox = new wxStaticBox(parent, -1,
137 		wxT("Game Detail Options"));
138 	wxStaticBoxSizer *speedSizer = new wxStaticBoxSizer(speedBox, wxHORIZONTAL);
139 
140 	wxGridSizer *loadSizer = new wxFlexGridSizer(2, 2);
141 	IDC_LOADULTRA_CTRL = new wxButton(parent,  ID_LOADULTRA, wxT("&Ultra Detail"), wxDefaultPosition, wxSize(120,-1));
142 	IDC_LOADDEFAULTS_CTRL = new wxButton(parent, ID_LOADDEFAULTS, wxT("&Normal Detail"), wxDefaultPosition, wxSize(120,-1));
143 	IDC_LOADMEDIUM_CTRL = new wxButton(parent, ID_LOADMEDIUM, wxT("Faster Detail"), wxDefaultPosition, wxSize(120,-1));
144 	IDC_LOADFASTEST_CTRL = new wxButton(parent, ID_LOADFASTEST, wxT("Fastest Detail"), wxDefaultPosition, wxSize(120,-1));
145 	IDC_LOADSAFE_CTRL = new wxButton(parent, ID_LOADSAFE, wxT("Safe Mode"), wxDefaultPosition, wxSize(120,-1));
146 	loadSizer->Add(IDC_LOADULTRA_CTRL, 0, wxALL, 2);
147 	loadSizer->Add(new wxStaticText(parent, -1, wxT("Use ultra detail settings for Scorched3D. (For V FAST machines)")),
148 		0, wxALL, 2);
149 	loadSizer->Add(IDC_LOADDEFAULTS_CTRL, 0, wxALL, 2);
150 	loadSizer->Add(new wxStaticText(parent, -1, wxT("Use normal detail settings for Scorched3D. (For FAST machines)")),
151 		0, wxALL, 2);
152 	loadSizer->Add(IDC_LOADMEDIUM_CTRL, 0, wxALL, 2);
153 	loadSizer->Add(new wxStaticText(parent, -1, wxT("Use faster detail settings for Scorched3D. (For MEDIUM machines)\n"
154 		"Note: This will result in a slightly reduced graphical experience.")),
155 		0, wxALL, 2);
156 	loadSizer->Add(IDC_LOADFASTEST_CTRL, 0, wxALL, 2);
157 	loadSizer->Add(new wxStaticText(parent, -1, wxT("Use fastest detail settings for Scorched3D. (For SLOW machines)\n"
158 		"Note: This will result in a greatly reduced graphical and audio experience.")),
159 		0, wxALL, 2);
160 	loadSizer->Add(IDC_LOADSAFE_CTRL, 0, wxALL, 2);
161 	loadSizer->Add(new wxStaticText(parent, -1, wxT("Use safest settings for Scorched3D.\n"
162 		"Note: This will result in a greatly reduced overall experience but may prevent crashes.")),
163 		0, wxALL, 2);
164 
165 	speedSizer->Add(loadSizer, 0, wxGROW);
166 	sizer->Add(speedSizer, 0, wxGROW | wxTOP | wxALIGN_CENTER, 5);
167 	}
168 }
169 
createOtherControls(wxWindow * parent,wxSizer * sizer)170 static void createOtherControls(wxWindow *parent, wxSizer *sizer)
171 {
172 	{
173 	// Misc switches
174 	wxStaticBox *miscBox = new wxStaticBox(parent, -1,
175 		wxT("Misc. Options"));
176 	wxStaticBoxSizer *miscSizer = new wxStaticBoxSizer(miscBox, wxHORIZONTAL);
177 	wxGridSizer *miscSizer2 = new wxGridSizer(3, 3, 10, 10);
178 	IDC_INVERT_CTRL =
179 		new wxCheckBox(parent, -1, wxT("Invert key elevation"));
180 	miscSizer2->Add(IDC_INVERT_CTRL, 0);
181 	IDC_INVERTMOUSE_CTRL =
182 		new wxCheckBox(parent, -1, wxT("Invert mouse elevation"));
183 	miscSizer2->Add(IDC_INVERTMOUSE_CTRL, 0);
184 	//IDC_SWAPYAXIS_CTRL =
185 	//	new wxCheckBox(parent, -1, wxT("Invert mouse y axis (OS X)"));
186 	//miscSizer2->Add(IDC_SWAPYAXIS_CTRL, 0);
187 	IDC_TIMER_CTRL =
188 		new wxCheckBox(parent, -1, wxT("Show frames per second"));
189 	miscSizer2->Add(IDC_TIMER_CTRL, 0);
190 	IDC_SMOUSE_CTRL =
191 		new wxCheckBox(parent, -1, wxT("Software Mouse"));
192 	miscSizer2->Add(IDC_SMOUSE_CTRL, 0);
193 	IDC_VALIDATESERVER_CTRL =
194 		new wxCheckBox(parent, -1, wxT("Validate Server Ip"));
195 	miscSizer2->Add(IDC_VALIDATESERVER_CTRL, 0);
196 	IDC_SIDESCROLL_CTRL =
197 		new wxCheckBox(parent, -1, wxT("Side Scrolling"));
198 	miscSizer2->Add(IDC_SIDESCROLL_CTRL, 0);
199 	IDC_PLAYERCAMERA_CTRL =
200 		new wxCheckBox(parent, -1, wxT("Remember camera pos"));
201 	miscSizer2->Add(IDC_PLAYERCAMERA_CTRL, 0);
202 	IDC_LOGGING_CTRL =
203 		new wxCheckBox(parent, -1, wxT("Client Logging"));
204 	miscSizer2->Add(IDC_LOGGING_CTRL, 0);
205 	miscSizer->Add(miscSizer2, 0, wxGROW);
206 	sizer->Add(miscSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
207 	}
208 }
209 
createSpeedControls(wxWindow * parent,wxSizer * sizer)210 static void createSpeedControls(wxWindow *parent, wxSizer *sizer)
211 {
212 	// Texture sizes (small med large)
213 	wxStaticBox *textureBox = new wxStaticBox(parent, -1, wxT("Level of Detail settings"));
214 	wxStaticBoxSizer *textureSizer = new wxStaticBoxSizer(textureBox, wxVERTICAL);
215 	wxGridSizer *textureSizer2 = new wxGridSizer(3, 4, 10, 10);
216 	wxStaticText *texSizeText = new wxStaticText(parent, -1, wxT("Texture Sizes :"));
217 	textureSizer2->Add(texSizeText, 0, wxALIGN_CENTER_VERTICAL);
218 	IDC_SMALLTEX_CTRL = new wxRadioButton(parent, -1, wxT("Small (3dfx/faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
219 	textureSizer2->Add(IDC_SMALLTEX_CTRL, 0);
220 	IDC_MEDIUMTEX_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
221 	textureSizer2->Add(IDC_MEDIUMTEX_CTRL, 0);
222 	IDC_LARGETEX_CTRL = new wxRadioButton(parent, -1, wxT("Large (slower)"));
223 	textureSizer2->Add(IDC_LARGETEX_CTRL, 0);
224 	wxStaticText *tankSizeText = new wxStaticText(parent, -1, wxT("Tank Detail :"));
225 	textureSizer2->Add(tankSizeText, 0, wxALIGN_CENTER_VERTICAL);
226 	IDC_LOWTANK_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
227 	textureSizer2->Add(IDC_LOWTANK_CTRL, 0);
228 	IDC_MEDIUMTANK_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
229 	textureSizer2->Add(IDC_MEDIUMTANK_CTRL, 0);
230 	IDC_HIGHTANK_CTRL = new wxRadioButton(parent, -1, wxT("Max (slower)"));
231 	textureSizer2->Add(IDC_HIGHTANK_CTRL, 0);
232 	wxStaticText *effectSizeText = new wxStaticText(parent, -1, wxT("Effects Detail :"));
233 	textureSizer2->Add(effectSizeText, 0, wxALIGN_CENTER_VERTICAL);
234 	IDC_LOWEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
235 	textureSizer2->Add(IDC_LOWEFFECTS_CTRL, 0);
236 	IDC_MEDIUMEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
237 	textureSizer2->Add(IDC_MEDIUMEFFECTS_CTRL, 0);
238 	IDC_HIGHEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("High (slower)"));
239 	textureSizer2->Add(IDC_HIGHEFFECTS_CTRL, 0);
240 	textureSizer->Add(textureSizer2, 0, wxGROW);
241 
242 	wxFlexGridSizer *textureSizer3 = new wxFlexGridSizer(1, 2, 10, 10);
243 	textureSizer3->Add(new wxStaticText(parent, -1, wxT("Land Error :")));
244 	IDC_LANDLOD_CTRL =
245 	new wxSlider(parent, -1,
246 				 0,0,0,
247 				 wxDefaultPosition, wxSize(315, -1),
248 				 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
249 	textureSizer3->Add(IDC_LANDLOD_CTRL, 0, wxGROW);
250 	textureSizer->Add(textureSizer3, 0, wxGROW | wxTOP, 10);
251 
252 	sizer->Add(textureSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
253 
254 	// Detail switches
255 	{
256 		wxStaticBox *waterDetailBox = new wxStaticBox(parent, -1,
257 													  wxT("Graphics Detail"));
258 		wxStaticBoxSizer *waterDetailSizer = new wxStaticBoxSizer(waterDetailBox, wxHORIZONTAL);
259 		wxGridSizer *waterDetailSizer2 = new wxGridSizer(3, 1, 10, 10);
260 
261 		IDC_NOWATERREF_CTRL =
262 		new wxCheckBox(parent, -1, wxT("Don't draw water reflections - Large Framerate Improvement"));
263 		waterDetailSizer2->Add(IDC_NOWATERREF_CTRL, 0);
264 		IDC_NOWATERMOVEMENT_CTRL =
265 		new wxCheckBox(parent, -1, wxT("Don't draw water movement - Large Framerate Improvement"));
266 		waterDetailSizer2->Add(IDC_NOWATERMOVEMENT_CTRL, 0);
267 		IDC_NOWATER_CTRL =
268 		new wxCheckBox(parent, -1, wxT("Don't draw water - Large Framerate Improvement"));
269 		waterDetailSizer2->Add(IDC_NOWATER_CTRL, 0);
270 		IDC_NOWATERWAVES_CTRL =
271 		new wxCheckBox(parent, -1, wxT("Don't draw water breakers - Small Loading Speed Improvement"));
272 		waterDetailSizer2->Add(IDC_NOWATERWAVES_CTRL, 0);
273 		IDC_NOWATERLOD_CTRL =
274 		new wxCheckBox(parent, -1, wxT("Draw simplistic water - Medium Framerate Improvement"));
275 		waterDetailSizer2->Add(IDC_NOWATERLOD_CTRL, 0);
276 		IDC_NOSHADERS_CTRL =
277 		new wxCheckBox(parent, -1, wxT("No GL shaders - Large Framerate Improvement"));
278 		waterDetailSizer2->Add(IDC_NOSHADERS_CTRL, 0);
279 		IDC_SIMPLEWATERSHADERS_CTRL =
280 		new wxCheckBox(parent, -1, wxT("Simple water shaders - Medium Framerate Improvement"));
281 		waterDetailSizer2->Add(IDC_SIMPLEWATERSHADERS_CTRL, 0);
282 		IDC_NOOBJECTSHADOWS_CTRL =
283 		new wxCheckBox(parent, -1, wxT("No GL shadows for objects - Medium Framerate Improvement"));
284 		waterDetailSizer2->Add(IDC_NOOBJECTSHADOWS_CTRL, 0);
285 		IDC_NOOBJECTREFLECTIONS_CTRL =
286 		new wxCheckBox(parent, -1, wxT("No water reflections for objects - Medium Framerate Improvement"));
287 		waterDetailSizer2->Add(IDC_NOOBJECTREFLECTIONS_CTRL, 0);
288 		IDC_NOPARTICLEREFLECTIONS_CTRL =
289 		new wxCheckBox(parent, -1, wxT("No water reflections for particles - Small Framerate Improvement"));
290 		waterDetailSizer2->Add(IDC_NOPARTICLEREFLECTIONS_CTRL, 0);
291 		IDC_NOSHADOWS_CTRL =
292 		new wxCheckBox(parent, -1, wxT("No GL shadows - Large Framerate Improvement"));
293 		waterDetailSizer2->Add(IDC_NOSHADOWS_CTRL, 0);
294 
295 		waterDetailSizer->Add(waterDetailSizer2, 0, wxGROW);
296 		sizer->Add(waterDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
297 	}
298 }
299 
createTroubleControls(wxWindow * parent,wxSizer * sizer)300 static void createTroubleControls(wxWindow *parent, wxSizer *sizer)
301 {
302 	// Graphics Settings
303 	{
304 		wxStaticBox *glDetailBox = new wxStaticBox(parent, -1,
305 			wxT("Compatibility Settings"));
306 		wxStaticBoxSizer *glDetailSizer = new wxStaticBoxSizer(glDetailBox, wxHORIZONTAL);
307 		wxGridSizer *glDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
308 
309 		IDC_NOEXT_CTRL =
310 			new wxCheckBox(parent, -1, wxT("No GL Extensions"));
311 		glDetailSizer2->Add(IDC_NOEXT_CTRL, 0);
312 		IDC_NOMULTITEX_CTRL =
313 			new wxCheckBox(parent, -1, wxT("No multi texture"));
314 		glDetailSizer2->Add(IDC_NOMULTITEX_CTRL, 0);
315 		IDC_NOLANDSCAPESCORCH_CTRL =
316 			new wxCheckBox(parent, -1, wxT("No TexSubImaging"));
317 		glDetailSizer2->Add(IDC_NOLANDSCAPESCORCH_CTRL, 0);
318 		IDC_NOENVCOMBINE_CTRL =
319 			new wxCheckBox(parent, -1, wxT("No combined textures"));
320 		glDetailSizer2->Add(IDC_NOENVCOMBINE_CTRL, 0);
321 		IDC_NOCUBEMAP_CTRL =
322 			new wxCheckBox(parent, -1, wxT("No cube map"));
323 		glDetailSizer2->Add(IDC_NOCUBEMAP_CTRL, 0);
324 		IDC_NOSPHEREMAP_CTRL =
325 			new wxCheckBox(parent, -1, wxT("No sphere map"));
326 		glDetailSizer2->Add(IDC_NOSPHEREMAP_CTRL, 0);
327 		IDC_NOMIPMAPS_CTRL =
328 			new wxCheckBox(parent, -1, wxT("No HW mip maps"));
329 		glDetailSizer2->Add(IDC_NOMIPMAPS_CTRL, 0);
330 		IDC_NOVBO_CTRL =
331 			new wxCheckBox(parent, -1, wxT("No VBO"));
332 		glDetailSizer2->Add(IDC_NOVBO_CTRL, 0);
333 
334 		glDetailSizer->Add(glDetailSizer2, 0, wxGROW);
335 		sizer->Add(glDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
336 	}
337 
338 	{
339 		wxStaticBox *miscDetailBox = new wxStaticBox(parent, -1,
340 			wxT("Misc Detail"));
341 		wxStaticBoxSizer *miscDetailSizer = new wxStaticBoxSizer(miscDetailBox, wxHORIZONTAL);
342 		wxGridSizer *miscDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
343 
344 		IDC_NODETAILTEX_CTRL =
345 			new wxCheckBox(parent, -1, wxT("Don't use detail textures"));
346 		miscDetailSizer2->Add(IDC_NODETAILTEX_CTRL, 0);
347 		IDC_NOSURROUND_CTRL =
348 			new wxCheckBox(parent, -1, wxT("Don't draw surround"));
349 		miscDetailSizer2->Add(IDC_NOSURROUND_CTRL, 0);
350 		IDC_SINGLESKYLAYER_CTRL =
351 			new wxCheckBox(parent, -1, wxT("Single sky layer"));
352 		miscDetailSizer2->Add(IDC_SINGLESKYLAYER_CTRL, 0);
353 		IDC_NOSKYANI_CTRL =
354 			new wxCheckBox(parent, -1, wxT("Don't animate sky"));
355 		miscDetailSizer2->Add(IDC_NOSKYANI_CTRL, 0);
356 		IDC_NOSKINS_CTRL =
357 			new wxCheckBox(parent, -1, wxT("No model skins"));
358 		miscDetailSizer2->Add(IDC_NOSKINS_CTRL, 0);
359 		IDC_NODYNAMICLIGHT_CTRL =
360 			new wxCheckBox(parent, -1, wxT("No model dynamic lighting"));
361 		miscDetailSizer2->Add(IDC_NODYNAMICLIGHT_CTRL, 0);
362 		IDC_NOPRECIPITATION_CTRL =
363 			new wxCheckBox(parent, -1, wxT("No precipitation"));
364 		miscDetailSizer2->Add(IDC_NOPRECIPITATION_CTRL, 0);
365 		IDC_NODEPTHSORT_CTRL =
366 			new wxCheckBox(parent, -1, wxT("No sprite depth sorting"));
367 		miscDetailSizer2->Add(IDC_NODEPTHSORT_CTRL, 0);
368 		IDC_NOBACKDROP_CTRL =
369 			new wxCheckBox(parent, -1, wxT("No progress backdrop"));
370 		miscDetailSizer2->Add(IDC_NOBACKDROP_CTRL, 0);
371 
372 		miscDetailSizer->Add(miscDetailSizer2, 0, wxGROW);
373 		sizer->Add(miscDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
374 	}
375 }
376 
createIdentControls(wxWindow * parent,wxSizer * sizer)377 static void createIdentControls(wxWindow *parent, wxSizer *sizer)
378 {
379 	{
380 	// User name edit box
381 	wxStaticBox *userNameBox = new wxStaticBox(parent, -1,
382 		wxT("Online User Name"));
383 	wxStaticBoxSizer *userNameSizer = new wxStaticBoxSizer(userNameBox, wxVERTICAL);
384 	IDC_USERNAME_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
385 	userNameSizer->Add(IDC_USERNAME_CTRL, 0, wxALIGN_CENTER);
386 	sizer->Add(userNameSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
387 	}
388 
389 	{
390 	// TankModel edit box
391 	wxStaticBox *tankModelBox = new wxStaticBox(parent, -1,
392 		wxT("Online Tank Model"));
393 	wxStaticBoxSizer *tankModelSizer = new wxStaticBoxSizer(tankModelBox, wxVERTICAL);
394 	IDC_TANKMODEL_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
395 	tankModelSizer->Add(IDC_TANKMODEL_CTRL, 0, wxALIGN_CENTER);
396 	sizer->Add(tankModelSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
397 	}
398 
399 	// User id edit box
400 	wxStaticBox *userBox = new wxStaticBox(parent, -1,
401 		wxT("User ID (Uniquely identifies this player for stats, not generated from any user information.)"));
402 	wxStaticBoxSizer *userSizer = new wxStaticBoxSizer(userBox, wxVERTICAL);
403 	IDC_USERID_CTRL = new wxGrid(parent, -1, wxDefaultPosition, wxDefaultSize);
404 	IDC_USERID_CTRL->CreateGrid(0, 3);
405 	IDC_USERID_CTRL->SetColLabelValue(0, wxT("Published Ip"));
406 	IDC_USERID_CTRL->SetColLabelValue(1, wxT("Current Ip"));
407 	IDC_USERID_CTRL->SetColLabelValue(2, wxT("Unique Id"));
408 	IDC_USERID_CTRL->SetColLabelSize(20);
409 	IDC_USERID_CTRL->SetRowLabelSize(0);
410 
411 	userSizer->Add(IDC_USERID_CTRL, 1, wxALIGN_CENTER | wxGROW);
412 	IDC_HOSTDESC_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY);
413 	userSizer->Add(IDC_HOSTDESC_CTRL, 0, wxALIGN_CENTER);
414 	sizer->Add(userSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
415 }
416 
refreshIdentControls()417 static void refreshIdentControls()
418 {
419 	UniqueIdStore idStore;
420 	idStore.loadStore();
421 
422 	if (int(idStore.getIds().size()) > IDC_USERID_CTRL->GetNumberRows())
423 	{
424 		IDC_USERID_CTRL->AppendRows(
425 			int(idStore.getIds().size()) - IDC_USERID_CTRL->GetNumberRows());
426 	}
427 
428 	// User id edit box
429 	int pos = 0;
430 	IDC_USERID_CTRL->ClearGrid();
431 	std::list<UniqueIdStore::Entry>::iterator itor;
432 	for (itor = idStore.getIds().begin();
433 		itor != idStore.getIds().end();
434 		++itor, pos++)
435 	{
436 		UniqueIdStore::Entry &entry = *itor;
437 		IDC_USERID_CTRL->SetCellValue(pos, 0, wxString(entry.published.c_str(), wxConvUTF8));
438 		IDC_USERID_CTRL->SetCellValue(pos, 1, wxString(NetInterface::getIpName(entry.ip), wxConvUTF8));
439 		IDC_USERID_CTRL->SetCellValue(pos, 2, wxString(entry.id.c_str(), wxConvUTF8));
440 		IDC_USERID_CTRL->SetReadOnly(pos, 0);
441 		IDC_USERID_CTRL->SetReadOnly(pos, 1);
442 	}
443 	IDC_USERID_CTRL->EnableEditing(true);
444 	IDC_USERID_CTRL->AutoSizeColumns(true);
445 	IDC_USERID_CTRL->ForceRefresh();
446 }
447 
448 class KeyButtonData : public wxObjectRefData
449 {
450 public:
451 	KeyButtonData(const char *key, unsigned int position);
452 	virtual ~KeyButtonData();
453 
454 	std::string key_;
455 	unsigned int position_;
456 };
457 
KeyButtonData(const char * key,unsigned int position)458 KeyButtonData::KeyButtonData(const char *key, unsigned int position) :
459 	wxObjectRefData(),
460 	key_(key), position_(position)
461 {
462 }
463 
~KeyButtonData()464 KeyButtonData::~KeyButtonData()
465 {
466 }
467 
468 static std::list<wxButton *> keyboardKeyList;
469 
createKeysControls(wxWindow * parent,wxSizer * topsizer)470 static void createKeysControls(wxWindow *parent, wxSizer *topsizer)
471 {
472 	wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, -1,
473 		wxDefaultPosition, wxSize(480, 250));
474 	wxSizer *sizer = new wxFlexGridSizer(5, 1);
475 
476 	keyboardKeyList.clear();
477 	if (!Keyboard::instance()->loadKeyFile())
478 	{
479 		S3D::dialogExit("Keyboard", "Failed to process keyboad file keys.xml");
480 	}
481 
482 	int lastGroup = 0;
483 	std::list<std::string> &keys =
484 		Keyboard::instance()->getKeyList();
485 	std::list<std::string>::iterator itor;
486 	for (itor = keys.begin();
487 		itor != keys.end();
488 		++itor)
489 	{
490 		KeyboardKey *key = Keyboard::instance()->getKey((*itor).c_str());
491 
492 		// Add a spacer line
493 		if (key->getGroup() != lastGroup)
494 		{
495 			lastGroup = key->getGroup();
496 			for (unsigned int i=0; i<5; i++)
497 			{
498 				sizer->Add(new wxStaticText(
499 					scrolledWindow, -1, wxString("", wxConvUTF8)), 0, wxALIGN_LEFT);
500 			}
501 		}
502 
503 		// Add the key name
504 		wxStaticText *text = new wxStaticText(
505 			scrolledWindow, -1, wxString(key->getTitle(), wxConvUTF8));
506 		text->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
507 		sizer->Add(text, 0, wxALIGN_LEFT);
508 
509 		// Add the keys
510 		for (unsigned int i=0; i<4; i++)
511 		{
512 			wxButton *button = new wxButton(scrolledWindow, ID_KEY, wxT(""),
513 				wxDefaultPosition, wxSize(120, -1));
514 			button->SetRefData(new KeyButtonData(key->getName(), i));
515 			button->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
516 			sizer->Add(button, 0, wxLEFT | wxALIGN_CENTER, 5);
517 			keyboardKeyList.push_back(button);
518 		}
519 	}
520 
521 	// Setup the scrolled area size
522 	scrolledWindow->SetAutoLayout(TRUE);
523 	scrolledWindow->SetSizer(sizer);
524 	wxSize minSize = sizer->CalcMin();
525 	scrolledWindow->SetScrollbars(10, 10,
526 		(minSize.GetWidth() + 10) / 10, (minSize.GetHeight() + 10) / 10);
527 	topsizer->Add(scrolledWindow, 1, wxGROW | wxALL | wxALIGN_CENTER, 2);
528 
529 	// Add the load default keys button
530 	IDC_LOADKEYDEFAULTS_CTRL = new wxButton(parent, ID_KEYDEFAULTS, wxT("Load Default Keys"));
531 	topsizer->Add(IDC_LOADKEYDEFAULTS_CTRL, 0, wxCENTER | wxALL, 2);
532 }
533 
534 static wxListBox *modbox = 0;
updateModList()535 static void updateModList()
536 {
537 	modbox->Clear();
538 	ModDirs dirs;
539 	if (dirs.loadModDirs())
540 	{
541 		std::list<ModInfo>::iterator itor;
542 		for (itor = dirs.getDirs().begin();
543 			itor != dirs.getDirs().end();
544 			++itor)
545 		{
546 			ModInfo &info = (*itor);
547 			modbox->Append(wxString(info.getName(), wxConvUTF8));
548 		}
549 	}
550 }
551 
createModsControls(wxWindow * parent,wxSizer * topsizer)552 static void createModsControls(wxWindow *parent, wxSizer *topsizer)
553 {
554 	wxStaticBox *modsBox = new wxStaticBox(parent, -1, wxT("Mods"));
555 	wxStaticBoxSizer *modsSizer = new wxStaticBoxSizer(modsBox, wxVERTICAL);
556 
557 	modbox = new wxListBox(parent, -1,
558 		wxDefaultPosition, wxSize(150, 200), 0, 0, wxLB_SINGLE);
559 	updateModList();
560 	modsSizer->Add(modbox, 0, wxALIGN_CENTER | wxALL, 5);
561 
562 	wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
563 	wxButton *exportBut = new wxButton(parent, ID_EXPORT, wxT("Export"));
564 	wxButton *importBut = new wxButton(parent, ID_IMPORT, wxT("Import"));
565 	buttonSizer->Add(exportBut, 0, wxRIGHT, 5);
566 	buttonSizer->Add(importBut, 0, wxLEFT, 5);
567 	modsSizer->Add(buttonSizer, 0, wxALIGN_CENTER);
568 
569 	topsizer->Add(modsSizer, 0, wxGROW);
570 }
571 
572