1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
48 {$IFDEF ENABLE_SHELLS}
51 {$IFDEF ENABLE_CORPSES}
54 {$IFDEF ENABLE_RENDER}
57 {$IFDEF ENABLE_SYSTEM}
61 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
62 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
63 MAPDEF
, Math
, g_saveload
,
65 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
69 type TYNCallback
= procedure (yes
:Boolean);
71 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
73 if win
.UserData
= nil then exit
;
75 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
76 IK_N
: TYNCallback(win
.UserData
)(false);
80 procedure YesButtonCB (ctl
: TGUITextButton
);
82 if ctl
.UserData
= nil then exit
;
83 TYNCallback(ctl
.UserData
)(true);
86 procedure NoButtonCB (ctl
: TGUITextButton
);
88 if ctl
.UserData
= nil then exit
;
89 TYNCallback(ctl
.UserData
)(false);
92 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; ActionProc
: TYNCallback
): TGUIWindow
;
96 //if length(Text) = 0 then exit;
97 Result
:= TGUIWindow
.Create(WinName
);
100 //OnKeyDownEx := @YNKeyDownProc;
101 //UserData := @ActionProc;
102 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(False, False, '')));
105 Name
:= '__temp_yes_no_menu:'+WinName
;
107 AddText(Text, MaxLen
);
108 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
109 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
111 DefControl
:= '__temp_yes_no_menu:'+WinName
;
117 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
118 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
120 procedure ProcApplyOptions();
125 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
127 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
132 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
134 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
135 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
136 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
138 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
140 g_Sound_SetupAllVolumes(
141 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
142 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
145 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
146 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
147 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
148 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
149 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
151 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
154 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
156 {$IFDEF ENABLE_SHELLS}
157 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
160 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
162 {$IFDEF ENABLE_CORPSES}
163 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
167 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
172 else gGibsCount
:= 48;
176 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
177 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
178 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
179 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
180 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
181 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
182 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
183 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
184 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
185 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
186 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
187 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
189 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
190 g_dbg_scale
:= TempScale
+ 1;
194 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
198 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
201 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
202 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
203 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
204 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
205 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
208 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
211 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
218 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
219 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
220 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
221 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
234 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
235 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
236 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
237 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
238 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
239 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
240 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
241 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
242 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
243 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
244 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
247 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
249 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
258 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
261 for i
:= WP_FIRST
to WP_LAST
do
263 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
265 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
270 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
273 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
274 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
275 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
276 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
277 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
278 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
279 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
280 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
281 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
282 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
283 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
296 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
297 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
298 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
299 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
300 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
301 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
302 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
303 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
304 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
305 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
306 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
307 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
309 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
310 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
311 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
312 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
313 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
314 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
315 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
316 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
317 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
323 for i
:= WP_FIRST
to WP_LAST
do
325 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
326 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
327 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
328 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
332 if e_HasJoysticks
then
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
337 for i
:= 0 to e_MaxJoys
- 1 do
338 if e_JoystickAvailable
[i
] then
339 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
343 if g_touch_enabled
then
345 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
346 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
347 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
348 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
349 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
352 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
353 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
354 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
355 TEAM_RED
, TEAM_BLUE
);
356 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
358 gPlayer1Settings
.Model
:= Model
.GetName();
359 gPlayer1Settings
.Color
:= Model
.Color
;
362 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
363 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
364 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
365 TEAM_RED
, TEAM_BLUE
);
366 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
368 gPlayer2Settings
.Model
:= Model
.GetName();
369 gPlayer2Settings
.Color
:= Model
.Color
;
372 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
373 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
374 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
375 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
376 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
379 for i
:= WP_FIRST
to WP_LAST
+1 do
381 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
386 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
387 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
388 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
389 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
392 for i
:= WP_FIRST
to WP_LAST
+1 do
394 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
398 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
399 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
401 if g_Game_IsServer
then
403 if gPlayer1
<> nil then
405 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
406 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
407 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
408 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
410 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
412 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
413 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
414 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
415 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
416 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
419 if gPlayer2
<> nil then
421 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
422 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
423 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
424 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
426 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
428 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
429 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
430 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
431 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
432 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
436 if g_Game_IsClient
then
438 MC_SEND_PlayerSettings
;
439 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
442 g_Console_WriteGameConfig
;
445 procedure ReadOptions();
450 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
452 with TGUISwitch(menu
.GetControl('swBPP')) do
458 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
459 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
461 with TGUISwitch(menu
.GetControl('swVSync')) do
462 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
464 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
465 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
467 with TGUISwitch(menu
.GetControl('swInterp')) do
468 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
470 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
472 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
473 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
474 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
476 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
477 if gMuteWhenInactive
then
482 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
484 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
485 if gSoundEffectsDF
then
490 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
491 if gUseChatSounds
then
496 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
516 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
520 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
524 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
527 for i
:= WP_FIRST
to WP_LAST
do
529 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
530 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
534 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
551 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
552 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
553 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
554 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
555 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
556 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
557 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
558 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
559 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
562 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
565 for i
:= WP_FIRST
to WP_LAST
do
567 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
568 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
572 if e_HasJoysticks
then
574 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
577 for i
:= 0 to e_MaxJoys
- 1 do
578 if e_JoystickAvailable
[i
] then
579 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
583 if g_touch_enabled
then
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
586 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
587 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
588 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
589 with TGUISwitch(menu
.GetControl('swTouchFire')) do
590 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
591 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
594 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
597 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
598 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
599 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
600 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
603 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
606 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
608 {$IFDEF ENABLE_SHELLS}
609 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
612 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
614 {$IFDEF ENABLE_CORPSES}
615 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
617 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
619 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
622 with TGUISwitch(menu
.GetControl('swBloodType')) do
623 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
625 with TGUISwitch(menu
.GetControl('swCorpseType')) do
626 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
628 with TGUISwitch(menu
.GetControl('swGibsType')) do
629 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
632 with TGUISwitch(menu
.GetControl('swGibsCount')) do
644 with TGUISwitch(menu
.GetControl('swBackGround')) do
645 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
647 with TGUISwitch(menu
.GetControl('swMessages')) do
648 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
650 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
651 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
653 with TGUISwitch(menu
.GetControl('swChatBubble')) do
654 ItemIndex
:= gChatBubble
;
656 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
657 ItemIndex
:= gPlayerIndicator
;
659 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
660 ItemIndex
:= gPlayerIndicatorStyle
;
662 TempScale
:= Round(g_dbg_scale
- 1);
663 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
665 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
667 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
668 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
670 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
671 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
673 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
674 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
675 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
677 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
678 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
679 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
680 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
681 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
682 for i
:= WP_FIRST
to WP_LAST
+1 do
684 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
685 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
688 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
689 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
690 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
691 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
692 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
693 for i
:= WP_FIRST
to WP_LAST
+1 do
695 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
696 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
699 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
701 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
702 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
704 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
705 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
707 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
708 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
709 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
711 ProcSelectModel(nil);
714 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
716 // don't turn off monsters in DM
718 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
719 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
720 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
725 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
726 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
727 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
728 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
732 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
734 // don't turn off monsters in DM
736 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
737 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
738 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
740 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
743 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
744 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
745 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
746 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
750 function LatchGameOptions(const MenuName
: string): Byte;
756 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
758 Map
:= TGUILabel(GetControl('lbMap')).Text;
761 if not isWadPath(Map
) then
764 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
765 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
766 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
767 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
768 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
769 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
770 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
774 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
775 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
776 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
777 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
778 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
779 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
780 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
781 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
782 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
783 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
785 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
786 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
787 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
788 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
791 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
792 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
793 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
794 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
797 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
798 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
799 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
800 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
803 // TODO: get this crap out of here
804 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
805 gGameSettings
.WarmupTime
:= gsWarmupTime
;
806 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
810 procedure ProcStartCustomGame();
814 GameMode
:= LatchGameOptions('mCustomGameMenu');
815 if GameMode
= GM_NONE
then Exit
;
817 g_Console_WriteGameConfig
;
818 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
819 gsMaxLives
, gsGameFlags
, gsPlayers
);
823 procedure ProcStartNetGame();
827 GameMode
:= LatchGameOptions('mNetServerMenu');
828 if GameMode
= GM_NONE
then Exit
;
830 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
832 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
833 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
834 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
835 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
836 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
837 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
840 g_Console_WriteGameConfig
;
841 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
842 gsGameFlags
, gsPlayers
, 0, NetPort
);
845 procedure ProcConnectNetGame();
849 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
851 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
852 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
853 PW
:= TGUIEdit(GetControl('edPW')).Text;
856 g_Console_WriteGameConfig
;
857 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
860 procedure ProcEnterPassword();
864 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
866 NetClientIP
:= PromptIP
;
867 NetClientPort
:= PromptPort
;
868 PW
:= TGUIEdit(GetControl('edPW')).Text;
871 g_Console_WriteGameConfig
;
872 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
875 procedure ProcServerlist();
877 if not NetInitDone
then
879 if (not g_Net_Init()) then
881 g_Console_Add('NET: ERROR: Failed to init ENet!');
888 g_Net_Slist_Set(NetMasterList
);
890 gState
:= STATE_SLIST
;
891 g_ActiveWindow
:= nil;
893 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
895 {$IFDEF ENABLE_RENDER}
898 {$IFDEF ENABLE_SYSTEM}
902 slReturnPressed
:= True;
903 if g_Net_Slist_Fetch(slCurrent
) then
905 if slCurrent
= nil then
906 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
909 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
910 g_Serverlist_GenerateTable(slCurrent
, slTable
);
913 procedure ProcStartCampaign();
919 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
921 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
922 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
924 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
930 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
933 procedure ProcSelectMap(Sender
: TGUIControl
);
937 wad
, map
, res
: String;
939 win
:= g_GUI_GetWindow('SelectMapMenu');
940 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
942 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
943 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
945 if (wad
= '') or (map
= '') then
946 begin // Ýòî íå êàðòà
947 TGUILabel(GetControl('lbMapName')).Text := '';
948 TGUILabel(GetControl('lbMapAuthor')).Text := '';
949 TGUILabel(GetControl('lbMapSize')).Text := '';
950 TGUIMemo(GetControl('meMapDescription')).SetText('');
951 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
952 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
958 a
:= g_Map_GetMapInfo(res
);
960 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
961 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
962 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
963 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
964 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
965 TGUILabel(win
.GetControl('lbMapScale')).Text :=
966 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
971 procedure ProcSelectWAD(Sender
: TGUIControl
);
976 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
978 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
980 with TGUIListBox(GetControl('lsMapRes')) do
986 list
:= g_Map_GetMapsList(wad
);
1000 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
1006 win
:= g_GUI_GetWindow('CampaignMenu');
1007 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
1009 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
1013 TGUILabel(GetControl('lbWADName')).Text := '';
1014 TGUILabel(GetControl('lbWADAuthor')).Text := '';
1015 TGUIMemo(GetControl('meWADDescription')).SetText('');
1018 a
:= g_Game_GetMegaWADInfo(wad
);
1020 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1021 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1022 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1024 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1028 fn
:= g_ExtractWadName(a
.pic
);
1030 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1032 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1037 procedure ProcChangeColor(Sender
: TGUIControl
);
1041 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1042 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1043 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1044 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1045 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1046 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1048 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1049 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1050 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1051 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1052 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1053 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1056 procedure ProcSelectModel(Sender
: TGUIControl
);
1061 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1062 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1063 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1065 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1066 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1067 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1069 ProcChangeColor(nil);
1072 procedure MenuLoadData();
1074 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1076 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1077 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1078 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1079 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1080 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1081 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1082 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1085 procedure MenuFreeData();
1087 g_Sound_Delete('MENU_SELECT');
1088 g_Sound_Delete('MENU_OPEN');
1089 g_Sound_Delete('MENU_CLOSE');
1090 g_Sound_Delete('MENU_CHANGE');
1091 g_Sound_Delete('SCROLL_ADD');
1092 g_Sound_Delete('SCROLL_SUB');
1093 g_Sound_Delete('SOUND_PLAYER_FALL');
1096 procedure ProcAuthorsMenu();
1098 gMusic
.SetByName('MUSIC_INTERMUS');
1102 procedure ProcExitMenuKeyDown (yes
: Boolean);
1105 snd
: TPlayableSound
;
1110 g_Game_StopAllSounds(True);
1111 case (Random(18)) of
1112 0: s
:= 'SOUND_MONSTER_PAIN';
1113 1: s
:= 'SOUND_MONSTER_DIE_3';
1114 2: s
:= 'SOUND_MONSTER_SLOP';
1115 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1116 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1117 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1118 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1119 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1120 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1121 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1122 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1123 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1124 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1125 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1126 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1127 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1128 else s
:= 'SOUND_PLAYER_FALL';
1130 snd
:= TPlayableSound
.Create();
1131 res
:= snd
.SetByName(s
);
1132 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1136 while snd
.IsPlaying() do begin end;
1144 procedure ProcLoadMenu();
1151 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1152 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1153 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1157 procedure ProcSaveMenu();
1165 name
:= g_GetSaveName(a
, valid
);
1166 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1167 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1171 procedure ProcSaveGame(Sender
: TGUIControl
);
1175 if g_Game_IsNet
then Exit
;
1176 if g_Game_IsTestMap
then Exit
;
1177 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1178 g_Game_PauseAllSounds(True);
1179 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1181 g_ActiveWindow
:= nil;
1182 g_Game_Pause(False);
1185 procedure ProcLoadGame(Sender
: TGUIControl
);
1189 if g_Game_IsNet
then Exit
;
1190 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1191 if g_LoadGame(a
) then
1193 g_Game_PauseAllSounds(False)
1195 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1197 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1198 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1199 //g_ActiveWindow := nil;
1203 procedure ProcSinglePlayer (n
: Integer);
1204 var wad
, map
: AnsiString;
1207 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1208 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1209 if e_FindResource(AllMapDirs
, wad
) then
1211 wad
:= ExpandFileName(wad
);
1212 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1216 procedure ProcSingle1Player
;
1221 procedure ProcSingle2Players
;
1226 procedure ProcSelectMapMenu();
1229 wad_lb
: TGUIFileListBox
;
1230 map_lb
: TGUIListBox
;
1233 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1234 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1235 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1237 if wad_lb
.SelectedItem() <> '' then
1238 map
:= map_lb
.SelectedItem()
1242 wad_lb
.UpdateFileList();
1245 if wad_lb
.SelectedItem() <> '' then
1248 map_lb
.SelectItem(map
);
1250 if map_lb
.SelectedItem() <> '' then
1254 g_GUI_ShowWindow('SelectMapMenu');
1257 procedure ProcSelectCampaignMenu();
1260 wad_lb
: TGUIFileListBox
;
1262 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1263 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1265 wad_lb
.UpdateFileList();
1267 if wad_lb
.SelectedItem() <> '' then
1268 ProcSelectCampaignWAD(nil);
1271 procedure ProcSetMap();
1273 wad
, map
, res
: String;
1275 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1277 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1278 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1281 if (wad
= '') or (map
= '') then
1284 wad
:= e_FindWadRel(MapDirs
, WAD
);
1286 res
:= wad
+':\'+map
;
1288 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1289 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1292 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1296 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1298 g_Sound_SetupAllVolumes(
1299 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1300 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1304 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1308 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1309 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1311 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1312 g_dbg_scale
:= TempScale
+ 1;
1316 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1321 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1322 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1323 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1326 procedure ProcOptionsPlayersMIMenu();
1331 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1333 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1335 if a
= '' then Exit
;
1337 i
:= g_PlayerModel_GetIndex(a
);
1338 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1340 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1341 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1342 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1344 if PlayerModelsArray
[i
].HaveWeapon
then
1345 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1347 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1350 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1353 procedure ProcOptionsPlayerP1WeaponMenu();
1357 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1358 if a
= '' then Exit
;
1359 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1362 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1364 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1367 procedure ProcOptionsPlayerP2WeaponMenu();
1371 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1372 if a
= '' then Exit
;
1373 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1376 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1378 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1381 procedure ProcOptionsPlayersAnim();
1385 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1390 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1393 Model
.AnimState
.Loop
:= True;
1397 procedure ProcOptionsPlayersWeap();
1401 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1406 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1410 procedure ProcOptionsPlayersRot();
1414 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1415 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1417 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1421 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1425 g_Options_SetDefault();
1431 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1433 if yes
then ReadOptions();
1437 procedure ProcAuthorsClose();
1439 gMusic
.SetByName('MUSIC_MENU');
1441 gState
:= STATE_MENU
;
1444 procedure ProcGMClose();
1446 g_Game_InGameMenu(False);
1449 procedure ProcGMShow();
1454 if (gGameSettings
.GameType
= GT_SINGLE
) and
1455 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1456 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1457 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1459 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1460 if g_Game_IsTestMap
then
1461 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1462 TGUIMainMenu(g_ActiveWindow
.GetControl(
1463 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1466 procedure ProcChangePlayers();
1468 TeamGame
, Spectator
, AddTwo
: Boolean;
1469 P1Team
{, P2Team}: Byte;
1470 bP2
: TGUITextButton
;
1472 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1473 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1474 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1475 P1Team
:= TEAM_NONE
;
1476 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1478 //P2Team := TEAM_NONE;
1479 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1481 TGUIMainMenu(g_ActiveWindow
.GetControl(
1482 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1483 TGUIMainMenu(g_ActiveWindow
.GetControl(
1484 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1485 TGUIMainMenu(g_ActiveWindow
.GetControl(
1486 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1488 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1489 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1490 bP2
.Enabled
:= AddTwo
and not Spectator
;
1492 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1494 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1495 if gPlayer2
= nil then
1496 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1498 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1500 TGUIMainMenu(g_ActiveWindow
.GetControl(
1501 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1504 procedure ProcJoinRed();
1506 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1508 if g_Game_IsServer
then
1510 if gPlayer1
= nil then
1511 g_Game_AddPlayer(TEAM_RED
)
1514 if gPlayer1
.Team
<> TEAM_RED
then
1516 gPlayer1
.SwitchTeam
;
1517 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1520 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1525 gPlayer1Settings
.Team
:= TEAM_RED
;
1526 MC_SEND_PlayerSettings
;
1527 if gPlayer1
= nil then
1528 g_Game_AddPlayer(TEAM_RED
);
1530 g_ActiveWindow
:= nil;
1531 g_Game_Pause(False);
1534 procedure ProcJoinBlue();
1536 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1538 if g_Game_IsServer
then
1540 if gPlayer1
= nil then
1541 g_Game_AddPlayer(TEAM_BLUE
)
1544 if gPlayer1
.Team
<> TEAM_BLUE
then
1546 gPlayer1
.SwitchTeam
;
1547 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1550 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1555 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1556 MC_SEND_PlayerSettings
;
1557 if gPlayer1
= nil then
1558 g_Game_AddPlayer(TEAM_BLUE
);
1560 g_ActiveWindow
:= nil;
1561 g_Game_Pause(False);
1564 procedure ProcJoinGame();
1566 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1568 if gPlayer1
= nil then
1570 g_ActiveWindow
:= nil;
1571 g_Game_Pause(False);
1574 procedure ProcSwitchP2();
1576 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1578 if gPlayer1
= nil then
1580 if gPlayer2
= nil then
1583 g_Game_RemovePlayer();
1584 g_ActiveWindow
:= nil;
1585 g_Game_Pause(False);
1588 procedure ProcSpectate();
1590 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1593 g_ActiveWindow
:= nil;
1594 g_Game_Pause(False);
1597 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1599 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1602 procedure ProcEndMenuKeyDown (yes
: Boolean);
1604 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1607 procedure ProcSetRussianLanguage
;
1609 if gLanguage
<> LANGUAGE_RUSSIAN
then
1611 gLanguage
:= LANGUAGE_RUSSIAN
;
1612 gLanguageChange
:= True;
1613 gAskLanguage
:= False;
1618 procedure ProcSetEnglishLanguage
;
1620 if gLanguage
<> LANGUAGE_ENGLISH
then
1622 gLanguage
:= LANGUAGE_ENGLISH
;
1623 gLanguageChange
:= True;
1624 gAskLanguage
:= False;
1629 procedure ReadGameSettings();
1633 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1635 with gGameSettings
do
1637 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1638 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1642 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1643 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1645 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1647 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1651 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1652 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1656 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1657 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1659 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1664 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1665 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1666 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1668 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1669 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1670 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1673 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1678 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1680 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1681 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1682 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1684 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1685 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1689 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1690 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1692 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1693 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1694 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1695 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1696 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1697 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1698 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1699 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1703 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1704 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1705 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1706 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1707 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1712 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1713 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1718 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1719 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1724 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1725 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1726 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1731 procedure ProcApplyGameSet();
1735 stat
: TPlayerStatArray
;
1737 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1739 if not g_Game_IsServer
then Exit
;
1741 with gGameSettings
do
1743 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1745 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1746 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1748 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1751 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1753 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1754 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1755 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1756 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1757 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1761 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1763 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1764 Options
:= Options
or GAME_OPTION_DMKEYS
1766 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1769 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1771 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1777 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1779 TimeLimit
:= Max(n
, b
);
1783 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1785 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1792 if GameMode
= GM_DM
then
1794 stat
:= g_Player_GetStats();
1796 for a
:= 0 to High(stat
) do
1797 if stat
[a
].Frags
> b
then
1801 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1803 ScoreLimit
:= Max(n
, b
);
1807 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1809 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1810 if n
< 0 then n
:= 0;
1811 if n
> 255 then n
:= 255;
1817 stat
:= g_Player_GetStats();
1819 for a
:= 0 to High(stat
) do
1820 if stat
[a
].Lives
> b
then
1823 MaxLives
:= Max(n
, b
);
1827 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1829 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1832 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1833 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1837 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1838 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1842 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1843 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1848 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1850 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1851 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1852 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1853 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1857 // don't forget to latch this shit
1858 gsGameFlags
:= Options
;
1859 gsMaxLives
:= MaxLives
;
1860 gsScoreLimit
:= ScoreLimit
;
1861 gsTimeLimit
:= TimeLimit
;
1864 if g_Game_IsNet
then MH_SEND_GameSettings
;
1867 procedure ProcVideoOptionsRes();
1872 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1874 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1875 IntToStr(gWinSizeX
) +
1876 ' x ' + IntToStr(gWinSizeY
) +
1877 ', ' + IntToStr(gBPP
) + ' bpp';
1879 with TGUIListBox(menu
.GetControl('lsResolution')) do
1881 {$IFDEF ENABLE_SYSTEM}
1882 list
:= sys_GetDisplayModes(gBPP
);
1889 ItemIndex
:= Length(list
)
1897 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1903 TempResScale
:= Round(r_pixel_scale
- 1);
1904 with TGUISwitch(menu
.GetControl('swResFactor')) do
1905 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1908 procedure ProcApplyVideoOptions();
1911 Fullscreen
: Boolean;
1912 SWidth
, SHeight
: Integer;
1913 ScaleChanged
: Boolean;
1916 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1918 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1920 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1923 SWidth
:= gWinSizeX
;
1924 SHeight
:= gWinSizeY
;
1925 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1928 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1930 ScaleChanged
:= False;
1931 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1933 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1934 r_pixel_scale
:= TempResScale
+ 1;
1935 ScaleChanged
:= True;
1938 if (SWidth
<> gWinSizeX
) or
1939 (SHeight
<> gWinSizeY
) or
1940 (Fullscreen
<> gFullscreen
) or
1943 gResolutionChange
:= True;
1944 gRC_Width
:= SWidth
;
1945 gRC_Height
:= SHeight
;
1946 gRC_FullScreen
:= Fullscreen
;
1947 gRC_Maximized
:= gWinMaximized
;
1950 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1954 procedure ProcSetFirstRussianLanguage
;
1956 gLanguage
:= LANGUAGE_RUSSIAN
;
1957 gLanguageChange
:= True;
1958 gAskLanguage
:= False;
1961 procedure ProcSetFirstEnglishLanguage
;
1963 gLanguage
:= LANGUAGE_ENGLISH
;
1964 gLanguageChange
:= True;
1965 gAskLanguage
:= False;
1968 procedure ProcRecallAddress();
1970 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1972 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1973 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1977 procedure CreateFirstLanguageMenu();
1981 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1983 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, ' '))) do // space to prevent show logo
1985 Name
:= 'mmFirstLanguageMenu';
1986 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1987 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1990 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1991 Menu
.MainWindow
:= True;
1992 g_GUI_AddWindow(Menu
);
1995 procedure g_Menu_AskLanguage();
1997 CreateFirstLanguageMenu();
1998 g_GUI_ShowWindow('FirstLanguageMenu');
2001 procedure CreatePlayerOptionsMenu(s
: String);
2006 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2008 a
:= _lc
[I_MENU_PLAYER_1
]
2010 a
:= _lc
[I_MENU_PLAYER_2
];
2011 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, a
))) do
2013 Name
:= 'mOptionsPlayers'+s
+'Menu';
2014 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2016 Name
:= 'ed'+s
+'Name';
2020 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2022 Name
:= 'sw'+s
+'Team';
2023 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2024 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2026 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2028 Name
:= 'ls'+s
+'Model';
2030 Items
:= g_PlayerModel_GetNames();
2031 OnChange
:= ProcSelectModel
;
2033 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2035 Name
:= 'sc'+s
+'Red';
2037 OnChange
:= ProcChangeColor
;
2039 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2041 Name
:= 'sc'+s
+'Green';
2043 OnChange
:= ProcChangeColor
;
2045 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2047 Name
:= 'sc'+s
+'Blue';
2049 OnChange
:= ProcChangeColor
;
2052 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2053 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2054 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2055 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2056 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2057 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2058 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2060 Name
:= 'mv'+s
+'Model';
2061 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2062 Y
:= GetControl('ls'+s
+'Model').Y
;
2065 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2066 g_GUI_AddWindow(Menu
);
2069 procedure CreateAllMenus();
2073 a
, cx
, _y
, i
: Integer;
2076 Menu
:= TGUIWindow
.Create('MainMenu');
2077 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
2079 Name
:= 'mmMainMenu';
2080 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2081 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2082 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2083 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2084 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2085 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2087 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), False))) do
2089 Color
:= _RGB(255, 255, 255);
2090 X
:= gScreenWidth
-GetWidth
-8;
2091 Y
:= gScreenHeight
-GetHeight
-8;
2093 Menu
.DefControl
:= 'mmMainMenu';
2094 Menu
.MainWindow
:= True;
2095 g_GUI_AddWindow(Menu
);
2097 Menu
:= TGUIWindow
.Create('NewGameMenu');
2098 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_NEW_GAME
]))) do
2100 Name
:= 'mmNewGameMenu';
2101 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2102 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2103 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2104 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2106 Menu
.DefControl
:= 'mmNewGameMenu';
2107 g_GUI_AddWindow(Menu
);
2109 Menu
:= TGUIWindow
.Create('NetGameMenu');
2110 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MULTIPLAYER
]))) do
2112 Name
:= 'mmNetGameMenu';
2113 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2114 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2116 Menu
.DefControl
:= 'mmNetGameMenu';
2117 g_GUI_AddWindow(Menu
);
2119 Menu
:= TGUIWindow
.Create('NetServerMenu');
2120 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_SERVER
]))) do
2122 Name
:= 'mNetServerMenu';
2123 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2125 Name
:= 'edSrvName';
2126 OnlyDigits
:= False;
2129 Text := NetServerName
;
2131 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2133 Name
:= 'edSrvPassword';
2134 OnlyDigits
:= False;
2137 Text := NetPassword
;
2139 with AddEdit(_lc
[I_NET_PORT
]) do
2145 Text := IntToStr(NetPort
);
2147 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2149 Name
:= 'edMaxPlayers';
2153 Text := IntToStr(NetMaxClients
);
2155 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2157 Name
:= 'swUseMaster';
2158 AddItem(_lc
[I_MENU_YES
]);
2159 AddItem(_lc
[I_MENU_NO
]);
2160 if NetUseMaster
then
2166 with AddLabel(_lc
[I_MENU_MAP
]) do
2171 OnClick
:= @ProcSelectMapMenu
;
2173 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2175 Name
:= 'swGameMode';
2176 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2177 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2178 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2179 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2180 case g_Game_TextToMode(gsGameMode
) of
2182 GM_DM
: ItemIndex
:= 0;
2183 GM_TDM
: ItemIndex
:= 1;
2184 GM_CTF
: ItemIndex
:= 2;
2186 GM_COOP
: ItemIndex
:= 3;
2188 OnChange
:= ProcSwitchMonstersCustom
;
2190 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2192 Name
:= 'edTimeLimit';
2196 if gsTimeLimit
> 0 then
2197 Text := IntToStr(gsTimeLimit
);
2199 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2201 Name
:= 'edScoreLimit';
2205 if gsScoreLimit
> 0 then
2206 Text := IntToStr(gsScoreLimit
);
2208 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2210 Name
:= 'edMaxLives';
2214 if gsMaxLives
> 0 then
2215 Text := IntToStr(gsMaxLives
);
2217 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2219 Name
:= 'edItemRespawnTime';
2223 if gsItemRespawnTime
> 0 then
2224 Text := IntToStr(gsItemRespawnTime
);
2226 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2228 Name
:= 'swPlayers';
2229 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2230 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2231 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2232 ItemIndex
:= gsPlayers
;
2234 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2236 Name
:= 'swTeamDamage';
2237 AddItem(_lc
[I_MENU_YES
]);
2238 AddItem(_lc
[I_MENU_NO
]);
2239 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2244 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2246 Name
:= 'swTeamHit';
2247 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2248 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2249 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2250 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2251 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2253 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2255 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2260 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2262 Name
:= 'swDeathmatchKeys';
2263 AddItem(_lc
[I_MENU_YES
]);
2264 AddItem(_lc
[I_MENU_NO
]);
2265 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2270 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2272 Name
:= 'swEnableExits';
2273 AddItem(_lc
[I_MENU_YES
]);
2274 AddItem(_lc
[I_MENU_NO
]);
2275 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2280 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2282 Name
:= 'swWeaponStay';
2283 AddItem(_lc
[I_MENU_YES
]);
2284 AddItem(_lc
[I_MENU_NO
]);
2285 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2290 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2292 Name
:= 'swMonsters';
2293 AddItem(_lc
[I_MENU_YES
]);
2294 AddItem(_lc
[I_MENU_NO
]);
2295 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2300 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2303 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2304 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2305 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2307 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2309 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2312 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2314 Name
:= 'swFlagDrop';
2315 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2316 AddItem(_lc
[I_MENU_YES
]);
2317 AddItem(_lc
[I_MENU_NO
]);
2318 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2320 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2326 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2330 Menu
.DefControl
:= 'mNetServerMenu';
2331 g_GUI_AddWindow(Menu
);
2333 Menu
:= TGUIWindow
.Create('NetClientMenu');
2334 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_CLIENT
]))) do
2336 Name
:= 'mNetClientMenu';
2338 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2341 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2347 Text := 'localhost';
2349 with AddEdit(_lc
[I_NET_PORT
]) do
2357 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2360 OnlyDigits
:= False;
2367 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2371 Menu
.DefControl
:= 'mNetClientMenu';
2372 g_GUI_AddWindow(Menu
);
2374 Menu
:= TGUIWindow
.Create('LoadMenu');
2375 Menu
.OnShow
:= ProcLoadMenu
;
2376 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LOAD_GAME
]))) do
2378 Name
:= 'mmLoadMenu';
2383 Name
:= 'edSlot'+IntToStr(a
);
2386 OnEnter
:= ProcLoadGame
;
2389 Menu
.DefControl
:= 'mmLoadMenu';
2390 g_GUI_AddWindow(Menu
);
2392 Menu
:= TGUIWindow
.Create('SaveMenu');
2393 Menu
.OnShow
:= ProcSaveMenu
;
2394 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SAVE_GAME
]))) do
2396 Name
:= 'mmSaveMenu';
2401 Name
:= 'edSlot'+IntToStr(a
);
2404 OnChange
:= ProcSaveGame
;
2407 Menu
.DefControl
:= 'mmSaveMenu';
2408 g_GUI_AddWindow(Menu
);
2410 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2411 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CUSTOM_GAME
]))) do
2413 Name
:= 'mCustomGameMenu';
2414 with AddLabel(_lc
[I_MENU_MAP
]) do
2419 OnClick
:= @ProcSelectMapMenu
;
2421 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2423 Name
:= 'swGameMode';
2424 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2425 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2426 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2427 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2428 case g_Game_TextToMode(gsGameMode
) of
2430 GM_DM
: ItemIndex
:= 0;
2431 GM_TDM
: ItemIndex
:= 1;
2432 GM_CTF
: ItemIndex
:= 2;
2434 GM_COOP
: ItemIndex
:= 3;
2436 OnChange
:= ProcSwitchMonstersCustom
;
2438 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2440 Name
:= 'edTimeLimit';
2444 if gsTimeLimit
> 0 then
2445 Text := IntToStr(gsTimeLimit
);
2447 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2449 Name
:= 'edScoreLimit';
2453 if gsScoreLimit
> 0 then
2454 Text := IntToStr(gsScoreLimit
);
2456 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2458 Name
:= 'edMaxLives';
2462 if gsMaxLives
> 0 then
2463 Text := IntToStr(gsMaxLives
);
2465 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2467 Name
:= 'edItemRespawnTime';
2471 if gsItemRespawnTime
> 0 then
2472 Text := IntToStr(gsItemRespawnTime
);
2474 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2476 Name
:= 'swPlayers';
2477 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2478 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2479 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2480 ItemIndex
:= gsPlayers
;
2482 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2484 Name
:= 'swTeamDamage';
2485 AddItem(_lc
[I_MENU_YES
]);
2486 AddItem(_lc
[I_MENU_NO
]);
2487 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2492 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2494 Name
:= 'swTeamHit';
2495 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2496 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2497 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2498 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2499 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2501 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2503 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2508 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2510 Name
:= 'swDeathmatchKeys';
2511 AddItem(_lc
[I_MENU_YES
]);
2512 AddItem(_lc
[I_MENU_NO
]);
2513 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2518 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2520 Name
:= 'swEnableExits';
2521 AddItem(_lc
[I_MENU_YES
]);
2522 AddItem(_lc
[I_MENU_NO
]);
2523 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2528 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2530 Name
:= 'swWeaponStay';
2531 AddItem(_lc
[I_MENU_YES
]);
2532 AddItem(_lc
[I_MENU_NO
]);
2533 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2538 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2540 Name
:= 'swMonsters';
2541 AddItem(_lc
[I_MENU_YES
]);
2542 AddItem(_lc
[I_MENU_NO
]);
2543 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2548 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2551 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2552 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2553 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2555 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2557 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2560 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2562 Name
:= 'swFlagDrop';
2563 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2564 AddItem(_lc
[I_MENU_YES
]);
2565 AddItem(_lc
[I_MENU_NO
]);
2566 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2568 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2574 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2578 Menu
.DefControl
:= 'mCustomGameMenu';
2579 g_GUI_AddWindow(Menu
);
2581 Menu
:= TGUIWindow
.Create('CampaignMenu');
2582 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CAMPAIGN
]))) do
2584 Name
:= 'mCampaignMenu';
2593 with AddFileList('', 15, 4) do
2596 OnChange
:= ProcSelectCampaignWAD
;
2600 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2601 SetBase(MegawadDirs
);
2604 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2606 Name
:= 'lbWADName';
2610 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2612 Name
:= 'lbWADAuthor';
2616 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2617 with AddMemo('', 15, 3) do
2619 Name
:= 'meWADDescription';
2620 Color
:= MENU_ITEMSCTRL_COLOR
;
2622 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2624 Name
:= 'swPlayers';
2625 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2626 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2629 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2633 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2635 Name
:= 'mpWADImage';
2636 DefaultRes
:= 'NOPIC';
2637 X
:= GetControl('lsWAD').X
+4;
2638 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2641 Menu
.DefControl
:= 'mCampaignMenu';
2642 g_GUI_AddWindow(Menu
);
2644 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2645 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SELECT_MAP
]))) do
2647 Name
:= 'mSelectMapMenu';
2648 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2651 OnChange
:= ProcSelectWAD
;
2655 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2658 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2662 OnChange
:= ProcSelectMap
;
2665 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2667 Name
:= 'lbMapName';
2671 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2673 Name
:= 'lbMapAuthor';
2677 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2679 Name
:= 'lbMapSize';
2683 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2685 Name
:= 'meMapDescription';
2690 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2692 Name
:= 'mpMapPreview';
2693 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2694 Y
:= GetControl('lsMapWAD').Y
;
2696 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', False))) do
2698 Name
:= 'lbMapScale';
2701 Color
:= MENU_ITEMSCTRL_COLOR
;
2702 X
:= GetControl('lsMapWAD').X
+
2703 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2704 2 + MAPPREVIEW_WIDTH
*4;
2705 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2708 Menu
.OnClose
:= ProcSetMap
;
2709 Menu
.DefControl
:= 'mSelectMapMenu';
2710 g_GUI_AddWindow(Menu
);
2712 Menu
:= TGUIWindow
.Create('OptionsMenu');
2713 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_OPTIONS
]))) do
2715 Name
:= 'mmOptionsMenu';
2716 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2717 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2718 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2719 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2720 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2721 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2723 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2724 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2726 Menu
.OnClose
:= ProcApplyOptions
;
2727 Menu
.DefControl
:= 'mmOptionsMenu';
2728 g_GUI_AddWindow(Menu
);
2730 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6), @ProcSavedMenuKeyDown
);
2731 g_GUI_AddWindow(Menu
);
2733 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2734 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2736 Name
:= 'mOptionsVideoMenu';
2737 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2738 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2744 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2747 AddItem(_lc
[I_MENU_YES
]);
2748 AddItem(_lc
[I_MENU_NO
]);
2750 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2752 Name
:= 'swTextureFilter';
2753 AddItem(_lc
[I_MENU_YES
]);
2754 AddItem(_lc
[I_MENU_NO
]);
2756 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2759 AddItem(_lc
[I_MENU_YES
]);
2760 AddItem(_lc
[I_MENU_NO
]);
2762 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2764 Name
:= 'swLegacyNPOT';
2765 AddItem(_lc
[I_MENU_NO
]);
2766 AddItem(_lc
[I_MENU_YES
]);
2769 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2772 Menu
.DefControl
:= 'mOptionsVideoMenu';
2773 g_GUI_AddWindow(Menu
);
2775 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2776 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2778 Name
:= 'mOptionsVideoResMenu';
2779 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2781 Name
:= 'lbCurrentRes';
2785 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2787 Name
:= 'lsResolution';
2790 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2792 Name
:= 'swFullScreen';
2793 AddItem(_lc
[I_MENU_YES
]);
2794 AddItem(_lc
[I_MENU_NO
]);
2796 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2798 Name
:= 'swResFactor';
2800 for i
:= 2 to gRC_Width
div 640 do
2801 AddItem(IntToStr(i
) + 'x');
2804 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2807 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2808 g_GUI_AddWindow(Menu
);
2810 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2811 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2813 Name
:= 'mOptionsSoundMenu';
2814 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2816 Name
:= 'scMusicLevel';
2818 OnChange
:= ProcChangeSoundSettings
;
2820 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2822 Name
:= 'scSoundLevel';
2824 OnChange
:= ProcChangeSoundSettings
;
2826 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2828 Name
:= 'scMaxSimSounds';
2831 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2833 Name
:= 'swAnnouncer';
2834 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2835 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2836 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2837 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2839 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2840 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2842 Name
:= 'swSoundEffects';
2843 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2844 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2846 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2847 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2849 Name
:= 'swChatSpeech';
2850 AddItem(_lc
[I_MENU_YES
]);
2851 AddItem(_lc
[I_MENU_NO
]);
2853 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2855 Name
:= 'swInactiveSounds';
2856 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2857 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2861 Menu
.DefControl
:= 'mOptionsSoundMenu';
2862 g_GUI_AddWindow(Menu
);
2864 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2865 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_GAME_OPTIONS
]))) do
2867 Name
:= 'mOptionsGameMenu';
2868 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2870 Name
:= 'scParticlesCount';
2873 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2875 Name
:= 'swBloodCount';
2876 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2877 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2878 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2879 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2880 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2882 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2884 Name
:= 'scShellsMax';
2887 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2889 Name
:= 'scGibsMax';
2892 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2894 Name
:= 'scCorpsesMax';
2897 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2899 Name
:= 'swGibsCount';
2900 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2901 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2902 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2903 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2904 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2906 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2908 Name
:= 'swCorpseType';
2909 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2910 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2912 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2914 Name
:= 'swGibsType';
2915 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2916 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2918 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2920 Name
:= 'swBloodType';
2921 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2922 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2924 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2926 Name
:= 'swScreenFlash';
2927 AddItem(_lc
[I_MENU_NO
]);
2928 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2929 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2931 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2933 Name
:= 'swBackground';
2934 AddItem(_lc
[I_MENU_YES
]);
2935 AddItem(_lc
[I_MENU_NO
]);
2937 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2939 Name
:= 'swMessages';
2940 AddItem(_lc
[I_MENU_YES
]);
2941 AddItem(_lc
[I_MENU_NO
]);
2943 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2945 Name
:= 'swRevertPlayers';
2946 AddItem(_lc
[I_MENU_YES
]);
2947 AddItem(_lc
[I_MENU_NO
]);
2949 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2951 Name
:= 'swChatBubble';
2952 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2953 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2954 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2955 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2956 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2958 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2960 Name
:= 'swPlayerIndicator';
2961 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2962 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2963 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2965 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2967 Name
:= 'swPlayerIndicatorStyle';
2968 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2969 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2971 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2973 Name
:= 'scScaleFactor';
2975 OnChange
:= ProcChangeGameSettings
;
2979 Menu
.DefControl
:= 'mOptionsGameMenu';
2980 g_GUI_AddWindow(Menu
);
2982 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2983 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2985 Name
:= 'mOptionsControlsMenu';
2986 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2987 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2988 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2989 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2990 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2992 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2993 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2994 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2995 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2996 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2997 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2998 if e_HasJoysticks
then
3001 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3003 if g_touch_enabled
then
3006 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3009 Menu
.DefControl
:= 'mOptionsControlsMenu';
3010 g_GUI_AddWindow(Menu
);
3012 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3013 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3015 Name
:= 'mOptionsControlsP1Menu';
3016 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3017 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3018 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3019 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3020 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3021 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3022 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3023 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3024 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3025 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3026 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3028 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3029 g_GUI_AddWindow(Menu
);
3031 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3032 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3034 Name
:= 'mOptionsControlsP1MenuWeapons';
3035 for i
:= WP_FIRST
to WP_LAST
do
3036 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3037 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3039 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3040 g_GUI_AddWindow(Menu
);
3042 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3043 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3045 Name
:= 'mOptionsControlsP2Menu';
3046 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3047 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3048 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3049 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3050 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3051 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3052 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3053 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3054 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3055 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3056 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3058 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3059 g_GUI_AddWindow(Menu
);
3061 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3062 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3064 Name
:= 'mOptionsControlsP2MenuWeapons';
3065 for i
:= WP_FIRST
to WP_LAST
do
3066 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3067 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3069 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3070 g_GUI_AddWindow(Menu
);
3072 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3073 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3075 Name
:= 'mOptionsControlsJoystickMenu';
3076 for i
:= 0 to e_MaxJoys
- 1 do
3077 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3079 Name
:= 'scDeadzone' + IntToStr(i
);
3083 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3084 g_GUI_AddWindow(Menu
);
3086 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3087 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3089 Name
:= 'mOptionsControlsTouchMenu';
3090 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3092 Name
:= 'swTouchAlt';
3093 AddItem(_lc
[I_MENU_NO
]);
3094 AddItem(_lc
[I_MENU_YES
]);
3095 OnChange
:= ProcChangeTouchSettings
;
3097 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3099 Name
:= 'scTouchSize';
3101 OnChange
:= ProcChangeTouchSettings
;
3103 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3105 Name
:= 'swTouchFire';
3106 AddItem(_lc
[I_MENU_NO
]);
3107 AddItem(_lc
[I_MENU_YES
]);
3109 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3111 Name
:= 'scTouchOffset';
3113 OnChange
:= ProcChangeTouchSettings
;
3116 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3117 g_GUI_AddWindow(Menu
);
3119 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3120 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3122 Name
:= 'mOptionsPlayersMenu';
3123 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3124 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3126 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3127 g_GUI_AddWindow(Menu
);
3129 CreatePlayerOptionsMenu('P1');
3130 CreatePlayerOptionsMenu('P2');
3132 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3133 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_MODEL_INFO
]))) do
3135 Name
:= 'mOptionsPlayersMIMenu';
3136 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3141 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3146 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3148 Name
:= 'meComment';
3151 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3152 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3155 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3159 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3160 g_GUI_AddWindow(Menu
);
3162 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3163 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON
]))) do
3165 Name
:= 'mOptionsPlayersP1WeaponMenu';
3166 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3168 Name
:= 'swWeaponAutoswitch';
3169 AddItem(_lc
[I_MENU_NO
]);
3170 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3171 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3173 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3175 Name
:= 'swWeaponAllowEmpty';
3176 AddItem(_lc
[I_MENU_YES
]);
3177 AddItem(_lc
[I_MENU_NO
]);
3179 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3181 Name
:= 'swWeaponAllowFist';
3182 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3183 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3185 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3188 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3189 g_GUI_AddWindow(Menu
);
3191 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3192 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3194 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3195 for i
:= WP_FIRST
to WP_LAST
do
3197 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3199 Name
:= IntToStr(i
);
3200 for a
:= WP_FIRST
to WP_LAST
+1 do
3202 AddItem(IntToStr(a
));
3207 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3209 Name
:= IntToStr(WP_LAST
+1);
3210 for a
:= WP_FIRST
to WP_LAST
+1 do
3212 AddItem(IntToStr(a
));
3214 ItemIndex
:= WP_LAST
+ 1;
3217 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3218 g_GUI_AddWindow(Menu
);
3221 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3222 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON
]))) do
3224 Name
:= 'mOptionsPlayersP2WeaponMenu';
3225 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3227 Name
:= 'swWeaponAutoswitch';
3228 AddItem(_lc
[I_MENU_NO
]);
3229 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3230 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3232 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3234 Name
:= 'swWeaponAllowEmpty';
3235 AddItem(_lc
[I_MENU_YES
]);
3236 AddItem(_lc
[I_MENU_NO
]);
3238 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3240 Name
:= 'swWeaponAllowFist';
3241 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3242 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3244 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3247 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3248 g_GUI_AddWindow(Menu
);
3250 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3251 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3253 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3254 for i
:= WP_FIRST
to WP_LAST
do
3256 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3258 Name
:= IntToStr(i
);
3259 for a
:= WP_FIRST
to WP_LAST
+1 do
3261 AddItem(IntToStr(a
));
3266 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3268 Name
:= IntToStr(WP_LAST
+1);
3269 for a
:= WP_FIRST
to WP_LAST
+1 do
3271 AddItem(IntToStr(a
));
3273 ItemIndex
:= WP_LAST
+ 1;
3276 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3277 g_GUI_AddWindow(Menu
);
3279 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3280 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3282 Name
:= 'mOptionsLanguageMenu';
3283 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3284 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3287 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3288 g_GUI_AddWindow(Menu
);
3290 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6), @ProcDefaultMenuKeyDown
);
3291 g_GUI_AddWindow(Menu
);
3293 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3294 Menu
.BackTexture
:= 'INTER';
3295 Menu
.OnClose
:= ProcAuthorsClose
;
3299 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], False))) do
3301 Color
:= _RGB(255, 0, 0);
3302 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3304 _y
:= _y
+GetHeight();
3306 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), False))) do
3308 Color
:= _RGB(255, 0, 0);
3309 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3311 _y
:= _y
+GetHeight()+32;
3313 // ×òî äåëàë: Êòî äåëàë
3314 cx
:= gScreenWidth
div 2 - 320 + 64;
3315 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], False))) do
3317 Color
:= _RGB(255, 0, 0);
3322 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], False))) do
3324 Color
:= _RGB(255, 255, 255);
3329 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], False))) do
3331 Color
:= _RGB(255, 0, 0);
3336 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], False))) do
3338 Color
:= _RGB(255, 255, 255);
3343 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], False))) do
3345 Color
:= _RGB(255, 255, 255);
3350 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], False))) do
3352 Color
:= _RGB(255, 0, 0);
3357 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], False))) do
3359 Color
:= _RGB(255, 255, 255);
3364 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], False))) do
3366 Color
:= _RGB(255, 0, 0);
3371 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], False))) do
3373 Color
:= _RGB(255, 255, 255);
3376 _y
:= gScreenHeight
- 128;
3379 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], False))) do
3381 Color
:= _RGB(255, 0, 0);
3386 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], False))) do
3388 Color
:= _RGB(255, 255, 255);
3391 _y
:= _y
+GetHeight();
3393 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], False))) do
3395 Color
:= _RGB(255, 255, 255);
3398 _y
:= _y
+GetHeight();
3400 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], False))) do
3402 Color
:= _RGB(255, 255, 255);
3405 _y
:= gScreenHeight
- 32;
3407 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], False))) do
3409 Color
:= _RGB(255, 0, 0);
3410 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3413 g_GUI_AddWindow(Menu
);
3415 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6), @ProcExitMenuKeyDown
);
3416 g_GUI_AddWindow(Menu
);
3418 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3419 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3421 Name
:= 'mmGameSingleMenu';
3422 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3423 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3424 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3425 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3426 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3427 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3429 Menu
.DefControl
:= 'mmGameSingleMenu';
3430 Menu
.MainWindow
:= True;
3431 Menu
.OnClose
:= ProcGMClose
;
3432 Menu
.OnShow
:= ProcGMShow
;
3433 g_GUI_AddWindow(Menu
);
3435 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcEndMenuKeyDown
);
3436 g_GUI_AddWindow(Menu
);
3438 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcRestartMenuKeyDown
);
3439 g_GUI_AddWindow(Menu
);
3441 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3442 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3444 Name
:= 'mmGameCustomMenu';
3445 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3446 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3447 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3448 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3449 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3450 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3451 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3453 Menu
.DefControl
:= 'mmGameCustomMenu';
3454 Menu
.MainWindow
:= True;
3455 Menu
.OnClose
:= ProcGMClose
;
3456 Menu
.OnShow
:= ProcGMShow
;
3457 g_GUI_AddWindow(Menu
);
3459 Menu
:= TGUIWindow
.Create('GameServerMenu');
3460 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3462 Name
:= 'mmGameServerMenu';
3463 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3464 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3465 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3466 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3467 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3469 Menu
.DefControl
:= 'mmGameServerMenu';
3470 Menu
.MainWindow
:= True;
3471 Menu
.OnClose
:= ProcGMClose
;
3472 Menu
.OnShow
:= ProcGMShow
;
3473 g_GUI_AddWindow(Menu
);
3475 Menu
:= TGUIWindow
.Create('GameClientMenu');
3476 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3478 Name
:= 'mmGameClientMenu';
3479 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3480 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3481 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3483 Menu
.DefControl
:= 'mmGameClientMenu';
3484 Menu
.MainWindow
:= True;
3485 Menu
.OnClose
:= ProcGMClose
;
3486 Menu
.OnShow
:= ProcGMShow
;
3487 g_GUI_AddWindow(Menu
);
3489 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3490 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(False, False, _lc
[I_MENU_ENTERPASSWORD
]))) do
3492 Name
:= 'mClientPasswordMenu';
3493 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3501 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3504 Menu
.DefControl
:= 'mClientPasswordMenu';
3505 g_GUI_AddWindow(Menu
);
3507 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3508 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SET_GAME
]))) do
3510 Name
:= 'mGameSetGameMenu';
3511 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3513 Name
:= 'swTeamDamage';
3514 AddItem(_lc
[I_MENU_YES
]);
3515 AddItem(_lc
[I_MENU_NO
]);
3518 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3520 Name
:= 'swTeamHit';
3521 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3522 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3523 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3524 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3527 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3529 Name
:= 'swDeathmatchKeys';
3530 AddItem(_lc
[I_MENU_YES
]);
3531 AddItem(_lc
[I_MENU_NO
]);
3534 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3536 Name
:= 'edTimeLimit';
3541 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3543 Name
:= 'edScoreLimit';
3548 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3550 Name
:= 'edMaxLives';
3555 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3558 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3559 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3560 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3563 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3565 Name
:= 'swFlagDrop';
3566 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3567 AddItem(_lc
[I_MENU_YES
]);
3568 AddItem(_lc
[I_MENU_NO
]);
3574 Menu
.DefControl
:= 'mGameSetGameMenu';
3575 Menu
.OnClose
:= ProcApplyGameSet
;
3576 g_GUI_AddWindow(Menu
);
3578 Menu
:= TGUIWindow
.Create('TeamMenu');
3579 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3581 Name
:= 'mmTeamMenu';
3582 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3583 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3584 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3585 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3586 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3588 Menu
.DefControl
:= 'mmTeamMenu';
3589 Menu
.OnShow
:= ProcChangePlayers
;
3590 g_GUI_AddWindow(Menu
);
3593 procedure g_Menu_Show_SaveMenu();
3595 if g_Game_IsTestMap
then
3597 if gGameSettings
.GameType
= GT_SINGLE
then
3598 g_GUI_ShowWindow('GameSingleMenu')
3601 if g_Game_IsClient
then
3604 if g_Game_IsNet
then
3607 g_GUI_ShowWindow('GameCustomMenu');
3609 g_GUI_ShowWindow('SaveMenu');
3610 g_Sound_PlayEx('MENU_OPEN');
3613 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3615 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3616 if gGameSettings
.GameType
= GT_SINGLE
then
3618 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3622 if g_Game_IsClient
then exit
;
3623 if g_Game_IsNet
then exit
;
3624 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3626 g_GUI_ShowWindow('LoadMenu');
3627 g_Sound_PlayEx('MENU_OPEN');
3630 procedure g_Menu_Show_GameSetGame();
3632 if gGameSettings
.GameType
= GT_SINGLE
then
3633 g_GUI_ShowWindow('GameSingleMenu')
3636 if g_Game_IsClient
then
3639 if g_Game_IsNet
then
3640 g_GUI_ShowWindow('GameServerMenu')
3642 g_GUI_ShowWindow('GameCustomMenu');
3645 g_GUI_ShowWindow('GameSetGameMenu');
3646 g_Sound_PlayEx('MENU_OPEN');
3649 procedure g_Menu_Show_OptionsVideo();
3651 if gGameSettings
.GameType
= GT_SINGLE
then
3652 g_GUI_ShowWindow('GameSingleMenu')
3655 if g_Game_IsClient
then
3656 g_GUI_ShowWindow('GameClientMenu')
3658 if g_Game_IsNet
then
3659 g_GUI_ShowWindow('GameServerMenu')
3661 g_GUI_ShowWindow('GameCustomMenu');
3664 g_GUI_ShowWindow('OptionsMenu');
3665 g_GUI_ShowWindow('OptionsVideoMenu');
3666 g_Sound_PlayEx('MENU_OPEN');
3669 procedure g_Menu_Show_OptionsSound();
3671 if gGameSettings
.GameType
= GT_SINGLE
then
3672 g_GUI_ShowWindow('GameSingleMenu')
3675 if g_Game_IsClient
then
3676 g_GUI_ShowWindow('GameClientMenu')
3678 if g_Game_IsNet
then
3679 g_GUI_ShowWindow('GameServerMenu')
3681 g_GUI_ShowWindow('GameCustomMenu');
3684 g_GUI_ShowWindow('OptionsMenu');
3685 g_GUI_ShowWindow('OptionsSoundMenu');
3686 g_Sound_PlayEx('MENU_OPEN');
3689 procedure g_Menu_Show_EndGameMenu();
3691 g_GUI_ShowWindow('EndGameMenu');
3692 g_Sound_PlayEx('MENU_OPEN');
3695 procedure g_Menu_Show_QuitGameMenu();
3697 g_GUI_ShowWindow('ExitMenu');
3698 g_Sound_PlayEx('MENU_OPEN');
3701 procedure g_Menu_Init();
3707 procedure g_Menu_Free();
3712 procedure g_Menu_Reset();
3716 g_GUI_SaveMenuPos();
3717 ex
:= g_GUI_Destroy();
3721 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3726 g_Game_SetDebugMode();
3728 g_GUI_LoadMenuPos();