DEADSOFTWARE

11d42616ea07bcf86b7a6258a2fa505d10e47e71
[d2df-sdl.git] / src / game / g_menu.pas
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../shared/a_modes.inc}
16 unit g_menu;
18 interface
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
33 var
34 PromptIP: string;
35 PromptPort: Word;
36 TempScale: Integer = -1;
37 TempResScale: Integer = -1;
39 implementation
41 uses
42 {$IFDEF ENABLE_GFX}
43 g_gfx,
44 {$ENDIF}
45 {$IFDEF ENABLE_GIBS}
46 g_gibs,
47 {$ENDIF}
48 {$IFDEF ENABLE_SHELLS}
49 g_shells,
50 {$ENDIF}
51 g_gui, r_textures, r_graphics, g_game, g_map,
52 g_base, g_basic, g_console, g_sound, g_player, g_options, g_weapons,
53 e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
54 MAPDEF, Math, g_saveload,
55 g_language, e_res,
56 g_net, g_netmsg, g_netmaster, g_items, e_input,
57 utils, wadreader, g_system, r_render, r_game;
60 type TYNCallback = procedure (yes:Boolean);
62 procedure YNKeyDownProc (win: TGUIWindow; Key: Byte);
63 begin
64 if win.UserData = nil then exit;
65 case Key of
66 IK_Y, IK_SPACE: TYNCallback(win.UserData)(true);
67 IK_N: TYNCallback(win.UserData)(false);
68 end;
69 end;
71 procedure YesButtonCB (ctl: TGUITextButton);
72 begin
73 if ctl.UserData = nil then exit;
74 TYNCallback(ctl.UserData)(true);
75 end;
77 procedure NoButtonCB (ctl: TGUITextButton);
78 begin
79 if ctl.UserData = nil then exit;
80 TYNCallback(ctl.UserData)(false);
81 end;
83 function CreateYNMenu (WinName, Text: String; MaxLen: Word; FontID: DWORD; ActionProc: TYNCallback): TGUIWindow;
84 var
85 menu: TGUIMenu;
86 begin
87 //if length(Text) = 0 then exit;
88 Result := TGUIWindow.Create(WinName);
89 with Result do
90 begin
91 //OnKeyDownEx := @YNKeyDownProc;
92 //UserData := @ActionProc;
93 menu := TGUIMenu(Result.AddChild(TGUIMenu.Create(gMenuSmallFont, gMenuSmallFont, '')));
94 with menu do
95 begin
96 Name := '__temp_yes_no_menu:'+WinName;
97 YesNo := true;
98 AddText(Text, MaxLen);
99 with AddButton(nil, _lc[I_MENU_YES]) do begin ProcEx := @YesButtonCB; UserData := @ActionProc; end;
100 with AddButton(nil, _lc[I_MENU_NO]) do begin ProcEx := @NoButtonCB; UserData := @ActionProc; end;
101 end;
102 DefControl := '__temp_yes_no_menu:'+WinName;
103 SetActive(nil);
104 end;
105 end;
108 procedure ProcChangeColor(Sender: TGUIControl); forward;
109 procedure ProcSelectModel(Sender: TGUIControl); forward;
111 procedure ProcApplyOptions();
112 var
113 menu: TGUIMenu;
114 i: Integer;
115 begin
116 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
118 if TGUISwitch(menu.GetControl('swBPP')).ItemIndex = 0 then
119 gBPP := 16
120 else
121 gBPP := 32;
123 gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
125 gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
126 glNPOTOverride := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
127 gLerpActors := TGUISwitch(menu.GetControl('swInterp')).ItemIndex = 0;
129 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu.GetControl('scSoundLevel')).Value*16, 255),
133 Min(TGUIScroll(menu.GetControl('scMusicLevel')).Value*16, 255)
134 );
136 gMaxSimSounds := Max(Min(TGUIScroll(menu.GetControl('scMaxSimSounds')).Value*4+2, 66), 2);
137 gMuteWhenInactive := TGUISwitch(menu.GetControl('swInactiveSounds')).ItemIndex = 1;
138 gAnnouncer := TGUISwitch(menu.GetControl('swAnnouncer')).ItemIndex;
139 gSoundEffectsDF := TGUISwitch(menu.GetControl('swSoundEffects')).ItemIndex = 1;
140 gUseChatSounds := TGUISwitch(menu.GetControl('swChatSpeech')).ItemIndex = 0;
142 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
144 {$IFDEF ENABLE_GFX}
145 g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000);
146 {$ENDIF}
147 {$IFDEF ENABLE_SHELLS}
148 g_Shells_SetMax(TGUIScroll(menu.GetControl('scShellsMax')).Value*30);
149 {$ENDIF}
150 {$IFDEF ENABLE_GIBS}
151 g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25);
152 {$ENDIF}
153 g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5);
155 {$IFDEF ENABLE_GIBS}
156 case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of
157 0: gGibsCount := 0;
158 1: gGibsCount := 8;
159 2: gGibsCount := 16;
160 3: gGibsCount := 32;
161 else gGibsCount := 48;
162 end;
163 {$ENDIF}
165 gBloodCount := TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex;
166 gFlash := TGUISwitch(menu.GetControl('swScreenFlash')).ItemIndex;
167 gAdvBlood := TGUISwitch(menu.GetControl('swBloodType')).ItemIndex = 1;
168 gAdvCorpses := TGUISwitch(menu.GetControl('swCorpseType')).ItemIndex = 1;
169 gAdvGibs := TGUISwitch(menu.GetControl('swGibsType')).ItemIndex = 1;
170 gDrawBackGround := TGUISwitch(menu.GetControl('swBackGround')).ItemIndex = 0;
171 gShowMessages := TGUISwitch(menu.GetControl('swMessages')).ItemIndex = 0;
172 gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0;
173 gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex;
174 gPlayerIndicator := TGUISwitch(menu.GetControl('swPlayerIndicator')).ItemIndex;
175 gPlayerIndicatorStyle := TGUISwitch(menu.GetControl('swPlayerIndicatorStyle')).ItemIndex;
176 if TGUIScroll(menu.GetControl('scScaleFactor')).Value <> TempScale then
177 begin
178 TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
179 g_dbg_scale := TempScale + 1;
180 end;
183 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
185 with menu do
186 begin
187 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
189 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
190 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
191 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key, 'screenshot');
192 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key, '+scores', '-scores');
193 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key, 'togglechat');
194 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key, 'toggleteamchat');
195 end;
197 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
198 with menu do
199 begin
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
201 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
202 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
203 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
204 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
205 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
206 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
207 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
208 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
209 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
210 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+p1_moveright', '-p1_moveright');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+p1_moveleft', '-p1_moveleft');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+p1_lookup', '-p1_lookup');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+p1_lookdown', '-p1_lookdown');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+p1_attack', '-p1_attack');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+p1_jump', '-p1_jump');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+p1_activate', '-p1_activate');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+p1_strafe', '-p1_strafe');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key0, 'p1_dropflag', '');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, 'p1_weapnext', '', True);
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, 'p1_weapprev', '', True);
222 // second set
223 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
224 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
225 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
226 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
227 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
228 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
229 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
230 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
231 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
232 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
233 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+p1_moveright', '-p1_moveright');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+p1_moveleft', '-p1_moveleft');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+p1_lookup', '-p1_lookup');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+p1_lookdown', '-p1_lookdown');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+p1_attack', '-p1_attack');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+p1_jump', '-p1_jump');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+p1_activate', '-p1_activate');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+p1_strafe', '-p1_strafe');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key1, 'p1_dropflag', '');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, 'p1_weapnext', '', True);
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, 'p1_weapprev', '', True);
245 end;
247 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
248 with menu do
249 begin
250 for i := WP_FIRST to WP_LAST do
251 begin
252 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1)), '');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'p1_weapon ' + IntToStr(i + 1));
254 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1)), '');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'p1_weapon ' + IntToStr(i + 1));
256 end;
257 end;
259 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
260 with menu do
261 begin
262 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
269 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
270 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
271 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
272 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+p2_moveright', '-p2_moveright');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+p2_moveleft', '-p2_moveleft');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+p2_lookup', '-p2_lookup');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+p2_lookdown', '-p2_lookdown');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+p2_attack', '-p2_attack');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+p2_jump', '-p2_jump');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+p2_activate', '-p2_activate');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+p2_strafe', '-p2_strafe');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key0, 'p2_dropflag', '');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, 'p2_weapnext', '', True);
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, 'p2_weapprev', '', True);
284 // second set
285 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
286 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
287 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
288 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
289 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
290 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
291 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
292 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
293 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
294 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
295 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+p2_moveright', '-p2_moveright');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+p2_moveleft', '-p2_moveleft');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+p2_lookup', '-p2_lookup');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+p2_lookdown', '-p2_lookdown');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+p2_attack', '-p2_attack');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+p2_jump', '-p2_jump');
302 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+p2_activate', '-p2_activate');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+p2_strafe', '-p2_strafe');
304 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key1, 'p2_dropflag', '');
305 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, 'p2_weapnext', '', True);
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, 'p2_weapprev', '', True);
307 end;
309 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
310 with menu do
311 begin
312 for i := WP_FIRST to WP_LAST do
313 begin
314 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i + 1)), '');
315 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'p2_weapon ' + IntToStr(i + 1));
316 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i + 1)), '');
317 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'p2_weapon ' + IntToStr(i + 1));
318 end;
319 end;
321 if e_HasJoysticks then
322 begin
323 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
324 with menu do
325 begin
326 for i := 0 to e_MaxJoys - 1 do
327 if e_JoystickAvailable[i] then
328 e_JoystickDeadzones[i] := TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value*(32767 div 20)
329 end
330 end;
332 if g_touch_enabled then
333 begin
334 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
335 g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
336 g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
337 g_touch_fire := TGUISwitch(menu.GetControl('swTouchFire')).ItemIndex = 1;
338 g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
339 end;
341 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
342 gPlayer1Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP1Name')).Text);
343 gPlayer1Settings.Team := IfThen(TGUISwitch(menu.GetControl('swP1Team')).ItemIndex = 0,
344 TEAM_RED, TEAM_BLUE);
345 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
346 begin
347 gPlayer1Settings.Model := Model.GetName();
348 gPlayer1Settings.Color := Model.Color;
349 end;
351 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
352 gPlayer2Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP2Name')).Text);
353 gPlayer2Settings.Team := IfThen(TGUISwitch(menu.GetControl('swP2Team')).ItemIndex = 0,
354 TEAM_RED, TEAM_BLUE);
355 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
356 begin
357 gPlayer2Settings.Model := Model.GetName();
358 gPlayer2Settings.Color := Model.Color;
359 end;
361 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
362 gPlayer1Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
363 gPlayer1Settings.SwitchToEmpty := TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex;
364 gPlayer1Settings.SkipFist := TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex;
365 menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
366 with menu do
367 begin
368 for i := WP_FIRST to WP_LAST+1 do
369 begin
370 gPlayer1Settings.WeaponPreferences[i] := TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex;
371 end;
372 end;
374 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
375 gPlayer2Settings.WeaponSwitch := TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex;
376 gPlayer2Settings.SwitchToEmpty := TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex;
377 gPlayer2Settings.SkipFist := TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex;
378 menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
379 with menu do
380 begin
381 for i := WP_FIRST to WP_LAST+1 do
382 begin
383 gPlayer2Settings.WeaponPreferences[i] := TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex;
384 end;
385 end;
387 if gPlayer1Settings.Name = '' then gPlayer1Settings.Name := GenPlayerName(1);
388 if gPlayer2Settings.Name = '' then gPlayer2Settings.Name := GenPlayerName(2);
390 if g_Game_IsServer then
391 begin
392 if gPlayer1 <> nil then
393 begin
394 gPlayer1.SetModel(gPlayer1Settings.Model);
395 gPlayer1.Name := gPlayer1Settings.Name;
396 if not (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
397 gPlayer1.SetColor(gPlayer1Settings.Color)
398 else
399 if gPlayer1.Team <> gPlayer1Settings.Team then
400 gPlayer1.SwitchTeam;
401 gPlayer1.WeapSwitchMode := gPlayer1Settings.WeaponSwitch;
402 gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
403 gPlayer1.SwitchToEmpty := gPlayer1Settings.SwitchToEmpty;
404 gPlayer1.SkipFist := gPlayer1Settings.SkipFist;
405 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
406 end;
408 if gPlayer2 <> nil then
409 begin
410 gPlayer2.SetModel(gPlayer2Settings.Model);
411 gPlayer2.Name := gPlayer2Settings.Name;
412 if not (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
413 gPlayer2.SetColor(gPlayer2Settings.Color)
414 else
415 if gPlayer2.Team <> gPlayer2Settings.Team then
416 gPlayer2.SwitchTeam;
417 gPlayer2.WeapSwitchMode := gPlayer2Settings.WeaponSwitch;
418 gPlayer2.setWeaponPrefs(gPlayer2Settings.WeaponPreferences);
419 gPlayer2.SwitchToEmpty := gPlayer2Settings.SwitchToEmpty;
420 gPlayer2.SkipFist := gPlayer2Settings.SkipFist;
421 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
422 end;
423 end;
425 if g_Game_IsClient then
426 begin
427 MC_SEND_PlayerSettings;
428 gPlayer1.setWeaponPrefs(gPlayer1Settings.WeaponPreferences);
429 end;
431 g_Console_WriteGameConfig;
432 end;
434 procedure ReadOptions();
435 var
436 menu: TGUIMenu;
437 i: Integer;
438 begin
439 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
441 with TGUISwitch(menu.GetControl('swBPP')) do
442 if gBPP = 16 then
443 ItemIndex := 0
444 else
445 ItemIndex := 1;
447 with TGUISwitch(menu.GetControl('swTextureFilter')) do
448 if gTextureFilter then ItemIndex := 0 else ItemIndex := 1;
450 with TGUISwitch(menu.GetControl('swVSync')) do
451 if gVSync then ItemIndex := 0 else ItemIndex := 1;
453 with TGUISwitch(menu.GetControl('swLegacyNPOT')) do
454 if not glNPOTOverride then ItemIndex := 0 else ItemIndex := 1;
456 with TGUISwitch(menu.GetControl('swInterp')) do
457 if gLerpActors then ItemIndex := 0 else ItemIndex := 1;
459 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
461 TGUIScroll(menu.GetControl('scSoundLevel')).Value := Round(gSoundLevel/16);
462 TGUIScroll(menu.GetControl('scMusicLevel')).Value := Round(gMusicLevel/16);
463 TGUIScroll(menu.GetControl('scMaxSimSounds')).Value := Round((gMaxSimSounds-2)/4);
465 with TGUISwitch(menu.GetControl('swInactiveSounds')) do
466 if gMuteWhenInactive then
467 ItemIndex := 1
468 else
469 ItemIndex := 0;
471 TGUISwitch(menu.GetControl('swAnnouncer')).ItemIndex := gAnnouncer;
473 with TGUISwitch(menu.GetControl('swSoundEffects')) do
474 if gSoundEffectsDF then
475 ItemIndex := 1
476 else
477 ItemIndex := 0;
479 with TGUISwitch(menu.GetControl('swChatSpeech')) do
480 if gUseChatSounds then
481 ItemIndex := 0
482 else
483 ItemIndex := 1;
485 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
486 with menu do
487 begin
488 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
489 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
490 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
491 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
492 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+p1_attack', '-p1_attack');
493 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+p1_jump', '-p1_jump');
494 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+p1_activate', '-p1_activate');
495 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
496 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key0 := g_Console_FindBind(1, 'p1_dropflag', '');
497 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, 'p1_weapnext', '');
498 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, 'p1_weapprev', '');
499 // second set
500 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
501 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
502 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
503 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
504 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+p1_attack', '-p1_attack');
505 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+p1_jump', '-p1_jump');
506 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+p1_activate', '-p1_activate');
507 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
508 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key1 := g_Console_FindBind(2, 'p1_dropflag', '');
509 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2, 'p1_weapnext', '');
510 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, 'p1_weapprev', '');
511 end;
513 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
514 with menu do
515 begin
516 for i := WP_FIRST to WP_LAST do
517 begin
518 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1));
519 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1));
520 end;
521 end;
523 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
524 with menu do
525 begin
526 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
527 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
528 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
529 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
530 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+p2_attack', '-p2_attack');
531 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+p2_jump', '-p2_jump');
532 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+p2_activate', '-p2_activate');
533 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
534 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key0 := g_Console_FindBind(1, 'p2_dropflag', '');
535 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, 'p2_weapnext', '');
536 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, 'p2_weapprev', '');
537 // second set
538 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
539 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
540 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
541 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
542 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+p2_attack', '-p2_attack');
543 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+p2_jump', '-p2_jump');
544 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+p2_activate', '-p2_activate');
545 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
546 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DROPFLAG])).Key1 := g_Console_FindBind(2, 'p2_dropflag', '');
547 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2, 'p2_weapnext', '');
548 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, 'p2_weapprev', '');
549 end;
551 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
552 with menu do
553 begin
554 for i := WP_FIRST to WP_LAST do
555 begin
556 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i + 1));
557 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i + 1));
558 end;
559 end;
561 if e_HasJoysticks then
562 begin
563 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
564 with menu do
565 begin
566 for i := 0 to e_MaxJoys - 1 do
567 if e_JoystickAvailable[i] then
568 TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value := e_JoystickDeadzones[i] div (32767 div 20)
569 end
570 end;
572 if g_touch_enabled then
573 begin
574 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
575 with TGUISwitch(menu.GetControl('swTouchAlt')) do
576 if g_touch_alt then ItemIndex := 1 else ItemIndex := 0;
577 TGUIScroll(menu.GetControl('scTouchSize')).Value := Round((g_touch_size - 0.5) * 10);
578 with TGUISwitch(menu.GetControl('swTouchFire')) do
579 if g_touch_fire then ItemIndex := 1 else ItemIndex := 0;
580 TGUIScroll(menu.GetControl('scTouchOffset')).Value := Round(g_touch_offset / 5);
581 end;
583 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
584 with menu do
585 begin
586 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key := g_Console_FindBind(1, 'screenshot');
587 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key := g_Console_FindBind(1, '+scores', '-scores');
588 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key := g_Console_FindBind(1, 'togglechat');
589 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key := g_Console_FindBind(1, 'toggleteamchat');
590 end;
592 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
594 {$IFDEF ENABLE_GFX}
595 TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000;
596 {$ENDIF}
597 {$IFDEF ENABLE_SHELLS}
598 TGUIScroll(menu.GetControl('scShellsMax')).Value := g_Shells_GetMax() div 30;
599 {$ENDIF}
600 {$IFDEF ENABLE_GIBS}
601 TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25;
602 {$ENDIF}
603 TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5;
604 TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex := gBloodCount;
606 with TGUISwitch(menu.GetControl('swScreenFlash')) do
607 ItemIndex := gFlash;
609 with TGUISwitch(menu.GetControl('swBloodType')) do
610 if gAdvBlood then ItemIndex := 1 else ItemIndex := 0;
612 with TGUISwitch(menu.GetControl('swCorpseType')) do
613 if gAdvCorpses then ItemIndex := 1 else ItemIndex := 0;
615 with TGUISwitch(menu.GetControl('swGibsType')) do
616 if gAdvGibs then ItemIndex := 1 else ItemIndex := 0;
618 {$IFDEF ENABLE_GIBS}
619 with TGUISwitch(menu.GetControl('swGibsCount')) do
620 begin
621 case gGibsCount of
622 0: ItemIndex := 0;
623 8: ItemIndex := 1;
624 16: ItemIndex := 2;
625 32: ItemIndex := 3;
626 else ItemIndex := 4;
627 end;
628 end;
629 {$ENDIF}
631 with TGUISwitch(menu.GetControl('swBackGround')) do
632 if gDrawBackGround then ItemIndex := 0 else ItemIndex := 1;
634 with TGUISwitch(menu.GetControl('swMessages')) do
635 if gShowMessages then ItemIndex := 0 else ItemIndex := 1;
637 with TGUISwitch(menu.GetControl('swRevertPlayers')) do
638 if gRevertPlayers then ItemIndex := 0 else ItemIndex := 1;
640 with TGUISwitch(menu.GetControl('swChatBubble')) do
641 ItemIndex := gChatBubble;
643 with TGUISwitch(menu.GetControl('swPlayerIndicator')) do
644 ItemIndex := gPlayerIndicator;
646 with TGUISwitch(menu.GetControl('swPlayerIndicatorStyle')) do
647 ItemIndex := gPlayerIndicatorStyle;
649 TempScale := Round(g_dbg_scale - 1);
650 TGUIScroll(menu.GetControl('scScaleFactor')).Value := TempScale;
652 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
654 TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model);
655 TGUIEdit(menu.GetControl('edP1Name')).Text := gPlayer1Settings.Name;
657 TGUISwitch(menu.GetControl('swP1Team')).ItemIndex :=
658 IfThen(gPlayer1Settings.Team = TEAM_BLUE, 1, 0);
660 TGUIScroll(menu.GetControl('scP1Red')).Value := Round(gPlayer1Settings.Color.R/16);
661 TGUIScroll(menu.GetControl('scP1Green')).Value := Round(gPlayer1Settings.Color.G/16);
662 TGUIScroll(menu.GetControl('scP1Blue')).Value := Round(gPlayer1Settings.Color.B/16);
664 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
665 TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer1Settings.WeaponSwitch;
666 TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex := gPlayer1Settings.SwitchToEmpty;
667 TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex := gPlayer1Settings.SkipFist;
668 menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
669 for i := WP_FIRST to WP_LAST+1 do
670 begin
671 if (gPlayer1Settings.WeaponPreferences[i] > 0) and (gPlayer1Settings.WeaponPreferences[i] <= WP_LAST+1) then TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := gPlayer1Settings.WeaponPreferences[i]
672 else TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := 0;
673 end;
675 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
676 TGUISwitch(menu.GetControl('swWeaponAutoswitch')).ItemIndex := gPlayer2Settings.WeaponSwitch;
677 TGUISwitch(menu.GetControl('swWeaponAllowEmpty')).ItemIndex := gPlayer2Settings.SwitchToEmpty;
678 TGUISwitch(menu.GetControl('swWeaponAllowFist')).ItemIndex := gPlayer2Settings.SkipFist;
679 menu := TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
680 for i := WP_FIRST to WP_LAST+1 do
681 begin
682 if (gPlayer2Settings.WeaponPreferences[i] > 0) and (gPlayer2Settings.WeaponPreferences[i] <= WP_LAST+1) then TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := gPlayer2Settings.WeaponPreferences[i]
683 else TGUISwitch(menu.GetControl(IntToStr(i))).ItemIndex := 0;
684 end;
686 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
688 TGUIListBox(menu.GetControl('lsP2Model')).SelectItem(gPlayer2Settings.Model);
689 TGUIEdit(menu.GetControl('edP2Name')).Text := gPlayer2Settings.Name;
691 TGUISwitch(menu.GetControl('swP2Team')).ItemIndex :=
692 IfThen(gPlayer2Settings.Team = TEAM_BLUE, 1, 0);
694 TGUIScroll(menu.GetControl('scP2Red')).Value := Round(gPlayer2Settings.Color.R/16);
695 TGUIScroll(menu.GetControl('scP2Green')).Value := Round(gPlayer2Settings.Color.G/16);
696 TGUIScroll(menu.GetControl('scP2Blue')).Value := Round(gPlayer2Settings.Color.B/16);
698 ProcSelectModel(nil);
699 end;
701 procedure ProcSwitchMonstersCustom(Sender: TGUIControl);
702 begin
703 // don't turn off monsters in DM
705 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
706 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
707 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
708 else
709 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
712 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
713 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
714 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
715 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
717 end;
719 procedure ProcSwitchMonstersNet(Sender: TGUIControl);
720 begin
721 // don't turn off monsters in DM
723 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
724 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
725 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
726 else
727 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
730 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
731 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
732 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
733 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
735 end;
737 function LatchGameOptions(const MenuName: string): Byte;
738 var
739 Map: string;
740 begin
741 Result := GM_NONE;
743 with TGUIMenu(g_ActiveWindow.GetControl(MenuName)) do
744 begin
745 Map := TGUILabel(GetControl('lbMap')).Text;
746 if Map = '' then
747 Exit;
748 if not isWadPath(Map) then
749 Exit;
751 Result := TGUISwitch(GetControl('swGameMode')).ItemIndex+1;
752 gsGameMode := TGUISwitch(GetControl('swGameMode')).GetText;
753 gsTimeLimit := StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
754 gsScoreLimit := StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
755 gsMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
756 gsItemRespawnTime := StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
757 gsPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
758 gsMap := Map;
760 gsGameFlags := 0;
761 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0 then
762 gsGameFlags := gsGameFlags or GAME_OPTION_TEAMDAMAGE;
763 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex = 0 then
764 gsGameFlags := gsGameFlags or GAME_OPTION_DMKEYS;
765 if TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0 then
766 gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWEXIT;
767 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0 then
768 gsGameFlags := gsGameFlags or GAME_OPTION_WEAPONSTAY;
769 if TGUISwitch(GetControl('swMonsters')).ItemIndex = 0 then
770 gsGameFlags := gsGameFlags or GAME_OPTION_MONSTERS;
772 case TGUISwitch(GetControl('swTeamHit')).ItemIndex of
773 1: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITTRACE;
774 2: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITPROJECTILE;
775 0: gsGameFlags := gsGameFlags or GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE;
776 end;
778 case TGUISwitch(GetControl('swBotsVS')).ItemIndex of
779 1: gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSMONSTER;
780 2: gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
781 else gsGameFlags := gsGameFlags or GAME_OPTION_BOTVSPLAYER;
782 end;
784 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex of
785 0: gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG;
786 1: gsGameFlags := gsGameFlags or GAME_OPTION_ALLOWDROPFLAG;
787 else gsGameFlags := gsGameFlags and not (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG);
788 end;
790 // TODO: get this crap out of here
791 gGameSettings.ItemRespawnTime := gsItemRespawnTime;
792 gGameSettings.WarmupTime := gsWarmupTime;
793 gGameSettings.SpawnInvul := gsSpawnInvul;
794 end;
795 end;
797 procedure ProcStartCustomGame();
798 var
799 GameMode: Byte;
800 begin
801 GameMode := LatchGameOptions('mCustomGameMenu');
802 if GameMode = GM_NONE then Exit;
804 g_Console_WriteGameConfig;
805 g_Game_StartCustom(gsMap, GameMode, gsTimeLimit, gsScoreLimit,
806 gsMaxLives, gsGameFlags, gsPlayers);
807 end;
810 procedure ProcStartNetGame();
811 var
812 GameMode: Byte;
813 begin
814 GameMode := LatchGameOptions('mNetServerMenu');
815 if GameMode = GM_NONE then Exit;
817 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
818 begin
819 NetPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
820 NetServerName := TGUIEdit(GetControl('edSrvName')).Text;
821 NetMaxClients := Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
822 NetMaxClients := Min(NET_MAXCLIENTS, NetMaxClients);
823 NetPassword := TGUIEdit(GetControl('edSrvPassword')).Text;
824 NetUseMaster := TGUISwitch(GetControl('swUseMaster')).ItemIndex = 0;
825 end;
827 g_Console_WriteGameConfig;
828 g_Game_StartServer(gsMap, GameMode, gsTimeLimit, gsScoreLimit, gsMaxLives,
829 gsGameFlags, gsPlayers, 0, NetPort);
830 end;
832 procedure ProcConnectNetGame();
833 var
834 PW: String;
835 begin
836 with TGUIMenu(g_ActiveWindow.GetControl('mNetClientMenu')) do
837 begin
838 NetClientIP := TGUIEdit(GetControl('edIP')).Text;
839 NetClientPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
840 PW := TGUIEdit(GetControl('edPW')).Text;
841 end;
843 g_Console_WriteGameConfig;
844 g_Game_StartClient(NetClientIP, NetClientPort, PW);
845 end;
847 procedure ProcEnterPassword();
848 var
849 PW: string;
850 begin
851 with TGUIMenu(g_ActiveWindow.GetControl('mClientPasswordMenu')) do
852 begin
853 NetClientIP := PromptIP;
854 NetClientPort := PromptPort;
855 PW := TGUIEdit(GetControl('edPW')).Text;
856 end;
858 g_Console_WriteGameConfig;
859 g_Game_StartClient(NetClientIP, NetClientPort, PW);
860 end;
862 procedure ProcServerlist();
863 begin
864 if not NetInitDone then
865 begin
866 if (not g_Net_Init()) then
867 begin
868 g_Console_Add('NET: ERROR: Failed to init ENet!');
869 Exit;
870 end
871 else
872 NetInitDone := True;
873 end;
875 g_Net_Slist_Set(NetMasterList);
877 gState := STATE_SLIST;
878 g_ActiveWindow := nil;
880 slWaitStr := _lc[I_NET_SLIST_WAIT];
882 r_Render_Draw;
883 sys_Repaint;
885 slReturnPressed := True;
886 if g_Net_Slist_Fetch(slCurrent) then
887 begin
888 if slCurrent = nil then
889 slWaitStr := _lc[I_NET_SLIST_NOSERVERS];
890 end
891 else
892 slWaitStr := _lc[I_NET_SLIST_ERROR];
893 g_Serverlist_GenerateTable(slCurrent, slTable);
894 end;
896 procedure ProcStartCampaign();
897 var
898 WAD: String;
899 TwoPlayers: Boolean;
900 n: Byte;
901 begin
902 with TGUIMenu(g_ActiveWindow.GetControl('mCampaignMenu')) do
903 begin
904 WAD := TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
905 TwoPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex = 1;
906 end;
907 WAD := e_FindWadRel(MegawadDirs, WAD);
909 if TwoPlayers then
910 n := 2
911 else
912 n := 1;
913 g_Game_StartSingle(WAD + ':\MAP01', TwoPlayers, n);
914 end;
916 procedure ProcSelectMap(Sender: TGUIControl);
917 var
918 win: TGUIWindow;
919 a: TMapInfo;
920 wad, map, res: String;
921 begin
922 win := g_GUI_GetWindow('SelectMapMenu');
923 with TGUIMenu(win.GetControl('mSelectMapMenu')) do
924 begin
925 wad := TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
926 map := TGUIListBox(GetControl('lsMapRes')).SelectedItem();
928 if (wad = '') or (map = '') then
929 begin // Ýòî íå êàðòà
930 TGUILabel(GetControl('lbMapName')).Text := '';
931 TGUILabel(GetControl('lbMapAuthor')).Text := '';
932 TGUILabel(GetControl('lbMapSize')).Text := '';
933 TGUIMemo(GetControl('meMapDescription')).SetText('');
934 TGUIMapPreview(win.GetControl('mpMapPreview')).ClearMap();
935 TGUILabel(win.GetControl('lbMapScale')).Text := '';
936 end
937 else // Ýòî êàðòà
938 begin
939 res := wad+':\'+map;
941 a := g_Map_GetMapInfo(res);
943 TGUILabel(GetControl('lbMapName')).Text := a.Name;
944 TGUILabel(GetControl('lbMapAuthor')).Text := a.Author;
945 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a.Width, a.Height]);
946 TGUIMemo(GetControl('meMapDescription')).SetText(a.Description);
947 TGUIMapPreview(win.GetControl('mpMapPreview')).SetMap(res);
948 TGUILabel(win.GetControl('lbMapScale')).Text :=
949 TGUIMapPreview(win.GetControl('mpMapPreview')).GetScaleStr;
950 end;
951 end;
952 end;
954 procedure ProcSelectWAD(Sender: TGUIControl);
955 var
956 wad: String;
957 list: SSArray;
958 begin
959 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
960 begin
961 wad := TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
963 with TGUIListBox(GetControl('lsMapRes')) do
964 begin
965 Clear();
967 if wad <> '' then
968 begin
969 list := g_Map_GetMapsList(wad);
971 if list <> nil then
972 begin
973 Items := list;
974 ItemIndex := 0;
975 end
976 end;
977 end;
978 end;
980 ProcSelectMap(nil);
981 end;
983 procedure ProcSelectCampaignWAD(Sender: TGUIControl);
984 var
985 win: TGUIWindow;
986 a: TMegaWADInfo;
987 wad, fn: String;
988 begin
989 win := g_GUI_GetWindow('CampaignMenu');
990 with TGUIMenu(win.GetControl('mCampaignMenu')) do
991 begin
992 wad := TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
994 if wad = '' then
995 begin
996 TGUILabel(GetControl('lbWADName')).Text := '';
997 TGUILabel(GetControl('lbWADAuthor')).Text := '';
998 TGUIMemo(GetControl('meWADDescription')).SetText('');
999 end;
1001 a := g_Game_GetMegaWADInfo(wad);
1003 TGUILabel(GetControl('lbWADName')).Text := a.Name;
1004 TGUILabel(GetControl('lbWADAuthor')).Text := a.Author;
1005 TGUIMemo(GetControl('meWADDescription')).SetText(a.Description);
1007 TGUIImage(win.GetControl('mpWADImage')).ClearImage();
1009 if a.pic <> '' then
1010 begin
1011 fn := g_ExtractWadName(a.pic);
1012 if fn = '' then
1013 TGUIImage(win.GetControl('mpWADImage')).SetImage(wad+a.pic)
1014 else
1015 TGUIImage(win.GetControl('mpWADImage')).SetImage(a.pic);
1016 end;
1017 end;
1018 end;
1020 procedure ProcChangeColor(Sender: TGUIControl);
1021 var
1022 window: TGUIWindow;
1023 begin
1024 window := g_GUI_GetWindow('OptionsPlayersP1Menu');
1025 with TGUIMenu(window.GetControl('mOptionsPlayersP1Menu')) do
1026 TGUIModelView(window.GetControl('mvP1Model')).SetColor(
1027 Min(TGUIScroll(GetControl('scP1Red')).Value*16, 255),
1028 Min(TGUIScroll(GetControl('scP1Green')).Value*16, 255),
1029 Min(TGUIScroll(GetControl('scP1Blue')).Value*16, 255));
1031 window := g_GUI_GetWindow('OptionsPlayersP2Menu');
1032 with TGUIMenu(window.GetControl('mOptionsPlayersP2Menu')) do
1033 TGUIModelView(window.GetControl('mvP2Model')).SetColor(
1034 Min(TGUIScroll(GetControl('scP2Red')).Value*16, 255),
1035 Min(TGUIScroll(GetControl('scP2Green')).Value*16, 255),
1036 Min(TGUIScroll(GetControl('scP2Blue')).Value*16, 255));
1037 end;
1039 procedure ProcSelectModel(Sender: TGUIControl);
1040 var
1041 a: string;
1042 window: TGUIWindow;
1043 begin
1044 window := g_GUI_GetWindow('OptionsPlayersP1Menu');
1045 a := TGUIListBox(TGUIMenu(window.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem;
1046 if a <> '' then TGUIModelView(window.GetControl('mvP1Model')).SetModel(a);
1048 window := g_GUI_GetWindow('OptionsPlayersP2Menu');
1049 a := TGUIListBox(TGUIMenu(window.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem;
1050 if a <> '' then TGUIModelView(window.GetControl('mvP2Model')).SetModel(a);
1052 ProcChangeColor(nil);
1053 end;
1055 procedure MenuLoadData();
1056 begin
1057 e_WriteLog('Loading menu data...', TMsgType.Notify);
1059 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD+':TEXTURES\MAINLOGO');
1060 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD+':TEXTURES\MARKER1');
1061 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD+':TEXTURES\MARKER2');
1062 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD+':TEXTURES\SLEFT');
1063 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD+':TEXTURES\SRIGHT');
1064 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD+':TEXTURES\SMIDDLE');
1065 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD+':TEXTURES\SMARKER');
1066 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD+':TEXTURES\ELEFT');
1067 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD+':TEXTURES\ERIGHT');
1068 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD+':TEXTURES\EMIDDLE');
1069 g_Texture_CreateWADEx('BOX1', GameWAD+':TEXTURES\BOX1');
1070 g_Texture_CreateWADEx('BOX2', GameWAD+':TEXTURES\BOX2');
1071 g_Texture_CreateWADEx('BOX3', GameWAD+':TEXTURES\BOX3');
1072 g_Texture_CreateWADEx('BOX4', GameWAD+':TEXTURES\BOX4');
1073 g_Texture_CreateWADEx('BOX5', GameWAD+':TEXTURES\BOX5');
1074 g_Texture_CreateWADEx('BOX6', GameWAD+':TEXTURES\BOX6');
1075 g_Texture_CreateWADEx('BOX7', GameWAD+':TEXTURES\BOX7');
1076 g_Texture_CreateWADEx('BOX8', GameWAD+':TEXTURES\BOX8');
1077 g_Texture_CreateWADEx('BOX9', GameWAD+':TEXTURES\BOX9');
1078 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD+':TEXTURES\SCROLLUPA');
1079 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD+':TEXTURES\SCROLLUPU');
1080 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD+':TEXTURES\SCROLLDOWNA');
1081 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD+':TEXTURES\SCROLLDOWNU');
1082 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD+':TEXTURES\SCROLLMIDDLE');
1083 g_Texture_CreateWADEx('NOPIC', GameWAD+':TEXTURES\NOPIC');
1085 g_Sound_CreateWADEx('MENU_SELECT', GameWAD+':SOUNDS\MENUSELECT');
1086 g_Sound_CreateWADEx('MENU_OPEN', GameWAD+':SOUNDS\MENUOPEN');
1087 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD+':SOUNDS\MENUCLOSE');
1088 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD+':SOUNDS\MENUCHANGE');
1089 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD+':SOUNDS\SCROLLADD');
1090 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD+':SOUNDS\SCROLLSUB');
1091 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD+':SOUNDS\FALL');
1092 end;
1094 procedure MenuFreeData();
1095 begin
1096 e_CharFont_Remove(gMenuFont);
1097 e_CharFont_Remove(gMenuSmallFont);
1099 g_Texture_Delete('MAINMENU_LOGO');
1100 g_Texture_Delete('MAINMENU_MARKER1');
1101 g_Texture_Delete('MAINMENU_MARKER2');
1102 g_Texture_Delete('SCROLL_LEFT');
1103 g_Texture_Delete('SCROLL_RIGHT');
1104 g_Texture_Delete('SCROLL_MIDDLE');
1105 g_Texture_Delete('SCROLL_MARKER');
1106 g_Texture_Delete('EDIT_LEFT');
1107 g_Texture_Delete('EDIT_RIGHT');
1108 g_Texture_Delete('EDIT_MIDDLE');
1109 g_Texture_Delete('BOX1');
1110 g_Texture_Delete('BOX2');
1111 g_Texture_Delete('BOX3');
1112 g_Texture_Delete('BOX4');
1113 g_Texture_Delete('BOX5');
1114 g_Texture_Delete('BOX6');
1115 g_Texture_Delete('BOX7');
1116 g_Texture_Delete('BOX8');
1117 g_Texture_Delete('BOX9');
1118 g_Texture_Delete('BSCROLL_UP_A');
1119 g_Texture_Delete('BSCROLL_UP_U');
1120 g_Texture_Delete('BSCROLL_DOWN_A');
1121 g_Texture_Delete('BSCROLL_DOWN_U');
1122 g_Texture_Delete('BSCROLL_MIDDLE');
1123 g_Texture_Delete('NOPIC');
1125 g_Sound_Delete('MENU_SELECT');
1126 g_Sound_Delete('MENU_OPEN');
1127 g_Sound_Delete('MENU_CLOSE');
1128 g_Sound_Delete('MENU_CHANGE');
1129 g_Sound_Delete('SCROLL_ADD');
1130 g_Sound_Delete('SCROLL_SUB');
1131 g_Sound_Delete('SOUND_PLAYER_FALL');
1132 end;
1134 procedure ProcAuthorsMenu();
1135 begin
1136 gMusic.SetByName('MUSIC_INTERMUS');
1137 gMusic.Play();
1138 end;
1140 procedure ProcExitMenuKeyDown (yes: Boolean);
1141 var
1142 s: ShortString;
1143 snd: TPlayableSound;
1144 res: Boolean;
1145 begin
1146 if yes then
1147 begin
1148 g_Game_StopAllSounds(True);
1149 case (Random(18)) of
1150 0: s := 'SOUND_MONSTER_PAIN';
1151 1: s := 'SOUND_MONSTER_DIE_3';
1152 2: s := 'SOUND_MONSTER_SLOP';
1153 3: s := 'SOUND_MONSTER_DEMON_DIE';
1154 4: s := 'SOUND_MONSTER_IMP_DIE_2';
1155 5: s := 'SOUND_MONSTER_MAN_DIE';
1156 6: s := 'SOUND_MONSTER_BSP_DIE';
1157 7: s := 'SOUND_MONSTER_VILE_DIE';
1158 8: s := 'SOUND_MONSTER_SKEL_DIE';
1159 9: s := 'SOUND_MONSTER_MANCUB_ALERT';
1160 10: s := 'SOUND_MONSTER_PAIN_PAIN';
1161 11: s := 'SOUND_MONSTER_BARON_DIE';
1162 12: s := 'SOUND_MONSTER_CACO_DIE';
1163 13: s := 'SOUND_MONSTER_CYBER_DIE';
1164 14: s := 'SOUND_MONSTER_KNIGHT_ALERT';
1165 15: s := 'SOUND_MONSTER_SPIDER_ALERT';
1166 else s := 'SOUND_PLAYER_FALL';
1167 end;
1168 snd := TPlayableSound.Create();
1169 res := snd.SetByName(s);
1170 if not res then res := snd.SetByName('SOUND_PLAYER_FALL');
1171 if res then
1172 begin
1173 snd.Play(True);
1174 while snd.IsPlaying() do begin end;
1175 end;
1176 g_Game_Quit();
1177 exit;
1178 end;
1179 g_GUI_HideWindow();
1180 end;
1182 procedure ProcLoadMenu();
1183 var
1184 a: Integer;
1185 valid: Boolean;
1186 begin
1187 for a := 1 to 8 do
1188 begin
1189 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Text := g_GetSaveName(a, valid);
1190 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := not valid;
1191 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1192 end;
1193 end;
1195 procedure ProcSaveMenu();
1196 var
1197 a: Integer;
1198 valid: Boolean;
1199 name: AnsiString;
1200 begin
1201 for a := 1 to 8 do
1202 begin
1203 name := g_GetSaveName(a, valid);
1204 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Text := name;
1205 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := (name <> '') and (not valid);
1206 end;
1207 end;
1209 procedure ProcSaveGame(Sender: TGUIControl);
1210 var
1211 a: Integer;
1212 begin
1213 if g_Game_IsNet then Exit;
1214 if g_Game_IsTestMap then Exit;
1215 a := StrToInt(Copy(Sender.Name, Length(Sender.Name), 1));
1216 g_Game_PauseAllSounds(True);
1217 g_SaveGame(a, TGUIEdit(Sender).Text);
1219 g_ActiveWindow := nil;
1220 g_Game_Pause(False);
1221 end;
1223 procedure ProcLoadGame(Sender: TGUIControl);
1224 var
1225 a: Integer;
1226 begin
1227 if g_Game_IsNet then Exit;
1228 a := StrToInt(Copy(Sender.Name, Length(Sender.Name), 1));
1229 if g_LoadGame(a) then
1230 begin
1231 g_Game_PauseAllSounds(False)
1232 end
1233 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1234 begin
1235 g_Console_Add(_lc[I_MSG_BAD_SAVE_VERSION], true);
1236 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1237 //g_ActiveWindow := nil;
1238 end;
1239 end;
1241 procedure ProcSinglePlayer (n: Integer);
1242 var wad, map: AnsiString;
1243 begin
1244 assert(n >= 1);
1245 wad := g_ExtractWadName(gDefaultMegawadStart);
1246 map := g_ExtractFilePathName(gDefaultMegawadStart);
1247 if e_FindResource(AllMapDirs, wad) then
1248 begin
1249 wad := ExpandFileName(wad);
1250 g_Game_StartSingle(wad + ':\' + map, n > 1, n)
1251 end
1252 end;
1254 procedure ProcSingle1Player;
1255 begin
1256 ProcSinglePlayer(1)
1257 end;
1259 procedure ProcSingle2Players;
1260 begin
1261 ProcSinglePlayer(2)
1262 end;
1264 procedure ProcSelectMapMenu();
1265 var
1266 menu: TGUIMenu;
1267 wad_lb: TGUIFileListBox;
1268 map_lb: TGUIListBox;
1269 map: String;
1270 begin
1271 menu := TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1272 wad_lb := TGUIFileListBox(menu.GetControl('lsMapWAD'));
1273 map_lb := TGUIListBox(menu.GetControl('lsMapRes'));
1275 if wad_lb.SelectedItem() <> '' then
1276 map := map_lb.SelectedItem()
1277 else
1278 map := '';
1280 wad_lb.UpdateFileList();
1281 map_lb.Clear();
1283 if wad_lb.SelectedItem() <> '' then
1284 begin
1285 ProcSelectWAD(nil);
1286 map_lb.SelectItem(map);
1288 if map_lb.SelectedItem() <> '' then
1289 ProcSelectMap(nil);
1290 end;
1292 g_GUI_ShowWindow('SelectMapMenu');
1293 end;
1295 procedure ProcSelectCampaignMenu();
1296 var
1297 menu: TGUIMenu;
1298 wad_lb: TGUIFileListBox;
1299 begin
1300 menu := TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1301 wad_lb := TGUIFileListBox(menu.GetControl('lsWAD'));
1303 wad_lb.UpdateFileList();
1305 if wad_lb.SelectedItem() <> '' then
1306 ProcSelectCampaignWAD(nil);
1307 end;
1309 procedure ProcSetMap();
1310 var
1311 wad, map, res: String;
1312 begin
1313 with TGUIMenu(g_ActiveWindow.GetControl('mSelectMapMenu')) do
1314 begin
1315 wad := TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1316 map := TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1317 end;
1319 if (wad = '') or (map = '') then
1320 Exit;
1322 wad := e_FindWadRel(MapDirs, WAD);
1324 res := wad+':\'+map;
1326 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res;
1327 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res;
1328 end;
1330 procedure ProcChangeSoundSettings(Sender: TGUIControl);
1331 var
1332 menu: TGUIMenu;
1333 begin
1334 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1336 g_Sound_SetupAllVolumes(
1337 Min(TGUIScroll(menu.GetControl('scSoundLevel')).Value*16, 255),
1338 Min(TGUIScroll(menu.GetControl('scMusicLevel')).Value*16, 255)
1339 );
1340 end;
1342 procedure ProcChangeGameSettings(Sender: TGUIControl);
1343 var
1344 menu: TGUIMenu;
1345 begin
1346 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1347 if TGUIScroll(menu.GetControl('scScaleFactor')).Value <> TempScale then
1348 begin
1349 TempScale := TGUIScroll(menu.GetControl('scScaleFactor')).Value;
1350 g_dbg_scale := TempScale + 1;
1351 end;
1352 end;
1354 procedure ProcChangeTouchSettings(Sender: TGUIControl);
1355 var
1356 menu: TGUIMenu;
1357 begin
1358 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1359 g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
1360 g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
1361 g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
1362 end;
1364 procedure ProcOptionsPlayersMIMenu();
1365 var
1366 s, a: string;
1367 i: Integer;
1368 begin
1369 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
1371 a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+s+'Menu')).GetControl('ls'+s+'Model')).SelectedItem;
1373 if a = '' then Exit;
1375 i := g_PlayerModel_GetIndex(a);
1376 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1377 begin
1378 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray[i].Name;
1379 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray[i].Author;
1380 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray[i].Description);
1382 if PlayerModelsArray[i].HaveWeapon then
1383 TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_YES]
1384 else
1385 TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_NO];
1386 end;
1388 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1389 end;
1391 procedure ProcOptionsPlayerP1WeaponMenu();
1392 var
1393 a: string;
1394 begin
1395 a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem;
1396 if a = '' then Exit;
1397 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1398 end;
1400 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1401 begin
1402 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1403 end;
1405 procedure ProcOptionsPlayerP2WeaponMenu();
1406 var
1407 a: string;
1408 begin
1409 a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem;
1410 if a = '' then Exit;
1411 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1412 end;
1414 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1415 begin
1416 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1417 end;
1419 procedure ProcOptionsPlayersAnim();
1420 var
1421 s: String;
1422 begin
1423 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then
1424 s := 'P1'
1425 else
1426 s := 'P2';
1428 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')) do
1429 begin
1430 NextAnim();
1431 Model.AnimState.Loop := True;
1432 end;
1433 end;
1435 procedure ProcOptionsPlayersWeap();
1436 var
1437 s: String;
1438 begin
1439 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then
1440 s := 'P1'
1441 else
1442 s := 'P2';
1444 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')) do
1445 NextWeapon();
1446 end;
1448 procedure ProcOptionsPlayersRot();
1449 var
1450 s: string;
1451 begin
1452 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
1453 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')).Model do
1454 begin
1455 if Direction = TDirection.D_LEFT then Direction := TDirection.D_RIGHT else Direction := TDirection.D_LEFT;
1456 end;
1457 end;
1459 procedure ProcDefaultMenuKeyDown (yes: Boolean);
1460 begin
1461 if yes then
1462 begin
1463 g_Options_SetDefault();
1464 ReadOptions();
1465 end;
1466 g_GUI_HideWindow();
1467 end;
1469 procedure ProcSavedMenuKeyDown (yes: Boolean);
1470 begin
1471 if yes then ReadOptions();
1472 g_GUI_HideWindow();
1473 end;
1475 procedure ProcAuthorsClose();
1476 begin
1477 gMusic.SetByName('MUSIC_MENU');
1478 gMusic.Play();
1479 gState := STATE_MENU;
1480 end;
1482 procedure ProcGMClose();
1483 begin
1484 g_Game_InGameMenu(False);
1485 end;
1487 procedure ProcGMShow();
1488 var
1489 Enabled: Boolean;
1490 begin
1491 Enabled := True;
1492 if (gGameSettings.GameType = GT_SINGLE) and
1493 ((gPlayer1 = nil) or (not gPlayer1.alive)) and
1494 ((gPlayer2 = nil) or (not gPlayer2.alive)) then
1495 Enabled := False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1496 if not gGameOn then
1497 Enabled := False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1498 if g_Game_IsTestMap then
1499 Enabled := False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1500 TGUIMainMenu(g_ActiveWindow.GetControl(
1501 g_ActiveWindow.DefControl )).EnableButton('save', Enabled);
1502 end;
1504 procedure ProcChangePlayers();
1505 var
1506 TeamGame, Spectator, AddTwo: Boolean;
1507 P1Team{, P2Team}: Byte;
1508 bP2: TGUITextButton;
1509 begin
1510 TeamGame := gGameSettings.GameMode in [GM_TDM, GM_CTF];
1511 Spectator := (gPlayer1 = nil) and (gPlayer2 = nil);
1512 AddTwo := gGameSettings.GameType in [GT_CUSTOM, GT_SERVER];
1513 P1Team := TEAM_NONE;
1514 if gPlayer1 <> nil then P1Team := gPlayer1.Team;
1515 // TODO
1516 //P2Team := TEAM_NONE;
1517 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1519 TGUIMainMenu(g_ActiveWindow.GetControl(
1520 g_ActiveWindow.DefControl )).EnableButton('tmJoinRed', TeamGame and (P1Team <> TEAM_RED));
1521 TGUIMainMenu(g_ActiveWindow.GetControl(
1522 g_ActiveWindow.DefControl )).EnableButton('tmJoinBlue', TeamGame and (P1Team <> TEAM_BLUE));
1523 TGUIMainMenu(g_ActiveWindow.GetControl(
1524 g_ActiveWindow.DefControl )).EnableButton('tmJoinGame', Spectator and not TeamGame);
1526 bP2 := TGUIMainMenu(g_ActiveWindow.GetControl(
1527 g_ActiveWindow.DefControl )).GetButton('tmPlayer2');
1528 bP2.Enabled := AddTwo and not Spectator;
1529 if bP2.Enabled then
1530 bP2.Color := MAINMENU_ITEMS_COLOR
1531 else
1532 bP2.Color := MAINMENU_UNACTIVEITEMS_COLOR;
1533 if gPlayer2 = nil then
1534 bP2.Caption := _lc[I_MENU_ADD_PLAYER_2]
1535 else
1536 bP2.Caption := _lc[I_MENU_REM_PLAYER_2];
1538 TGUIMainMenu(g_ActiveWindow.GetControl(
1539 g_ActiveWindow.DefControl )).EnableButton('tmSpectate', not Spectator);
1540 end;
1542 procedure ProcJoinRed();
1543 begin
1544 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1545 Exit;
1546 if g_Game_IsServer then
1547 begin
1548 if gPlayer1 = nil then
1549 g_Game_AddPlayer(TEAM_RED)
1550 else
1551 begin
1552 if gPlayer1.Team <> TEAM_RED then
1553 begin
1554 gPlayer1.SwitchTeam;
1555 gPlayer1Settings.Team := gPlayer1.Team;
1556 end;
1558 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
1559 end;
1560 end
1561 else
1562 begin
1563 gPlayer1Settings.Team := TEAM_RED;
1564 MC_SEND_PlayerSettings;
1565 if gPlayer1 = nil then
1566 g_Game_AddPlayer(TEAM_RED);
1567 end;
1568 g_ActiveWindow := nil;
1569 g_Game_Pause(False);
1570 end;
1572 procedure ProcJoinBlue();
1573 begin
1574 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1575 Exit;
1576 if g_Game_IsServer then
1577 begin
1578 if gPlayer1 = nil then
1579 g_Game_AddPlayer(TEAM_BLUE)
1580 else
1581 begin
1582 if gPlayer1.Team <> TEAM_BLUE then
1583 begin
1584 gPlayer1.SwitchTeam;
1585 gPlayer1Settings.Team := gPlayer1.Team;
1586 end;
1588 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
1589 end;
1590 end
1591 else
1592 begin
1593 gPlayer1Settings.Team := TEAM_BLUE;
1594 MC_SEND_PlayerSettings;
1595 if gPlayer1 = nil then
1596 g_Game_AddPlayer(TEAM_BLUE);
1597 end;
1598 g_ActiveWindow := nil;
1599 g_Game_Pause(False);
1600 end;
1602 procedure ProcJoinGame();
1603 begin
1604 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1605 Exit;
1606 if gPlayer1 = nil then
1607 g_Game_AddPlayer();
1608 g_ActiveWindow := nil;
1609 g_Game_Pause(False);
1610 end;
1612 procedure ProcSwitchP2();
1613 begin
1614 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER]) then
1615 Exit;
1616 if gPlayer1 = nil then
1617 Exit;
1618 if gPlayer2 = nil then
1619 g_Game_AddPlayer()
1620 else
1621 g_Game_RemovePlayer();
1622 g_ActiveWindow := nil;
1623 g_Game_Pause(False);
1624 end;
1626 procedure ProcSpectate();
1627 begin
1628 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1629 Exit;
1630 g_Game_Spectate();
1631 g_ActiveWindow := nil;
1632 g_Game_Pause(False);
1633 end;
1635 procedure ProcRestartMenuKeyDown (yes: Boolean);
1636 begin
1637 if yes then g_Game_Restart() else g_GUI_HideWindow;
1638 end;
1640 procedure ProcEndMenuKeyDown (yes: Boolean);
1641 begin
1642 if yes then gExit := EXIT_SIMPLE else g_GUI_HideWindow;
1643 end;
1645 procedure ProcSetRussianLanguage;
1646 begin
1647 if gLanguage <> LANGUAGE_RUSSIAN then
1648 begin
1649 gLanguage := LANGUAGE_RUSSIAN;
1650 gLanguageChange := True;
1651 gAskLanguage := False;
1652 ProcApplyOptions();
1653 end;
1654 end;
1656 procedure ProcSetEnglishLanguage;
1657 begin
1658 if gLanguage <> LANGUAGE_ENGLISH then
1659 begin
1660 gLanguage := LANGUAGE_ENGLISH;
1661 gLanguageChange := True;
1662 gAskLanguage := False;
1663 ProcApplyOptions();
1664 end;
1665 end;
1667 procedure ReadGameSettings();
1668 var
1669 menu: TGUIMenu;
1670 begin
1671 menu := TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1673 with gGameSettings do
1674 begin
1675 with TGUISwitch(menu.GetControl('swTeamDamage')) do
1676 if LongBool(Options and GAME_OPTION_TEAMDAMAGE) then
1677 ItemIndex := 0
1678 else
1679 ItemIndex := 1;
1680 with TGUISwitch(menu.GetControl('swTeamHit')) do
1681 if (Options and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
1682 ItemIndex := 0
1683 else if LongBool(Options and GAME_OPTION_TEAMHITTRACE) then
1684 ItemIndex := 1
1685 else if LongBool(Options and GAME_OPTION_TEAMHITPROJECTILE) then
1686 ItemIndex := 2
1687 else
1688 ItemIndex := 3;
1689 with TGUISwitch(menu.GetControl('swDeathmatchKeys')) do
1690 if LongBool(Options and GAME_OPTION_DMKEYS) then
1691 ItemIndex := 0
1692 else
1693 ItemIndex := 1;
1694 with TGUISwitch(menu.GetControl('swFlagDrop')) do
1695 if LongBool(Options and GAME_OPTION_ALLOWDROPFLAG) and LongBool(Options and GAME_OPTION_THROWFLAG) then
1696 ItemIndex := 0
1697 else if LongBool(Options and GAME_OPTION_ALLOWDROPFLAG) then
1698 ItemIndex := 1
1699 else
1700 ItemIndex := 2;
1702 TGUIEdit(menu.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit);
1703 TGUIEdit(menu.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit);
1704 TGUIEdit(menu.GetControl('edMaxLives')).Text := IntToStr(MaxLives);
1706 with TGUISwitch(menu.GetControl('swBotsVS')) do
1707 if LongBool(Options and GAME_OPTION_BOTVSPLAYER) and
1708 LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
1709 ItemIndex := 2
1710 else
1711 if LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
1712 ItemIndex := 1
1713 else
1714 ItemIndex := 0;
1716 if GameType in [GT_CUSTOM, GT_SERVER] then
1717 begin
1718 TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
1719 TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
1720 if (GameMode in [GM_DM, GM_TDM, GM_CTF]) then
1721 begin
1722 TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := True;
1723 TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_ITEMSTEXT_COLOR;
1724 end
1725 else
1726 begin
1727 TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
1728 TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
1729 end;
1730 TGUIEdit(menu.GetControl('edTimeLimit')).Enabled := True;
1731 TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_ITEMSTEXT_COLOR;
1732 TGUIEdit(menu.GetControl('edScoreLimit')).Enabled := True;
1733 TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_ITEMSTEXT_COLOR;
1734 TGUIEdit(menu.GetControl('edMaxLives')).Enabled := True;
1735 TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_ITEMSTEXT_COLOR;
1736 TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
1737 TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := True;
1738 end
1739 else
1740 begin
1741 TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
1742 TGUISwitch(menu.GetControl('swTeamHit')).Enabled := True;
1743 TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
1744 TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
1745 with TGUIEdit(menu.GetControl('edTimeLimit')) do
1746 begin
1747 Enabled := False;
1748 Text := '';
1749 end;
1750 TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
1751 with TGUIEdit(menu.GetControl('edScoreLimit')) do
1752 begin
1753 Enabled := False;
1754 Text := '';
1755 end;
1756 TGUILabel(menu.GetControlsText('edScoreLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
1757 with TGUIEdit(menu.GetControl('edMaxLives')) do
1758 begin
1759 Enabled := False;
1760 Text := '';
1761 end;
1762 TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_UNACTIVEITEMS_COLOR;
1763 TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
1764 TGUISwitch(menu.GetControl('swFlagDrop')).Enabled := False;
1765 end;
1766 end;
1767 end;
1769 procedure ProcApplyGameSet();
1770 var
1771 menu: TGUIMenu;
1772 a, b, n: Integer;
1773 stat: TPlayerStatArray;
1774 begin
1775 menu := TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1777 if not g_Game_IsServer then Exit;
1779 with gGameSettings do
1780 begin
1781 if TGUISwitch(menu.GetControl('swTeamDamage')).Enabled then
1782 begin
1783 if TGUISwitch(menu.GetControl('swTeamDamage')).ItemIndex = 0 then
1784 Options := Options or GAME_OPTION_TEAMDAMAGE
1785 else
1786 Options := Options and (not GAME_OPTION_TEAMDAMAGE);
1787 end;
1789 if TGUISwitch(menu.GetControl('swTeamHit')).Enabled then
1790 begin
1791 Options := Options and not (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE);
1792 case TGUISwitch(menu.GetControl('swTeamHit')).ItemIndex of
1793 1: Options := Options or GAME_OPTION_TEAMHITTRACE;
1794 2: Options := Options or GAME_OPTION_TEAMHITPROJECTILE;
1795 0: Options := Options or GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE;
1796 end;
1797 end;
1799 if TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled then
1800 begin
1801 if TGUISwitch(menu.GetControl('swDeathmatchKeys')).ItemIndex = 0 then
1802 Options := Options or GAME_OPTION_DMKEYS
1803 else
1804 Options := Options and (not GAME_OPTION_DMKEYS);
1805 end;
1807 if TGUIEdit(menu.GetControl('edTimeLimit')).Enabled then
1808 begin
1809 n := StrToIntDef(TGUIEdit(menu.GetControl('edTimeLimit')).Text, TimeLimit);
1811 if n = 0 then
1812 TimeLimit := 0
1813 else
1814 begin
1815 b := (gTime - gGameStartTime) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1817 TimeLimit := Max(n, b);
1818 end;
1819 end;
1821 if TGUIEdit(menu.GetControl('edScoreLimit')).Enabled then
1822 begin
1823 n := StrToIntDef(TGUIEdit(menu.GetControl('edScoreLimit')).Text, ScoreLimit);
1825 if n = 0 then
1826 ScoreLimit := 0
1827 else
1828 begin
1829 b := 0;
1830 if GameMode = GM_DM then
1831 begin // DM
1832 stat := g_Player_GetStats();
1833 if stat <> nil then
1834 for a := 0 to High(stat) do
1835 if stat[a].Frags > b then
1836 b := stat[a].Frags;
1837 end
1838 else // CTF
1839 b := Max(gTeamStat[TEAM_RED].Score, gTeamStat[TEAM_BLUE].Score);
1841 ScoreLimit := Max(n, b);
1842 end;
1843 end;
1845 if TGUIEdit(menu.GetControl('edMaxLives')).Enabled then
1846 begin
1847 n := StrToIntDef(TGUIEdit(menu.GetControl('edMaxLives')).Text, MaxLives);
1848 if n < 0 then n := 0;
1849 if n > 255 then n := 255;
1850 if n = 0 then
1851 MaxLives := 0
1852 else
1853 begin
1854 b := 0;
1855 stat := g_Player_GetStats();
1856 if stat <> nil then
1857 for a := 0 to High(stat) do
1858 if stat[a].Lives > b then
1859 b := stat[a].Lives;
1861 MaxLives := Max(n, b);
1862 end;
1863 end;
1865 if TGUISwitch(menu.GetControl('swBotsVS')).Enabled then
1866 begin
1867 case TGUISwitch(menu.GetControl('swBotsVS')).ItemIndex of
1868 1:
1869 begin
1870 Options := Options and (not GAME_OPTION_BOTVSPLAYER);
1871 Options := Options or GAME_OPTION_BOTVSMONSTER;
1872 end;
1873 2:
1874 begin
1875 Options := Options or GAME_OPTION_BOTVSPLAYER;
1876 Options := Options or GAME_OPTION_BOTVSMONSTER;
1877 end;
1878 else
1879 begin
1880 Options := Options or GAME_OPTION_BOTVSPLAYER;
1881 Options := Options and (not GAME_OPTION_BOTVSMONSTER);
1882 end;
1883 end;
1884 end;
1886 if TGUISwitch(menu.GetControl('swFlagDrop')).Enabled then
1887 begin
1888 case TGUISwitch(menu.GetControl('swFlagDrop')).ItemIndex of
1889 0: Options := Options or GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG;
1890 1: Options := Options or GAME_OPTION_ALLOWDROPFLAG;
1891 else Options := Options and not (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG);
1892 end;
1893 end;
1895 // don't forget to latch this shit
1896 gsGameFlags := Options;
1897 gsMaxLives := MaxLives;
1898 gsScoreLimit := ScoreLimit;
1899 gsTimeLimit := TimeLimit;
1900 end;
1902 if g_Game_IsNet then MH_SEND_GameSettings;
1903 end;
1905 procedure ProcVideoOptionsRes();
1906 var
1907 menu: TGUIMenu;
1908 list: SSArray;
1909 begin
1910 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1912 TGUILabel(menu.GetControl('lbCurrentRes')).Text :=
1913 IntToStr(gWinSizeX) +
1914 ' x ' + IntToStr(gWinSizeY) +
1915 ', ' + IntToStr(gBPP) + ' bpp';
1917 with TGUIListBox(menu.GetControl('lsResolution')) do
1918 begin
1919 list := sys_GetDisplayModes(gBPP);
1920 if list <> nil then
1921 begin
1922 Items := list;
1923 ItemIndex := Length(list)
1924 end
1925 else
1926 begin
1927 Clear
1928 end
1929 end;
1931 with TGUISwitch(menu.GetControl('swFullScreen')) do
1932 if gFullscreen then
1933 ItemIndex := 0
1934 else
1935 ItemIndex := 1;
1937 TempResScale := Round(r_pixel_scale - 1);
1938 with TGUISwitch(menu.GetControl('swResFactor')) do
1939 ItemIndex := Min(TempResScale, gRC_Width div 640 - 1);
1940 end;
1942 procedure ProcApplyVideoOptions();
1943 var
1944 menu: TGUIMenu;
1945 Fullscreen: Boolean;
1946 SWidth, SHeight: Integer;
1947 ScaleChanged: Boolean;
1948 str: String;
1949 begin
1950 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1952 str := TGUIListBox(menu.GetControl('lsResolution')).SelectedItem;
1953 if str <> '' then
1954 SScanf(str, '%dx%d', [@SWidth, @SHeight])
1955 else
1956 begin
1957 SWidth := gWinSizeX;
1958 SHeight := gWinSizeY;
1959 TempResScale := Min(TempResScale, SWidth div 640 - 1);
1960 end;
1962 Fullscreen := TGUISwitch(menu.GetControl('swFullScreen')).ItemIndex = 0;
1964 ScaleChanged := False;
1965 if TGUISwitch(menu.GetControl('swResFactor')).ItemIndex <> TempResScale then
1966 begin
1967 TempResScale := Min(TGUISwitch(menu.GetControl('swResFactor')).ItemIndex, SWidth div 640 - 1);
1968 r_pixel_scale := TempResScale + 1;
1969 ScaleChanged := True;
1970 end;
1972 if (SWidth <> gWinSizeX) or
1973 (SHeight <> gWinSizeY) or
1974 (Fullscreen <> gFullscreen) or
1975 ScaleChanged then
1976 begin
1977 gResolutionChange := True;
1978 gRC_Width := SWidth;
1979 gRC_Height := SHeight;
1980 gRC_FullScreen := Fullscreen;
1981 gRC_Maximized := gWinMaximized;
1982 end;
1984 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1985 ProcApplyOptions();
1986 end;
1988 procedure ProcSetFirstRussianLanguage;
1989 begin
1990 gLanguage := LANGUAGE_RUSSIAN;
1991 gLanguageChange := True;
1992 gAskLanguage := False;
1993 end;
1995 procedure ProcSetFirstEnglishLanguage;
1996 begin
1997 gLanguage := LANGUAGE_ENGLISH;
1998 gLanguageChange := True;
1999 gAskLanguage := False;
2000 end;
2002 procedure ProcRecallAddress();
2003 begin
2004 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2005 begin
2006 TGUIEdit(GetControl('edIP')).Text := NetClientIP;
2007 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort);
2008 end;
2009 end;
2011 procedure CreateFirstLanguageMenu();
2012 var
2013 Menu: TGUIWindow;
2014 begin
2015 Menu := TGUIWindow.Create('FirstLanguageMenu');
2017 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', ' '))) do
2018 begin
2019 Name := 'mmFirstLanguageMenu';
2020 AddButton(@ProcSetFirstRussianLanguage, 'Ðóññêèé', '');
2021 AddButton(@ProcSetFirstEnglishLanguage, 'English', '');
2022 end;
2024 Menu.DefControl := 'mmFirstLanguageMenu';
2025 Menu.MainWindow := True;
2026 g_GUI_AddWindow(Menu);
2027 end;
2029 procedure g_Menu_AskLanguage();
2030 begin
2031 CreateFirstLanguageMenu();
2032 g_GUI_ShowWindow('FirstLanguageMenu');
2033 end;
2035 procedure CreatePlayerOptionsMenu(s: String);
2036 var
2037 Menu: TGUIWindow;
2038 a: String;
2039 begin
2040 Menu := TGUIWindow.Create('OptionsPlayers'+s+'Menu');
2041 if s = 'P1' then
2042 a := _lc[I_MENU_PLAYER_1]
2043 else
2044 a := _lc[I_MENU_PLAYER_2];
2045 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, a))) do
2046 begin
2047 Name := 'mOptionsPlayers'+s+'Menu';
2048 with AddEdit(_lc[I_MENU_PLAYER_NAME]) do
2049 begin
2050 Name := 'ed'+s+'Name';
2051 MaxLength := 12;
2052 Width := 12;
2053 end;
2054 with AddSwitch(_lc[I_MENU_PLAYER_TEAM]) do
2055 begin
2056 Name := 'sw'+s+'Team';
2057 AddItem(_lc[I_MENU_PLAYER_TEAM_RED]);
2058 AddItem(_lc[I_MENU_PLAYER_TEAM_BLUE]);
2059 end ;
2060 with AddList(_lc[I_MENU_PLAYER_MODEL], 12, 6) do
2061 begin
2062 Name := 'ls'+s+'Model';
2063 Sort := True;
2064 Items := g_PlayerModel_GetNames();
2065 OnChange := ProcSelectModel;
2066 end;
2067 with AddScroll(_lc[I_MENU_PLAYER_RED]) do
2068 begin
2069 Name := 'sc'+s+'Red';
2070 Max := 16;
2071 OnChange := ProcChangeColor;
2072 end;
2073 with AddScroll(_lc[I_MENU_PLAYER_GREEN]) do
2074 begin
2075 Name := 'sc'+s+'Green';
2076 Max := 16;
2077 OnChange := ProcChangeColor;
2078 end;
2079 with AddScroll(_lc[I_MENU_PLAYER_BLUE]) do
2080 begin
2081 Name := 'sc'+s+'Blue';
2082 Max := 16;
2083 OnChange := ProcChangeColor;
2084 end;
2085 AddSpace();
2086 AddButton(@ProcOptionsPlayersMIMenu, _lc[I_MENU_MODEL_INFO]);
2087 AddButton(@ProcOptionsPlayersAnim, _lc[I_MENU_MODEL_ANIMATION]);
2088 AddButton(@ProcOptionsPlayersWeap, _lc[I_MENU_MODEL_CHANGE_WEAPON]);
2089 AddButton(@ProcOptionsPlayersRot, _lc[I_MENU_MODEL_ROTATE]);
2090 if s = 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu, _lc[I_MENU_WEAPON])
2091 else AddButton(@ProcOptionsPlayerP2WeaponMenu, _lc[I_MENU_WEAPON]);
2092 with TGUIModelView(Menu.AddChild(TGUIModelView.Create)) do
2093 begin
2094 Name := 'mv'+s+'Model';
2095 X := GetControl('ls'+s+'Model').X+TGUIListBox(GetControl('ls'+s+'Model')).GetWidth+16;
2096 Y := GetControl('ls'+s+'Model').Y;
2097 end;
2098 end;
2099 Menu.DefControl := 'mOptionsPlayers'+s+'Menu';
2100 g_GUI_AddWindow(Menu);
2101 end;
2103 procedure CreateAllMenus();
2104 var
2105 Menu: TGUIWindow;
2106 //SR: TSearchRec;
2107 a, cx, _y, i: Integer;
2108 //list: SSArray;
2109 begin
2110 Menu := TGUIWindow.Create('MainMenu');
2111 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, 'MAINMENU_LOGO', _lc[I_MENU_MAIN_MENU]))) do
2112 begin
2113 Name := 'mmMainMenu';
2114 AddButton(nil, _lc[I_MENU_NEW_GAME], 'NewGameMenu');
2115 AddButton(nil, _lc[I_MENU_MULTIPLAYER], 'NetGameMenu');
2116 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
2117 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
2118 AddButton(@ProcAuthorsMenu, _lc[I_MENU_AUTHORS], 'AuthorsMenu');
2119 AddButton(nil, _lc[I_MENU_EXIT], 'ExitMenu');
2120 end;
2121 with TGUILabel(Menu.AddChild(TGUILabel.Create(Format(_lc[I_VERSION], [GAME_VERSION]), gMenuSmallFont))) do
2122 begin
2123 Color := _RGB(255, 255, 255);
2124 X := gScreenWidth-GetWidth-8;
2125 Y := gScreenHeight-GetHeight-8;
2126 end;
2127 Menu.DefControl := 'mmMainMenu';
2128 Menu.MainWindow := True;
2129 g_GUI_AddWindow(Menu);
2131 Menu := TGUIWindow.Create('NewGameMenu');
2132 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_NEW_GAME]))) do
2133 begin
2134 Name := 'mmNewGameMenu';
2135 AddButton(@ProcSingle1Player, _lc[I_MENU_1_PLAYER]);
2136 AddButton(@ProcSingle2Players, _lc[I_MENU_2_PLAYERS]);
2137 AddButton(@ProcSelectCampaignMenu, _lc[I_MENU_CAMPAIGN], 'CampaignMenu');
2138 AddButton(nil, _lc[I_MENU_CUSTOM_GAME], 'CustomGameMenu');
2139 end;
2140 Menu.DefControl := 'mmNewGameMenu';
2141 g_GUI_AddWindow(Menu);
2143 Menu := TGUIWindow.Create('NetGameMenu');
2144 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_MULTIPLAYER]))) do
2145 begin
2146 Name := 'mmNetGameMenu';
2147 AddButton(@ProcRecallAddress, _lc[I_MENU_START_CLIENT], 'NetClientMenu');
2148 AddButton(nil, _lc[I_MENU_START_SERVER], 'NetServerMenu');
2149 end;
2150 Menu.DefControl := 'mmNetGameMenu';
2151 g_GUI_AddWindow(Menu);
2153 Menu := TGUIWindow.Create('NetServerMenu');
2154 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_START_SERVER]))) do
2155 begin
2156 Name := 'mNetServerMenu';
2157 with AddEdit(_lc[I_NET_SERVER_NAME]) do
2158 begin
2159 Name := 'edSrvName';
2160 OnlyDigits := False;
2161 Width := 16;
2162 MaxLength := 64;
2163 Text := NetServerName;
2164 end;
2165 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
2166 begin
2167 Name := 'edSrvPassword';
2168 OnlyDigits := False;
2169 Width := 16;
2170 MaxLength := 24;
2171 Text := NetPassword;
2172 end;
2173 with AddEdit(_lc[I_NET_PORT]) do
2174 begin
2175 Name := 'edPort';
2176 OnlyDigits := True;
2177 Width := 4;
2178 MaxLength := 5;
2179 Text := IntToStr(NetPort);
2180 end;
2181 with AddEdit(_lc[I_NET_MAX_CLIENTS]) do
2182 begin
2183 Name := 'edMaxPlayers';
2184 OnlyDigits := True;
2185 Width := 4;
2186 MaxLength := 2;
2187 Text := IntToStr(NetMaxClients);
2188 end;
2189 with AddSwitch(_lc[I_NET_USE_MASTER]) do
2190 begin
2191 Name := 'swUseMaster';
2192 AddItem(_lc[I_MENU_YES]);
2193 AddItem(_lc[I_MENU_NO]);
2194 if NetUseMaster then
2195 ItemIndex := 0
2196 else
2197 ItemIndex := 1;
2198 end;
2199 AddSpace();
2200 with AddLabel(_lc[I_MENU_MAP]) do
2201 begin
2202 Name := 'lbMap';
2203 FixedLength := 16;
2204 Text := gsMap;
2205 OnClick := @ProcSelectMapMenu;
2206 end;
2207 with AddSwitch(_lc[I_MENU_GAME_TYPE]) do
2208 begin
2209 Name := 'swGameMode';
2210 AddItem(_lc[I_MENU_GAME_TYPE_DM]);
2211 AddItem(_lc[I_MENU_GAME_TYPE_TDM]);
2212 AddItem(_lc[I_MENU_GAME_TYPE_CTF]);
2213 AddItem(_lc[I_MENU_GAME_TYPE_COOP]);
2214 case g_Game_TextToMode(gsGameMode) of
2215 GM_NONE,
2216 GM_DM: ItemIndex := 0;
2217 GM_TDM: ItemIndex := 1;
2218 GM_CTF: ItemIndex := 2;
2219 GM_SINGLE,
2220 GM_COOP: ItemIndex := 3;
2221 end;
2222 OnChange := ProcSwitchMonstersCustom;
2223 end;
2224 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
2225 begin
2226 Name := 'edTimeLimit';
2227 OnlyDigits := True;
2228 Width := 4;
2229 MaxLength := 5;
2230 if gsTimeLimit > 0 then
2231 Text := IntToStr(gsTimeLimit);
2232 end;
2233 with AddEdit(_lc[I_MENU_SCORE_LIMIT]) do
2234 begin
2235 Name := 'edScoreLimit';
2236 OnlyDigits := True;
2237 Width := 4;
2238 MaxLength := 5;
2239 if gsScoreLimit > 0 then
2240 Text := IntToStr(gsScoreLimit);
2241 end;
2242 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
2243 begin
2244 Name := 'edMaxLives';
2245 OnlyDigits := True;
2246 Width := 4;
2247 MaxLength := 5;
2248 if gsMaxLives > 0 then
2249 Text := IntToStr(gsMaxLives);
2250 end;
2251 with AddEdit(_lc[I_MENU_ITEM_RESPAWN_TIME]) do
2252 begin
2253 Name := 'edItemRespawnTime';
2254 OnlyDigits := True;
2255 Width := 4;
2256 MaxLength := 5;
2257 if gsItemRespawnTime > 0 then
2258 Text := IntToStr(gsItemRespawnTime);
2259 end;
2260 with AddSwitch(_lc[I_MENU_PLAYERS]) do
2261 begin
2262 Name := 'swPlayers';
2263 AddItem(_lc[I_MENU_COUNT_NONE]);
2264 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2265 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2266 ItemIndex := gsPlayers;
2267 end;
2268 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
2269 begin
2270 Name := 'swTeamDamage';
2271 AddItem(_lc[I_MENU_YES]);
2272 AddItem(_lc[I_MENU_NO]);
2273 if LongBool(gsGameFlags and GAME_OPTION_TEAMDAMAGE) then
2274 ItemIndex := 0
2275 else
2276 ItemIndex := 1;
2277 end;
2278 with AddSwitch(_lc[I_MENU_TEAM_HIT]) do
2279 begin
2280 Name := 'swTeamHit';
2281 AddItem(_lc[I_MENU_TEAM_HIT_BOTH]);
2282 AddItem(_lc[I_MENU_TEAM_HIT_TRACE]);
2283 AddItem(_lc[I_MENU_TEAM_HIT_PROJECTILE]);
2284 AddItem(_lc[I_MENU_TEAM_HIT_NOTHING]);
2285 if (gsGameFlags and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
2286 ItemIndex := 0
2287 else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITTRACE) then
2288 ItemIndex := 1
2289 else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITPROJECTILE) then
2290 ItemIndex := 2
2291 else
2292 ItemIndex := 3;
2293 end;
2294 with AddSwitch(_lc[I_MENU_DEATHMATCH_KEYS]) do
2295 begin
2296 Name := 'swDeathmatchKeys';
2297 AddItem(_lc[I_MENU_YES]);
2298 AddItem(_lc[I_MENU_NO]);
2299 if LongBool(gsGameFlags and GAME_OPTION_DMKEYS) then
2300 ItemIndex := 0
2301 else
2302 ItemIndex := 1;
2303 end;
2304 with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
2305 begin
2306 Name := 'swEnableExits';
2307 AddItem(_lc[I_MENU_YES]);
2308 AddItem(_lc[I_MENU_NO]);
2309 if LongBool(gsGameFlags and GAME_OPTION_ALLOWEXIT) then
2310 ItemIndex := 0
2311 else
2312 ItemIndex := 1;
2313 end;
2314 with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
2315 begin
2316 Name := 'swWeaponStay';
2317 AddItem(_lc[I_MENU_YES]);
2318 AddItem(_lc[I_MENU_NO]);
2319 if LongBool(gsGameFlags and GAME_OPTION_WEAPONSTAY) then
2320 ItemIndex := 0
2321 else
2322 ItemIndex := 1;
2323 end;
2324 with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
2325 begin
2326 Name := 'swMonsters';
2327 AddItem(_lc[I_MENU_YES]);
2328 AddItem(_lc[I_MENU_NO]);
2329 if LongBool(gsGameFlags and GAME_OPTION_MONSTERS) then
2330 ItemIndex := 0
2331 else
2332 ItemIndex := 1;
2333 end;
2334 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
2335 begin
2336 Name := 'swBotsVS';
2337 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
2338 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
2339 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
2340 ItemIndex := 2;
2341 if not LongBool(gsGameFlags and GAME_OPTION_BOTVSMONSTER) then
2342 ItemIndex := 0;
2343 if not LongBool(gsGameFlags and GAME_OPTION_BOTVSPLAYER) then
2344 ItemIndex := 1;
2345 end;
2346 with AddSwitch(_lc[I_MENU_FLAG_DROP]) do
2347 begin
2348 Name := 'swFlagDrop';
2349 AddItem(_lc[I_MENU_FLAG_THROW]);
2350 AddItem(_lc[I_MENU_YES]);
2351 AddItem(_lc[I_MENU_NO]);
2352 if (gsGameFlags and (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG)) = (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG) then
2353 ItemIndex := 0
2354 else if LongBool(gsGameFlags and GAME_OPTION_ALLOWDROPFLAG) then
2355 ItemIndex := 1
2356 else
2357 ItemIndex := 2;
2358 end;
2359 AddSpace();
2360 AddButton(@ProcStartNetGame, _lc[I_MENU_START_GAME]);
2362 ReAlign();
2363 end;
2364 Menu.DefControl := 'mNetServerMenu';
2365 g_GUI_AddWindow(Menu);
2367 Menu := TGUIWindow.Create('NetClientMenu');
2368 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_START_CLIENT]))) do
2369 begin
2370 Name := 'mNetClientMenu';
2372 AddButton(@ProcServerlist, _lc[I_NET_SLIST]);
2373 AddSpace();
2375 with AddEdit(_lc[I_NET_ADDRESS]) do
2376 begin
2377 Name := 'edIP';
2378 OnlyDigits :=False;
2379 Width := 12;
2380 MaxLength := 64;
2381 Text := 'localhost';
2382 end;
2383 with AddEdit(_lc[I_NET_PORT]) do
2384 begin
2385 Name := 'edPort';
2386 OnlyDigits := True;
2387 Width := 4;
2388 MaxLength := 5;
2389 Text := '25666';
2390 end;
2391 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
2392 begin
2393 Name := 'edPW';
2394 OnlyDigits := False;
2395 Width := 12;
2396 MaxLength := 32;
2397 Text := '';
2398 end;
2400 AddSpace();
2401 AddButton(@ProcConnectNetGame, _lc[I_MENU_CLIENT_CONNECT]);
2403 ReAlign();
2404 end;
2405 Menu.DefControl := 'mNetClientMenu';
2406 g_GUI_AddWindow(Menu);
2408 Menu := TGUIWindow.Create('LoadMenu');
2409 Menu.OnShow := ProcLoadMenu;
2410 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LOAD_GAME]))) do
2411 begin
2412 Name := 'mmLoadMenu';
2414 for a := 1 to 8 do
2415 with AddEdit('') do
2416 begin
2417 Name := 'edSlot'+IntToStr(a);
2418 Width := 16;
2419 MaxLength := 16;
2420 OnEnter := ProcLoadGame;
2421 end;
2422 end;
2423 Menu.DefControl := 'mmLoadMenu';
2424 g_GUI_AddWindow(Menu);
2426 Menu := TGUIWindow.Create('SaveMenu');
2427 Menu.OnShow := ProcSaveMenu;
2428 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SAVE_GAME]))) do
2429 begin
2430 Name := 'mmSaveMenu';
2432 for a := 1 to 8 do
2433 with AddEdit('') do
2434 begin
2435 Name := 'edSlot'+IntToStr(a);
2436 Width := 16;
2437 MaxLength := 16;
2438 OnChange := ProcSaveGame;
2439 end;
2440 end;
2441 Menu.DefControl := 'mmSaveMenu';
2442 g_GUI_AddWindow(Menu);
2444 Menu := TGUIWindow.Create('CustomGameMenu');
2445 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CUSTOM_GAME]))) do
2446 begin
2447 Name := 'mCustomGameMenu';
2448 with AddLabel(_lc[I_MENU_MAP]) do
2449 begin
2450 Name := 'lbMap';
2451 FixedLength := 16;
2452 Text := gsMap;
2453 OnClick := @ProcSelectMapMenu;
2454 end;
2455 with AddSwitch(_lc[I_MENU_GAME_TYPE]) do
2456 begin
2457 Name := 'swGameMode';
2458 AddItem(_lc[I_MENU_GAME_TYPE_DM]);
2459 AddItem(_lc[I_MENU_GAME_TYPE_TDM]);
2460 AddItem(_lc[I_MENU_GAME_TYPE_CTF]);
2461 AddItem(_lc[I_MENU_GAME_TYPE_COOP]);
2462 case g_Game_TextToMode(gsGameMode) of
2463 GM_NONE,
2464 GM_DM: ItemIndex := 0;
2465 GM_TDM: ItemIndex := 1;
2466 GM_CTF: ItemIndex := 2;
2467 GM_SINGLE,
2468 GM_COOP: ItemIndex := 3;
2469 end;
2470 OnChange := ProcSwitchMonstersCustom;
2471 end;
2472 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
2473 begin
2474 Name := 'edTimeLimit';
2475 OnlyDigits := True;
2476 Width := 4;
2477 MaxLength := 5;
2478 if gsTimeLimit > 0 then
2479 Text := IntToStr(gsTimeLimit);
2480 end;
2481 with AddEdit(_lc[I_MENU_SCORE_LIMIT]) do
2482 begin
2483 Name := 'edScoreLimit';
2484 OnlyDigits := True;
2485 Width := 4;
2486 MaxLength := 5;
2487 if gsScoreLimit > 0 then
2488 Text := IntToStr(gsScoreLimit);
2489 end;
2490 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
2491 begin
2492 Name := 'edMaxLives';
2493 OnlyDigits := True;
2494 Width := 4;
2495 MaxLength := 5;
2496 if gsMaxLives > 0 then
2497 Text := IntToStr(gsMaxLives);
2498 end;
2499 with AddEdit(_lc[I_MENU_ITEM_RESPAWN_TIME]) do
2500 begin
2501 Name := 'edItemRespawnTime';
2502 OnlyDigits := True;
2503 Width := 4;
2504 MaxLength := 5;
2505 if gsItemRespawnTime > 0 then
2506 Text := IntToStr(gsItemRespawnTime);
2507 end;
2508 with AddSwitch(_lc[I_MENU_PLAYERS]) do
2509 begin
2510 Name := 'swPlayers';
2511 AddItem(_lc[I_MENU_COUNT_NONE]);
2512 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2513 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2514 ItemIndex := gsPlayers;
2515 end;
2516 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
2517 begin
2518 Name := 'swTeamDamage';
2519 AddItem(_lc[I_MENU_YES]);
2520 AddItem(_lc[I_MENU_NO]);
2521 if LongBool(gsGameFlags and GAME_OPTION_TEAMDAMAGE) then
2522 ItemIndex := 0
2523 else
2524 ItemIndex := 1;
2525 end;
2526 with AddSwitch(_lc[I_MENU_TEAM_HIT]) do
2527 begin
2528 Name := 'swTeamHit';
2529 AddItem(_lc[I_MENU_TEAM_HIT_BOTH]);
2530 AddItem(_lc[I_MENU_TEAM_HIT_TRACE]);
2531 AddItem(_lc[I_MENU_TEAM_HIT_PROJECTILE]);
2532 AddItem(_lc[I_MENU_TEAM_HIT_NOTHING]);
2533 if (gsGameFlags and (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE)) = (GAME_OPTION_TEAMHITTRACE or GAME_OPTION_TEAMHITPROJECTILE) then
2534 ItemIndex := 0
2535 else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITTRACE) then
2536 ItemIndex := 1
2537 else if LongBool(gsGameFlags and GAME_OPTION_TEAMHITPROJECTILE) then
2538 ItemIndex := 2
2539 else
2540 ItemIndex := 3;
2541 end;
2542 with AddSwitch(_lc[I_MENU_DEATHMATCH_KEYS]) do
2543 begin
2544 Name := 'swDeathmatchKeys';
2545 AddItem(_lc[I_MENU_YES]);
2546 AddItem(_lc[I_MENU_NO]);
2547 if LongBool(gsGameFlags and GAME_OPTION_DMKEYS) then
2548 ItemIndex := 0
2549 else
2550 ItemIndex := 1;
2551 end;
2552 with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
2553 begin
2554 Name := 'swEnableExits';
2555 AddItem(_lc[I_MENU_YES]);
2556 AddItem(_lc[I_MENU_NO]);
2557 if LongBool(gsGameFlags and GAME_OPTION_ALLOWEXIT) then
2558 ItemIndex := 0
2559 else
2560 ItemIndex := 1;
2561 end;
2562 with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
2563 begin
2564 Name := 'swWeaponStay';
2565 AddItem(_lc[I_MENU_YES]);
2566 AddItem(_lc[I_MENU_NO]);
2567 if LongBool(gsGameFlags and GAME_OPTION_WEAPONSTAY) then
2568 ItemIndex := 0
2569 else
2570 ItemIndex := 1;
2571 end;
2572 with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
2573 begin
2574 Name := 'swMonsters';
2575 AddItem(_lc[I_MENU_YES]);
2576 AddItem(_lc[I_MENU_NO]);
2577 if LongBool(gsGameFlags and GAME_OPTION_MONSTERS) then
2578 ItemIndex := 0
2579 else
2580 ItemIndex := 1;
2581 end;
2582 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
2583 begin
2584 Name := 'swBotsVS';
2585 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
2586 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
2587 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
2588 ItemIndex := 2;
2589 if not LongBool(gsGameFlags and GAME_OPTION_BOTVSMONSTER) then
2590 ItemIndex := 0;
2591 if not LongBool(gsGameFlags and GAME_OPTION_BOTVSPLAYER) then
2592 ItemIndex := 1;
2593 end;
2594 with AddSwitch(_lc[I_MENU_FLAG_DROP]) do
2595 begin
2596 Name := 'swFlagDrop';
2597 AddItem(_lc[I_MENU_FLAG_THROW]);
2598 AddItem(_lc[I_MENU_YES]);
2599 AddItem(_lc[I_MENU_NO]);
2600 if (gsGameFlags and (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG)) = (GAME_OPTION_ALLOWDROPFLAG or GAME_OPTION_THROWFLAG) then
2601 ItemIndex := 0
2602 else if LongBool(gsGameFlags and GAME_OPTION_ALLOWDROPFLAG) then
2603 ItemIndex := 1
2604 else
2605 ItemIndex := 2;
2606 end;
2607 AddSpace();
2608 AddButton(@ProcStartCustomGame, _lc[I_MENU_START_GAME]);
2610 ReAlign();
2611 end;
2612 Menu.DefControl := 'mCustomGameMenu';
2613 g_GUI_AddWindow(Menu);
2615 Menu := TGUIWindow.Create('CampaignMenu');
2616 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CAMPAIGN]))) do
2617 begin
2618 Name := 'mCampaignMenu';
2620 AddSpace();
2621 AddSpace();
2622 AddSpace();
2623 AddSpace();
2624 AddSpace();
2625 AddSpace();
2627 with AddFileList('', 15, 4) do
2628 begin
2629 Name := 'lsWAD';
2630 OnChange := ProcSelectCampaignWAD;
2632 Sort := True;
2633 Dirs := True;
2634 FileMask := '*.wad|*.pk3|*.zip|*.dfz';
2635 SetBase(MegawadDirs);
2636 end;
2638 with AddLabel(_lc[I_MENU_MAP_NAME]) do
2639 begin
2640 Name := 'lbWADName';
2641 FixedLength := 8;
2642 Enabled := False;
2643 end;
2644 with AddLabel(_lc[I_MENU_MAP_AUTHOR]) do
2645 begin
2646 Name := 'lbWADAuthor';
2647 FixedLength := 8;
2648 Enabled := False;
2649 end;
2650 AddLine(_lc[I_MENU_MAP_DESCRIPTION]);
2651 with AddMemo('', 15, 3) do
2652 begin
2653 Name := 'meWADDescription';
2654 Color := MENU_ITEMSCTRL_COLOR;
2655 end;
2656 with AddSwitch(_lc[I_MENU_PLAYERS]) do
2657 begin
2658 Name := 'swPlayers';
2659 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2660 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2661 end;
2662 AddSpace();
2663 AddButton(@ProcStartCampaign, _lc[I_MENU_START_GAME]);
2665 ReAlign();
2667 with TGUIImage(Menu.AddChild(TGUIImage.Create)) do
2668 begin
2669 Name := 'mpWADImage';
2670 DefaultRes := 'NOPIC';
2671 X := GetControl('lsWAD').X+4;
2672 Y := GetControl('lsWAD').Y-128-MENU_VSPACE;
2673 end;
2674 end;
2675 Menu.DefControl := 'mCampaignMenu';
2676 g_GUI_AddWindow(Menu);
2678 Menu := TGUIWindow.Create('SelectMapMenu');
2679 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SELECT_MAP]))) do
2680 begin
2681 Name := 'mSelectMapMenu';
2682 with AddFileList(_lc[I_MENU_MAP_WAD], 12, 4) do
2683 begin
2684 Name := 'lsMapWAD';
2685 OnChange := ProcSelectWAD;
2687 Sort := True;
2688 Dirs := True;
2689 FileMask := '*.wad|*.pk3|*.zip|*.dfz';
2690 SetBase(MapDirs);
2691 end;
2692 with AddList(_lc[I_MENU_MAP_RESOURCE], 12, 4) do
2693 begin
2694 Name := 'lsMapRes';
2695 Sort := True;
2696 OnChange := ProcSelectMap;
2697 end;
2698 AddSpace();
2699 with AddLabel(_lc[I_MENU_MAP_NAME]) do
2700 begin
2701 Name := 'lbMapName';
2702 FixedLength := 24;
2703 Enabled := False;
2704 end;
2705 with AddLabel(_lc[I_MENU_MAP_AUTHOR]) do
2706 begin
2707 Name := 'lbMapAuthor';
2708 FixedLength := 16;
2709 Enabled := False;
2710 end;
2711 with AddLabel(_lc[I_MENU_MAP_SIZE]) do
2712 begin
2713 Name := 'lbMapSize';
2714 FixedLength := 10;
2715 Enabled := False;
2716 end;
2717 with AddMemo(_lc[I_MENU_MAP_DESCRIPTION], 20, 4) do
2718 begin
2719 Name := 'meMapDescription';
2720 end;
2722 ReAlign();
2724 with TGUIMapPreview(Menu.AddChild(TGUIMapPreview.Create)) do
2725 begin
2726 Name := 'mpMapPreview';
2727 X := GetControl('lsMapWAD').X+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2728 Y := GetControl('lsMapWAD').Y;
2729 end;
2730 with TGUILabel(Menu.AddChild(TGUILabel.Create('', gMenuSmallFont))) do
2731 begin
2732 Name := 'lbMapScale';
2733 FixedLength := 8;
2734 Enabled := False;
2735 Color := MENU_ITEMSCTRL_COLOR;
2736 X := GetControl('lsMapWAD').X +
2737 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2738 2 + MAPPREVIEW_WIDTH*4;
2739 Y := GetControl('lsMapWAD').Y + MAPPREVIEW_HEIGHT*16 + 16;
2740 end;
2741 end;
2742 Menu.OnClose := ProcSetMap;
2743 Menu.DefControl := 'mSelectMapMenu';
2744 g_GUI_AddWindow(Menu);
2746 Menu := TGUIWindow.Create('OptionsMenu');
2747 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_OPTIONS]))) do
2748 begin
2749 Name := 'mmOptionsMenu';
2750 AddButton(nil, _lc[I_MENU_VIDEO_OPTIONS], 'OptionsVideoMenu');
2751 AddButton(nil, _lc[I_MENU_SOUND_OPTIONS], 'OptionsSoundMenu');
2752 AddButton(nil, _lc[I_MENU_GAME_OPTIONS], 'OptionsGameMenu');
2753 AddButton(nil, _lc[I_MENU_CONTROLS_OPTIONS], 'OptionsControlsMenu');
2754 AddButton(nil, _lc[I_MENU_PLAYER_OPTIONS], 'OptionsPlayersMenu');
2755 AddButton(nil, _lc[I_MENU_LANGUAGE_OPTIONS], 'OptionsLanguageMenu');
2756 AddSpace();
2757 AddButton(nil, _lc[I_MENU_SAVED_OPTIONS], 'SavedOptionsMenu').Color := _RGB(255, 0, 0);
2758 AddButton(nil, _lc[I_MENU_DEFAULT_OPTIONS], 'DefaultOptionsMenu').Color := _RGB(255, 0, 0);
2759 end;
2760 Menu.OnClose := ProcApplyOptions;
2761 Menu.DefControl := 'mmOptionsMenu';
2762 g_GUI_AddWindow(Menu);
2764 Menu := CreateYNMenu('SavedOptionsMenu', _lc[I_MENU_LOAD_SAVED_PROMT], Round(gScreenWidth*0.6),
2765 gMenuSmallFont, @ProcSavedMenuKeyDown);
2766 g_GUI_AddWindow(Menu);
2768 Menu := TGUIWindow.Create('OptionsVideoMenu');
2769 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_VIDEO_OPTIONS]))) do
2770 begin
2771 Name := 'mOptionsVideoMenu';
2772 AddButton(@ProcVideoOptionsRes, _lc[I_MENU_VIDEO_RESOLUTION], 'OptionsVideoResMenu');
2773 with AddSwitch(_lc[I_MENU_VIDEO_BPP]) do
2774 begin
2775 Name := 'swBPP';
2776 AddItem('16');
2777 AddItem('32');
2778 end;
2779 with AddSwitch(_lc[I_MENU_VIDEO_VSYNC]) do
2780 begin
2781 Name := 'swVSync';
2782 AddItem(_lc[I_MENU_YES]);
2783 AddItem(_lc[I_MENU_NO]);
2784 end;
2785 with AddSwitch(_lc[I_MENU_VIDEO_FILTER_SKY]) do
2786 begin
2787 Name := 'swTextureFilter';
2788 AddItem(_lc[I_MENU_YES]);
2789 AddItem(_lc[I_MENU_NO]);
2790 end;
2791 with AddSwitch(_lc[I_MENU_VIDEO_INTERPOLATION]) do
2792 begin
2793 Name := 'swInterp';
2794 AddItem(_lc[I_MENU_YES]);
2795 AddItem(_lc[I_MENU_NO]);
2796 end;
2797 with AddSwitch(_lc[I_MENU_VIDEO_LEGACY_COMPATIBLE]) do
2798 begin
2799 Name := 'swLegacyNPOT';
2800 AddItem(_lc[I_MENU_NO]);
2801 AddItem(_lc[I_MENU_YES]);
2802 end;
2803 AddSpace();
2804 AddText(_lc[I_MENU_VIDEO_NEED_RESTART], Round(gScreenWidth*0.6));
2805 ReAlign();
2806 end;
2807 Menu.DefControl := 'mOptionsVideoMenu';
2808 g_GUI_AddWindow(Menu);
2810 Menu := TGUIWindow.Create('OptionsVideoResMenu');
2811 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_RESOLUTION_SELECT]))) do
2812 begin
2813 Name := 'mOptionsVideoResMenu';
2814 with AddLabel(_lc[I_MENU_RESOLUTION_CURRENT]) do
2815 begin
2816 Name := 'lbCurrentRes';
2817 FixedLength := 24;
2818 Enabled := False;
2819 end;
2820 with AddList(_lc[I_MENU_RESOLUTION_LIST], 12, 6) do
2821 begin
2822 Name := 'lsResolution';
2823 Sort := False;
2824 end;
2825 with AddSwitch(_lc[I_MENU_RESOLUTION_FULLSCREEN]) do
2826 begin
2827 Name := 'swFullScreen';
2828 AddItem(_lc[I_MENU_YES]);
2829 AddItem(_lc[I_MENU_NO]);
2830 end;
2831 with AddSwitch(_lc[I_MENU_GAME_SCALE_FACTOR]) do
2832 begin
2833 Name := 'swResFactor';
2834 AddItem('1x');
2835 for i := 2 to gRC_Width div 640 do
2836 AddItem(IntToStr(i) + 'x');
2837 end;
2838 AddSpace();
2839 AddButton(@ProcApplyVideoOptions, _lc[I_MENU_RESOLUTION_APPLY]);
2840 UpdateIndex();
2841 end;
2842 Menu.DefControl := 'mOptionsVideoResMenu';
2843 g_GUI_AddWindow(Menu);
2845 Menu := TGUIWindow.Create('OptionsSoundMenu');
2846 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SOUND_OPTIONS]))) do
2847 begin
2848 Name := 'mOptionsSoundMenu';
2849 with AddScroll(_lc[I_MENU_SOUND_MUSIC_LEVEL]) do
2850 begin
2851 Name := 'scMusicLevel';
2852 Max := 16;
2853 OnChange := ProcChangeSoundSettings;
2854 end;
2855 with AddScroll(_lc[I_MENU_SOUND_SOUND_LEVEL]) do
2856 begin
2857 Name := 'scSoundLevel';
2858 Max := 16;
2859 OnChange := ProcChangeSoundSettings;
2860 end;
2861 with AddScroll(_lc[I_MENU_SOUND_MAX_SIM_SOUNDS]) do
2862 begin
2863 Name := 'scMaxSimSounds';
2864 Max := 16;
2865 end;
2866 with AddSwitch (_lc[I_MENU_SOUND_ANNOUNCE]) do
2867 begin;
2868 Name := 'swAnnouncer';
2869 AddItem(_lc[I_MENU_ANNOUNCE_NONE]);
2870 AddItem(_lc[I_MENU_ANNOUNCE_ME]);
2871 AddItem(_lc[I_MENU_ANNOUNCE_MEPLUS]);
2872 AddItem(_lc[I_MENU_ANNOUNCE_ALL]);
2873 end;
2874 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2875 with AddSwitch (_lc[I_MENU_SOUND_COMPAT]) do
2876 begin;
2877 Name := 'swSoundEffects';
2878 AddItem(_lc[I_MENU_COMPAT_DOOM2]);
2879 AddItem(_lc[I_MENU_COMPAT_DF]);
2880 end;
2881 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2882 with AddSwitch (_lc[I_MENU_SOUND_CHAT]) do
2883 begin;
2884 Name := 'swChatSpeech';
2885 AddItem(_lc[I_MENU_YES]);
2886 AddItem(_lc[I_MENU_NO]);
2887 end;
2888 with AddSwitch(_lc[I_MENU_SOUND_INACTIVE_SOUNDS]) do
2889 begin
2890 Name := 'swInactiveSounds';
2891 AddItem(_lc[I_MENU_SOUND_INACTIVE_SOUNDS_ON]);
2892 AddItem(_lc[I_MENU_SOUND_INACTIVE_SOUNDS_OFF]);
2893 end;
2894 ReAlign();
2895 end;
2896 Menu.DefControl := 'mOptionsSoundMenu';
2897 g_GUI_AddWindow(Menu);
2899 Menu := TGUIWindow.Create('OptionsGameMenu');
2900 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_GAME_OPTIONS]))) do
2901 begin
2902 Name := 'mOptionsGameMenu';
2903 with AddScroll(_lc[I_MENU_GAME_PARTICLES_COUNT]) do
2904 begin
2905 Name := 'scParticlesCount';
2906 Max := 20;
2907 end;
2908 with AddSwitch(_lc[I_MENU_GAME_BLOOD_COUNT]) do
2909 begin
2910 Name := 'swBloodCount';
2911 AddItem(_lc[I_MENU_COUNT_NONE]);
2912 AddItem(_lc[I_MENU_COUNT_SMALL]);
2913 AddItem(_lc[I_MENU_COUNT_NORMAL]);
2914 AddItem(_lc[I_MENU_COUNT_BIG]);
2915 AddItem(_lc[I_MENU_COUNT_VERYBIG]);
2916 end;
2917 with AddScroll(_lc[I_MENU_GAME_MAX_SHELLS]) do
2918 begin
2919 Name := 'scShellsMax';
2920 Max := 20;
2921 end;
2922 with AddScroll(_lc[I_MENU_GAME_GIBS_COUNT]) do
2923 begin
2924 Name := 'scGibsMax';
2925 Max := 20;
2926 end;
2927 with AddScroll(_lc[I_MENU_GAME_MAX_CORPSES]) do
2928 begin
2929 Name := 'scCorpsesMax';
2930 Max := 20;
2931 end;
2932 with AddSwitch(_lc[I_MENU_GAME_MAX_GIBS]) do
2933 begin
2934 Name := 'swGibsCount';
2935 AddItem(_lc[I_MENU_COUNT_NONE]);
2936 AddItem(_lc[I_MENU_COUNT_SMALL]);
2937 AddItem(_lc[I_MENU_COUNT_NORMAL]);
2938 AddItem(_lc[I_MENU_COUNT_BIG]);
2939 AddItem(_lc[I_MENU_COUNT_VERYBIG]);
2940 end;
2941 with AddSwitch(_lc[I_MENU_GAME_CORPSE_TYPE]) do
2942 begin
2943 Name := 'swCorpseType';
2944 AddItem(_lc[I_MENU_GAME_CORPSE_TYPE_SIMPLE]);
2945 AddItem(_lc[I_MENU_GAME_CORPSE_TYPE_ADV]);
2946 end;
2947 with AddSwitch(_lc[I_MENU_GAME_GIBS_TYPE]) do
2948 begin
2949 Name := 'swGibsType';
2950 AddItem(_lc[I_MENU_GAME_GIBS_TYPE_SIMPLE]);
2951 AddItem(_lc[I_MENU_GAME_GIBS_TYPE_ADV]);
2952 end;
2953 with AddSwitch(_lc[I_MENU_GAME_BLOOD_TYPE]) do
2954 begin
2955 Name := 'swBloodType';
2956 AddItem(_lc[I_MENU_GAME_BLOOD_TYPE_SIMPLE]);
2957 AddItem(_lc[I_MENU_GAME_BLOOD_TYPE_ADV]);
2958 end;
2959 with AddSwitch(_lc[I_MENU_GAME_SCREEN_FLASH]) do
2960 begin
2961 Name := 'swScreenFlash';
2962 AddItem(_lc[I_MENU_NO]);
2963 AddItem(_lc[I_MENU_COMPAT_DF]);
2964 AddItem(_lc[I_MENU_COMPAT_DOOM2]);
2965 end;
2966 with AddSwitch(_lc[I_MENU_GAME_BACKGROUND]) do
2967 begin
2968 Name := 'swBackground';
2969 AddItem(_lc[I_MENU_YES]);
2970 AddItem(_lc[I_MENU_NO]);
2971 end;
2972 with AddSwitch(_lc[I_MENU_GAME_MESSAGES]) do
2973 begin
2974 Name := 'swMessages';
2975 AddItem(_lc[I_MENU_YES]);
2976 AddItem(_lc[I_MENU_NO]);
2977 end;
2978 with AddSwitch(_lc[I_MENU_GAME_REVERT_PLAYERS]) do
2979 begin
2980 Name := 'swRevertPlayers';
2981 AddItem(_lc[I_MENU_YES]);
2982 AddItem(_lc[I_MENU_NO]);
2983 end;
2984 with AddSwitch(_lc[I_MENU_GAME_CHAT_BUBBLE]) do
2985 begin
2986 Name := 'swChatBubble';
2987 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_NONE]);
2988 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_SIMPLE]);
2989 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_ADV]);
2990 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_COLOR]);
2991 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_TEXTURE]);
2992 end;
2993 with AddSwitch(_lc[I_MENU_GAME_PLAYER_INDICATOR]) do
2994 begin
2995 Name := 'swPlayerIndicator';
2996 AddItem(_lc[I_MENU_GAME_INDICATOR_NONE]);
2997 AddItem(_lc[I_MENU_GAME_INDICATOR_OWN]);
2998 AddItem(_lc[I_MENU_GAME_INDICATOR_ALL]);
2999 end;
3000 with AddSwitch(_lc[I_MENU_GAME_INDICATOR_STYLE]) do
3001 begin
3002 Name := 'swPlayerIndicatorStyle';
3003 AddItem(_lc[I_MENU_GAME_INDICATOR_ARROW]);
3004 AddItem(_lc[I_MENU_GAME_INDICATOR_NAME]);
3005 end;
3006 with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do
3007 begin
3008 Name := 'scScaleFactor';
3009 Max := 10;
3010 OnChange := ProcChangeGameSettings;
3011 end;
3012 ReAlign();
3013 end;
3014 Menu.DefControl := 'mOptionsGameMenu';
3015 g_GUI_AddWindow(Menu);
3017 Menu := TGUIWindow.Create('OptionsControlsMenu');
3018 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROLS_OPTIONS]))) do
3019 begin
3020 Name := 'mOptionsControlsMenu';
3021 AddLine(_lc[I_MENU_CONTROL_GLOBAL]);
3022 AddKeyRead(_lc[I_MENU_CONTROL_SCREENSHOT]).Name := _lc[I_MENU_CONTROL_SCREENSHOT];
3023 AddKeyRead(_lc[I_MENU_CONTROL_STAT]).Name := _lc[I_MENU_CONTROL_STAT];
3024 AddKeyRead(_lc[I_MENU_CONTROL_CHAT]).Name := _lc[I_MENU_CONTROL_CHAT];
3025 AddKeyRead(_lc[I_MENU_CONTROL_TEAMCHAT]).Name := _lc[I_MENU_CONTROL_TEAMCHAT];
3026 AddSpace();
3027 AddButton(nil, _lc[I_MENU_PLAYER_1_KBD], 'OptionsControlsP1Menu');
3028 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3029 AddButton(nil, _lc[I_MENU_PLAYER_1_WEAPONS], 'OptionsControlsP1MenuWeapons');
3030 AddButton(nil, _lc[I_MENU_PLAYER_2_KBD], 'OptionsControlsP2Menu');
3031 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3032 AddButton(nil, _lc[I_MENU_PLAYER_2_WEAPONS], 'OptionsControlsP2MenuWeapons');
3033 if e_HasJoysticks then
3034 begin
3035 AddSpace();
3036 AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
3037 end;
3038 if g_touch_enabled then
3039 begin
3040 AddSpace();
3041 AddButton(nil, _lc[I_MENU_CONTROL_TOUCH], 'OptionsControlsTouchMenu');
3042 end;
3043 end;
3044 Menu.DefControl := 'mOptionsControlsMenu';
3045 g_GUI_AddWindow(Menu);
3047 Menu := TGUIWindow.Create('OptionsControlsP1Menu');
3048 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_KBD]))) do
3049 begin
3050 Name := 'mOptionsControlsP1Menu';
3051 AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
3052 AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
3053 AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
3054 AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
3055 AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
3056 AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
3057 AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
3058 AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
3059 AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
3060 AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
3061 AddKeyRead2(_lc[I_MENU_CONTROL_DROPFLAG]).Name := _lc[I_MENU_CONTROL_DROPFLAG];
3062 end;
3063 Menu.DefControl := 'mOptionsControlsP1Menu';
3064 g_GUI_AddWindow(Menu);
3066 Menu := TGUIWindow.Create('OptionsControlsP1MenuWeapons');
3067 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_WEAPONS]))) do
3068 begin
3069 Name := 'mOptionsControlsP1MenuWeapons';
3070 for i := WP_FIRST to WP_LAST do
3071 AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
3072 _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
3073 end;
3074 Menu.DefControl := 'mOptionsControlsP1MenuWeapons';
3075 g_GUI_AddWindow(Menu);
3077 Menu := TGUIWindow.Create('OptionsControlsP2Menu');
3078 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_KBD]))) do
3079 begin
3080 Name := 'mOptionsControlsP2Menu';
3081 AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
3082 AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
3083 AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
3084 AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
3085 AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
3086 AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
3087 AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
3088 AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
3089 AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
3090 AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
3091 AddKeyRead2(_lc[I_MENU_CONTROL_DROPFLAG]).Name := _lc[I_MENU_CONTROL_DROPFLAG];
3092 end;
3093 Menu.DefControl := 'mOptionsControlsP2Menu';
3094 g_GUI_AddWindow(Menu);
3096 Menu := TGUIWindow.Create('OptionsControlsP2MenuWeapons');
3097 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_WEAPONS]))) do
3098 begin
3099 Name := 'mOptionsControlsP2MenuWeapons';
3100 for i := WP_FIRST to WP_LAST do
3101 AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
3102 _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
3103 end;
3104 Menu.DefControl := 'mOptionsControlsP2MenuWeapons';
3105 g_GUI_AddWindow(Menu);
3107 Menu := TGUIWindow.Create('OptionsControlsJoystickMenu');
3108 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do
3109 begin
3110 Name := 'mOptionsControlsJoystickMenu';
3111 for i := 0 to e_MaxJoys - 1 do
3112 with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
3113 begin
3114 Name := 'scDeadzone' + IntToStr(i);
3115 Max := 20
3116 end
3117 end;
3118 Menu.DefControl := 'mOptionsControlsJoystickMenu';
3119 g_GUI_AddWindow(Menu);
3121 Menu := TGUIWindow.Create('OptionsControlsTouchMenu');
3122 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_TOUCH]))) do
3123 begin
3124 Name := 'mOptionsControlsTouchMenu';
3125 with AddSwitch(_lc[I_MENU_CONTROL_TOUCH_ALT]) do
3126 begin
3127 Name := 'swTouchAlt';
3128 AddItem(_lc[I_MENU_NO]);
3129 AddItem(_lc[I_MENU_YES]);
3130 OnChange := ProcChangeTouchSettings;
3131 end;
3132 with AddScroll(_lc[I_MENU_CONTROL_TOUCH_SIZE]) do
3133 begin
3134 Name := 'scTouchSize';
3135 Max := 20;
3136 OnChange := ProcChangeTouchSettings;
3137 end;
3138 with AddSwitch(_lc[I_MENU_CONTROL_TOUCH_FIRE]) do
3139 begin
3140 Name := 'swTouchFire';
3141 AddItem(_lc[I_MENU_NO]);
3142 AddItem(_lc[I_MENU_YES]);
3143 end;
3144 with AddScroll(_lc[I_MENU_CONTROL_TOUCH_OFFSET]) do
3145 begin
3146 Name := 'scTouchOffset';
3147 Max := 20;
3148 OnChange := ProcChangeTouchSettings;
3149 end;
3150 end;
3151 Menu.DefControl := 'mOptionsControlsTouchMenu';
3152 g_GUI_AddWindow(Menu);
3154 Menu := TGUIWindow.Create('OptionsPlayersMenu');
3155 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_OPTIONS]))) do
3156 begin
3157 Name := 'mOptionsPlayersMenu';
3158 AddButton(nil, _lc[I_MENU_PLAYER_1], 'OptionsPlayersP1Menu');
3159 AddButton(nil, _lc[I_MENU_PLAYER_2], 'OptionsPlayersP2Menu');
3160 end;
3161 Menu.DefControl := 'mOptionsPlayersMenu';
3162 g_GUI_AddWindow(Menu);
3164 CreatePlayerOptionsMenu('P1');
3165 CreatePlayerOptionsMenu('P2');
3167 Menu := TGUIWindow.Create('OptionsPlayersMIMenu');
3168 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_MODEL_INFO]))) do
3169 begin
3170 Name := 'mOptionsPlayersMIMenu';
3171 with AddLabel(_lc[I_MENU_MODEL_NAME]) do
3172 begin
3173 Name := 'lbName';
3174 FixedLength := 16;
3175 end;
3176 with AddLabel(_lc[I_MENU_MODEL_AUTHOR]) do
3177 begin
3178 Name := 'lbAuthor';
3179 FixedLength := 16;
3180 end;
3181 with AddMemo(_lc[I_MENU_MODEL_COMMENT], 14, 6) do
3182 begin
3183 Name := 'meComment';
3184 end;
3185 AddSpace();
3186 AddLine(_lc[I_MENU_MODEL_OPTIONS]);
3187 with AddLabel(_lc[I_MENU_MODEL_WEAPON]) do
3188 begin
3189 Name := 'lbWeapon';
3190 FixedLength := Max(Length(_lc[I_MENU_YES]), Length(_lc[I_MENU_NO]));
3191 end;
3192 ReAlign();
3193 end;
3194 Menu.DefControl := 'mOptionsPlayersMIMenu';
3195 g_GUI_AddWindow(Menu);
3197 Menu := TGUIWindow.Create('OptionsPlayersP1WeaponMenu');
3198 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON]))) do
3199 begin
3200 Name := 'mOptionsPlayersP1WeaponMenu';
3201 with AddSwitch(_lc[I_MENU_WEAPON_SWITCH]) do
3202 begin
3203 Name := 'swWeaponAutoswitch';
3204 AddItem(_lc[I_MENU_NO]);
3205 AddItem(_lc[I_MENU_WEAPON_SWITCH_LINEAR]);
3206 AddItem(_lc[I_MENU_WEAPON_SWITCH_PREFERENCE]);
3207 end;
3208 with AddSwitch(_lc[I_MENU_WEAPON_ALLOW_EMPTY]) do
3209 begin
3210 Name := 'swWeaponAllowEmpty';
3211 AddItem(_lc[I_MENU_YES]);
3212 AddItem(_lc[I_MENU_NO]);
3213 end;
3214 with AddSwitch(_lc[I_MENU_KASTET_ALLOW]) do
3215 begin
3216 Name := 'swWeaponAllowFist';
3217 AddItem(_lc[I_MENU_KASTET_ALLOW_ALWAYS]);
3218 AddItem(_lc[I_MENU_KASTET_ALLOW_BERSERK]);
3219 end;
3220 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
3221 ReAlign();
3222 end;
3223 Menu.DefControl := 'mOptionsPlayersP1WeaponMenu';
3224 g_GUI_AddWindow(Menu);
3226 Menu := TGUIWindow.Create('OptionsPreferencesP1WeaponMenu');
3227 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON_PRIORITY_PLAYER_1]))) do
3228 begin
3229 Name := 'mOptionsPreferencesP1WeaponMenu';
3230 for i := WP_FIRST to WP_LAST do
3231 begin
3232 with AddSwitch(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]) do
3233 begin
3234 Name := IntToStr(i);
3235 for a := WP_FIRST to WP_LAST+1 do
3236 begin
3237 AddItem(IntToStr(a));
3238 end;
3239 ItemIndex := i
3240 end;
3241 end;
3242 with AddSwitch(_lc[I_GAME_WEAPON_BERSERK]) do
3243 begin
3244 Name := IntToStr(WP_LAST+1);
3245 for a := WP_FIRST to WP_LAST+1 do
3246 begin
3247 AddItem(IntToStr(a));
3248 end;
3249 ItemIndex := WP_LAST + 1;
3250 end;
3251 end;
3252 Menu.DefControl := 'mOptionsPreferencesP1WeaponMenu';
3253 g_GUI_AddWindow(Menu);
3256 Menu := TGUIWindow.Create('OptionsPlayersP2WeaponMenu');
3257 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON]))) do
3258 begin
3259 Name := 'mOptionsPlayersP2WeaponMenu';
3260 with AddSwitch(_lc[I_MENU_WEAPON_SWITCH]) do
3261 begin
3262 Name := 'swWeaponAutoswitch';
3263 AddItem(_lc[I_MENU_NO]);
3264 AddItem(_lc[I_MENU_WEAPON_SWITCH_LINEAR]);
3265 AddItem(_lc[I_MENU_WEAPON_SWITCH_PREFERENCE]);
3266 end;
3267 with AddSwitch(_lc[I_MENU_WEAPON_ALLOW_EMPTY]) do
3268 begin
3269 Name := 'swWeaponAllowEmpty';
3270 AddItem(_lc[I_MENU_YES]);
3271 AddItem(_lc[I_MENU_NO]);
3272 end;
3273 with AddSwitch(_lc[I_MENU_KASTET_ALLOW]) do
3274 begin
3275 Name := 'swWeaponAllowFist';
3276 AddItem(_lc[I_MENU_KASTET_ALLOW_ALWAYS]);
3277 AddItem(_lc[I_MENU_KASTET_ALLOW_BERSERK]);
3278 end;
3279 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu, _lc[I_MENU_WEAPON_SWITCH_PRIORITY]);
3280 ReAlign();
3281 end;
3282 Menu.DefControl := 'mOptionsPlayersP2WeaponMenu';
3283 g_GUI_AddWindow(Menu);
3285 Menu := TGUIWindow.Create('OptionsPreferencesP2WeaponMenu');
3286 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_WEAPON_PRIORITY_PLAYER_2]))) do
3287 begin
3288 Name := 'mOptionsPreferencesP2WeaponMenu';
3289 for i := WP_FIRST to WP_LAST do
3290 begin
3291 with AddSwitch(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]) do
3292 begin
3293 Name := IntToStr(i);
3294 for a := WP_FIRST to WP_LAST+1 do
3295 begin
3296 AddItem(IntToStr(a));
3297 end;
3298 ItemIndex := i
3299 end;
3300 end;
3301 with AddSwitch(_lc[I_GAME_WEAPON_BERSERK]) do
3302 begin
3303 Name := IntToStr(WP_LAST+1);
3304 for a := WP_FIRST to WP_LAST+1 do
3305 begin
3306 AddItem(IntToStr(a));
3307 end;
3308 ItemIndex := WP_LAST + 1;
3309 end;
3310 end;
3311 Menu.DefControl := 'mOptionsPreferencesP2WeaponMenu';
3312 g_GUI_AddWindow(Menu);
3314 Menu := TGUIWindow.Create('OptionsLanguageMenu');
3315 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LANGUAGE_OPTIONS]))) do
3316 begin
3317 Name := 'mOptionsLanguageMenu';
3318 AddButton(@ProcSetRussianLanguage, _lc[I_MENU_LANGUAGE_RUSSIAN]);
3319 AddButton(@ProcSetEnglishLanguage, _lc[I_MENU_LANGUAGE_ENGLISH]);
3320 ReAlign();
3321 end;
3322 Menu.DefControl := 'mOptionsLanguageMenu';
3323 g_GUI_AddWindow(Menu);
3325 Menu := CreateYNMenu('DefaultOptionsMenu', _lc[I_MENU_SET_DEFAULT_PROMT], Round(gScreenWidth*0.6),
3326 gMenuSmallFont, @ProcDefaultMenuKeyDown);
3327 g_GUI_AddWindow(Menu);
3329 Menu := TGUIWindow.Create('AuthorsMenu');
3330 Menu.BackTexture := 'INTER';
3331 Menu.OnClose := ProcAuthorsClose;
3333 // Çàãîëîâîê:
3334 _y := 16;
3335 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CAP_1], gMenuFont))) do
3336 begin
3337 Color := _RGB(255, 0, 0);
3338 X := (gScreenWidth div 2)-(GetWidth() div 2);
3339 Y := _y;
3340 _y := _y+GetHeight();
3341 end;
3342 with TGUILabel(Menu.AddChild(TGUILabel.Create(Format(_lc[I_CREDITS_CAP_2], [GAME_VERSION, NET_PROTOCOL_VER]), gMenuSmallFont))) do
3343 begin
3344 Color := _RGB(255, 0, 0);
3345 X := (gScreenWidth div 2)-(GetWidth() div 2);
3346 Y := _y;
3347 _y := _y+GetHeight()+32;
3348 end;
3349 // ×òî äåëàë: Êòî äåëàë
3350 cx := gScreenWidth div 2 - 320 + 64;
3351 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_1], gMenuSmallFont))) do
3352 begin
3353 Color := _RGB(255, 0, 0);
3354 X := cx;
3355 Y := _y;
3356 _y := _y+22;
3357 end;
3358 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_1_1], gMenuSmallFont))) do
3359 begin
3360 Color := _RGB(255, 255, 255);
3361 X := cx+32;
3362 Y := _y;
3363 _y := _y+36;
3364 end;
3365 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2], gMenuSmallFont))) do
3366 begin
3367 Color := _RGB(255, 0, 0);
3368 X := cx;
3369 Y := _y;
3370 _y := _y+22;
3371 end;
3372 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_1], gMenuSmallFont))) do
3373 begin
3374 Color := _RGB(255, 255, 255);
3375 X := cx+32;
3376 Y := _y;
3377 _y := _y+22;
3378 end;
3379 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_2], gMenuSmallFont))) do
3380 begin
3381 Color := _RGB(255, 255, 255);
3382 X := cx+32;
3383 Y := _y;
3384 _y := _y+36;
3385 end;
3386 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_3], gMenuSmallFont))) do
3387 begin
3388 Color := _RGB(255, 0, 0);
3389 X := cx;
3390 Y := _y;
3391 _y := _y+22;
3392 end;
3393 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_3_1], gMenuSmallFont))) do
3394 begin
3395 Color := _RGB(255, 255, 255);
3396 X := cx+32;
3397 Y := _y;
3398 _y := _y+36;
3399 end;
3400 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_4], gMenuSmallFont))) do
3401 begin
3402 Color := _RGB(255, 0, 0);
3403 X := cx;
3404 Y := _y;
3405 _y := _y+22;
3406 end;
3407 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_4_1], gMenuSmallFont))) do
3408 begin
3409 Color := _RGB(255, 255, 255);
3410 X := cx+32;
3411 Y := _y;
3412 _y := gScreenHeight - 128;
3413 end;
3414 // Çàêëþ÷åíèå:
3415 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CAP_3], gMenuSmallFont))) do
3416 begin
3417 Color := _RGB(255, 0, 0);
3418 X := cx;
3419 Y := _y;
3420 _y := _y+16;
3421 end;
3422 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_1], gMenuSmallFont))) do
3423 begin
3424 Color := _RGB(255, 255, 255);
3425 X := cx+32;
3426 Y := _y;
3427 _y := _y+GetHeight();
3428 end;
3429 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_2], gMenuSmallFont))) do
3430 begin
3431 Color := _RGB(255, 255, 255);
3432 X := cx+32;
3433 Y := _y;
3434 _y := _y+GetHeight();
3435 end;
3436 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_3], gMenuSmallFont))) do
3437 begin
3438 Color := _RGB(255, 255, 255);
3439 X := cx+32;
3440 Y := _y;
3441 _y := gScreenHeight - 32;
3442 end;
3443 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_4], gMenuSmallFont))) do
3444 begin
3445 Color := _RGB(255, 0, 0);
3446 X := gScreenWidth div 2 - GetWidth() div 2;
3447 Y := _y;
3448 end;
3449 g_GUI_AddWindow(Menu);
3451 Menu := CreateYNMenu('ExitMenu', _lc[I_MENU_EXIT_PROMT], Round(gScreenWidth*0.6),
3452 gMenuSmallFont, @ProcExitMenuKeyDown);
3453 g_GUI_AddWindow(Menu);
3455 Menu := TGUIWindow.Create('GameSingleMenu');
3456 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_MAIN_MENU]))) do
3457 begin
3458 Name := 'mmGameSingleMenu';
3459 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
3460 AddButton(nil, _lc[I_MENU_SAVE_GAME], 'SaveMenu').Name := 'save';
3461 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3462 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3463 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3464 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3465 end;
3466 Menu.DefControl := 'mmGameSingleMenu';
3467 Menu.MainWindow := True;
3468 Menu.OnClose := ProcGMClose;
3469 Menu.OnShow := ProcGMShow;
3470 g_GUI_AddWindow(Menu);
3472 Menu := CreateYNMenu('EndGameMenu', _lc[I_MENU_END_GAME_PROMT], Round(gScreenWidth*0.6),
3473 gMenuSmallFont, @ProcEndMenuKeyDown);
3474 g_GUI_AddWindow(Menu);
3476 Menu := CreateYNMenu('RestartGameMenu', _lc[I_MENU_RESTART_GAME_PROMT], Round(gScreenWidth*0.6),
3477 gMenuSmallFont, @ProcRestartMenuKeyDown);
3478 g_GUI_AddWindow(Menu);
3480 Menu := TGUIWindow.Create('GameCustomMenu');
3481 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_MAIN_MENU]))) do
3482 begin
3483 Name := 'mmGameCustomMenu';
3484 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3485 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
3486 AddButton(nil, _lc[I_MENU_SAVE_GAME], 'SaveMenu').Name := 'save';
3487 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3488 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3489 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3490 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3491 end;
3492 Menu.DefControl := 'mmGameCustomMenu';
3493 Menu.MainWindow := True;
3494 Menu.OnClose := ProcGMClose;
3495 Menu.OnShow := ProcGMShow;
3496 g_GUI_AddWindow(Menu);
3498 Menu := TGUIWindow.Create('GameServerMenu');
3499 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_MAIN_MENU]))) do
3500 begin
3501 Name := 'mmGameServerMenu';
3502 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3503 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3504 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3505 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3506 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3507 end;
3508 Menu.DefControl := 'mmGameServerMenu';
3509 Menu.MainWindow := True;
3510 Menu.OnClose := ProcGMClose;
3511 Menu.OnShow := ProcGMShow;
3512 g_GUI_AddWindow(Menu);
3514 Menu := TGUIWindow.Create('GameClientMenu');
3515 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_MAIN_MENU]))) do
3516 begin
3517 Name := 'mmGameClientMenu';
3518 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3519 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3520 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3521 end;
3522 Menu.DefControl := 'mmGameClientMenu';
3523 Menu.MainWindow := True;
3524 Menu.OnClose := ProcGMClose;
3525 Menu.OnShow := ProcGMShow;
3526 g_GUI_AddWindow(Menu);
3528 Menu := TGUIWindow.Create('ClientPasswordMenu');
3529 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuSmallFont, gMenuSmallFont, _lc[I_MENU_ENTERPASSWORD]))) do
3530 begin
3531 Name := 'mClientPasswordMenu';
3532 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
3533 begin
3534 Name := 'edPW';
3535 Width := 12;
3536 MaxLength := 32;
3537 end;
3538 AddSpace;
3540 AddButton(@ProcEnterPassword, _lc[I_MENU_START_GAME]);
3541 ReAlign();
3542 end;
3543 Menu.DefControl := 'mClientPasswordMenu';
3544 g_GUI_AddWindow(Menu);
3546 Menu := TGUIWindow.Create('GameSetGameMenu');
3547 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SET_GAME]))) do
3548 begin
3549 Name := 'mGameSetGameMenu';
3550 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
3551 begin
3552 Name := 'swTeamDamage';
3553 AddItem(_lc[I_MENU_YES]);
3554 AddItem(_lc[I_MENU_NO]);
3555 ItemIndex := 1;
3556 end;
3557 with AddSwitch(_lc[I_MENU_TEAM_HIT]) do
3558 begin
3559 Name := 'swTeamHit';
3560 AddItem(_lc[I_MENU_TEAM_HIT_BOTH]);
3561 AddItem(_lc[I_MENU_TEAM_HIT_TRACE]);
3562 AddItem(_lc[I_MENU_TEAM_HIT_PROJECTILE]);
3563 AddItem(_lc[I_MENU_TEAM_HIT_NOTHING]);
3564 ItemIndex := 0
3565 end;
3566 with AddSwitch(_lc[I_MENU_DEATHMATCH_KEYS]) do
3567 begin
3568 Name := 'swDeathmatchKeys';
3569 AddItem(_lc[I_MENU_YES]);
3570 AddItem(_lc[I_MENU_NO]);
3571 ItemIndex := 1;
3572 end;
3573 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
3574 begin
3575 Name := 'edTimeLimit';
3576 OnlyDigits := True;
3577 Width := 4;
3578 MaxLength := 5;
3579 end;
3580 with AddEdit(_lc[I_MENU_SCORE_LIMIT]) do
3581 begin
3582 Name := 'edScoreLimit';
3583 OnlyDigits := True;
3584 Width := 4;
3585 MaxLength := 5;
3586 end;
3587 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
3588 begin
3589 Name := 'edMaxLives';
3590 OnlyDigits := True;
3591 Width := 4;
3592 MaxLength := 5;
3593 end;
3594 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
3595 begin
3596 Name := 'swBotsVS';
3597 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
3598 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
3599 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
3600 ItemIndex := 2;
3601 end;
3602 with AddSwitch(_lc[I_MENU_FLAG_DROP]) do
3603 begin
3604 Name := 'swFlagDrop';
3605 AddItem(_lc[I_MENU_FLAG_THROW]);
3606 AddItem(_lc[I_MENU_YES]);
3607 AddItem(_lc[I_MENU_NO]);
3608 ItemIndex := 2;
3609 end;
3611 ReAlign();
3612 end;
3613 Menu.DefControl := 'mGameSetGameMenu';
3614 Menu.OnClose := ProcApplyGameSet;
3615 g_GUI_AddWindow(Menu);
3617 Menu := TGUIWindow.Create('TeamMenu');
3618 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, '', _lc[I_MENU_CHANGE_PLAYERS]))) do
3619 begin
3620 Name := 'mmTeamMenu';
3621 AddButton(@ProcJoinRed, _lc[I_MENU_JOIN_RED], '').Name := 'tmJoinRed';
3622 AddButton(@ProcJoinBlue, _lc[I_MENU_JOIN_BLUE], '').Name := 'tmJoinBlue';
3623 AddButton(@ProcJoinGame, _lc[I_MENU_JOIN_GAME], '').Name := 'tmJoinGame';
3624 AddButton(@ProcSwitchP2, _lc[I_MENU_ADD_PLAYER_2], '').Name := 'tmPlayer2';
3625 AddButton(@ProcSpectate, _lc[I_MENU_SPECTATE], '').Name := 'tmSpectate';
3626 end;
3627 Menu.DefControl := 'mmTeamMenu';
3628 Menu.OnShow := ProcChangePlayers;
3629 g_GUI_AddWindow(Menu);
3630 end;
3632 procedure g_Menu_Show_SaveMenu();
3633 begin
3634 if g_Game_IsTestMap then
3635 Exit;
3636 if gGameSettings.GameType = GT_SINGLE then
3637 g_GUI_ShowWindow('GameSingleMenu')
3638 else
3639 begin
3640 if g_Game_IsClient then
3641 Exit
3642 else
3643 if g_Game_IsNet then
3644 Exit
3645 else
3646 g_GUI_ShowWindow('GameCustomMenu');
3647 end;
3648 g_GUI_ShowWindow('SaveMenu');
3649 g_Sound_PlayEx('MENU_OPEN');
3650 end;
3652 procedure g_Menu_Show_LoadMenu (standalone: Boolean=false);
3653 begin
3654 if (g_ActiveWindow <> nil) and (g_ActiveWindow.name = 'LoadMenu') then exit; // nothing to do
3655 if gGameSettings.GameType = GT_SINGLE then
3656 begin
3657 if not standalone then g_GUI_ShowWindow('GameSingleMenu')
3658 end
3659 else
3660 begin
3661 if g_Game_IsClient then exit;
3662 if g_Game_IsNet then exit;
3663 if not standalone then g_GUI_ShowWindow('GameCustomMenu');
3664 end;
3665 g_GUI_ShowWindow('LoadMenu');
3666 g_Sound_PlayEx('MENU_OPEN');
3667 end;
3669 procedure g_Menu_Show_GameSetGame();
3670 begin
3671 if gGameSettings.GameType = GT_SINGLE then
3672 g_GUI_ShowWindow('GameSingleMenu')
3673 else
3674 begin
3675 if g_Game_IsClient then
3676 Exit
3677 else
3678 if g_Game_IsNet then
3679 g_GUI_ShowWindow('GameServerMenu')
3680 else
3681 g_GUI_ShowWindow('GameCustomMenu');
3682 end;
3683 ReadGameSettings();
3684 g_GUI_ShowWindow('GameSetGameMenu');
3685 g_Sound_PlayEx('MENU_OPEN');
3686 end;
3688 procedure g_Menu_Show_OptionsVideo();
3689 begin
3690 if gGameSettings.GameType = GT_SINGLE then
3691 g_GUI_ShowWindow('GameSingleMenu')
3692 else
3693 begin
3694 if g_Game_IsClient then
3695 g_GUI_ShowWindow('GameClientMenu')
3696 else
3697 if g_Game_IsNet then
3698 g_GUI_ShowWindow('GameServerMenu')
3699 else
3700 g_GUI_ShowWindow('GameCustomMenu');
3701 end;
3702 ReadOptions();
3703 g_GUI_ShowWindow('OptionsMenu');
3704 g_GUI_ShowWindow('OptionsVideoMenu');
3705 g_Sound_PlayEx('MENU_OPEN');
3706 end;
3708 procedure g_Menu_Show_OptionsSound();
3709 begin
3710 if gGameSettings.GameType = GT_SINGLE then
3711 g_GUI_ShowWindow('GameSingleMenu')
3712 else
3713 begin
3714 if g_Game_IsClient then
3715 g_GUI_ShowWindow('GameClientMenu')
3716 else
3717 if g_Game_IsNet then
3718 g_GUI_ShowWindow('GameServerMenu')
3719 else
3720 g_GUI_ShowWindow('GameCustomMenu');
3721 end;
3722 ReadOptions();
3723 g_GUI_ShowWindow('OptionsMenu');
3724 g_GUI_ShowWindow('OptionsSoundMenu');
3725 g_Sound_PlayEx('MENU_OPEN');
3726 end;
3728 procedure g_Menu_Show_EndGameMenu();
3729 begin
3730 g_GUI_ShowWindow('EndGameMenu');
3731 g_Sound_PlayEx('MENU_OPEN');
3732 end;
3734 procedure g_Menu_Show_QuitGameMenu();
3735 begin
3736 g_GUI_ShowWindow('ExitMenu');
3737 g_Sound_PlayEx('MENU_OPEN');
3738 end;
3740 procedure g_Menu_Init();
3741 begin
3742 MenuLoadData();
3743 CreateAllMenus();
3744 end;
3746 procedure g_Menu_Free();
3747 begin
3748 MenuFreeData();
3749 end;
3751 procedure g_Menu_Reset();
3752 var
3753 ex: Boolean;
3754 begin
3755 g_GUI_SaveMenuPos();
3756 ex := g_GUI_Destroy();
3758 if ex then
3759 begin
3760 e_WriteLog('Recreating menu...', TMsgType.Notify);
3762 CreateAllMenus();
3764 if gDebugMode then
3765 g_Game_SetDebugMode();
3767 g_GUI_LoadMenuPos();
3768 end;
3769 end;
3771 end.