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; FontID
: DWORD
; 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(gMenuSmallFont
, gMenuSmallFont
, '')));
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 list
:= sys_GetDisplayModes(gBPP
);
1885 ItemIndex
:= Length(list
)
1893 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1899 TempResScale
:= Round(r_pixel_scale
- 1);
1900 with TGUISwitch(menu
.GetControl('swResFactor')) do
1901 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1904 procedure ProcApplyVideoOptions();
1907 Fullscreen
: Boolean;
1908 SWidth
, SHeight
: Integer;
1909 ScaleChanged
: Boolean;
1912 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1914 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1916 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1919 SWidth
:= gWinSizeX
;
1920 SHeight
:= gWinSizeY
;
1921 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1924 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1926 ScaleChanged
:= False;
1927 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1929 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1930 r_pixel_scale
:= TempResScale
+ 1;
1931 ScaleChanged
:= True;
1934 if (SWidth
<> gWinSizeX
) or
1935 (SHeight
<> gWinSizeY
) or
1936 (Fullscreen
<> gFullscreen
) or
1939 gResolutionChange
:= True;
1940 gRC_Width
:= SWidth
;
1941 gRC_Height
:= SHeight
;
1942 gRC_FullScreen
:= Fullscreen
;
1943 gRC_Maximized
:= gWinMaximized
;
1946 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1950 procedure ProcSetFirstRussianLanguage
;
1952 gLanguage
:= LANGUAGE_RUSSIAN
;
1953 gLanguageChange
:= True;
1954 gAskLanguage
:= False;
1957 procedure ProcSetFirstEnglishLanguage
;
1959 gLanguage
:= LANGUAGE_ENGLISH
;
1960 gLanguageChange
:= True;
1961 gAskLanguage
:= False;
1964 procedure ProcRecallAddress();
1966 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1968 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1969 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1973 procedure CreateFirstLanguageMenu();
1977 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1979 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do // space to prevent show logo
1981 Name
:= 'mmFirstLanguageMenu';
1982 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1983 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1986 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1987 Menu
.MainWindow
:= True;
1988 g_GUI_AddWindow(Menu
);
1991 procedure g_Menu_AskLanguage();
1993 CreateFirstLanguageMenu();
1994 g_GUI_ShowWindow('FirstLanguageMenu');
1997 procedure CreatePlayerOptionsMenu(s
: String);
2002 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2004 a
:= _lc
[I_MENU_PLAYER_1
]
2006 a
:= _lc
[I_MENU_PLAYER_2
];
2007 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2009 Name
:= 'mOptionsPlayers'+s
+'Menu';
2010 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2012 Name
:= 'ed'+s
+'Name';
2016 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2018 Name
:= 'sw'+s
+'Team';
2019 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2020 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2022 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2024 Name
:= 'ls'+s
+'Model';
2026 Items
:= g_PlayerModel_GetNames();
2027 OnChange
:= ProcSelectModel
;
2029 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2031 Name
:= 'sc'+s
+'Red';
2033 OnChange
:= ProcChangeColor
;
2035 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2037 Name
:= 'sc'+s
+'Green';
2039 OnChange
:= ProcChangeColor
;
2041 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2043 Name
:= 'sc'+s
+'Blue';
2045 OnChange
:= ProcChangeColor
;
2048 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2049 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2050 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2051 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2052 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2053 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2054 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2056 Name
:= 'mv'+s
+'Model';
2057 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2058 Y
:= GetControl('ls'+s
+'Model').Y
;
2061 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2062 g_GUI_AddWindow(Menu
);
2065 procedure CreateAllMenus();
2069 a
, cx
, _y
, i
: Integer;
2072 Menu
:= TGUIWindow
.Create('MainMenu');
2073 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
2075 Name
:= 'mmMainMenu';
2076 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2077 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2078 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2079 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2080 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2081 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2083 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2085 Color
:= _RGB(255, 255, 255);
2086 X
:= gScreenWidth
-GetWidth
-8;
2087 Y
:= gScreenHeight
-GetHeight
-8;
2089 Menu
.DefControl
:= 'mmMainMenu';
2090 Menu
.MainWindow
:= True;
2091 g_GUI_AddWindow(Menu
);
2093 Menu
:= TGUIWindow
.Create('NewGameMenu');
2094 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
2096 Name
:= 'mmNewGameMenu';
2097 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2098 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2099 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2100 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2102 Menu
.DefControl
:= 'mmNewGameMenu';
2103 g_GUI_AddWindow(Menu
);
2105 Menu
:= TGUIWindow
.Create('NetGameMenu');
2106 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
2108 Name
:= 'mmNetGameMenu';
2109 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2110 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2112 Menu
.DefControl
:= 'mmNetGameMenu';
2113 g_GUI_AddWindow(Menu
);
2115 Menu
:= TGUIWindow
.Create('NetServerMenu');
2116 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2118 Name
:= 'mNetServerMenu';
2119 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2121 Name
:= 'edSrvName';
2122 OnlyDigits
:= False;
2125 Text := NetServerName
;
2127 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2129 Name
:= 'edSrvPassword';
2130 OnlyDigits
:= False;
2133 Text := NetPassword
;
2135 with AddEdit(_lc
[I_NET_PORT
]) do
2141 Text := IntToStr(NetPort
);
2143 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2145 Name
:= 'edMaxPlayers';
2149 Text := IntToStr(NetMaxClients
);
2151 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2153 Name
:= 'swUseMaster';
2154 AddItem(_lc
[I_MENU_YES
]);
2155 AddItem(_lc
[I_MENU_NO
]);
2156 if NetUseMaster
then
2162 with AddLabel(_lc
[I_MENU_MAP
]) do
2167 OnClick
:= @ProcSelectMapMenu
;
2169 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2171 Name
:= 'swGameMode';
2172 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2173 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2174 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2175 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2176 case g_Game_TextToMode(gsGameMode
) of
2178 GM_DM
: ItemIndex
:= 0;
2179 GM_TDM
: ItemIndex
:= 1;
2180 GM_CTF
: ItemIndex
:= 2;
2182 GM_COOP
: ItemIndex
:= 3;
2184 OnChange
:= ProcSwitchMonstersCustom
;
2186 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2188 Name
:= 'edTimeLimit';
2192 if gsTimeLimit
> 0 then
2193 Text := IntToStr(gsTimeLimit
);
2195 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2197 Name
:= 'edScoreLimit';
2201 if gsScoreLimit
> 0 then
2202 Text := IntToStr(gsScoreLimit
);
2204 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2206 Name
:= 'edMaxLives';
2210 if gsMaxLives
> 0 then
2211 Text := IntToStr(gsMaxLives
);
2213 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2215 Name
:= 'edItemRespawnTime';
2219 if gsItemRespawnTime
> 0 then
2220 Text := IntToStr(gsItemRespawnTime
);
2222 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2224 Name
:= 'swPlayers';
2225 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2226 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2227 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2228 ItemIndex
:= gsPlayers
;
2230 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2232 Name
:= 'swTeamDamage';
2233 AddItem(_lc
[I_MENU_YES
]);
2234 AddItem(_lc
[I_MENU_NO
]);
2235 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2240 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2242 Name
:= 'swTeamHit';
2243 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2244 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2245 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2246 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2247 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2249 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2251 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2256 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2258 Name
:= 'swDeathmatchKeys';
2259 AddItem(_lc
[I_MENU_YES
]);
2260 AddItem(_lc
[I_MENU_NO
]);
2261 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2266 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2268 Name
:= 'swEnableExits';
2269 AddItem(_lc
[I_MENU_YES
]);
2270 AddItem(_lc
[I_MENU_NO
]);
2271 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2276 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2278 Name
:= 'swWeaponStay';
2279 AddItem(_lc
[I_MENU_YES
]);
2280 AddItem(_lc
[I_MENU_NO
]);
2281 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2286 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2288 Name
:= 'swMonsters';
2289 AddItem(_lc
[I_MENU_YES
]);
2290 AddItem(_lc
[I_MENU_NO
]);
2291 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2296 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2299 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2300 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2301 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2303 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2305 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2308 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2310 Name
:= 'swFlagDrop';
2311 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2312 AddItem(_lc
[I_MENU_YES
]);
2313 AddItem(_lc
[I_MENU_NO
]);
2314 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2316 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2322 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2326 Menu
.DefControl
:= 'mNetServerMenu';
2327 g_GUI_AddWindow(Menu
);
2329 Menu
:= TGUIWindow
.Create('NetClientMenu');
2330 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2332 Name
:= 'mNetClientMenu';
2334 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2337 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2343 Text := 'localhost';
2345 with AddEdit(_lc
[I_NET_PORT
]) do
2353 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2356 OnlyDigits
:= False;
2363 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2367 Menu
.DefControl
:= 'mNetClientMenu';
2368 g_GUI_AddWindow(Menu
);
2370 Menu
:= TGUIWindow
.Create('LoadMenu');
2371 Menu
.OnShow
:= ProcLoadMenu
;
2372 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2374 Name
:= 'mmLoadMenu';
2379 Name
:= 'edSlot'+IntToStr(a
);
2382 OnEnter
:= ProcLoadGame
;
2385 Menu
.DefControl
:= 'mmLoadMenu';
2386 g_GUI_AddWindow(Menu
);
2388 Menu
:= TGUIWindow
.Create('SaveMenu');
2389 Menu
.OnShow
:= ProcSaveMenu
;
2390 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2392 Name
:= 'mmSaveMenu';
2397 Name
:= 'edSlot'+IntToStr(a
);
2400 OnChange
:= ProcSaveGame
;
2403 Menu
.DefControl
:= 'mmSaveMenu';
2404 g_GUI_AddWindow(Menu
);
2406 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2407 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2409 Name
:= 'mCustomGameMenu';
2410 with AddLabel(_lc
[I_MENU_MAP
]) do
2415 OnClick
:= @ProcSelectMapMenu
;
2417 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2419 Name
:= 'swGameMode';
2420 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2421 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2422 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2423 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2424 case g_Game_TextToMode(gsGameMode
) of
2426 GM_DM
: ItemIndex
:= 0;
2427 GM_TDM
: ItemIndex
:= 1;
2428 GM_CTF
: ItemIndex
:= 2;
2430 GM_COOP
: ItemIndex
:= 3;
2432 OnChange
:= ProcSwitchMonstersCustom
;
2434 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2436 Name
:= 'edTimeLimit';
2440 if gsTimeLimit
> 0 then
2441 Text := IntToStr(gsTimeLimit
);
2443 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2445 Name
:= 'edScoreLimit';
2449 if gsScoreLimit
> 0 then
2450 Text := IntToStr(gsScoreLimit
);
2452 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2454 Name
:= 'edMaxLives';
2458 if gsMaxLives
> 0 then
2459 Text := IntToStr(gsMaxLives
);
2461 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2463 Name
:= 'edItemRespawnTime';
2467 if gsItemRespawnTime
> 0 then
2468 Text := IntToStr(gsItemRespawnTime
);
2470 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2472 Name
:= 'swPlayers';
2473 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2474 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2475 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2476 ItemIndex
:= gsPlayers
;
2478 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2480 Name
:= 'swTeamDamage';
2481 AddItem(_lc
[I_MENU_YES
]);
2482 AddItem(_lc
[I_MENU_NO
]);
2483 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2488 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2490 Name
:= 'swTeamHit';
2491 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2492 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2493 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2494 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2495 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2497 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2499 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2504 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2506 Name
:= 'swDeathmatchKeys';
2507 AddItem(_lc
[I_MENU_YES
]);
2508 AddItem(_lc
[I_MENU_NO
]);
2509 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2514 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2516 Name
:= 'swEnableExits';
2517 AddItem(_lc
[I_MENU_YES
]);
2518 AddItem(_lc
[I_MENU_NO
]);
2519 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2524 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2526 Name
:= 'swWeaponStay';
2527 AddItem(_lc
[I_MENU_YES
]);
2528 AddItem(_lc
[I_MENU_NO
]);
2529 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2534 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2536 Name
:= 'swMonsters';
2537 AddItem(_lc
[I_MENU_YES
]);
2538 AddItem(_lc
[I_MENU_NO
]);
2539 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2544 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2547 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2548 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2549 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2551 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2553 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2556 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2558 Name
:= 'swFlagDrop';
2559 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2560 AddItem(_lc
[I_MENU_YES
]);
2561 AddItem(_lc
[I_MENU_NO
]);
2562 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2564 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2570 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2574 Menu
.DefControl
:= 'mCustomGameMenu';
2575 g_GUI_AddWindow(Menu
);
2577 Menu
:= TGUIWindow
.Create('CampaignMenu');
2578 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2580 Name
:= 'mCampaignMenu';
2589 with AddFileList('', 15, 4) do
2592 OnChange
:= ProcSelectCampaignWAD
;
2596 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2597 SetBase(MegawadDirs
);
2600 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2602 Name
:= 'lbWADName';
2606 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2608 Name
:= 'lbWADAuthor';
2612 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2613 with AddMemo('', 15, 3) do
2615 Name
:= 'meWADDescription';
2616 Color
:= MENU_ITEMSCTRL_COLOR
;
2618 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2620 Name
:= 'swPlayers';
2621 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2622 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2625 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2629 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2631 Name
:= 'mpWADImage';
2632 DefaultRes
:= 'NOPIC';
2633 X
:= GetControl('lsWAD').X
+4;
2634 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2637 Menu
.DefControl
:= 'mCampaignMenu';
2638 g_GUI_AddWindow(Menu
);
2640 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2641 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2643 Name
:= 'mSelectMapMenu';
2644 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2647 OnChange
:= ProcSelectWAD
;
2651 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2654 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2658 OnChange
:= ProcSelectMap
;
2661 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2663 Name
:= 'lbMapName';
2667 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2669 Name
:= 'lbMapAuthor';
2673 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2675 Name
:= 'lbMapSize';
2679 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2681 Name
:= 'meMapDescription';
2686 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2688 Name
:= 'mpMapPreview';
2689 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2690 Y
:= GetControl('lsMapWAD').Y
;
2692 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2694 Name
:= 'lbMapScale';
2697 Color
:= MENU_ITEMSCTRL_COLOR
;
2698 X
:= GetControl('lsMapWAD').X
+
2699 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2700 2 + MAPPREVIEW_WIDTH
*4;
2701 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2704 Menu
.OnClose
:= ProcSetMap
;
2705 Menu
.DefControl
:= 'mSelectMapMenu';
2706 g_GUI_AddWindow(Menu
);
2708 Menu
:= TGUIWindow
.Create('OptionsMenu');
2709 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2711 Name
:= 'mmOptionsMenu';
2712 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2713 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2714 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2715 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2716 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2717 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2719 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2720 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2722 Menu
.OnClose
:= ProcApplyOptions
;
2723 Menu
.DefControl
:= 'mmOptionsMenu';
2724 g_GUI_AddWindow(Menu
);
2726 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2727 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2728 g_GUI_AddWindow(Menu
);
2730 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2731 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2733 Name
:= 'mOptionsVideoMenu';
2734 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2735 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2741 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2744 AddItem(_lc
[I_MENU_YES
]);
2745 AddItem(_lc
[I_MENU_NO
]);
2747 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2749 Name
:= 'swTextureFilter';
2750 AddItem(_lc
[I_MENU_YES
]);
2751 AddItem(_lc
[I_MENU_NO
]);
2753 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2756 AddItem(_lc
[I_MENU_YES
]);
2757 AddItem(_lc
[I_MENU_NO
]);
2759 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2761 Name
:= 'swLegacyNPOT';
2762 AddItem(_lc
[I_MENU_NO
]);
2763 AddItem(_lc
[I_MENU_YES
]);
2766 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2769 Menu
.DefControl
:= 'mOptionsVideoMenu';
2770 g_GUI_AddWindow(Menu
);
2772 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2773 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2775 Name
:= 'mOptionsVideoResMenu';
2776 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2778 Name
:= 'lbCurrentRes';
2782 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2784 Name
:= 'lsResolution';
2787 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2789 Name
:= 'swFullScreen';
2790 AddItem(_lc
[I_MENU_YES
]);
2791 AddItem(_lc
[I_MENU_NO
]);
2793 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2795 Name
:= 'swResFactor';
2797 for i
:= 2 to gRC_Width
div 640 do
2798 AddItem(IntToStr(i
) + 'x');
2801 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2804 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2805 g_GUI_AddWindow(Menu
);
2807 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2808 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2810 Name
:= 'mOptionsSoundMenu';
2811 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2813 Name
:= 'scMusicLevel';
2815 OnChange
:= ProcChangeSoundSettings
;
2817 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2819 Name
:= 'scSoundLevel';
2821 OnChange
:= ProcChangeSoundSettings
;
2823 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2825 Name
:= 'scMaxSimSounds';
2828 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2830 Name
:= 'swAnnouncer';
2831 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2832 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2833 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2834 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2836 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2837 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2839 Name
:= 'swSoundEffects';
2840 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2841 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2843 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2844 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2846 Name
:= 'swChatSpeech';
2847 AddItem(_lc
[I_MENU_YES
]);
2848 AddItem(_lc
[I_MENU_NO
]);
2850 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2852 Name
:= 'swInactiveSounds';
2853 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2854 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2858 Menu
.DefControl
:= 'mOptionsSoundMenu';
2859 g_GUI_AddWindow(Menu
);
2861 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2862 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2864 Name
:= 'mOptionsGameMenu';
2865 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2867 Name
:= 'scParticlesCount';
2870 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2872 Name
:= 'swBloodCount';
2873 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2874 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2875 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2876 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2877 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2879 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2881 Name
:= 'scShellsMax';
2884 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2886 Name
:= 'scGibsMax';
2889 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2891 Name
:= 'scCorpsesMax';
2894 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2896 Name
:= 'swGibsCount';
2897 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2898 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2899 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2900 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2901 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2903 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2905 Name
:= 'swCorpseType';
2906 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2907 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2909 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2911 Name
:= 'swGibsType';
2912 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2913 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2915 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2917 Name
:= 'swBloodType';
2918 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2919 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2921 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2923 Name
:= 'swScreenFlash';
2924 AddItem(_lc
[I_MENU_NO
]);
2925 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2926 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2928 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2930 Name
:= 'swBackground';
2931 AddItem(_lc
[I_MENU_YES
]);
2932 AddItem(_lc
[I_MENU_NO
]);
2934 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2936 Name
:= 'swMessages';
2937 AddItem(_lc
[I_MENU_YES
]);
2938 AddItem(_lc
[I_MENU_NO
]);
2940 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2942 Name
:= 'swRevertPlayers';
2943 AddItem(_lc
[I_MENU_YES
]);
2944 AddItem(_lc
[I_MENU_NO
]);
2946 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2948 Name
:= 'swChatBubble';
2949 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2950 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2951 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2952 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2953 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2955 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2957 Name
:= 'swPlayerIndicator';
2958 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2959 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2960 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2962 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2964 Name
:= 'swPlayerIndicatorStyle';
2965 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2966 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2968 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2970 Name
:= 'scScaleFactor';
2972 OnChange
:= ProcChangeGameSettings
;
2976 Menu
.DefControl
:= 'mOptionsGameMenu';
2977 g_GUI_AddWindow(Menu
);
2979 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2980 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2982 Name
:= 'mOptionsControlsMenu';
2983 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2984 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2985 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2986 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2987 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2989 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2990 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2991 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2992 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2993 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2994 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2995 if e_HasJoysticks
then
2998 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3000 if g_touch_enabled
then
3003 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3006 Menu
.DefControl
:= 'mOptionsControlsMenu';
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3012 Name
:= 'mOptionsControlsP1Menu';
3013 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3014 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3015 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3016 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3017 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3018 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3019 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3020 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3021 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3022 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3023 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3025 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3026 g_GUI_AddWindow(Menu
);
3028 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3029 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3031 Name
:= 'mOptionsControlsP1MenuWeapons';
3032 for i
:= WP_FIRST
to WP_LAST
do
3033 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3034 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3036 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3037 g_GUI_AddWindow(Menu
);
3039 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3040 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3042 Name
:= 'mOptionsControlsP2Menu';
3043 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3044 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3045 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3046 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3047 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3048 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3049 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3050 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3051 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3052 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3053 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3055 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3056 g_GUI_AddWindow(Menu
);
3058 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3059 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3061 Name
:= 'mOptionsControlsP2MenuWeapons';
3062 for i
:= WP_FIRST
to WP_LAST
do
3063 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3064 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3066 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3067 g_GUI_AddWindow(Menu
);
3069 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3070 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3072 Name
:= 'mOptionsControlsJoystickMenu';
3073 for i
:= 0 to e_MaxJoys
- 1 do
3074 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3076 Name
:= 'scDeadzone' + IntToStr(i
);
3080 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3081 g_GUI_AddWindow(Menu
);
3083 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3084 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3086 Name
:= 'mOptionsControlsTouchMenu';
3087 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3089 Name
:= 'swTouchAlt';
3090 AddItem(_lc
[I_MENU_NO
]);
3091 AddItem(_lc
[I_MENU_YES
]);
3092 OnChange
:= ProcChangeTouchSettings
;
3094 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3096 Name
:= 'scTouchSize';
3098 OnChange
:= ProcChangeTouchSettings
;
3100 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3102 Name
:= 'swTouchFire';
3103 AddItem(_lc
[I_MENU_NO
]);
3104 AddItem(_lc
[I_MENU_YES
]);
3106 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3108 Name
:= 'scTouchOffset';
3110 OnChange
:= ProcChangeTouchSettings
;
3113 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3114 g_GUI_AddWindow(Menu
);
3116 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3117 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3119 Name
:= 'mOptionsPlayersMenu';
3120 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3121 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3123 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3124 g_GUI_AddWindow(Menu
);
3126 CreatePlayerOptionsMenu('P1');
3127 CreatePlayerOptionsMenu('P2');
3129 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3130 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3132 Name
:= 'mOptionsPlayersMIMenu';
3133 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3138 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3143 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3145 Name
:= 'meComment';
3148 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3149 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3152 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3156 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3157 g_GUI_AddWindow(Menu
);
3159 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3160 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3162 Name
:= 'mOptionsPlayersP1WeaponMenu';
3163 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3165 Name
:= 'swWeaponAutoswitch';
3166 AddItem(_lc
[I_MENU_NO
]);
3167 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3168 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3170 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3172 Name
:= 'swWeaponAllowEmpty';
3173 AddItem(_lc
[I_MENU_YES
]);
3174 AddItem(_lc
[I_MENU_NO
]);
3176 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3178 Name
:= 'swWeaponAllowFist';
3179 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3180 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3182 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3185 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3186 g_GUI_AddWindow(Menu
);
3188 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3189 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3191 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3192 for i
:= WP_FIRST
to WP_LAST
do
3194 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3196 Name
:= IntToStr(i
);
3197 for a
:= WP_FIRST
to WP_LAST
+1 do
3199 AddItem(IntToStr(a
));
3204 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3206 Name
:= IntToStr(WP_LAST
+1);
3207 for a
:= WP_FIRST
to WP_LAST
+1 do
3209 AddItem(IntToStr(a
));
3211 ItemIndex
:= WP_LAST
+ 1;
3214 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3215 g_GUI_AddWindow(Menu
);
3218 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3219 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3221 Name
:= 'mOptionsPlayersP2WeaponMenu';
3222 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3224 Name
:= 'swWeaponAutoswitch';
3225 AddItem(_lc
[I_MENU_NO
]);
3226 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3227 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3229 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3231 Name
:= 'swWeaponAllowEmpty';
3232 AddItem(_lc
[I_MENU_YES
]);
3233 AddItem(_lc
[I_MENU_NO
]);
3235 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3237 Name
:= 'swWeaponAllowFist';
3238 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3239 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3241 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3244 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3245 g_GUI_AddWindow(Menu
);
3247 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3248 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3250 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3251 for i
:= WP_FIRST
to WP_LAST
do
3253 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3255 Name
:= IntToStr(i
);
3256 for a
:= WP_FIRST
to WP_LAST
+1 do
3258 AddItem(IntToStr(a
));
3263 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3265 Name
:= IntToStr(WP_LAST
+1);
3266 for a
:= WP_FIRST
to WP_LAST
+1 do
3268 AddItem(IntToStr(a
));
3270 ItemIndex
:= WP_LAST
+ 1;
3273 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3274 g_GUI_AddWindow(Menu
);
3276 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3277 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3279 Name
:= 'mOptionsLanguageMenu';
3280 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3281 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3284 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3285 g_GUI_AddWindow(Menu
);
3287 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3288 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3289 g_GUI_AddWindow(Menu
);
3291 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3292 Menu
.BackTexture
:= 'INTER';
3293 Menu
.OnClose
:= ProcAuthorsClose
;
3297 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3299 Color
:= _RGB(255, 0, 0);
3300 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3302 _y
:= _y
+GetHeight();
3304 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3306 Color
:= _RGB(255, 0, 0);
3307 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3309 _y
:= _y
+GetHeight()+32;
3311 // ×òî äåëàë: Êòî äåëàë
3312 cx
:= gScreenWidth
div 2 - 320 + 64;
3313 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3315 Color
:= _RGB(255, 0, 0);
3320 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3322 Color
:= _RGB(255, 255, 255);
3327 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3329 Color
:= _RGB(255, 0, 0);
3334 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3336 Color
:= _RGB(255, 255, 255);
3341 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3343 Color
:= _RGB(255, 255, 255);
3348 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3350 Color
:= _RGB(255, 0, 0);
3355 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3357 Color
:= _RGB(255, 255, 255);
3362 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3364 Color
:= _RGB(255, 0, 0);
3369 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3371 Color
:= _RGB(255, 255, 255);
3374 _y
:= gScreenHeight
- 128;
3377 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3379 Color
:= _RGB(255, 0, 0);
3384 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3386 Color
:= _RGB(255, 255, 255);
3389 _y
:= _y
+GetHeight();
3391 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3393 Color
:= _RGB(255, 255, 255);
3396 _y
:= _y
+GetHeight();
3398 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3400 Color
:= _RGB(255, 255, 255);
3403 _y
:= gScreenHeight
- 32;
3405 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3407 Color
:= _RGB(255, 0, 0);
3408 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3411 g_GUI_AddWindow(Menu
);
3413 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3414 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3415 g_GUI_AddWindow(Menu
);
3417 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3418 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3420 Name
:= 'mmGameSingleMenu';
3421 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3422 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3423 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3424 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3425 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3426 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3428 Menu
.DefControl
:= 'mmGameSingleMenu';
3429 Menu
.MainWindow
:= True;
3430 Menu
.OnClose
:= ProcGMClose
;
3431 Menu
.OnShow
:= ProcGMShow
;
3432 g_GUI_AddWindow(Menu
);
3434 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3435 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3436 g_GUI_AddWindow(Menu
);
3438 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3439 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3440 g_GUI_AddWindow(Menu
);
3442 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3443 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3445 Name
:= 'mmGameCustomMenu';
3446 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3447 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3448 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3449 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3450 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3451 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3452 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3454 Menu
.DefControl
:= 'mmGameCustomMenu';
3455 Menu
.MainWindow
:= True;
3456 Menu
.OnClose
:= ProcGMClose
;
3457 Menu
.OnShow
:= ProcGMShow
;
3458 g_GUI_AddWindow(Menu
);
3460 Menu
:= TGUIWindow
.Create('GameServerMenu');
3461 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3463 Name
:= 'mmGameServerMenu';
3464 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3465 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3466 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3467 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3468 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3470 Menu
.DefControl
:= 'mmGameServerMenu';
3471 Menu
.MainWindow
:= True;
3472 Menu
.OnClose
:= ProcGMClose
;
3473 Menu
.OnShow
:= ProcGMShow
;
3474 g_GUI_AddWindow(Menu
);
3476 Menu
:= TGUIWindow
.Create('GameClientMenu');
3477 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3479 Name
:= 'mmGameClientMenu';
3480 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3481 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3482 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3484 Menu
.DefControl
:= 'mmGameClientMenu';
3485 Menu
.MainWindow
:= True;
3486 Menu
.OnClose
:= ProcGMClose
;
3487 Menu
.OnShow
:= ProcGMShow
;
3488 g_GUI_AddWindow(Menu
);
3490 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3491 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3493 Name
:= 'mClientPasswordMenu';
3494 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3502 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3505 Menu
.DefControl
:= 'mClientPasswordMenu';
3506 g_GUI_AddWindow(Menu
);
3508 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3509 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3511 Name
:= 'mGameSetGameMenu';
3512 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3514 Name
:= 'swTeamDamage';
3515 AddItem(_lc
[I_MENU_YES
]);
3516 AddItem(_lc
[I_MENU_NO
]);
3519 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3521 Name
:= 'swTeamHit';
3522 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3523 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3524 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3525 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3528 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3530 Name
:= 'swDeathmatchKeys';
3531 AddItem(_lc
[I_MENU_YES
]);
3532 AddItem(_lc
[I_MENU_NO
]);
3535 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3537 Name
:= 'edTimeLimit';
3542 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3544 Name
:= 'edScoreLimit';
3549 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3551 Name
:= 'edMaxLives';
3556 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3559 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3560 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3561 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3564 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3566 Name
:= 'swFlagDrop';
3567 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3568 AddItem(_lc
[I_MENU_YES
]);
3569 AddItem(_lc
[I_MENU_NO
]);
3575 Menu
.DefControl
:= 'mGameSetGameMenu';
3576 Menu
.OnClose
:= ProcApplyGameSet
;
3577 g_GUI_AddWindow(Menu
);
3579 Menu
:= TGUIWindow
.Create('TeamMenu');
3580 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3582 Name
:= 'mmTeamMenu';
3583 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3584 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3585 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3586 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3587 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3589 Menu
.DefControl
:= 'mmTeamMenu';
3590 Menu
.OnShow
:= ProcChangePlayers
;
3591 g_GUI_AddWindow(Menu
);
3594 procedure g_Menu_Show_SaveMenu();
3596 if g_Game_IsTestMap
then
3598 if gGameSettings
.GameType
= GT_SINGLE
then
3599 g_GUI_ShowWindow('GameSingleMenu')
3602 if g_Game_IsClient
then
3605 if g_Game_IsNet
then
3608 g_GUI_ShowWindow('GameCustomMenu');
3610 g_GUI_ShowWindow('SaveMenu');
3611 g_Sound_PlayEx('MENU_OPEN');
3614 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3616 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3617 if gGameSettings
.GameType
= GT_SINGLE
then
3619 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3623 if g_Game_IsClient
then exit
;
3624 if g_Game_IsNet
then exit
;
3625 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3627 g_GUI_ShowWindow('LoadMenu');
3628 g_Sound_PlayEx('MENU_OPEN');
3631 procedure g_Menu_Show_GameSetGame();
3633 if gGameSettings
.GameType
= GT_SINGLE
then
3634 g_GUI_ShowWindow('GameSingleMenu')
3637 if g_Game_IsClient
then
3640 if g_Game_IsNet
then
3641 g_GUI_ShowWindow('GameServerMenu')
3643 g_GUI_ShowWindow('GameCustomMenu');
3646 g_GUI_ShowWindow('GameSetGameMenu');
3647 g_Sound_PlayEx('MENU_OPEN');
3650 procedure g_Menu_Show_OptionsVideo();
3652 if gGameSettings
.GameType
= GT_SINGLE
then
3653 g_GUI_ShowWindow('GameSingleMenu')
3656 if g_Game_IsClient
then
3657 g_GUI_ShowWindow('GameClientMenu')
3659 if g_Game_IsNet
then
3660 g_GUI_ShowWindow('GameServerMenu')
3662 g_GUI_ShowWindow('GameCustomMenu');
3665 g_GUI_ShowWindow('OptionsMenu');
3666 g_GUI_ShowWindow('OptionsVideoMenu');
3667 g_Sound_PlayEx('MENU_OPEN');
3670 procedure g_Menu_Show_OptionsSound();
3672 if gGameSettings
.GameType
= GT_SINGLE
then
3673 g_GUI_ShowWindow('GameSingleMenu')
3676 if g_Game_IsClient
then
3677 g_GUI_ShowWindow('GameClientMenu')
3679 if g_Game_IsNet
then
3680 g_GUI_ShowWindow('GameServerMenu')
3682 g_GUI_ShowWindow('GameCustomMenu');
3685 g_GUI_ShowWindow('OptionsMenu');
3686 g_GUI_ShowWindow('OptionsSoundMenu');
3687 g_Sound_PlayEx('MENU_OPEN');
3690 procedure g_Menu_Show_EndGameMenu();
3692 g_GUI_ShowWindow('EndGameMenu');
3693 g_Sound_PlayEx('MENU_OPEN');
3696 procedure g_Menu_Show_QuitGameMenu();
3698 g_GUI_ShowWindow('ExitMenu');
3699 g_Sound_PlayEx('MENU_OPEN');
3702 procedure g_Menu_Init();
3708 procedure g_Menu_Free();
3713 procedure g_Menu_Reset();
3717 g_GUI_SaveMenuPos();
3718 ex
:= g_GUI_Destroy();
3722 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3727 g_Game_SetDebugMode();
3729 g_GUI_LoadMenuPos();