DEADSOFTWARE

c6e5339a15d0f562e9eaf555373a7e2fb56d40d9
[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, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *)
16 {$INCLUDE ../shared/a_modes.inc}
17 unit g_menu;
19 interface
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD);
25 procedure LoadFont(txtres, fntres: string; var FontID: DWORD);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
36 var
37 gMenuFont: DWORD;
38 gMenuSmallFont: DWORD;
39 PromptIP: string;
40 PromptPort: Word;
42 implementation
44 uses
45 {$INCLUDE ../nogl/noGLuses.inc}
46 g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
47 g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
48 e_log, SysUtils, CONFIG, g_playermodel, DateUtils, sdl2,
49 MAPDEF, Math, g_saveload,
50 e_texture, g_language,
51 g_net, g_netmsg, g_netmaster, g_items, e_input, g_touch,
52 utils, wadreader;
55 type TYNCallback = procedure (yes:Boolean);
57 procedure YNKeyDownProc (win: TGUIWindow; Key: Byte);
58 begin
59 if win.UserData = nil then exit;
60 case Key of
61 IK_Y, IK_SPACE: TYNCallback(win.UserData)(true);
62 IK_N: TYNCallback(win.UserData)(false);
63 end;
64 end;
66 procedure YesButtonCB (ctl: TGUITextButton);
67 begin
68 if ctl.UserData = nil then exit;
69 TYNCallback(ctl.UserData)(true);
70 end;
72 procedure NoButtonCB (ctl: TGUITextButton);
73 begin
74 if ctl.UserData = nil then exit;
75 TYNCallback(ctl.UserData)(false);
76 end;
78 function CreateYNMenu (WinName, Text: String; MaxLen: Word; FontID: DWORD; ActionProc: TYNCallback): TGUIWindow;
79 var
80 menu: TGUIMenu;
81 begin
82 //if length(Text) = 0 then exit;
83 Result := TGUIWindow.Create(WinName);
84 with Result do
85 begin
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu := TGUIMenu(Result.AddChild(TGUIMenu.Create(gMenuSmallFont, gMenuSmallFont, '')));
89 with menu do
90 begin
91 Name := '__temp_yes_no_menu:'+WinName;
92 YesNo := true;
93 AddText(Text, MaxLen);
94 with AddButton(nil, _lc[I_MENU_YES]) do begin ProcEx := @YesButtonCB; UserData := @ActionProc; end;
95 with AddButton(nil, _lc[I_MENU_NO]) do begin ProcEx := @NoButtonCB; UserData := @ActionProc; end;
96 end;
97 DefControl := '__temp_yes_no_menu:'+WinName;
98 SetActive(nil);
99 end;
100 end;
103 procedure ProcChangeColor(Sender: TGUIControl); forward;
104 procedure ProcSelectModel(Sender: TGUIControl); forward;
106 procedure ProcApplyOptions();
107 var
108 menu: TGUIMenu;
109 i: Integer;
110 ovs: Boolean;
111 begin
112 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu.GetControl('swBPP')).ItemIndex = 0 then
115 gBPP := 16
116 else
117 gBPP := 32;
119 ovs := gVSync;
120 gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
121 if (ovs <> gVSync) then g_SetVSync(gVSync);
123 gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
124 glLegacyNPOT := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
126 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
128 g_Sound_SetupAllVolumes(
129 Min(TGUIScroll(menu.GetControl('scSoundLevel')).Value*16, 255),
130 Min(TGUIScroll(menu.GetControl('scMusicLevel')).Value*16, 255)
131 );
133 gMaxSimSounds := Max(Min(TGUIScroll(menu.GetControl('scMaxSimSounds')).Value*4+2, 66), 2);
134 gMuteWhenInactive := TGUISwitch(menu.GetControl('swInactiveSounds')).ItemIndex = 1;
135 gAnnouncer := TGUISwitch(menu.GetControl('swAnnouncer')).ItemIndex;
136 gSoundEffectsDF := TGUISwitch(menu.GetControl('swSoundEffects')).ItemIndex = 1;
137 gUseChatSounds := TGUISwitch(menu.GetControl('swChatSpeech')).ItemIndex = 0;
139 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
141 g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000);
142 g_Shells_SetMax(TGUIScroll(menu.GetControl('scShellsMax')).Value*30);
143 g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25);
144 g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5);
146 case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of
147 0: gGibsCount := 0;
148 1: gGibsCount := 8;
149 2: gGibsCount := 16;
150 3: gGibsCount := 32;
151 else gGibsCount := 48;
152 end;
154 gBloodCount := TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex;
155 gFlash := TGUISwitch(menu.GetControl('swScreenFlash')).ItemIndex;
156 gAdvBlood := TGUISwitch(menu.GetControl('swBloodType')).ItemIndex = 1;
157 gAdvCorpses := TGUISwitch(menu.GetControl('swCorpseType')).ItemIndex = 1;
158 gAdvGibs := TGUISwitch(menu.GetControl('swGibsType')).ItemIndex = 1;
159 gDrawBackGround := TGUISwitch(menu.GetControl('swBackGround')).ItemIndex = 0;
160 gShowMessages := TGUISwitch(menu.GetControl('swMessages')).ItemIndex = 0;
161 gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0;
162 gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex;
163 gPlayerIndicator := TGUISwitch(menu.GetControl('swPlayerIndicator')).ItemIndex = 0;
164 g_dbg_scale := TGUIScroll(menu.GetControl('scScaleFactor')).Value + 1;
166 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
168 with menu do
169 begin
170 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
171 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
172 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
173 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
174 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key, 'screenshot');
175 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key, '+p1_scores', '-p1_scores');
176 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key, 'togglechat');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key, 'toggleteamchat');
178 end;
180 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
181 with menu do
182 begin
183 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
193 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+p1_moveright', '-p1_moveright');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+p1_moveleft', '-p1_moveleft');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+p1_lookup', '-p1_lookup');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+p1_lookdown', '-p1_lookdown');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+p1_attack', '-p1_attack');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+p1_jump', '-p1_jump');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, '+p1_weapnext', '-p1_weapnext');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, '+p1_weapprev', '-p1_weapprev');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+p1_activate', '-p1_activate');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+p1_strafe', '-p1_strafe');
203 // second set
204 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
205 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
206 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+p1_moveright', '-p1_moveright');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+p1_moveleft', '-p1_moveleft');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+p1_lookup', '-p1_lookup');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+p1_lookdown', '-p1_lookdown');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+p1_attack', '-p1_attack');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+p1_jump', '-p1_jump');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, '+p1_weapnext', '-p1_weapnext');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, '+p1_weapprev', '-p1_weapprev');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+p1_activate', '-p1_activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+p1_strafe', '-p1_strafe');
224 end;
226 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
227 with menu do
228 begin
229 for i := WP_FIRST to WP_LAST do
230 begin
231 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1)), '');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'p1_weapon ' + IntToStr(i + 1));
233 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1)), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'p1_weapon ' + IntToStr(i + 1));
235 end;
236 end;
238 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
239 with menu do
240 begin
241 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
242 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
243 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0, '+p2_moveright', '-p2_moveright');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0, '+p2_moveleft', '-p2_moveleft');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0, '+p2_lookup', '-p2_lookup');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0, '+p2_lookdown', '-p2_lookdown');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0, '+p2_attack', '-p2_attack');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0, '+p2_jump', '-p2_jump');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0, '+p2_weapnext', '-p2_weapnext');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0, '+p2_weapprev', '-p2_weapprev');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0, '+p2_activate', '-p2_activate');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0, '+p2_strafe', '-p2_strafe');
261 // second set
262 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1, '+p2_moveright', '-p2_moveright');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1, '+p2_moveleft', '-p2_moveleft');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1, '+p2_lookup', '-p2_lookup');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1, '+p2_lookdown', '-p2_lookdown');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1, '+p2_attack', '-p2_attack');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1, '+p2_jump', '-p2_jump');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1, '+p2_weapnext', '-p2_weapnext');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1, '+p2_weapprev', '-p2_weapprev');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1, '+p2_activate', '-p2_activate');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1, '+p2_strafe', '-p2_strafe');
282 end;
284 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
285 with menu do
286 begin
287 for i := WP_FIRST to WP_LAST do
288 begin
289 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i + 1)), '');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0, 'p2_weapon ' + IntToStr(i + 1));
291 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i + 1)), '');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1, 'p2_weapon ' + IntToStr(i + 1));
293 end;
294 end;
296 if e_HasJoysticks then
297 begin
298 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
299 with menu do
300 begin
301 for i := 0 to e_MaxJoys - 1 do
302 if e_JoystickAvailable[i] then
303 e_JoystickDeadzones[i] := TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value*(32767 div 20)
304 end
305 end;
307 if g_touch_enabled then
308 begin
309 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
310 g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
311 g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
312 g_touch_fire := TGUISwitch(menu.GetControl('swTouchFire')).ItemIndex = 1;
313 g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
314 end;
316 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
318 gPlayer1Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP1Name')).Text);
319 gPlayer1Settings.Team := IfThen(TGUISwitch(menu.GetControl('swP1Team')).ItemIndex = 0,
320 TEAM_RED, TEAM_BLUE);
322 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
323 begin
324 gPlayer1Settings.Model := Model.Name;
325 gPlayer1Settings.Color := Model.Color;
326 end;
328 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
330 gPlayer2Settings.Name := b_Text_Unformat(TGUIEdit(menu.GetControl('edP2Name')).Text);
331 gPlayer2Settings.Team := IfThen(TGUISwitch(menu.GetControl('swP2Team')).ItemIndex = 0,
332 TEAM_RED, TEAM_BLUE);
333 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
334 begin
335 gPlayer2Settings.Model := Model.Name;
336 gPlayer2Settings.Color := Model.Color;
337 end;
339 if gPlayer1Settings.Name = '' then gPlayer1Settings.Name := GenPlayerName(1);
340 if gPlayer2Settings.Name = '' then gPlayer2Settings.Name := GenPlayerName(2);
342 if g_Game_IsServer then
343 begin
344 if gPlayer1 <> nil then
345 begin
346 gPlayer1.SetModel(gPlayer1Settings.Model);
347 gPlayer1.Name := gPlayer1Settings.Name;
348 if not (gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
349 gPlayer1.SetColor(gPlayer1Settings.Color)
350 else
351 if gPlayer1.Team <> gPlayer1Settings.Team then
352 gPlayer1.SwitchTeam;
354 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
355 end;
357 if gPlayer2 <> nil then
358 begin
359 gPlayer2.SetModel(gPlayer2Settings.Model);
360 gPlayer2.Name := gPlayer2Settings.Name;
361 if (gGameSettings.GameMode <> GM_TDM) and (gGameSettings.GameMode <> GM_CTF) then
362 gPlayer2.SetColor(gPlayer2Settings.Color)
363 else
364 if gPlayer2.Team <> gPlayer2Settings.Team then
365 gPlayer2.SwitchTeam;
366 end;
367 end;
369 if g_Game_IsClient then MC_SEND_PlayerSettings;
371 g_Options_Write(GameDir+'/'+CONFIG_FILENAME);
372 g_Console_WriteConfig(GameDir + '/dfconfig.cfg');
373 end;
375 procedure ReadOptions();
376 var
377 menu: TGUIMenu;
378 i: Integer;
379 begin
380 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
382 with TGUISwitch(menu.GetControl('swBPP')) do
383 if gBPP = 16 then
384 ItemIndex := 0
385 else
386 ItemIndex := 1;
388 with TGUISwitch(menu.GetControl('swTextureFilter')) do
389 if gTextureFilter then ItemIndex := 0 else ItemIndex := 1;
391 with TGUISwitch(menu.GetControl('swVSync')) do
392 if gVSync then ItemIndex := 0 else ItemIndex := 1;
394 with TGUISwitch(menu.GetControl('swLegacyNPOT')) do
395 if not glLegacyNPOT then ItemIndex := 0 else ItemIndex := 1;
397 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
399 TGUIScroll(menu.GetControl('scSoundLevel')).Value := Round(gSoundLevel/16);
400 TGUIScroll(menu.GetControl('scMusicLevel')).Value := Round(gMusicLevel/16);
401 TGUIScroll(menu.GetControl('scMaxSimSounds')).Value := Round((gMaxSimSounds-2)/4);
403 with TGUISwitch(menu.GetControl('swInactiveSounds')) do
404 if gMuteWhenInactive then
405 ItemIndex := 1
406 else
407 ItemIndex := 0;
409 TGUISwitch(menu.GetControl('swAnnouncer')).ItemIndex := gAnnouncer;
411 with TGUISwitch(menu.GetControl('swSoundEffects')) do
412 if gSoundEffectsDF then
413 ItemIndex := 1
414 else
415 ItemIndex := 0;
417 with TGUISwitch(menu.GetControl('swChatSpeech')) do
418 if gUseChatSounds then
419 ItemIndex := 0
420 else
421 ItemIndex := 1;
423 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
424 with menu do
425 begin
426 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
427 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
428 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
429 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
430 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+p1_attack', '-p1_attack');
431 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+p1_jump', '-p1_jump');
432 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
433 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
434 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+p1_activate', '-p1_activate');
435 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
436 // second set
437 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
438 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
439 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
440 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
441 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+p1_attack', '-p1_attack');
442 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+p1_jump', '-p1_jump');
443 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
444 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
445 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+p1_activate', '-p1_activate');
446 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
447 end;
449 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
450 with menu do
451 begin
452 for i := WP_FIRST to WP_LAST do
453 begin
454 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i + 1));
455 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i + 1));
456 end;
457 end;
459 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
460 with menu do
461 begin
462 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
463 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
464 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
465 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
466 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := g_Console_FindBind(1, '+p2_attack', '-p2_attack');
467 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := g_Console_FindBind(1, '+p2_jump', '-p2_jump');
468 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
469 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
470 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := g_Console_FindBind(1, '+p2_activate', '-p2_activate');
471 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
472 // second set
473 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
474 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
475 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
476 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
477 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := g_Console_FindBind(2, '+p2_attack', '-p2_attack');
478 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := g_Console_FindBind(2, '+p2_jump', '-p2_jump');
479 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
480 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
481 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := g_Console_FindBind(2, '+p2_activate', '-p2_activate');
482 TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
483 end;
485 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
486 with menu do
487 begin
488 for i := WP_FIRST to WP_LAST do
489 begin
490 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i + 1));
491 TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i + 1));
492 end;
493 end;
495 if e_HasJoysticks then
496 begin
497 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
498 with menu do
499 begin
500 for i := 0 to e_MaxJoys - 1 do
501 if e_JoystickAvailable[i] then
502 TGUIScroll(menu.GetControl('scDeadzone' + IntToStr(i))).Value := e_JoystickDeadzones[i] div (32767 div 20)
503 end
504 end;
506 if g_touch_enabled then
507 begin
508 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
509 with TGUISwitch(menu.GetControl('swTouchAlt')) do
510 if g_touch_alt then ItemIndex := 1 else ItemIndex := 0;
511 TGUIScroll(menu.GetControl('scTouchSize')).Value := Round((g_touch_size - 0.5) * 10);
512 with TGUISwitch(menu.GetControl('swTouchFire')) do
513 if g_touch_fire then ItemIndex := 1 else ItemIndex := 0;
514 TGUIScroll(menu.GetControl('scTouchOffset')).Value := Round(g_touch_offset / 5);
515 end;
517 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
518 with menu do
519 begin
520 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_SCREENSHOT])).Key := g_Console_FindBind(1, 'screenshot');
521 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STAT])).Key := g_Console_FindBind(1, '+p1_scores', '-p1_scores');
522 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_CHAT])).Key := g_Console_FindBind(1, 'togglechat');
523 TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_TEAMCHAT])).Key := g_Console_FindBind(1, 'toggleteamchat');
524 end;
526 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
528 TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000;
529 TGUIScroll(menu.GetControl('scShellsMax')).Value := g_Shells_GetMax() div 30;
530 TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25;
531 TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5;
532 TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex := gBloodCount;
534 with TGUISwitch(menu.GetControl('swScreenFlash')) do
535 ItemIndex := gFlash;
537 with TGUISwitch(menu.GetControl('swBloodType')) do
538 if gAdvBlood then ItemIndex := 1 else ItemIndex := 0;
540 with TGUISwitch(menu.GetControl('swCorpseType')) do
541 if gAdvCorpses then ItemIndex := 1 else ItemIndex := 0;
543 with TGUISwitch(menu.GetControl('swGibsType')) do
544 if gAdvGibs then ItemIndex := 1 else ItemIndex := 0;
546 with TGUISwitch(menu.GetControl('swGibsCount')) do
547 case gGibsCount of
548 0: ItemIndex := 0;
549 8: ItemIndex := 1;
550 16: ItemIndex := 2;
551 32: ItemIndex := 3;
552 else ItemIndex := 4;
553 end;
555 with TGUISwitch(menu.GetControl('swBackGround')) do
556 if gDrawBackGround then ItemIndex := 0 else ItemIndex := 1;
558 with TGUISwitch(menu.GetControl('swMessages')) do
559 if gShowMessages then ItemIndex := 0 else ItemIndex := 1;
561 with TGUISwitch(menu.GetControl('swRevertPlayers')) do
562 if gRevertPlayers then ItemIndex := 0 else ItemIndex := 1;
564 with TGUISwitch(menu.GetControl('swChatBubble')) do
565 ItemIndex := gChatBubble;
567 with TGUISwitch(menu.GetControl('swPlayerIndicator')) do
568 if gPlayerIndicator then ItemIndex := 0 else ItemIndex := 1;
570 TGUIScroll(menu.GetControl('scScaleFactor')).Value := Round(g_dbg_scale - 1);
572 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
574 TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model);
575 TGUIEdit(menu.GetControl('edP1Name')).Text := gPlayer1Settings.Name;
577 TGUISwitch(menu.GetControl('swP1Team')).ItemIndex :=
578 IfThen(gPlayer1Settings.Team = TEAM_BLUE, 1, 0);
580 TGUIScroll(menu.GetControl('scP1Red')).Value := Round(gPlayer1Settings.Color.R/16);
581 TGUIScroll(menu.GetControl('scP1Green')).Value := Round(gPlayer1Settings.Color.G/16);
582 TGUIScroll(menu.GetControl('scP1Blue')).Value := Round(gPlayer1Settings.Color.B/16);
584 menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
586 TGUIListBox(menu.GetControl('lsP2Model')).SelectItem(gPlayer2Settings.Model);
587 TGUIEdit(menu.GetControl('edP2Name')).Text := gPlayer2Settings.Name;
589 TGUISwitch(menu.GetControl('swP2Team')).ItemIndex :=
590 IfThen(gPlayer2Settings.Team = TEAM_BLUE, 1, 0);
592 TGUIScroll(menu.GetControl('scP2Red')).Value := Round(gPlayer2Settings.Color.R/16);
593 TGUIScroll(menu.GetControl('scP2Green')).Value := Round(gPlayer2Settings.Color.G/16);
594 TGUIScroll(menu.GetControl('scP2Blue')).Value := Round(gPlayer2Settings.Color.B/16);
596 ProcSelectModel(nil);
597 end;
599 procedure ProcSwitchMonstersCustom(Sender: TGUIControl);
600 begin
601 // don't turn off monsters in DM
603 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
604 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
605 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
606 else
607 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
610 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
611 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
612 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
613 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
615 end;
617 procedure ProcSwitchMonstersNet(Sender: TGUIControl);
618 begin
619 // don't turn off monsters in DM
621 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
622 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
624 else
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
628 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
629 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
630 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
631 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
633 end;
635 procedure ProcStartCustomGame();
636 var
637 Map: String;
638 GameMode: Byte;
639 Options: LongWord;
640 begin
641 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
642 begin
643 Map := TGUILabel(GetControl('lbMap')).Text;
644 if Map = '' then
645 Exit;
646 if not isWadPath(Map) then
647 Exit;
649 GameMode := TGUISwitch(GetControl('swGameMode')).ItemIndex+1;
650 gcGameMode := TGUISwitch(GetControl('swGameMode')).GetText;
651 gcTimeLimit := StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
652 gcGoalLimit := StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
653 gcMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
655 gcTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
656 gcAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
657 gcWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
658 gcMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
659 Options := 0;
660 if gcTeamDamage then
661 Options := Options or GAME_OPTION_TEAMDAMAGE;
662 if gcAllowExit then
663 Options := Options or GAME_OPTION_ALLOWEXIT;
664 if gcWeaponStay then
665 Options := Options or GAME_OPTION_WEAPONSTAY;
666 if gcMonsters then
667 Options := Options or GAME_OPTION_MONSTERS;
668 gcPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
670 case TGUISwitch(GetControl('swBotsVS')).ItemIndex of
671 1: begin
672 Options := Options or GAME_OPTION_BOTVSMONSTER;
673 gcBotsVS := 'Monsters';
674 end;
675 2: begin
676 Options := Options or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
677 gcBotsVS := 'Everybody';
678 end;
679 else begin
680 Options := Options or GAME_OPTION_BOTVSPLAYER;
681 gcBotsVS := 'Players';
682 end;
683 end;
685 gcMap := Map;
686 end;
688 g_Options_Write_Gameplay_Custom(GameDir+'/'+CONFIG_FILENAME);
690 g_Game_StartCustom(Map, GameMode, gcTimeLimit, gcGoalLimit,
691 gcMaxLives, Options, gcPlayers);
692 end;
695 procedure ProcStartNetGame();
696 var
697 Map: String;
698 GameMode: Byte;
699 Options: LongWord;
700 begin
701 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
702 begin
703 Map := TGUILabel(GetControl('lbMap')).Text;
704 if Map = '' then
705 Exit;
706 if not isWadPath(Map) then
707 Exit;
709 GameMode := TGUISwitch(GetControl('swGameMode')).ItemIndex+1;
710 gnGameMode := TGUISwitch(GetControl('swGameMode')).GetText;
711 gnTimeLimit := StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
712 gnGoalLimit := StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
713 gnMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
714 NetPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
716 gnTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
717 gnAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
718 gnWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
719 gnMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
720 Options := 0;
721 if gnTeamDamage then
722 Options := Options or GAME_OPTION_TEAMDAMAGE;
723 if gnAllowExit then
724 Options := Options or GAME_OPTION_ALLOWEXIT;
725 if gnWeaponStay then
726 Options := Options or GAME_OPTION_WEAPONSTAY;
727 if gnMonsters then
728 Options := Options or GAME_OPTION_MONSTERS;
729 gnPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex;
731 case TGUISwitch(GetControl('swBotsVS')).ItemIndex of
732 1: begin
733 Options := Options or GAME_OPTION_BOTVSMONSTER;
734 gnBotsVS := 'Monsters';
735 end;
736 2: begin
737 Options := Options or GAME_OPTION_BOTVSPLAYER or GAME_OPTION_BOTVSMONSTER;
738 gnBotsVS := 'Everybody';
739 end;
740 else begin
741 Options := Options or GAME_OPTION_BOTVSPLAYER;
742 gnBotsVS := 'Players';
743 end;
744 end;
746 gnMap := Map;
747 NetServerName := TGUIEdit(GetControl('edSrvName')).Text;
748 NetMaxClients := Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
749 NetMaxClients := Min(NET_MAXCLIENTS, NetMaxClients);
750 NetPassword := TGUIEdit(GetControl('edSrvPassword')).Text;
751 NetUseMaster := TGUISwitch(GetControl('swUseMaster')).ItemIndex = 0;
752 end;
754 g_Options_Write_Net_Server(GameDir+'/'+CONFIG_FILENAME);
755 g_Options_Write_Gameplay_Net(GameDir+'/'+CONFIG_FILENAME);
757 g_Game_StartServer(Map, GameMode, gnTimeLimit, gnGoalLimit, gnMaxLives,
758 Options, gnPlayers, 0, NetPort);
759 end;
761 procedure ProcConnectNetGame();
762 var
763 PW: String;
764 begin
765 with TGUIMenu(g_ActiveWindow.GetControl('mNetClientMenu')) do
766 begin
767 NetClientIP := TGUIEdit(GetControl('edIP')).Text;
768 NetClientPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
769 PW := TGUIEdit(GetControl('edPW')).Text;
770 end;
772 g_Options_Write_Net_Client(GameDir+'/'+CONFIG_FILENAME);
773 g_Game_StartClient(NetClientIP, NetClientPort, PW);
774 end;
776 procedure ProcEnterPassword();
777 var
778 PW: string;
779 begin
780 with TGUIMenu(g_ActiveWindow.GetControl('mClientPasswordMenu')) do
781 begin
782 NetClientIP := PromptIP;
783 NetClientPort := PromptPort;
784 PW := TGUIEdit(GetControl('edPW')).Text;
785 end;
787 g_Options_Write_Net_Client(GameDir+'/'+CONFIG_FILENAME);
788 g_Game_StartClient(NetClientIP, NetClientPort, PW);
789 end;
791 procedure ProcServerlist();
792 begin
793 if not NetInitDone then
794 begin
795 if (not g_Net_Init()) then
796 begin
797 g_Console_Add('NET: ERROR: Failed to init ENet!');
798 Exit;
799 end
800 else
801 NetInitDone := True;
802 end;
804 g_Net_Slist_Set(NetSlistIP, NetSlistPort);
806 gState := STATE_SLIST;
807 g_ActiveWindow := nil;
809 slWaitStr := _lc[I_NET_SLIST_WAIT];
811 g_Game_Draw;
812 ReDrawWindow;
814 slReturnPressed := True;
815 if g_Net_Slist_Fetch(slCurrent) then
816 begin
817 if slCurrent = nil then
818 slWaitStr := _lc[I_NET_SLIST_NOSERVERS];
819 end
820 else
821 slWaitStr := _lc[I_NET_SLIST_ERROR];
822 g_Serverlist_GenerateTable(slCurrent, slTable);
823 end;
825 procedure ProcStartCampaign();
826 var
827 WAD: String;
828 TwoPlayers: Boolean;
829 n: Byte;
830 begin
831 with TGUIMenu(g_ActiveWindow.GetControl('mCampaignMenu')) do
832 begin
833 WAD := ExtractRelativePath(MapsDir, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
834 TwoPlayers := TGUISwitch(GetControl('swPlayers')).ItemIndex = 1;
835 end;
837 if TwoPlayers then
838 n := 2
839 else
840 n := 1;
841 g_Game_StartSingle(WAD + ':\MAP01', TwoPlayers, n);
842 end;
844 procedure ProcSelectMap(Sender: TGUIControl);
845 var
846 win: TGUIWindow;
847 a: TMapInfo;
848 wad, map, res: String;
849 begin
850 win := g_GUI_GetWindow('SelectMapMenu');
851 with TGUIMenu(win.GetControl('mSelectMapMenu')) do
852 begin
853 wad := TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
854 map := TGUIListBox(GetControl('lsMapRes')).SelectedItem();
856 if (wad = '') or (map = '') then
857 begin // Ýòî íå êàðòà
858 TGUILabel(GetControl('lbMapName')).Text := '';
859 TGUILabel(GetControl('lbMapAuthor')).Text := '';
860 TGUILabel(GetControl('lbMapSize')).Text := '';
861 TGUIMemo(GetControl('meMapDescription')).SetText('');
862 TGUIMapPreview(win.GetControl('mpMapPreview')).ClearMap();
863 TGUILabel(win.GetControl('lbMapScale')).Text := '';
864 end
865 else // Ýòî êàðòà
866 begin
867 res := wad+':\'+map;
869 a := g_Map_GetMapInfo(res);
871 TGUILabel(GetControl('lbMapName')).Text := a.Name;
872 TGUILabel(GetControl('lbMapAuthor')).Text := a.Author;
873 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a.Width, a.Height]);
874 TGUIMemo(GetControl('meMapDescription')).SetText(a.Description);
875 TGUIMapPreview(win.GetControl('mpMapPreview')).SetMap(res);
876 TGUILabel(win.GetControl('lbMapScale')).Text :=
877 TGUIMapPreview(win.GetControl('mpMapPreview')).GetScaleStr;
878 end;
879 end;
880 end;
882 procedure ProcSelectWAD(Sender: TGUIControl);
883 var
884 wad: String;
885 list: SSArray;
886 begin
887 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
888 begin
889 wad := TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
891 with TGUIListBox(GetControl('lsMapRes')) do
892 begin
893 Clear();
895 if wad <> '' then
896 begin
897 list := g_Map_GetMapsList(wad);
899 if list <> nil then
900 begin
901 Items := list;
902 ItemIndex := 0;
903 end
904 end;
905 end;
906 end;
908 ProcSelectMap(nil);
909 end;
911 procedure ProcSelectCampaignWAD(Sender: TGUIControl);
912 var
913 win: TGUIWindow;
914 a: TMegaWADInfo;
915 wad, fn: String;
916 begin
917 win := g_GUI_GetWindow('CampaignMenu');
918 with TGUIMenu(win.GetControl('mCampaignMenu')) do
919 begin
920 wad := TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
922 if wad = '' then
923 begin
924 TGUILabel(GetControl('lbWADName')).Text := '';
925 TGUILabel(GetControl('lbWADAuthor')).Text := '';
926 TGUIMemo(GetControl('meWADDescription')).SetText('');
927 end;
929 a := g_Game_GetMegaWADInfo(wad);
931 TGUILabel(GetControl('lbWADName')).Text := a.Name;
932 TGUILabel(GetControl('lbWADAuthor')).Text := a.Author;
933 TGUIMemo(GetControl('meWADDescription')).SetText(a.Description);
935 TGUIImage(win.GetControl('mpWADImage')).ClearImage();
937 if a.pic <> '' then
938 begin
939 fn := g_ExtractWadName(a.pic);
940 if fn = '' then
941 TGUIImage(win.GetControl('mpWADImage')).SetImage(wad+a.pic)
942 else
943 TGUIImage(win.GetControl('mpWADImage')).SetImage(a.pic);
944 end;
945 end;
946 end;
948 procedure ProcChangeColor(Sender: TGUIControl);
949 var
950 window: TGUIWindow;
951 begin
952 window := g_GUI_GetWindow('OptionsPlayersP1Menu');
953 with TGUIMenu(window.GetControl('mOptionsPlayersP1Menu')) do
954 TGUIModelView(window.GetControl('mvP1Model')).SetColor(
955 Min(TGUIScroll(GetControl('scP1Red')).Value*16, 255),
956 Min(TGUIScroll(GetControl('scP1Green')).Value*16, 255),
957 Min(TGUIScroll(GetControl('scP1Blue')).Value*16, 255));
959 window := g_GUI_GetWindow('OptionsPlayersP2Menu');
960 with TGUIMenu(window.GetControl('mOptionsPlayersP2Menu')) do
961 TGUIModelView(window.GetControl('mvP2Model')).SetColor(
962 Min(TGUIScroll(GetControl('scP2Red')).Value*16, 255),
963 Min(TGUIScroll(GetControl('scP2Green')).Value*16, 255),
964 Min(TGUIScroll(GetControl('scP2Blue')).Value*16, 255));
965 end;
967 procedure ProcSelectModel(Sender: TGUIControl);
968 var
969 a: string;
970 window: TGUIWindow;
971 begin
972 window := g_GUI_GetWindow('OptionsPlayersP1Menu');
973 a := TGUIListBox(TGUIMenu(window.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem;
974 if a <> '' then TGUIModelView(window.GetControl('mvP1Model')).SetModel(a);
976 window := g_GUI_GetWindow('OptionsPlayersP2Menu');
977 a := TGUIListBox(TGUIMenu(window.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem;
978 if a <> '' then TGUIModelView(window.GetControl('mvP2Model')).SetModel(a);
980 ProcChangeColor(nil);
981 end;
983 procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD);
984 var
985 cwdt, chgt: Byte;
986 spc: ShortInt;
987 ID: DWORD;
988 wad: TWADFile;
989 cfgdata: Pointer;
990 cfglen: Integer;
991 config: TConfig;
992 begin
993 cfglen := 0;
995 wad := TWADFile.Create;
996 if wad.ReadFile(GameWAD) then
997 wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen);
998 wad.Free();
1000 if cfglen <> 0 then
1001 begin
1002 g_Texture_CreateWADEx('FONT_STD', GameWAD+':FONTS\'+texture);
1004 config := TConfig.CreateMem(cfgdata, cfglen);
1005 cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1006 chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1007 spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1009 if g_Texture_Get('FONT_STD', ID) then
1010 e_TextureFontBuild(ID, FontID, cwdt, chgt, spc);
1012 config.Free();
1013 end;
1015 if cfglen <> 0 then FreeMem(cfgdata);
1016 end;
1018 procedure LoadFont(txtres, fntres: string; var FontID: DWORD);
1019 var
1020 cwdt, chgt: Byte;
1021 spc: ShortInt;
1022 CharID: DWORD;
1023 wad: TWADFile;
1024 cfgdata, fntdata: Pointer;
1025 cfglen, fntlen: Integer;
1026 config: TConfig;
1027 chrwidth: Integer;
1028 a: Byte;
1029 begin
1030 cfglen := 0;
1031 fntlen := 0;
1033 wad := TWADFile.Create;
1034 if wad.ReadFile(GameWAD) then
1035 begin
1036 wad.GetResource('FONTS/'+txtres, cfgdata, cfglen);
1037 wad.GetResource('FONTS/'+fntres, fntdata, fntlen);
1038 end;
1039 wad.Free();
1041 if cfglen <> 0 then
1042 begin
1043 config := TConfig.CreateMem(cfgdata, cfglen);
1044 cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1045 chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1047 spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1048 FontID := e_CharFont_Create(spc);
1050 for a := 0 to 255 do
1051 begin
1052 chrwidth := config.ReadInt(IntToStr(a), 'Width', 0);
1053 if chrwidth = 0 then Continue;
1055 if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16),
1056 cwdt, chgt) then
1057 e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth);
1058 end;
1060 config.Free();
1061 end;
1063 if cfglen <> 0 then FreeMem(cfgdata);
1064 if fntlen <> 0 then FreeMem(fntdata);
1065 end;
1067 procedure MenuLoadData();
1068 begin
1069 e_WriteLog('Loading menu data...', TMsgType.Notify);
1071 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD+':TEXTURES\MARKER1');
1072 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD+':TEXTURES\MARKER2');
1073 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD+':TEXTURES\SLEFT');
1074 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD+':TEXTURES\SRIGHT');
1075 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD+':TEXTURES\SMIDDLE');
1076 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD+':TEXTURES\SMARKER');
1077 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD+':TEXTURES\ELEFT');
1078 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD+':TEXTURES\ERIGHT');
1079 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD+':TEXTURES\EMIDDLE');
1080 g_Texture_CreateWADEx('BOX1', GameWAD+':TEXTURES\BOX1');
1081 g_Texture_CreateWADEx('BOX2', GameWAD+':TEXTURES\BOX2');
1082 g_Texture_CreateWADEx('BOX3', GameWAD+':TEXTURES\BOX3');
1083 g_Texture_CreateWADEx('BOX4', GameWAD+':TEXTURES\BOX4');
1084 g_Texture_CreateWADEx('BOX5', GameWAD+':TEXTURES\BOX5');
1085 g_Texture_CreateWADEx('BOX6', GameWAD+':TEXTURES\BOX6');
1086 g_Texture_CreateWADEx('BOX7', GameWAD+':TEXTURES\BOX7');
1087 g_Texture_CreateWADEx('BOX8', GameWAD+':TEXTURES\BOX8');
1088 g_Texture_CreateWADEx('BOX9', GameWAD+':TEXTURES\BOX9');
1089 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD+':TEXTURES\SCROLLUPA');
1090 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD+':TEXTURES\SCROLLUPU');
1091 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD+':TEXTURES\SCROLLDOWNA');
1092 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD+':TEXTURES\SCROLLDOWNU');
1093 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD+':TEXTURES\SCROLLMIDDLE');
1094 g_Texture_CreateWADEx('NOPIC', GameWAD+':TEXTURES\NOPIC');
1096 g_Sound_CreateWADEx('MENU_SELECT', GameWAD+':SOUNDS\MENUSELECT');
1097 g_Sound_CreateWADEx('MENU_OPEN', GameWAD+':SOUNDS\MENUOPEN');
1098 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD+':SOUNDS\MENUCLOSE');
1099 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD+':SOUNDS\MENUCHANGE');
1100 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD+':SOUNDS\SCROLLADD');
1101 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD+':SOUNDS\SCROLLSUB');
1102 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD+':SOUNDS\FALL');
1103 end;
1105 procedure MenuFreeData();
1106 begin
1107 e_CharFont_Remove(gMenuFont);
1108 e_CharFont_Remove(gMenuSmallFont);
1110 g_Texture_Delete('MAINMENU_MARKER1');
1111 g_Texture_Delete('MAINMENU_MARKER2');
1112 g_Texture_Delete('SCROLL_LEFT');
1113 g_Texture_Delete('SCROLL_RIGHT');
1114 g_Texture_Delete('SCROLL_MIDDLE');
1115 g_Texture_Delete('SCROLL_MARKER');
1116 g_Texture_Delete('EDIT_LEFT');
1117 g_Texture_Delete('EDIT_RIGHT');
1118 g_Texture_Delete('EDIT_MIDDLE');
1119 g_Texture_Delete('BOX1');
1120 g_Texture_Delete('BOX2');
1121 g_Texture_Delete('BOX3');
1122 g_Texture_Delete('BOX4');
1123 g_Texture_Delete('BOX5');
1124 g_Texture_Delete('BOX6');
1125 g_Texture_Delete('BOX7');
1126 g_Texture_Delete('BOX8');
1127 g_Texture_Delete('BOX9');
1128 g_Texture_Delete('BSCROLL_UP_A');
1129 g_Texture_Delete('BSCROLL_UP_U');
1130 g_Texture_Delete('BSCROLL_DOWN_A');
1131 g_Texture_Delete('BSCROLL_DOWN_U');
1132 g_Texture_Delete('BSCROLL_MIDDLE');
1133 g_Texture_Delete('NOPIC');
1135 g_Sound_Delete('MENU_SELECT');
1136 g_Sound_Delete('MENU_OPEN');
1137 g_Sound_Delete('MENU_CLOSE');
1138 g_Sound_Delete('MENU_CHANGE');
1139 g_Sound_Delete('SCROLL_ADD');
1140 g_Sound_Delete('SCROLL_SUB');
1141 g_Sound_Delete('SOUND_PLAYER_FALL');
1142 end;
1144 procedure ProcAuthorsMenu();
1145 begin
1146 gMusic.SetByName('MUSIC_INTERMUS');
1147 gMusic.Play();
1148 end;
1150 procedure ProcExitMenuKeyDown (yes: Boolean);
1151 var
1152 s: ShortString;
1153 snd: TPlayableSound;
1154 res: Boolean;
1155 begin
1156 if yes then
1157 begin
1158 g_Game_StopAllSounds(True);
1159 case (Random(18)) of
1160 0: s := 'SOUND_MONSTER_PAIN';
1161 1: s := 'SOUND_MONSTER_DIE_3';
1162 2: s := 'SOUND_MONSTER_SLOP';
1163 3: s := 'SOUND_MONSTER_DEMON_DIE';
1164 4: s := 'SOUND_MONSTER_IMP_DIE_2';
1165 5: s := 'SOUND_MONSTER_MAN_DIE';
1166 6: s := 'SOUND_MONSTER_BSP_DIE';
1167 7: s := 'SOUND_MONSTER_VILE_DIE';
1168 8: s := 'SOUND_MONSTER_SKEL_DIE';
1169 9: s := 'SOUND_MONSTER_MANCUB_ALERT';
1170 10: s := 'SOUND_MONSTER_PAIN_PAIN';
1171 11: s := 'SOUND_MONSTER_BARON_DIE';
1172 12: s := 'SOUND_MONSTER_CACO_DIE';
1173 13: s := 'SOUND_MONSTER_CYBER_DIE';
1174 14: s := 'SOUND_MONSTER_KNIGHT_ALERT';
1175 15: s := 'SOUND_MONSTER_SPIDER_ALERT';
1176 else s := 'SOUND_PLAYER_FALL';
1177 end;
1178 snd := TPlayableSound.Create();
1179 res := snd.SetByName(s);
1180 if not res then res := snd.SetByName('SOUND_PLAYER_FALL');
1181 if res then
1182 begin
1183 snd.Play(True);
1184 while snd.IsPlaying() do begin end;
1185 end;
1186 g_Game_Quit();
1187 exit;
1188 end;
1189 g_GUI_HideWindow();
1190 end;
1192 procedure ProcLoadMenu();
1193 var
1194 a: Integer;
1195 valid: Boolean;
1196 begin
1197 for a := 1 to 8 do
1198 begin
1199 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Text := g_GetSaveName(a, valid);
1200 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := not valid;
1201 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1202 end;
1203 end;
1205 procedure ProcSaveMenu();
1206 var
1207 a: Integer;
1208 valid: Boolean;
1209 name: AnsiString;
1210 begin
1211 for a := 1 to 8 do
1212 begin
1213 name := g_GetSaveName(a, valid);
1214 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Text := name;
1215 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a))).Invalid := (name <> '') and (not valid);
1216 end;
1217 end;
1219 procedure ProcSaveGame(Sender: TGUIControl);
1220 var
1221 a: Integer;
1222 begin
1223 if g_Game_IsNet then Exit;
1224 if g_Game_IsTestMap then Exit;
1225 a := StrToInt(Copy(Sender.Name, Length(Sender.Name), 1));
1226 g_Game_PauseAllSounds(True);
1227 g_SaveGame(a, TGUIEdit(Sender).Text);
1229 g_ActiveWindow := nil;
1230 g_Game_Pause(False);
1231 end;
1233 procedure ProcLoadGame(Sender: TGUIControl);
1234 var
1235 a: Integer;
1236 begin
1237 if g_Game_IsNet then Exit;
1238 a := StrToInt(Copy(Sender.Name, Length(Sender.Name), 1));
1239 if g_LoadGame(a) then
1240 begin
1241 g_Game_PauseAllSounds(False)
1242 end
1243 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1244 begin
1245 g_Console_Add(_lc[I_MSG_BAD_SAVE_VERSION], true);
1246 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1247 //g_ActiveWindow := nil;
1248 end;
1249 end;
1251 procedure ProcSingle1Player();
1252 begin
1253 g_Game_StartSingle(gDefaultMegawadStart, False, 1);
1254 end;
1256 procedure ProcSingle2Players();
1257 begin
1258 g_Game_StartSingle(gDefaultMegawadStart, True, 2);
1259 end;
1261 procedure ProcSelectMapMenu();
1262 var
1263 menu: TGUIMenu;
1264 wad_lb: TGUIFileListBox;
1265 map_lb: TGUIListBox;
1266 map: String;
1267 begin
1268 menu := TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1269 wad_lb := TGUIFileListBox(menu.GetControl('lsMapWAD'));
1270 map_lb := TGUIListBox(menu.GetControl('lsMapRes'));
1272 if wad_lb.SelectedItem() <> '' then
1273 map := map_lb.SelectedItem()
1274 else
1275 map := '';
1277 wad_lb.UpdateFileList();
1278 map_lb.Clear();
1280 if wad_lb.SelectedItem() <> '' then
1281 begin
1282 ProcSelectWAD(nil);
1283 map_lb.SelectItem(map);
1285 if map_lb.SelectedItem() <> '' then
1286 ProcSelectMap(nil);
1287 end;
1289 g_GUI_ShowWindow('SelectMapMenu');
1290 end;
1292 procedure ProcSelectCampaignMenu();
1293 var
1294 menu: TGUIMenu;
1295 wad_lb: TGUIFileListBox;
1296 begin
1297 menu := TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1298 wad_lb := TGUIFileListBox(menu.GetControl('lsWAD'));
1300 wad_lb.UpdateFileList();
1302 if wad_lb.SelectedItem() <> '' then
1303 ProcSelectCampaignWAD(nil);
1304 end;
1306 procedure ProcSetMap();
1307 var
1308 wad, map, res: String;
1309 begin
1310 with TGUIMenu(g_ActiveWindow.GetControl('mSelectMapMenu')) do
1311 begin
1312 wad := ExtractRelativePath(MapsDir, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1313 map := TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1314 end;
1316 if (wad = '') or (map = '') then
1317 Exit;
1319 res := wad+':\'+map;
1321 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res;
1322 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res;
1323 end;
1325 procedure ProcChangeSoundSettings(Sender: TGUIControl);
1326 var
1327 menu: TGUIMenu;
1328 begin
1329 menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1331 g_Sound_SetupAllVolumes(
1332 Min(TGUIScroll(menu.GetControl('scSoundLevel')).Value*16, 255),
1333 Min(TGUIScroll(menu.GetControl('scMusicLevel')).Value*16, 255)
1334 );
1335 end;
1337 procedure ProcChangeGameSettings(Sender: TGUIControl);
1338 var
1339 menu: TGUIMenu;
1340 begin
1341 menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1342 g_dbg_scale := TGUIScroll(menu.GetControl('scScaleFactor')).Value + 1;
1343 end;
1345 procedure ProcChangeTouchSettings(Sender: TGUIControl);
1346 var
1347 menu: TGUIMenu;
1348 begin
1349 menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1350 g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
1351 g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
1352 g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
1353 end;
1355 procedure ProcOptionsPlayersMIMenu();
1356 var
1357 s, a: string;
1358 b: TModelInfo;
1359 begin
1360 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
1362 a := TGUIListBox(TGUIMenu(g_ActiveWindow.GetControl('mOptionsPlayers'+s+'Menu')).GetControl('ls'+s+'Model')).SelectedItem;
1364 if a = '' then Exit;
1366 b := g_PlayerModel_GetInfo(a);
1368 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1369 begin
1370 TGUILabel(GetControl('lbName')).Text := b.Name;
1371 TGUILabel(GetControl('lbAuthor')).Text := b.Author;
1372 TGUIMemo(GetControl('meComment')).SetText(b.Description);
1374 if b.HaveWeapon then
1375 TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_YES]
1376 else
1377 TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_NO];
1378 end;
1380 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1381 end;
1383 procedure ProcOptionsPlayersAnim();
1384 var
1385 s: String;
1386 begin
1387 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then
1388 s := 'P1'
1389 else
1390 s := 'P2';
1392 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')) do
1393 begin
1394 NextAnim();
1395 Model.GetCurrentAnimation.Loop := True;
1396 Model.GetCurrentAnimationMask.Loop := True;
1397 end;
1398 end;
1400 procedure ProcOptionsPlayersWeap();
1401 var
1402 s: String;
1403 begin
1404 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then
1405 s := 'P1'
1406 else
1407 s := 'P2';
1409 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')) do
1410 NextWeapon();
1411 end;
1413 procedure ProcOptionsPlayersRot();
1414 var
1415 s: string;
1416 begin
1417 if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
1418 with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')).Model do
1419 begin
1420 if Direction = TDirection.D_LEFT then Direction := TDirection.D_RIGHT else Direction := TDirection.D_LEFT;
1421 end;
1422 end;
1424 procedure ProcDefaultMenuKeyDown (yes: Boolean);
1425 begin
1426 if yes then
1427 begin
1428 g_Options_SetDefault();
1429 ReadOptions();
1430 end;
1431 g_GUI_HideWindow();
1432 end;
1434 procedure ProcSavedMenuKeyDown (yes: Boolean);
1435 begin
1436 if yes then ReadOptions();
1437 g_GUI_HideWindow();
1438 end;
1440 procedure ProcAuthorsClose();
1441 begin
1442 gMusic.SetByName('MUSIC_MENU');
1443 gMusic.Play();
1444 gState := STATE_MENU;
1445 end;
1447 procedure ProcGMClose();
1448 begin
1449 g_Game_InGameMenu(False);
1450 end;
1452 procedure ProcGMShow();
1453 var
1454 Enabled: Boolean;
1455 begin
1456 Enabled := True;
1457 if (gGameSettings.GameType = GT_SINGLE) and
1458 ((gPlayer1 = nil) or (not gPlayer1.alive)) and
1459 ((gPlayer2 = nil) or (not gPlayer2.alive)) then
1460 Enabled := False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1461 if not gGameOn then
1462 Enabled := False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1463 if g_Game_IsTestMap then
1464 Enabled := False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1465 TGUIMainMenu(g_ActiveWindow.GetControl(
1466 g_ActiveWindow.DefControl )).EnableButton('save', Enabled);
1467 end;
1469 procedure ProcChangePlayers();
1470 var
1471 TeamGame, Spectator, AddTwo: Boolean;
1472 P1Team{, P2Team}: Byte;
1473 bP2: TGUITextButton;
1474 begin
1475 TeamGame := gGameSettings.GameMode in [GM_TDM, GM_CTF];
1476 Spectator := (gPlayer1 = nil) and (gPlayer2 = nil);
1477 AddTwo := gGameSettings.GameType in [GT_CUSTOM, GT_SERVER];
1478 P1Team := TEAM_NONE;
1479 if gPlayer1 <> nil then P1Team := gPlayer1.Team;
1480 // TODO
1481 //P2Team := TEAM_NONE;
1482 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1484 TGUIMainMenu(g_ActiveWindow.GetControl(
1485 g_ActiveWindow.DefControl )).EnableButton('tmJoinRed', TeamGame and (P1Team <> TEAM_RED));
1486 TGUIMainMenu(g_ActiveWindow.GetControl(
1487 g_ActiveWindow.DefControl )).EnableButton('tmJoinBlue', TeamGame and (P1Team <> TEAM_BLUE));
1488 TGUIMainMenu(g_ActiveWindow.GetControl(
1489 g_ActiveWindow.DefControl )).EnableButton('tmJoinGame', Spectator and not TeamGame);
1491 bP2 := TGUIMainMenu(g_ActiveWindow.GetControl(
1492 g_ActiveWindow.DefControl )).GetButton('tmPlayer2');
1493 bP2.Enabled := AddTwo and not Spectator;
1494 if bP2.Enabled then
1495 bP2.Color := MAINMENU_ITEMS_COLOR
1496 else
1497 bP2.Color := MAINMENU_UNACTIVEITEMS_COLOR;
1498 if gPlayer2 = nil then
1499 bP2.Caption := _lc[I_MENU_ADD_PLAYER_2]
1500 else
1501 bP2.Caption := _lc[I_MENU_REM_PLAYER_2];
1503 TGUIMainMenu(g_ActiveWindow.GetControl(
1504 g_ActiveWindow.DefControl )).EnableButton('tmSpectate', not Spectator);
1505 end;
1507 procedure ProcJoinRed();
1508 begin
1509 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1510 Exit;
1511 if g_Game_IsServer then
1512 begin
1513 if gPlayer1 = nil then
1514 g_Game_AddPlayer(TEAM_RED)
1515 else
1516 begin
1517 if gPlayer1.Team <> TEAM_RED then
1518 begin
1519 gPlayer1.SwitchTeam;
1520 gPlayer1Settings.Team := gPlayer1.Team;
1521 end;
1523 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
1524 end;
1525 end
1526 else
1527 begin
1528 gPlayer1Settings.Team := TEAM_RED;
1529 MC_SEND_PlayerSettings;
1530 if gPlayer1 = nil then
1531 g_Game_AddPlayer(TEAM_RED);
1532 end;
1533 g_ActiveWindow := nil;
1534 g_Game_Pause(False);
1535 end;
1537 procedure ProcJoinBlue();
1538 begin
1539 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1540 Exit;
1541 if g_Game_IsServer then
1542 begin
1543 if gPlayer1 = nil then
1544 g_Game_AddPlayer(TEAM_BLUE)
1545 else
1546 begin
1547 if gPlayer1.Team <> TEAM_BLUE then
1548 begin
1549 gPlayer1.SwitchTeam;
1550 gPlayer1Settings.Team := gPlayer1.Team;
1551 end;
1553 if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer1.UID);
1554 end;
1555 end
1556 else
1557 begin
1558 gPlayer1Settings.Team := TEAM_BLUE;
1559 MC_SEND_PlayerSettings;
1560 if gPlayer1 = nil then
1561 g_Game_AddPlayer(TEAM_BLUE);
1562 end;
1563 g_ActiveWindow := nil;
1564 g_Game_Pause(False);
1565 end;
1567 procedure ProcJoinGame();
1568 begin
1569 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1570 Exit;
1571 if gPlayer1 = nil then
1572 g_Game_AddPlayer();
1573 g_ActiveWindow := nil;
1574 g_Game_Pause(False);
1575 end;
1577 procedure ProcSwitchP2();
1578 begin
1579 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER]) then
1580 Exit;
1581 if gPlayer1 = nil then
1582 Exit;
1583 if gPlayer2 = nil then
1584 g_Game_AddPlayer()
1585 else
1586 g_Game_RemovePlayer();
1587 g_ActiveWindow := nil;
1588 g_Game_Pause(False);
1589 end;
1591 procedure ProcSpectate();
1592 begin
1593 if not (gGameSettings.GameType in [GT_CUSTOM, GT_SERVER, GT_CLIENT]) then
1594 Exit;
1595 g_Game_Spectate();
1596 g_ActiveWindow := nil;
1597 g_Game_Pause(False);
1598 end;
1600 procedure ProcRestartMenuKeyDown (yes: Boolean);
1601 begin
1602 if yes then g_Game_Restart() else g_GUI_HideWindow;
1603 end;
1605 procedure ProcEndMenuKeyDown (yes: Boolean);
1606 begin
1607 if yes then gExit := EXIT_SIMPLE else g_GUI_HideWindow;
1608 end;
1610 procedure ProcSetRussianLanguage();
1611 begin
1612 if gLanguage <> LANGUAGE_RUSSIAN then
1613 begin
1614 gLanguage := LANGUAGE_RUSSIAN;
1615 gLanguageChange := True;
1616 gAskLanguage := False;
1618 g_Options_Write_Language(GameDir+'/'+CONFIG_FILENAME);
1620 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1621 ProcApplyOptions();
1622 end;
1623 end;
1625 procedure ProcSetEnglishLanguage();
1626 begin
1627 if gLanguage <> LANGUAGE_ENGLISH then
1628 begin
1629 gLanguage := LANGUAGE_ENGLISH;
1630 gLanguageChange := True;
1631 gAskLanguage := False;
1633 g_Options_Write_Language(GameDir+'/'+CONFIG_FILENAME);
1635 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1636 ProcApplyOptions();
1637 end;
1638 end;
1640 procedure ReadGameSettings();
1641 var
1642 menu: TGUIMenu;
1643 begin
1644 menu := TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1646 with gGameSettings do
1647 begin
1648 with TGUISwitch(menu.GetControl('swTeamDamage')) do
1649 if LongBool(Options and GAME_OPTION_TEAMDAMAGE) then
1650 ItemIndex := 0
1651 else
1652 ItemIndex := 1;
1654 TGUIEdit(menu.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit);
1655 TGUIEdit(menu.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit);
1656 TGUIEdit(menu.GetControl('edMaxLives')).Text := IntToStr(MaxLives);
1658 with TGUISwitch(menu.GetControl('swBotsVS')) do
1659 if LongBool(Options and GAME_OPTION_BOTVSPLAYER) and
1660 LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
1661 ItemIndex := 2
1662 else
1663 if LongBool(Options and GAME_OPTION_BOTVSMONSTER) then
1664 ItemIndex := 1
1665 else
1666 ItemIndex := 0;
1668 if GameType in [GT_CUSTOM, GT_SERVER] then
1669 begin
1670 TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
1671 TGUIEdit(menu.GetControl('edTimeLimit')).Enabled := True;
1672 TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_ITEMSTEXT_COLOR;
1673 TGUIEdit(menu.GetControl('edGoalLimit')).Enabled := True;
1674 TGUILabel(menu.GetControlsText('edGoalLimit')).Color := MENU_ITEMSTEXT_COLOR;
1675 TGUIEdit(menu.GetControl('edMaxLives')).Enabled := True;
1676 TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_ITEMSTEXT_COLOR;
1677 TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
1678 end
1679 else
1680 begin
1681 TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
1682 with TGUIEdit(menu.GetControl('edTimeLimit')) do
1683 begin
1684 Enabled := False;
1685 Text := '';
1686 end;
1687 TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
1688 with TGUIEdit(menu.GetControl('edGoalLimit')) do
1689 begin
1690 Enabled := False;
1691 Text := '';
1692 end;
1693 TGUILabel(menu.GetControlsText('edGoalLimit')).Color := MENU_UNACTIVEITEMS_COLOR;
1694 with TGUIEdit(menu.GetControl('edMaxLives')) do
1695 begin
1696 Enabled := False;
1697 Text := '';
1698 end;
1699 TGUILabel(menu.GetControlsText('edMaxLives')).Color := MENU_UNACTIVEITEMS_COLOR;
1700 TGUISwitch(menu.GetControl('swBotsVS')).Enabled := True;
1701 end;
1702 end;
1703 end;
1705 procedure ProcApplyGameSet();
1706 var
1707 menu: TGUIMenu;
1708 a, b, n: Integer;
1709 stat: TPlayerStatArray;
1710 begin
1711 menu := TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1713 if not g_Game_IsServer then Exit;
1715 with gGameSettings do
1716 begin
1717 if TGUISwitch(menu.GetControl('swTeamDamage')).Enabled then
1718 begin
1719 if TGUISwitch(menu.GetControl('swTeamDamage')).ItemIndex = 0 then
1720 Options := Options or GAME_OPTION_TEAMDAMAGE
1721 else
1722 Options := Options and (not GAME_OPTION_TEAMDAMAGE);
1723 end;
1725 if TGUIEdit(menu.GetControl('edTimeLimit')).Enabled then
1726 begin
1727 n := StrToIntDef(TGUIEdit(menu.GetControl('edTimeLimit')).Text, TimeLimit);
1729 if n = 0 then
1730 TimeLimit := 0
1731 else
1732 begin
1733 b := (gTime - gGameStartTime) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1735 TimeLimit := Max(n, b);
1736 end;
1737 end;
1739 if TGUIEdit(menu.GetControl('edGoalLimit')).Enabled then
1740 begin
1741 n := StrToIntDef(TGUIEdit(menu.GetControl('edGoalLimit')).Text, GoalLimit);
1743 if n = 0 then
1744 GoalLimit := 0
1745 else
1746 begin
1747 b := 0;
1748 if GameMode = GM_DM then
1749 begin // DM
1750 stat := g_Player_GetStats();
1751 if stat <> nil then
1752 for a := 0 to High(stat) do
1753 if stat[a].Frags > b then
1754 b := stat[a].Frags;
1755 end
1756 else // CTF
1757 b := Max(gTeamStat[TEAM_RED].Goals, gTeamStat[TEAM_BLUE].Goals);
1759 GoalLimit := Max(n, b);
1760 end;
1761 end;
1763 if TGUIEdit(menu.GetControl('edMaxLives')).Enabled then
1764 begin
1765 n := StrToIntDef(TGUIEdit(menu.GetControl('edMaxLives')).Text, GoalLimit);
1766 if n < 0 then n := 0;
1767 if n > 255 then n := 255;
1768 if n = 0 then
1769 MaxLives := 0
1770 else
1771 begin
1772 b := 0;
1773 stat := g_Player_GetStats();
1774 if stat <> nil then
1775 for a := 0 to High(stat) do
1776 if stat[a].Lives > b then
1777 b := stat[a].Lives;
1779 MaxLives := Max(n, b);
1780 end;
1781 end;
1783 if TGUISwitch(menu.GetControl('swBotsVS')).Enabled then
1784 begin
1785 case TGUISwitch(menu.GetControl('swBotsVS')).ItemIndex of
1786 1:
1787 begin
1788 Options := Options and (not GAME_OPTION_BOTVSPLAYER);
1789 Options := Options or GAME_OPTION_BOTVSMONSTER;
1790 end;
1791 2:
1792 begin
1793 Options := Options or GAME_OPTION_BOTVSPLAYER;
1794 Options := Options or GAME_OPTION_BOTVSMONSTER;
1795 end;
1796 else
1797 begin
1798 Options := Options or GAME_OPTION_BOTVSPLAYER;
1799 Options := Options and (not GAME_OPTION_BOTVSMONSTER);
1800 end;
1801 end;
1802 end;
1803 end;
1805 if g_Game_IsNet then MH_SEND_GameSettings;
1806 end;
1808 procedure ProcVideoOptionsRes();
1809 var
1810 menu: TGUIMenu;
1811 list: SSArray;
1812 SR: DWORD;
1813 begin
1814 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1816 TGUILabel(menu.GetControl('lbCurrentRes')).Text :=
1817 IntToStr(gScreenWidth) +
1818 ' x ' + IntToStr(gScreenHeight) +
1819 ', ' + IntToStr(gBPP) + ' bpp';
1821 with TGUIListBox(menu.GetControl('lsResolution')) do
1822 begin
1823 list := GetDisplayModes(gBPP, SR);
1825 if list <> nil then
1826 begin
1827 Items := list;
1828 ItemIndex := SR;
1829 end
1830 else
1831 Clear();
1832 end;
1834 with TGUISwitch(menu.GetControl('swFullScreen')) do
1835 if gFullscreen then
1836 ItemIndex := 0
1837 else
1838 ItemIndex := 1;
1839 end;
1841 procedure ProcApplyVideoOptions();
1842 var
1843 menu: TGUIMenu;
1844 Fullscreen: Boolean;
1845 SWidth, SHeight: Integer;
1846 str: String;
1847 begin
1848 menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1850 str := TGUIListBox(menu.GetControl('lsResolution')).SelectedItem;
1851 SScanf(str, '%dx%d', [@SWidth, @SHeight]);
1853 Fullscreen := TGUISwitch(menu.GetControl('swFullScreen')).ItemIndex = 0;
1855 if (SWidth <> gScreenWidth) or
1856 (SHeight <> gScreenHeight) or
1857 (Fullscreen <> gFullscreen) then
1858 begin
1859 gResolutionChange := True;
1860 gRC_Width := SWidth;
1861 gRC_Height := SHeight;
1862 gRC_FullScreen := Fullscreen;
1863 gRC_Maximized := gWinMaximized;
1864 end;
1866 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1867 ProcApplyOptions();
1868 end;
1870 procedure ProcSetFirstRussianLanguage();
1871 begin
1872 gLanguage := LANGUAGE_RUSSIAN;
1873 gLanguageChange := True;
1874 gAskLanguage := False;
1876 g_Options_Write_Language(GameDir+'/'+CONFIG_FILENAME);
1877 end;
1879 procedure ProcSetFirstEnglishLanguage();
1880 begin
1881 gLanguage := LANGUAGE_ENGLISH;
1882 gLanguageChange := True;
1883 gAskLanguage := False;
1885 g_Options_Write_Language(GameDir+'/'+CONFIG_FILENAME);
1886 end;
1888 procedure ProcRecallAddress();
1889 begin
1890 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1891 begin
1892 TGUIEdit(GetControl('edIP')).Text := NetClientIP;
1893 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort);
1894 end;
1895 end;
1897 procedure CreateFirstLanguageMenu();
1898 var
1899 Menu: TGUIWindow;
1900 begin
1901 Menu := TGUIWindow.Create('FirstLanguageMenu');
1903 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, ' '))) do
1904 begin
1905 Name := 'mmFirstLanguageMenu';
1906 AddButton(@ProcSetFirstRussianLanguage, 'Ðóññêèé', '');
1907 AddButton(@ProcSetFirstEnglishLanguage, 'English', '');
1908 end;
1910 Menu.DefControl := 'mmFirstLanguageMenu';
1911 Menu.MainWindow := True;
1912 g_GUI_AddWindow(Menu);
1913 end;
1915 procedure g_Menu_AskLanguage();
1916 begin
1917 CreateFirstLanguageMenu();
1918 g_GUI_ShowWindow('FirstLanguageMenu');
1919 end;
1921 procedure CreatePlayerOptionsMenu(s: String);
1922 var
1923 Menu: TGUIWindow;
1924 a: String;
1925 begin
1926 Menu := TGUIWindow.Create('OptionsPlayers'+s+'Menu');
1927 if s = 'P1' then
1928 a := _lc[I_MENU_PLAYER_1]
1929 else
1930 a := _lc[I_MENU_PLAYER_2];
1931 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, a))) do
1932 begin
1933 Name := 'mOptionsPlayers'+s+'Menu';
1934 with AddEdit(_lc[I_MENU_PLAYER_NAME]) do
1935 begin
1936 Name := 'ed'+s+'Name';
1937 MaxLength := 12;
1938 Width := 12;
1939 end;
1940 with AddSwitch(_lc[I_MENU_PLAYER_TEAM]) do
1941 begin
1942 Name := 'sw'+s+'Team';
1943 AddItem(_lc[I_MENU_PLAYER_TEAM_RED]);
1944 AddItem(_lc[I_MENU_PLAYER_TEAM_BLUE]);
1945 end ;
1946 with AddList(_lc[I_MENU_PLAYER_MODEL], 12, 6) do
1947 begin
1948 Name := 'ls'+s+'Model';
1949 Sort := True;
1950 Items := g_PlayerModel_GetNames();
1951 OnChange := ProcSelectModel;
1952 end;
1953 with AddScroll(_lc[I_MENU_PLAYER_RED]) do
1954 begin
1955 Name := 'sc'+s+'Red';
1956 Max := 16;
1957 OnChange := ProcChangeColor;
1958 end;
1959 with AddScroll(_lc[I_MENU_PLAYER_GREEN]) do
1960 begin
1961 Name := 'sc'+s+'Green';
1962 Max := 16;
1963 OnChange := ProcChangeColor;
1964 end;
1965 with AddScroll(_lc[I_MENU_PLAYER_BLUE]) do
1966 begin
1967 Name := 'sc'+s+'Blue';
1968 Max := 16;
1969 OnChange := ProcChangeColor;
1970 end;
1971 AddSpace();
1972 AddButton(@ProcOptionsPlayersMIMenu, _lc[I_MENU_MODEL_INFO]);
1973 AddButton(@ProcOptionsPlayersAnim, _lc[I_MENU_MODEL_ANIMATION]);
1974 AddButton(@ProcOptionsPlayersWeap, _lc[I_MENU_MODEL_CHANGE_WEAPON]);
1975 AddButton(@ProcOptionsPlayersRot, _lc[I_MENU_MODEL_ROTATE]);
1977 with TGUIModelView(Menu.AddChild(TGUIModelView.Create)) do
1978 begin
1979 Name := 'mv'+s+'Model';
1980 X := GetControl('ls'+s+'Model').X+TGUIListBox(GetControl('ls'+s+'Model')).GetWidth+16;
1981 Y := GetControl('ls'+s+'Model').Y;
1982 end;
1983 end;
1984 Menu.DefControl := 'mOptionsPlayers'+s+'Menu';
1985 g_GUI_AddWindow(Menu);
1986 end;
1988 procedure CreateAllMenus();
1989 var
1990 Menu: TGUIWindow;
1991 //SR: TSearchRec;
1992 a, cx, _y, i: Integer;
1993 //list: SSArray;
1994 begin
1995 Menu := TGUIWindow.Create('MainMenu');
1996 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MAIN_MENU]))) do
1997 begin
1998 Name := 'mmMainMenu';
1999 AddButton(nil, _lc[I_MENU_NEW_GAME], 'NewGameMenu');
2000 AddButton(nil, _lc[I_MENU_MULTIPLAYER], 'NetGameMenu');
2001 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
2002 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
2003 AddButton(@ProcAuthorsMenu, _lc[I_MENU_AUTHORS], 'AuthorsMenu');
2004 AddButton(nil, _lc[I_MENU_EXIT], 'ExitMenu');
2005 end;
2006 with TGUILabel(Menu.AddChild(TGUILabel.Create(Format(_lc[I_VERSION], [GAME_VERSION]), gMenuSmallFont))) do
2007 begin
2008 Color := _RGB(255, 255, 255);
2009 X := gScreenWidth-GetWidth-8;
2010 Y := gScreenHeight-GetHeight-8;
2011 end;
2012 Menu.DefControl := 'mmMainMenu';
2013 Menu.MainWindow := True;
2014 g_GUI_AddWindow(Menu);
2016 Menu := TGUIWindow.Create('NewGameMenu');
2017 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_NEW_GAME]))) do
2018 begin
2019 Name := 'mmNewGameMenu';
2020 AddButton(@ProcSingle1Player, _lc[I_MENU_1_PLAYER]);
2021 AddButton(@ProcSingle2Players, _lc[I_MENU_2_PLAYERS]);
2022 AddButton(nil, _lc[I_MENU_CUSTOM_GAME], 'CustomGameMenu');
2023 AddButton(@ProcSelectCampaignMenu, _lc[I_MENU_CAMPAIGN], 'CampaignMenu');
2024 end;
2025 Menu.DefControl := 'mmNewGameMenu';
2026 g_GUI_AddWindow(Menu);
2028 Menu := TGUIWindow.Create('NetGameMenu');
2029 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MULTIPLAYER]))) do
2030 begin
2031 Name := 'mmNetGameMenu';
2032 AddButton(@ProcRecallAddress, _lc[I_MENU_START_CLIENT], 'NetClientMenu');
2033 AddButton(nil, _lc[I_MENU_START_SERVER], 'NetServerMenu');
2034 end;
2035 Menu.DefControl := 'mmNetGameMenu';
2036 g_GUI_AddWindow(Menu);
2038 Menu := TGUIWindow.Create('NetServerMenu');
2039 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_START_SERVER]))) do
2040 begin
2041 Name := 'mNetServerMenu';
2042 with AddEdit(_lc[I_NET_SERVER_NAME]) do
2043 begin
2044 Name := 'edSrvName';
2045 OnlyDigits := False;
2046 Width := 16;
2047 MaxLength := 64;
2048 Text := NetServerName;
2049 end;
2050 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
2051 begin
2052 Name := 'edSrvPassword';
2053 OnlyDigits := False;
2054 Width := 16;
2055 MaxLength := 24;
2056 Text := NetPassword;
2057 end;
2058 with AddEdit(_lc[I_NET_PORT]) do
2059 begin
2060 Name := 'edPort';
2061 OnlyDigits := True;
2062 Width := 4;
2063 MaxLength := 5;
2064 Text := IntToStr(NetPort);
2065 end;
2066 with AddEdit(_lc[I_NET_MAX_CLIENTS]) do
2067 begin
2068 Name := 'edMaxPlayers';
2069 OnlyDigits := True;
2070 Width := 4;
2071 MaxLength := 2;
2072 Text := IntToStr(NetMaxClients);
2073 end;
2074 with AddSwitch(_lc[I_NET_USE_MASTER]) do
2075 begin
2076 Name := 'swUseMaster';
2077 AddItem(_lc[I_MENU_YES]);
2078 AddItem(_lc[I_MENU_NO]);
2079 if NetUseMaster then
2080 ItemIndex := 0
2081 else
2082 ItemIndex := 1;
2083 end;
2084 AddSpace();
2085 with AddLabel(_lc[I_MENU_MAP]) do
2086 begin
2087 Name := 'lbMap';
2088 FixedLength := 16;
2089 Text := gnMap;
2090 OnClick := @ProcSelectMapMenu;
2091 end;
2092 with AddSwitch(_lc[I_MENU_GAME_TYPE]) do
2093 begin
2094 Name := 'swGameMode';
2095 AddItem(_lc[I_MENU_GAME_TYPE_DM]);
2096 AddItem(_lc[I_MENU_GAME_TYPE_TDM]);
2097 AddItem(_lc[I_MENU_GAME_TYPE_CTF]);
2098 AddItem(_lc[I_MENU_GAME_TYPE_COOP]);
2099 case g_Game_TextToMode(gnGameMode) of
2100 GM_NONE,
2101 GM_DM: ItemIndex := 0;
2102 GM_TDM: ItemIndex := 1;
2103 GM_CTF: ItemIndex := 2;
2104 GM_SINGLE,
2105 GM_COOP: ItemIndex := 3;
2106 end;
2107 OnChange := ProcSwitchMonstersNet;
2108 end;
2109 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
2110 begin
2111 Name := 'edTimeLimit';
2112 OnlyDigits := True;
2113 Width := 4;
2114 MaxLength := 5;
2115 if gnTimeLimit > 0 then
2116 Text := IntToStr(gnTimeLimit);
2117 end;
2118 with AddEdit(_lc[I_MENU_GOAL_LIMIT]) do
2119 begin
2120 Name := 'edGoalLimit';
2121 OnlyDigits := True;
2122 Width := 4;
2123 MaxLength := 5;
2124 if gnGoalLimit > 0 then
2125 Text := IntToStr(gnGoalLimit);
2126 end;
2127 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
2128 begin
2129 Name := 'edMaxLives';
2130 OnlyDigits := True;
2131 Width := 4;
2132 MaxLength := 3;
2133 if gnMaxLives > 0 then
2134 Text := IntToStr(gnMaxLives);
2135 end;
2136 with AddSwitch(_lc[I_MENU_SERVER_PLAYERS]) do
2137 begin
2138 Name := 'swPlayers';
2139 AddItem(_lc[I_MENU_COUNT_NONE]);
2140 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2141 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2142 ItemIndex := gnPlayers;
2143 end;
2144 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
2145 begin
2146 Name := 'swTeamDamage';
2147 AddItem(_lc[I_MENU_YES]);
2148 AddItem(_lc[I_MENU_NO]);
2149 if gnTeamDamage then
2150 ItemIndex := 0
2151 else
2152 ItemIndex := 1;
2153 end;
2154 with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
2155 begin
2156 Name := 'swEnableExits';
2157 AddItem(_lc[I_MENU_YES]);
2158 AddItem(_lc[I_MENU_NO]);
2159 if gnAllowExit then
2160 ItemIndex := 0
2161 else
2162 ItemIndex := 1;
2163 end;
2164 with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
2165 begin
2166 Name := 'swWeaponStay';
2167 AddItem(_lc[I_MENU_YES]);
2168 AddItem(_lc[I_MENU_NO]);
2169 if gnWeaponStay then
2170 ItemIndex := 0
2171 else
2172 ItemIndex := 1;
2173 end;
2174 with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
2175 begin
2176 Name := 'swMonsters';
2177 AddItem(_lc[I_MENU_YES]);
2178 AddItem(_lc[I_MENU_NO]);
2179 if gnMonsters then
2180 ItemIndex := 0
2181 else
2182 ItemIndex := 1;
2183 end;
2184 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
2185 begin
2186 Name := 'swBotsVS';
2187 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
2188 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
2189 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
2190 ItemIndex := 2;
2191 if gnBotsVS = 'Players' then
2192 ItemIndex := 0;
2193 if gnBotsVS = 'Monsters' then
2194 ItemIndex := 1;
2195 end;
2196 AddSpace();
2197 AddButton(@ProcStartNetGame, _lc[I_MENU_START_GAME]);
2199 ReAlign();
2200 end;
2201 Menu.DefControl := 'mNetServerMenu';
2202 g_GUI_AddWindow(Menu);
2204 Menu := TGUIWindow.Create('NetClientMenu');
2205 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_START_CLIENT]))) do
2206 begin
2207 Name := 'mNetClientMenu';
2209 AddButton(@ProcServerlist, _lc[I_NET_SLIST]);
2210 AddSpace();
2212 with AddEdit(_lc[I_NET_ADDRESS]) do
2213 begin
2214 Name := 'edIP';
2215 OnlyDigits :=False;
2216 Width := 12;
2217 MaxLength := 64;
2218 Text := 'localhost';
2219 end;
2220 with AddEdit(_lc[I_NET_PORT]) do
2221 begin
2222 Name := 'edPort';
2223 OnlyDigits := True;
2224 Width := 4;
2225 MaxLength := 5;
2226 Text := '25666';
2227 end;
2228 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
2229 begin
2230 Name := 'edPW';
2231 OnlyDigits := False;
2232 Width := 12;
2233 MaxLength := 32;
2234 Text := '';
2235 end;
2237 AddSpace();
2238 AddButton(@ProcConnectNetGame, _lc[I_MENU_CLIENT_CONNECT]);
2240 ReAlign();
2241 end;
2242 Menu.DefControl := 'mNetClientMenu';
2243 g_GUI_AddWindow(Menu);
2245 Menu := TGUIWindow.Create('LoadMenu');
2246 Menu.OnShow := ProcLoadMenu;
2247 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LOAD_GAME]))) do
2248 begin
2249 Name := 'mmLoadMenu';
2251 for a := 1 to 8 do
2252 with AddEdit('') do
2253 begin
2254 Name := 'edSlot'+IntToStr(a);
2255 Width := 16;
2256 MaxLength := 16;
2257 OnEnter := ProcLoadGame;
2258 end;
2259 end;
2260 Menu.DefControl := 'mmLoadMenu';
2261 g_GUI_AddWindow(Menu);
2263 Menu := TGUIWindow.Create('SaveMenu');
2264 Menu.OnShow := ProcSaveMenu;
2265 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SAVE_GAME]))) do
2266 begin
2267 Name := 'mmSaveMenu';
2269 for a := 1 to 8 do
2270 with AddEdit('') do
2271 begin
2272 Name := 'edSlot'+IntToStr(a);
2273 Width := 16;
2274 MaxLength := 16;
2275 OnChange := ProcSaveGame;
2276 end;
2277 end;
2278 Menu.DefControl := 'mmSaveMenu';
2279 g_GUI_AddWindow(Menu);
2281 Menu := TGUIWindow.Create('CustomGameMenu');
2282 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CUSTOM_GAME]))) do
2283 begin
2284 Name := 'mCustomGameMenu';
2285 with AddLabel(_lc[I_MENU_MAP]) do
2286 begin
2287 Name := 'lbMap';
2288 FixedLength := 16;
2289 Text := gcMap;
2290 OnClick := @ProcSelectMapMenu;
2291 end;
2292 with AddSwitch(_lc[I_MENU_GAME_TYPE]) do
2293 begin
2294 Name := 'swGameMode';
2295 AddItem(_lc[I_MENU_GAME_TYPE_DM]);
2296 AddItem(_lc[I_MENU_GAME_TYPE_TDM]);
2297 AddItem(_lc[I_MENU_GAME_TYPE_CTF]);
2298 AddItem(_lc[I_MENU_GAME_TYPE_COOP]);
2299 case g_Game_TextToMode(gcGameMode) of
2300 GM_NONE,
2301 GM_DM: ItemIndex := 0;
2302 GM_TDM: ItemIndex := 1;
2303 GM_CTF: ItemIndex := 2;
2304 GM_SINGLE,
2305 GM_COOP: ItemIndex := 3;
2306 end;
2307 OnChange := ProcSwitchMonstersCustom;
2308 end;
2309 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
2310 begin
2311 Name := 'edTimeLimit';
2312 OnlyDigits := True;
2313 Width := 4;
2314 MaxLength := 5;
2315 if gcTimeLimit > 0 then
2316 Text := IntToStr(gcTimeLimit);
2317 end;
2318 with AddEdit(_lc[I_MENU_GOAL_LIMIT]) do
2319 begin
2320 Name := 'edGoalLimit';
2321 OnlyDigits := True;
2322 Width := 4;
2323 MaxLength := 5;
2324 if gcGoalLimit > 0 then
2325 Text := IntToStr(gcGoalLimit);
2326 end;
2327 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
2328 begin
2329 Name := 'edMaxLives';
2330 OnlyDigits := True;
2331 Width := 4;
2332 MaxLength := 5;
2333 if gcMaxLives > 0 then
2334 Text := IntToStr(gcMaxLives);
2335 end;
2336 with AddSwitch(_lc[I_MENU_PLAYERS]) do
2337 begin
2338 Name := 'swPlayers';
2339 AddItem(_lc[I_MENU_COUNT_NONE]);
2340 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2341 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2342 ItemIndex := gcPlayers;
2343 end;
2344 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
2345 begin
2346 Name := 'swTeamDamage';
2347 AddItem(_lc[I_MENU_YES]);
2348 AddItem(_lc[I_MENU_NO]);
2349 if gcTeamDamage then
2350 ItemIndex := 0
2351 else
2352 ItemIndex := 1;
2353 end;
2354 with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
2355 begin
2356 Name := 'swEnableExits';
2357 AddItem(_lc[I_MENU_YES]);
2358 AddItem(_lc[I_MENU_NO]);
2359 if gcAllowExit then
2360 ItemIndex := 0
2361 else
2362 ItemIndex := 1;
2363 end;
2364 with AddSwitch(_lc[I_MENU_WEAPONS_STAY]) do
2365 begin
2366 Name := 'swWeaponStay';
2367 AddItem(_lc[I_MENU_YES]);
2368 AddItem(_lc[I_MENU_NO]);
2369 if gcWeaponStay then
2370 ItemIndex := 0
2371 else
2372 ItemIndex := 1;
2373 end;
2374 with AddSwitch(_lc[I_MENU_ENABLE_MONSTERS]) do
2375 begin
2376 Name := 'swMonsters';
2377 AddItem(_lc[I_MENU_YES]);
2378 AddItem(_lc[I_MENU_NO]);
2379 if gcMonsters then
2380 ItemIndex := 0
2381 else
2382 ItemIndex := 1;
2383 end;
2384 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
2385 begin
2386 Name := 'swBotsVS';
2387 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
2388 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
2389 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
2390 ItemIndex := 2;
2391 if gcBotsVS = 'Players' then
2392 ItemIndex := 0;
2393 if gcBotsVS = 'Monsters' then
2394 ItemIndex := 1;
2395 end;
2396 AddSpace();
2397 AddButton(@ProcStartCustomGame, _lc[I_MENU_START_GAME]);
2399 ReAlign();
2400 end;
2401 Menu.DefControl := 'mCustomGameMenu';
2402 g_GUI_AddWindow(Menu);
2404 Menu := TGUIWindow.Create('CampaignMenu');
2405 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CAMPAIGN]))) do
2406 begin
2407 Name := 'mCampaignMenu';
2409 AddSpace();
2410 AddSpace();
2411 AddSpace();
2412 AddSpace();
2413 AddSpace();
2414 AddSpace();
2416 with AddFileList('', 15, 4) do
2417 begin
2418 Name := 'lsWAD';
2419 OnChange := ProcSelectCampaignWAD;
2421 Sort := True;
2422 Dirs := True;
2423 FileMask := '*.wad|*.pk3|*.zip|*.dfz';
2424 SetBase(MapsDir+'megawads/');
2425 end;
2427 with AddLabel(_lc[I_MENU_MAP_NAME]) do
2428 begin
2429 Name := 'lbWADName';
2430 FixedLength := 8;
2431 Enabled := False;
2432 end;
2433 with AddLabel(_lc[I_MENU_MAP_AUTHOR]) do
2434 begin
2435 Name := 'lbWADAuthor';
2436 FixedLength := 8;
2437 Enabled := False;
2438 end;
2439 AddLine(_lc[I_MENU_MAP_DESCRIPTION]);
2440 with AddMemo('', 15, 3) do
2441 begin
2442 Name := 'meWADDescription';
2443 Color := MENU_ITEMSCTRL_COLOR;
2444 end;
2445 with AddSwitch(_lc[I_MENU_PLAYERS]) do
2446 begin
2447 Name := 'swPlayers';
2448 AddItem(_lc[I_MENU_PLAYERS_ONE]);
2449 AddItem(_lc[I_MENU_PLAYERS_TWO]);
2450 end;
2451 AddSpace();
2452 AddButton(@ProcStartCampaign, _lc[I_MENU_START_GAME]);
2454 ReAlign();
2456 with TGUIImage(Menu.AddChild(TGUIImage.Create)) do
2457 begin
2458 Name := 'mpWADImage';
2459 DefaultRes := 'NOPIC';
2460 X := GetControl('lsWAD').X+4;
2461 Y := GetControl('lsWAD').Y-128-MENU_VSPACE;
2462 end;
2463 end;
2464 Menu.DefControl := 'mCampaignMenu';
2465 g_GUI_AddWindow(Menu);
2467 Menu := TGUIWindow.Create('SelectMapMenu');
2468 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SELECT_MAP]))) do
2469 begin
2470 Name := 'mSelectMapMenu';
2471 with AddFileList(_lc[I_MENU_MAP_WAD], 12, 4) do
2472 begin
2473 Name := 'lsMapWAD';
2474 OnChange := ProcSelectWAD;
2476 Sort := True;
2477 Dirs := True;
2478 FileMask := '*.wad|*.pk3|*.zip|*.dfz';
2479 SetBase(MapsDir);
2480 end;
2481 with AddList(_lc[I_MENU_MAP_RESOURCE], 12, 4) do
2482 begin
2483 Name := 'lsMapRes';
2484 Sort := True;
2485 OnChange := ProcSelectMap;
2486 end;
2487 AddSpace();
2488 with AddLabel(_lc[I_MENU_MAP_NAME]) do
2489 begin
2490 Name := 'lbMapName';
2491 FixedLength := 24;
2492 Enabled := False;
2493 end;
2494 with AddLabel(_lc[I_MENU_MAP_AUTHOR]) do
2495 begin
2496 Name := 'lbMapAuthor';
2497 FixedLength := 16;
2498 Enabled := False;
2499 end;
2500 with AddLabel(_lc[I_MENU_MAP_SIZE]) do
2501 begin
2502 Name := 'lbMapSize';
2503 FixedLength := 10;
2504 Enabled := False;
2505 end;
2506 with AddMemo(_lc[I_MENU_MAP_DESCRIPTION], 12, 4) do
2507 begin
2508 Name := 'meMapDescription';
2509 end;
2511 ReAlign();
2513 with TGUIMapPreview(Menu.AddChild(TGUIMapPreview.Create)) do
2514 begin
2515 Name := 'mpMapPreview';
2516 X := GetControl('lsMapWAD').X+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2517 Y := GetControl('lsMapWAD').Y;
2518 end;
2519 with TGUILabel(Menu.AddChild(TGUILabel.Create('', gMenuSmallFont))) do
2520 begin
2521 Name := 'lbMapScale';
2522 FixedLength := 8;
2523 Enabled := False;
2524 Color := MENU_ITEMSCTRL_COLOR;
2525 X := GetControl('lsMapWAD').X +
2526 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2527 2 + MAPPREVIEW_WIDTH*4;
2528 Y := GetControl('lsMapWAD').Y + MAPPREVIEW_HEIGHT*16 + 16;
2529 end;
2530 end;
2531 Menu.OnClose := ProcSetMap;
2532 Menu.DefControl := 'mSelectMapMenu';
2533 g_GUI_AddWindow(Menu);
2535 Menu := TGUIWindow.Create('OptionsMenu');
2536 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_OPTIONS]))) do
2537 begin
2538 Name := 'mmOptionsMenu';
2539 AddButton(nil, _lc[I_MENU_VIDEO_OPTIONS], 'OptionsVideoMenu');
2540 AddButton(nil, _lc[I_MENU_SOUND_OPTIONS], 'OptionsSoundMenu');
2541 AddButton(nil, _lc[I_MENU_GAME_OPTIONS], 'OptionsGameMenu');
2542 AddButton(nil, _lc[I_MENU_CONTROLS_OPTIONS], 'OptionsControlsMenu');
2543 AddButton(nil, _lc[I_MENU_PLAYER_OPTIONS], 'OptionsPlayersMenu');
2544 AddButton(nil, _lc[I_MENU_LANGUAGE_OPTIONS], 'OptionsLanguageMenu');
2545 AddSpace();
2546 AddButton(nil, _lc[I_MENU_SAVED_OPTIONS], 'SavedOptionsMenu').Color := _RGB(255, 0, 0);
2547 AddButton(nil, _lc[I_MENU_DEFAULT_OPTIONS], 'DefaultOptionsMenu').Color := _RGB(255, 0, 0);
2548 end;
2549 Menu.OnClose := ProcApplyOptions;
2550 Menu.DefControl := 'mmOptionsMenu';
2551 g_GUI_AddWindow(Menu);
2553 Menu := CreateYNMenu('SavedOptionsMenu', _lc[I_MENU_LOAD_SAVED_PROMT], Round(gScreenWidth*0.6),
2554 gMenuSmallFont, @ProcSavedMenuKeyDown);
2555 g_GUI_AddWindow(Menu);
2557 Menu := TGUIWindow.Create('OptionsVideoMenu');
2558 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_VIDEO_OPTIONS]))) do
2559 begin
2560 Name := 'mOptionsVideoMenu';
2561 AddButton(@ProcVideoOptionsRes, _lc[I_MENU_VIDEO_RESOLUTION], 'OptionsVideoResMenu');
2562 with AddSwitch(_lc[I_MENU_VIDEO_BPP]) do
2563 begin
2564 Name := 'swBPP';
2565 AddItem('16');
2566 AddItem('32');
2567 end;
2568 with AddSwitch(_lc[I_MENU_VIDEO_VSYNC]) do
2569 begin
2570 Name := 'swVSync';
2571 AddItem(_lc[I_MENU_YES]);
2572 AddItem(_lc[I_MENU_NO]);
2573 end;
2574 with AddSwitch(_lc[I_MENU_VIDEO_FILTER_SKY]) do
2575 begin
2576 Name := 'swTextureFilter';
2577 AddItem(_lc[I_MENU_YES]);
2578 AddItem(_lc[I_MENU_NO]);
2579 end;
2580 with AddSwitch(_lc[I_MENU_VIDEO_LEGACY_COMPATIBLE]) do
2581 begin
2582 Name := 'swLegacyNPOT';
2583 AddItem(_lc[I_MENU_NO]);
2584 AddItem(_lc[I_MENU_YES]);
2585 end;
2586 AddSpace();
2587 AddText(_lc[I_MENU_VIDEO_NEED_RESTART], Round(gScreenWidth*0.6));
2588 ReAlign();
2589 end;
2590 Menu.DefControl := 'mOptionsVideoMenu';
2591 g_GUI_AddWindow(Menu);
2593 Menu := TGUIWindow.Create('OptionsVideoResMenu');
2594 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_RESOLUTION_SELECT]))) do
2595 begin
2596 Name := 'mOptionsVideoResMenu';
2597 with AddLabel(_lc[I_MENU_RESOLUTION_CURRENT]) do
2598 begin
2599 Name := 'lbCurrentRes';
2600 FixedLength := 24;
2601 Enabled := False;
2602 end;
2603 with AddList(_lc[I_MENU_RESOLUTION_LIST], 12, 6) do
2604 begin
2605 Name := 'lsResolution';
2606 Sort := False;
2607 end;
2608 with AddSwitch(_lc[I_MENU_RESOLUTION_FULLSCREEN]) do
2609 begin
2610 Name := 'swFullScreen';
2611 AddItem(_lc[I_MENU_YES]);
2612 AddItem(_lc[I_MENU_NO]);
2613 end;
2614 AddSpace();
2615 AddButton(@ProcApplyVideoOptions, _lc[I_MENU_RESOLUTION_APPLY]);
2616 UpdateIndex();
2617 end;
2618 Menu.DefControl := 'mOptionsVideoResMenu';
2619 g_GUI_AddWindow(Menu);
2621 Menu := TGUIWindow.Create('OptionsSoundMenu');
2622 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SOUND_OPTIONS]))) do
2623 begin
2624 Name := 'mOptionsSoundMenu';
2625 with AddScroll(_lc[I_MENU_SOUND_MUSIC_LEVEL]) do
2626 begin
2627 Name := 'scMusicLevel';
2628 Max := 16;
2629 OnChange := ProcChangeSoundSettings;
2630 end;
2631 with AddScroll(_lc[I_MENU_SOUND_SOUND_LEVEL]) do
2632 begin
2633 Name := 'scSoundLevel';
2634 Max := 16;
2635 OnChange := ProcChangeSoundSettings;
2636 end;
2637 with AddScroll(_lc[I_MENU_SOUND_MAX_SIM_SOUNDS]) do
2638 begin
2639 Name := 'scMaxSimSounds';
2640 Max := 16;
2641 end;
2642 with AddSwitch (_lc[I_MENU_SOUND_ANNOUNCE]) do
2643 begin;
2644 Name := 'swAnnouncer';
2645 AddItem(_lc[I_MENU_ANNOUNCE_NONE]);
2646 AddItem(_lc[I_MENU_ANNOUNCE_ME]);
2647 AddItem(_lc[I_MENU_ANNOUNCE_MEPLUS]);
2648 AddItem(_lc[I_MENU_ANNOUNCE_ALL]);
2649 end;
2650 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2651 with AddSwitch (_lc[I_MENU_SOUND_COMPAT]) do
2652 begin;
2653 Name := 'swSoundEffects';
2654 AddItem(_lc[I_MENU_COMPAT_DOOM2]);
2655 AddItem(_lc[I_MENU_COMPAT_DF]);
2656 end;
2657 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2658 with AddSwitch (_lc[I_MENU_SOUND_CHAT]) do
2659 begin;
2660 Name := 'swChatSpeech';
2661 AddItem(_lc[I_MENU_YES]);
2662 AddItem(_lc[I_MENU_NO]);
2663 end;
2664 with AddSwitch(_lc[I_MENU_SOUND_INACTIVE_SOUNDS]) do
2665 begin
2666 Name := 'swInactiveSounds';
2667 AddItem(_lc[I_MENU_SOUND_INACTIVE_SOUNDS_ON]);
2668 AddItem(_lc[I_MENU_SOUND_INACTIVE_SOUNDS_OFF]);
2669 end;
2670 ReAlign();
2671 end;
2672 Menu.DefControl := 'mOptionsSoundMenu';
2673 g_GUI_AddWindow(Menu);
2675 Menu := TGUIWindow.Create('OptionsGameMenu');
2676 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_GAME_OPTIONS]))) do
2677 begin
2678 Name := 'mOptionsGameMenu';
2679 with AddScroll(_lc[I_MENU_GAME_PARTICLES_COUNT]) do
2680 begin
2681 Name := 'scParticlesCount';
2682 Max := 20;
2683 end;
2684 with AddSwitch(_lc[I_MENU_GAME_BLOOD_COUNT]) do
2685 begin
2686 Name := 'swBloodCount';
2687 AddItem(_lc[I_MENU_COUNT_NONE]);
2688 AddItem(_lc[I_MENU_COUNT_SMALL]);
2689 AddItem(_lc[I_MENU_COUNT_NORMAL]);
2690 AddItem(_lc[I_MENU_COUNT_BIG]);
2691 AddItem(_lc[I_MENU_COUNT_VERYBIG]);
2692 end;
2693 with AddScroll(_lc[I_MENU_GAME_MAX_SHELLS]) do
2694 begin
2695 Name := 'scShellsMax';
2696 Max := 20;
2697 end;
2698 with AddScroll(_lc[I_MENU_GAME_GIBS_COUNT]) do
2699 begin
2700 Name := 'scGibsMax';
2701 Max := 20;
2702 end;
2703 with AddScroll(_lc[I_MENU_GAME_MAX_CORPSES]) do
2704 begin
2705 Name := 'scCorpsesMax';
2706 Max := 20;
2707 end;
2708 with AddSwitch(_lc[I_MENU_GAME_MAX_GIBS]) do
2709 begin
2710 Name := 'swGibsCount';
2711 AddItem(_lc[I_MENU_COUNT_NONE]);
2712 AddItem(_lc[I_MENU_COUNT_SMALL]);
2713 AddItem(_lc[I_MENU_COUNT_NORMAL]);
2714 AddItem(_lc[I_MENU_COUNT_BIG]);
2715 AddItem(_lc[I_MENU_COUNT_VERYBIG]);
2716 end;
2717 with AddSwitch(_lc[I_MENU_GAME_CORPSE_TYPE]) do
2718 begin
2719 Name := 'swCorpseType';
2720 AddItem(_lc[I_MENU_GAME_CORPSE_TYPE_SIMPLE]);
2721 AddItem(_lc[I_MENU_GAME_CORPSE_TYPE_ADV]);
2722 end;
2723 with AddSwitch(_lc[I_MENU_GAME_GIBS_TYPE]) do
2724 begin
2725 Name := 'swGibsType';
2726 AddItem(_lc[I_MENU_GAME_GIBS_TYPE_SIMPLE]);
2727 AddItem(_lc[I_MENU_GAME_GIBS_TYPE_ADV]);
2728 end;
2729 with AddSwitch(_lc[I_MENU_GAME_BLOOD_TYPE]) do
2730 begin
2731 Name := 'swBloodType';
2732 AddItem(_lc[I_MENU_GAME_BLOOD_TYPE_SIMPLE]);
2733 AddItem(_lc[I_MENU_GAME_BLOOD_TYPE_ADV]);
2734 end;
2735 with AddSwitch(_lc[I_MENU_GAME_SCREEN_FLASH]) do
2736 begin
2737 Name := 'swScreenFlash';
2738 AddItem(_lc[I_MENU_NO]);
2739 AddItem(_lc[I_MENU_COMPAT_DF]);
2740 AddItem(_lc[I_MENU_COMPAT_DOOM2]);
2741 end;
2742 with AddSwitch(_lc[I_MENU_GAME_BACKGROUND]) do
2743 begin
2744 Name := 'swBackground';
2745 AddItem(_lc[I_MENU_YES]);
2746 AddItem(_lc[I_MENU_NO]);
2747 end;
2748 with AddSwitch(_lc[I_MENU_GAME_MESSAGES]) do
2749 begin
2750 Name := 'swMessages';
2751 AddItem(_lc[I_MENU_YES]);
2752 AddItem(_lc[I_MENU_NO]);
2753 end;
2754 with AddSwitch(_lc[I_MENU_GAME_REVERT_PLAYERS]) do
2755 begin
2756 Name := 'swRevertPlayers';
2757 AddItem(_lc[I_MENU_YES]);
2758 AddItem(_lc[I_MENU_NO]);
2759 end;
2760 with AddSwitch(_lc[I_MENU_GAME_CHAT_BUBBLE]) do
2761 begin
2762 Name := 'swChatBubble';
2763 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_NONE]);
2764 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_SIMPLE]);
2765 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_ADV]);
2766 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_COLOR]);
2767 AddItem(_lc[I_MENU_GAME_CHAT_TYPE_TEXTURE]);
2768 end;
2769 with AddSwitch(_lc[I_MENU_GAME_PLAYER_INDICATOR]) do
2770 begin
2771 Name := 'swPlayerIndicator';
2772 AddItem(_lc[I_MENU_YES]);
2773 AddItem(_lc[I_MENU_NO]);
2774 end;
2775 with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do
2776 begin
2777 Name := 'scScaleFactor';
2778 Max := 10;
2779 OnChange := ProcChangeGameSettings;
2780 end;
2781 ReAlign();
2782 end;
2783 Menu.DefControl := 'mOptionsGameMenu';
2784 g_GUI_AddWindow(Menu);
2786 Menu := TGUIWindow.Create('OptionsControlsMenu');
2787 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROLS_OPTIONS]))) do
2788 begin
2789 Name := 'mOptionsControlsMenu';
2790 AddLine(_lc[I_MENU_CONTROL_GLOBAL]);
2791 AddKeyRead(_lc[I_MENU_CONTROL_SCREENSHOT]).Name := _lc[I_MENU_CONTROL_SCREENSHOT];
2792 AddKeyRead(_lc[I_MENU_CONTROL_STAT]).Name := _lc[I_MENU_CONTROL_STAT];
2793 AddKeyRead(_lc[I_MENU_CONTROL_CHAT]).Name := _lc[I_MENU_CONTROL_CHAT];
2794 AddKeyRead(_lc[I_MENU_CONTROL_TEAMCHAT]).Name := _lc[I_MENU_CONTROL_TEAMCHAT];
2795 AddSpace();
2796 AddButton(nil, _lc[I_MENU_PLAYER_1_KBD], 'OptionsControlsP1Menu');
2797 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2798 AddButton(nil, _lc[I_MENU_PLAYER_1_WEAPONS], 'OptionsControlsP1MenuWeapons');
2799 AddButton(nil, _lc[I_MENU_PLAYER_2_KBD], 'OptionsControlsP2Menu');
2800 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2801 AddButton(nil, _lc[I_MENU_PLAYER_2_WEAPONS], 'OptionsControlsP2MenuWeapons');
2802 if e_HasJoysticks then
2803 begin
2804 AddSpace();
2805 AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
2806 end;
2807 if g_touch_enabled then
2808 begin
2809 AddSpace();
2810 AddButton(nil, _lc[I_MENU_CONTROL_TOUCH], 'OptionsControlsTouchMenu');
2811 end;
2812 end;
2813 Menu.DefControl := 'mOptionsControlsMenu';
2814 g_GUI_AddWindow(Menu);
2816 Menu := TGUIWindow.Create('OptionsControlsP1Menu');
2817 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_KBD]))) do
2818 begin
2819 Name := 'mOptionsControlsP1Menu';
2820 AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
2821 AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
2822 AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
2823 AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
2824 AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
2825 AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
2826 AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
2827 AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
2828 AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
2829 AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
2830 end;
2831 Menu.DefControl := 'mOptionsControlsP1Menu';
2832 g_GUI_AddWindow(Menu);
2834 Menu := TGUIWindow.Create('OptionsControlsP1MenuWeapons');
2835 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_WEAPONS]))) do
2836 begin
2837 Name := 'mOptionsControlsP1MenuWeapons';
2838 for i := WP_FIRST to WP_LAST do
2839 AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
2840 _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
2841 end;
2842 Menu.DefControl := 'mOptionsControlsP1MenuWeapons';
2843 g_GUI_AddWindow(Menu);
2845 Menu := TGUIWindow.Create('OptionsControlsP2Menu');
2846 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_KBD]))) do
2847 begin
2848 Name := 'mOptionsControlsP2Menu';
2849 AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
2850 AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
2851 AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
2852 AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
2853 AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
2854 AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
2855 AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
2856 AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
2857 AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
2858 AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
2859 end;
2860 Menu.DefControl := 'mOptionsControlsP2Menu';
2861 g_GUI_AddWindow(Menu);
2863 Menu := TGUIWindow.Create('OptionsControlsP2MenuWeapons');
2864 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_WEAPONS]))) do
2865 begin
2866 Name := 'mOptionsControlsP2MenuWeapons';
2867 for i := WP_FIRST to WP_LAST do
2868 AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
2869 _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
2870 end;
2871 Menu.DefControl := 'mOptionsControlsP2MenuWeapons';
2872 g_GUI_AddWindow(Menu);
2874 Menu := TGUIWindow.Create('OptionsControlsJoystickMenu');
2875 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do
2876 begin
2877 Name := 'mOptionsControlsJoystickMenu';
2878 for i := 0 to e_MaxJoys - 1 do
2879 if e_JoystickAvailable[i] then
2880 with AddScroll(Format(_lc[I_MENU_CONTROL_DEADZONE], [i + 1])) do
2881 begin
2882 Name := 'scDeadzone' + IntToStr(i);
2883 Max := 20
2884 end
2885 end;
2886 Menu.DefControl := 'mOptionsControlsJoystickMenu';
2887 g_GUI_AddWindow(Menu);
2889 Menu := TGUIWindow.Create('OptionsControlsTouchMenu');
2890 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_TOUCH]))) do
2891 begin
2892 Name := 'mOptionsControlsTouchMenu';
2893 with AddSwitch(_lc[I_MENU_CONTROL_TOUCH_ALT]) do
2894 begin
2895 Name := 'swTouchAlt';
2896 AddItem(_lc[I_MENU_NO]);
2897 AddItem(_lc[I_MENU_YES]);
2898 OnChange := ProcChangeTouchSettings;
2899 end;
2900 with AddScroll(_lc[I_MENU_CONTROL_TOUCH_SIZE]) do
2901 begin
2902 Name := 'scTouchSize';
2903 Max := 20;
2904 OnChange := ProcChangeTouchSettings;
2905 end;
2906 with AddSwitch(_lc[I_MENU_CONTROL_TOUCH_FIRE]) do
2907 begin
2908 Name := 'swTouchFire';
2909 AddItem(_lc[I_MENU_NO]);
2910 AddItem(_lc[I_MENU_YES]);
2911 end;
2912 with AddScroll(_lc[I_MENU_CONTROL_TOUCH_OFFSET]) do
2913 begin
2914 Name := 'scTouchOffset';
2915 Max := 20;
2916 OnChange := ProcChangeTouchSettings;
2917 end;
2918 end;
2919 Menu.DefControl := 'mOptionsControlsTouchMenu';
2920 g_GUI_AddWindow(Menu);
2922 Menu := TGUIWindow.Create('OptionsPlayersMenu');
2923 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_OPTIONS]))) do
2924 begin
2925 Name := 'mOptionsPlayersMenu';
2926 AddButton(nil, _lc[I_MENU_PLAYER_1], 'OptionsPlayersP1Menu');
2927 AddButton(nil, _lc[I_MENU_PLAYER_2], 'OptionsPlayersP2Menu');
2928 end;
2929 Menu.DefControl := 'mOptionsPlayersMenu';
2930 g_GUI_AddWindow(Menu);
2932 CreatePlayerOptionsMenu('P1');
2933 CreatePlayerOptionsMenu('P2');
2935 Menu := TGUIWindow.Create('OptionsPlayersMIMenu');
2936 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_MODEL_INFO]))) do
2937 begin
2938 Name := 'mOptionsPlayersMIMenu';
2939 with AddLabel(_lc[I_MENU_MODEL_NAME]) do
2940 begin
2941 Name := 'lbName';
2942 FixedLength := 16;
2943 end;
2944 with AddLabel(_lc[I_MENU_MODEL_AUTHOR]) do
2945 begin
2946 Name := 'lbAuthor';
2947 FixedLength := 16;
2948 end;
2949 with AddMemo(_lc[I_MENU_MODEL_COMMENT], 14, 6) do
2950 begin
2951 Name := 'meComment';
2952 end;
2953 AddSpace();
2954 AddLine(_lc[I_MENU_MODEL_OPTIONS]);
2955 with AddLabel(_lc[I_MENU_MODEL_WEAPON]) do
2956 begin
2957 Name := 'lbWeapon';
2958 FixedLength := Max(Length(_lc[I_MENU_YES]), Length(_lc[I_MENU_NO]));
2959 end;
2960 ReAlign();
2961 end;
2962 Menu.DefControl := 'mOptionsPlayersMIMenu';
2963 g_GUI_AddWindow(Menu);
2965 Menu := TGUIWindow.Create('OptionsLanguageMenu');
2966 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_LANGUAGE_OPTIONS]))) do
2967 begin
2968 Name := 'mOptionsLanguageMenu';
2969 AddButton(@ProcSetRussianLanguage, _lc[I_MENU_LANGUAGE_RUSSIAN]);
2970 AddButton(@ProcSetEnglishLanguage, _lc[I_MENU_LANGUAGE_ENGLISH]);
2971 ReAlign();
2972 end;
2973 Menu.DefControl := 'mOptionsLanguageMenu';
2974 g_GUI_AddWindow(Menu);
2976 Menu := CreateYNMenu('DefaultOptionsMenu', _lc[I_MENU_SET_DEFAULT_PROMT], Round(gScreenWidth*0.6),
2977 gMenuSmallFont, @ProcDefaultMenuKeyDown);
2978 g_GUI_AddWindow(Menu);
2980 Menu := TGUIWindow.Create('AuthorsMenu');
2981 Menu.BackTexture := 'INTER';
2982 Menu.OnClose := ProcAuthorsClose;
2984 // Çàãîëîâîê:
2985 _y := 16;
2986 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CAP_1], gMenuFont))) do
2987 begin
2988 Color := _RGB(255, 0, 0);
2989 X := (gScreenWidth div 2)-(GetWidth() div 2);
2990 Y := _y;
2991 _y := _y+GetHeight();
2992 end;
2993 with TGUILabel(Menu.AddChild(TGUILabel.Create(Format(_lc[I_CREDITS_CAP_2], [GAME_VERSION, NET_PROTOCOL_VER]), gMenuSmallFont))) do
2994 begin
2995 Color := _RGB(255, 0, 0);
2996 X := (gScreenWidth div 2)-(GetWidth() div 2);
2997 Y := _y;
2998 _y := _y+GetHeight()+32;
2999 end;
3000 // ×òî äåëàë: Êòî äåëàë
3001 cx := gScreenWidth div 2 - 320 + 64;
3002 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_1], gMenuSmallFont))) do
3003 begin
3004 Color := _RGB(255, 0, 0);
3005 X := cx;
3006 Y := _y;
3007 _y := _y+22;
3008 end;
3009 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_1_1], gMenuSmallFont))) do
3010 begin
3011 Color := _RGB(255, 255, 255);
3012 X := cx+32;
3013 Y := _y;
3014 _y := _y+36;
3015 end;
3016 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2], gMenuSmallFont))) do
3017 begin
3018 Color := _RGB(255, 0, 0);
3019 X := cx;
3020 Y := _y;
3021 _y := _y+22;
3022 end;
3023 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_1], gMenuSmallFont))) do
3024 begin
3025 Color := _RGB(255, 255, 255);
3026 X := cx+32;
3027 Y := _y;
3028 _y := _y+22;
3029 end;
3030 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_2], gMenuSmallFont))) do
3031 begin
3032 Color := _RGB(255, 255, 255);
3033 X := cx+32;
3034 Y := _y;
3035 _y := _y+36;
3036 end;
3037 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_3], gMenuSmallFont))) do
3038 begin
3039 Color := _RGB(255, 0, 0);
3040 X := cx;
3041 Y := _y;
3042 _y := _y+22;
3043 end;
3044 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_3_1], gMenuSmallFont))) do
3045 begin
3046 Color := _RGB(255, 255, 255);
3047 X := cx+32;
3048 Y := _y;
3049 _y := _y+36;
3050 end;
3051 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_4], gMenuSmallFont))) do
3052 begin
3053 Color := _RGB(255, 0, 0);
3054 X := cx;
3055 Y := _y;
3056 _y := _y+22;
3057 end;
3058 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_4_1], gMenuSmallFont))) do
3059 begin
3060 Color := _RGB(255, 255, 255);
3061 X := cx+32;
3062 Y := _y;
3063 _y := gScreenHeight - 128;
3064 end;
3065 // Çàêëþ÷åíèå:
3066 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CAP_3], gMenuSmallFont))) do
3067 begin
3068 Color := _RGB(255, 0, 0);
3069 X := cx;
3070 Y := _y;
3071 _y := _y+16;
3072 end;
3073 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_1], gMenuSmallFont))) do
3074 begin
3075 Color := _RGB(255, 255, 255);
3076 X := cx+32;
3077 Y := _y;
3078 _y := _y+GetHeight();
3079 end;
3080 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_2], gMenuSmallFont))) do
3081 begin
3082 Color := _RGB(255, 255, 255);
3083 X := cx+32;
3084 Y := _y;
3085 _y := _y+GetHeight();
3086 end;
3087 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_3], gMenuSmallFont))) do
3088 begin
3089 Color := _RGB(255, 255, 255);
3090 X := cx+32;
3091 Y := _y;
3092 _y := gScreenHeight - 32;
3093 end;
3094 with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_CLO_4], gMenuSmallFont))) do
3095 begin
3096 Color := _RGB(255, 0, 0);
3097 X := gScreenWidth div 2 - GetWidth() div 2;
3098 Y := _y;
3099 end;
3100 g_GUI_AddWindow(Menu);
3102 Menu := CreateYNMenu('ExitMenu', _lc[I_MENU_EXIT_PROMT], Round(gScreenWidth*0.6),
3103 gMenuSmallFont, @ProcExitMenuKeyDown);
3104 g_GUI_AddWindow(Menu);
3106 Menu := TGUIWindow.Create('GameSingleMenu');
3107 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MAIN_MENU]))) do
3108 begin
3109 Name := 'mmGameSingleMenu';
3110 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
3111 AddButton(nil, _lc[I_MENU_SAVE_GAME], 'SaveMenu').Name := 'save';
3112 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3113 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3114 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3115 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3116 end;
3117 Menu.DefControl := 'mmGameSingleMenu';
3118 Menu.MainWindow := True;
3119 Menu.OnClose := ProcGMClose;
3120 Menu.OnShow := ProcGMShow;
3121 g_GUI_AddWindow(Menu);
3123 Menu := CreateYNMenu('EndGameMenu', _lc[I_MENU_END_GAME_PROMT], Round(gScreenWidth*0.6),
3124 gMenuSmallFont, @ProcEndMenuKeyDown);
3125 g_GUI_AddWindow(Menu);
3127 Menu := CreateYNMenu('RestartGameMenu', _lc[I_MENU_RESTART_GAME_PROMT], Round(gScreenWidth*0.6),
3128 gMenuSmallFont, @ProcRestartMenuKeyDown);
3129 g_GUI_AddWindow(Menu);
3131 Menu := TGUIWindow.Create('GameCustomMenu');
3132 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MAIN_MENU]))) do
3133 begin
3134 Name := 'mmGameCustomMenu';
3135 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3136 AddButton(nil, _lc[I_MENU_LOAD_GAME], 'LoadMenu');
3137 AddButton(nil, _lc[I_MENU_SAVE_GAME], 'SaveMenu').Name := 'save';
3138 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3139 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3140 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3141 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3142 end;
3143 Menu.DefControl := 'mmGameCustomMenu';
3144 Menu.MainWindow := True;
3145 Menu.OnClose := ProcGMClose;
3146 Menu.OnShow := ProcGMShow;
3147 g_GUI_AddWindow(Menu);
3149 Menu := TGUIWindow.Create('GameServerMenu');
3150 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MAIN_MENU]))) do
3151 begin
3152 Name := 'mmGameServerMenu';
3153 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3154 AddButton(@ReadGameSettings, _lc[I_MENU_SET_GAME], 'GameSetGameMenu');
3155 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3156 AddButton(nil, _lc[I_MENU_RESTART], 'RestartGameMenu');
3157 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3158 end;
3159 Menu.DefControl := 'mmGameServerMenu';
3160 Menu.MainWindow := True;
3161 Menu.OnClose := ProcGMClose;
3162 Menu.OnShow := ProcGMShow;
3163 g_GUI_AddWindow(Menu);
3165 Menu := TGUIWindow.Create('GameClientMenu');
3166 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_MAIN_MENU]))) do
3167 begin
3168 Name := 'mmGameClientMenu';
3169 AddButton(nil, _lc[I_MENU_CHANGE_PLAYERS], 'TeamMenu');
3170 AddButton(@ReadOptions, _lc[I_MENU_OPTIONS], 'OptionsMenu');
3171 AddButton(nil, _lc[I_MENU_END_GAME], 'EndGameMenu');
3172 end;
3173 Menu.DefControl := 'mmGameClientMenu';
3174 Menu.MainWindow := True;
3175 Menu.OnClose := ProcGMClose;
3176 Menu.OnShow := ProcGMShow;
3177 g_GUI_AddWindow(Menu);
3179 Menu := TGUIWindow.Create('ClientPasswordMenu');
3180 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuSmallFont, gMenuSmallFont, _lc[I_MENU_ENTERPASSWORD]))) do
3181 begin
3182 Name := 'mClientPasswordMenu';
3183 with AddEdit(_lc[I_NET_SERVER_PASSWORD]) do
3184 begin
3185 Name := 'edPW';
3186 Width := 12;
3187 MaxLength := 32;
3188 end;
3189 AddSpace;
3191 AddButton(@ProcEnterPassword, _lc[I_MENU_START_GAME]);
3192 ReAlign();
3193 end;
3194 Menu.DefControl := 'mClientPasswordMenu';
3195 g_GUI_AddWindow(Menu);
3197 Menu := TGUIWindow.Create('GameSetGameMenu');
3198 with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_SET_GAME]))) do
3199 begin
3200 Name := 'mGameSetGameMenu';
3201 with AddSwitch(_lc[I_MENU_TEAM_DAMAGE]) do
3202 begin
3203 Name := 'swTeamDamage';
3204 AddItem(_lc[I_MENU_YES]);
3205 AddItem(_lc[I_MENU_NO]);
3206 ItemIndex := 1;
3207 end;
3208 with AddEdit(_lc[I_MENU_TIME_LIMIT]) do
3209 begin
3210 Name := 'edTimeLimit';
3211 OnlyDigits := True;
3212 Width := 4;
3213 MaxLength := 5;
3214 end;
3215 with AddEdit(_lc[I_MENU_GOAL_LIMIT]) do
3216 begin
3217 Name := 'edGoalLimit';
3218 OnlyDigits := True;
3219 Width := 4;
3220 MaxLength := 5;
3221 end;
3222 with AddEdit(_lc[I_MENU_MAX_LIVES]) do
3223 begin
3224 Name := 'edMaxLives';
3225 OnlyDigits := True;
3226 Width := 4;
3227 MaxLength := 5;
3228 end;
3229 with AddSwitch(_lc[I_MENU_BOTS_VS]) do
3230 begin
3231 Name := 'swBotsVS';
3232 AddItem(_lc[I_MENU_BOTS_VS_PLAYERS]);
3233 AddItem(_lc[I_MENU_BOTS_VS_MONSTERS]);
3234 AddItem(_lc[I_MENU_BOTS_VS_ALL]);
3235 ItemIndex := 2;
3236 end;
3238 ReAlign();
3239 end;
3240 Menu.DefControl := 'mGameSetGameMenu';
3241 Menu.OnClose := ProcApplyGameSet;
3242 g_GUI_AddWindow(Menu);
3244 Menu := TGUIWindow.Create('TeamMenu');
3245 with TGUIMainMenu(Menu.AddChild(TGUIMainMenu.Create(gMenuFont, _lc[I_MENU_CHANGE_PLAYERS]))) do
3246 begin
3247 Name := 'mmTeamMenu';
3248 AddButton(@ProcJoinRed, _lc[I_MENU_JOIN_RED], '').Name := 'tmJoinRed';
3249 AddButton(@ProcJoinBlue, _lc[I_MENU_JOIN_BLUE], '').Name := 'tmJoinBlue';
3250 AddButton(@ProcJoinGame, _lc[I_MENU_JOIN_GAME], '').Name := 'tmJoinGame';
3251 AddButton(@ProcSwitchP2, _lc[I_MENU_ADD_PLAYER_2], '').Name := 'tmPlayer2';
3252 AddButton(@ProcSpectate, _lc[I_MENU_SPECTATE], '').Name := 'tmSpectate';
3253 end;
3254 Menu.DefControl := 'mmTeamMenu';
3255 Menu.OnShow := ProcChangePlayers;
3256 g_GUI_AddWindow(Menu);
3257 end;
3259 procedure g_Menu_Show_SaveMenu();
3260 begin
3261 if g_Game_IsTestMap then
3262 Exit;
3263 if gGameSettings.GameType = GT_SINGLE then
3264 g_GUI_ShowWindow('GameSingleMenu')
3265 else
3266 begin
3267 if g_Game_IsClient then
3268 Exit
3269 else
3270 if g_Game_IsNet then
3271 Exit
3272 else
3273 g_GUI_ShowWindow('GameCustomMenu');
3274 end;
3275 g_GUI_ShowWindow('SaveMenu');
3276 g_Sound_PlayEx('MENU_OPEN');
3277 end;
3279 procedure g_Menu_Show_LoadMenu (standalone: Boolean=false);
3280 begin
3281 if (g_ActiveWindow <> nil) and (g_ActiveWindow.name = 'LoadMenu') then exit; // nothing to do
3282 if gGameSettings.GameType = GT_SINGLE then
3283 begin
3284 if not standalone then g_GUI_ShowWindow('GameSingleMenu')
3285 end
3286 else
3287 begin
3288 if g_Game_IsClient then exit;
3289 if g_Game_IsNet then exit;
3290 if not standalone then g_GUI_ShowWindow('GameCustomMenu');
3291 end;
3292 g_GUI_ShowWindow('LoadMenu');
3293 g_Sound_PlayEx('MENU_OPEN');
3294 end;
3296 procedure g_Menu_Show_GameSetGame();
3297 begin
3298 if gGameSettings.GameType = GT_SINGLE then
3299 g_GUI_ShowWindow('GameSingleMenu')
3300 else
3301 begin
3302 if g_Game_IsClient then
3303 Exit
3304 else
3305 if g_Game_IsNet then
3306 g_GUI_ShowWindow('GameServerMenu')
3307 else
3308 g_GUI_ShowWindow('GameCustomMenu');
3309 end;
3310 ReadGameSettings();
3311 g_GUI_ShowWindow('GameSetGameMenu');
3312 g_Sound_PlayEx('MENU_OPEN');
3313 end;
3315 procedure g_Menu_Show_OptionsVideo();
3316 begin
3317 if gGameSettings.GameType = GT_SINGLE then
3318 g_GUI_ShowWindow('GameSingleMenu')
3319 else
3320 begin
3321 if g_Game_IsClient then
3322 g_GUI_ShowWindow('GameClientMenu')
3323 else
3324 if g_Game_IsNet then
3325 g_GUI_ShowWindow('GameServerMenu')
3326 else
3327 g_GUI_ShowWindow('GameCustomMenu');
3328 end;
3329 ReadOptions();
3330 g_GUI_ShowWindow('OptionsMenu');
3331 g_GUI_ShowWindow('OptionsVideoMenu');
3332 g_Sound_PlayEx('MENU_OPEN');
3333 end;
3335 procedure g_Menu_Show_OptionsSound();
3336 begin
3337 if gGameSettings.GameType = GT_SINGLE then
3338 g_GUI_ShowWindow('GameSingleMenu')
3339 else
3340 begin
3341 if g_Game_IsClient then
3342 g_GUI_ShowWindow('GameClientMenu')
3343 else
3344 if g_Game_IsNet then
3345 g_GUI_ShowWindow('GameServerMenu')
3346 else
3347 g_GUI_ShowWindow('GameCustomMenu');
3348 end;
3349 ReadOptions();
3350 g_GUI_ShowWindow('OptionsMenu');
3351 g_GUI_ShowWindow('OptionsSoundMenu');
3352 g_Sound_PlayEx('MENU_OPEN');
3353 end;
3355 procedure g_Menu_Show_EndGameMenu();
3356 begin
3357 g_GUI_ShowWindow('EndGameMenu');
3358 g_Sound_PlayEx('MENU_OPEN');
3359 end;
3361 procedure g_Menu_Show_QuitGameMenu();
3362 begin
3363 g_GUI_ShowWindow('ExitMenu');
3364 g_Sound_PlayEx('MENU_OPEN');
3365 end;
3367 procedure g_Menu_Init();
3368 begin
3369 MenuLoadData();
3370 g_GUI_Init();
3371 CreateAllMenus();
3372 end;
3374 procedure g_Menu_Free();
3375 begin
3376 g_GUI_Destroy();
3378 e_WriteLog('Releasing menu data...', TMsgType.Notify);
3380 MenuFreeData();
3381 end;
3383 procedure g_Menu_Reset();
3384 var
3385 ex: Boolean;
3386 begin
3387 g_GUI_SaveMenuPos();
3388 ex := g_GUI_Destroy();
3390 if ex then
3391 begin
3392 e_WriteLog('Recreating menu...', TMsgType.Notify);
3394 CreateAllMenus();
3396 if gDebugMode then
3397 g_Game_SetDebugMode();
3399 g_GUI_LoadMenuPos();
3400 end;
3401 end;
3403 end.