DEADSOFTWARE

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