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 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
55 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
56 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
57 MAPDEF
, Math
, g_saveload
,
59 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
60 utils
, wadreader
, g_system
, r_render
, r_game
;
63 type TYNCallback
= procedure (yes
:Boolean);
65 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
67 if win
.UserData
= nil then exit
;
69 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
70 IK_N
: TYNCallback(win
.UserData
)(false);
74 procedure YesButtonCB (ctl
: TGUITextButton
);
76 if ctl
.UserData
= nil then exit
;
77 TYNCallback(ctl
.UserData
)(true);
80 procedure NoButtonCB (ctl
: TGUITextButton
);
82 if ctl
.UserData
= nil then exit
;
83 TYNCallback(ctl
.UserData
)(false);
86 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
90 //if length(Text) = 0 then exit;
91 Result
:= TGUIWindow
.Create(WinName
);
94 //OnKeyDownEx := @YNKeyDownProc;
95 //UserData := @ActionProc;
96 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
99 Name
:= '__temp_yes_no_menu:'+WinName
;
101 AddText(Text, MaxLen
);
102 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
103 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
105 DefControl
:= '__temp_yes_no_menu:'+WinName
;
111 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
112 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
114 procedure ProcApplyOptions();
119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
121 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
126 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
128 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
129 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
130 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
132 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
134 g_Sound_SetupAllVolumes(
135 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
136 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
139 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
140 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
141 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
142 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
143 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
145 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
148 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
150 {$IFDEF ENABLE_SHELLS}
151 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
154 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
156 {$IFDEF ENABLE_CORPSES}
157 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
161 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
166 else gGibsCount
:= 48;
170 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
171 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
172 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
173 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
174 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
175 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
176 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
177 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
178 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
179 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
180 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
181 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
183 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
184 g_dbg_scale
:= TempScale
+ 1;
188 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
192 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
194 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
195 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
196 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
197 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
198 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
199 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
202 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
205 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
206 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
207 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
208 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
209 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
210 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
211 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
212 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
213 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
214 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
215 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
228 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
229 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
230 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
231 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
232 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
233 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
234 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
235 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
236 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
237 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
238 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
247 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
249 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
252 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
255 for i
:= WP_FIRST
to WP_LAST
do
257 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
259 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
264 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
267 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
268 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
269 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
270 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
271 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
272 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
273 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
274 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
275 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
276 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
277 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
290 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
291 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
292 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
293 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
294 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
295 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
296 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
297 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
298 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
299 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
300 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
302 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
304 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
305 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
307 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
309 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
310 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
311 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
317 for i
:= WP_FIRST
to WP_LAST
do
319 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
320 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
321 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
322 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
326 if e_HasJoysticks
then
328 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
331 for i
:= 0 to e_MaxJoys
- 1 do
332 if e_JoystickAvailable
[i
] then
333 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
337 if g_touch_enabled
then
339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
340 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
341 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
342 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
343 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
347 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
348 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
349 TEAM_RED
, TEAM_BLUE
);
350 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
352 gPlayer1Settings
.Model
:= Model
.GetName();
353 gPlayer1Settings
.Color
:= Model
.Color
;
356 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
357 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
358 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
359 TEAM_RED
, TEAM_BLUE
);
360 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
362 gPlayer2Settings
.Model
:= Model
.GetName();
363 gPlayer2Settings
.Color
:= Model
.Color
;
366 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
367 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
368 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
369 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
370 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
373 for i
:= WP_FIRST
to WP_LAST
+1 do
375 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
379 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
380 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
381 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
382 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
383 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
386 for i
:= WP_FIRST
to WP_LAST
+1 do
388 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
392 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
393 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
395 if g_Game_IsServer
then
397 if gPlayer1
<> nil then
399 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
400 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
401 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
402 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
404 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
406 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
407 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
408 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
409 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
410 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
413 if gPlayer2
<> nil then
415 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
416 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
417 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
418 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
420 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
422 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
423 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
424 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
425 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
426 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
430 if g_Game_IsClient
then
432 MC_SEND_PlayerSettings
;
433 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
436 g_Console_WriteGameConfig
;
439 procedure ReadOptions();
444 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
446 with TGUISwitch(menu
.GetControl('swBPP')) do
452 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
453 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
455 with TGUISwitch(menu
.GetControl('swVSync')) do
456 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
458 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
459 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
461 with TGUISwitch(menu
.GetControl('swInterp')) do
462 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
466 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
467 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
468 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
470 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
471 if gMuteWhenInactive
then
476 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
478 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
479 if gSoundEffectsDF
then
484 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
485 if gUseChatSounds
then
490 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
521 for i
:= WP_FIRST
to WP_LAST
do
523 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
524 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
528 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
548 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
551 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
552 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
553 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
556 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
559 for i
:= WP_FIRST
to WP_LAST
do
561 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
562 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
566 if e_HasJoysticks
then
568 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
571 for i
:= 0 to e_MaxJoys
- 1 do
572 if e_JoystickAvailable
[i
] then
573 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
577 if g_touch_enabled
then
579 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
580 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
581 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
582 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
583 with TGUISwitch(menu
.GetControl('swTouchFire')) do
584 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
585 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
588 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
591 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
592 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
593 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
594 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
600 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
602 {$IFDEF ENABLE_SHELLS}
603 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
606 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
608 {$IFDEF ENABLE_CORPSES}
609 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
611 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
613 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
616 with TGUISwitch(menu
.GetControl('swBloodType')) do
617 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
619 with TGUISwitch(menu
.GetControl('swCorpseType')) do
620 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
622 with TGUISwitch(menu
.GetControl('swGibsType')) do
623 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
626 with TGUISwitch(menu
.GetControl('swGibsCount')) do
638 with TGUISwitch(menu
.GetControl('swBackGround')) do
639 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
641 with TGUISwitch(menu
.GetControl('swMessages')) do
642 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
644 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
645 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
647 with TGUISwitch(menu
.GetControl('swChatBubble')) do
648 ItemIndex
:= gChatBubble
;
650 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
651 ItemIndex
:= gPlayerIndicator
;
653 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
654 ItemIndex
:= gPlayerIndicatorStyle
;
656 TempScale
:= Round(g_dbg_scale
- 1);
657 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
659 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
661 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
662 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
664 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
665 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
667 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
668 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
669 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
671 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
672 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
673 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
674 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
675 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
676 for i
:= WP_FIRST
to WP_LAST
+1 do
678 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
679 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
682 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
683 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
684 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
685 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
686 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
687 for i
:= WP_FIRST
to WP_LAST
+1 do
689 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
690 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
693 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
695 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
696 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
698 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
699 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
701 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
702 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
703 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
705 ProcSelectModel(nil);
708 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
710 // don't turn off monsters in DM
712 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
713 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
714 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
716 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
719 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
720 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
721 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
726 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
728 // don't turn off monsters in DM
730 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
731 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
732 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
734 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
737 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
738 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
739 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
740 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
744 function LatchGameOptions(const MenuName
: string): Byte;
750 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
752 Map
:= TGUILabel(GetControl('lbMap')).Text;
755 if not isWadPath(Map
) then
758 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
759 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
760 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
761 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
762 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
763 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
764 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
768 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
769 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
770 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
771 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
772 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
773 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
774 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
775 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
776 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
777 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
779 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
780 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
781 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
782 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
785 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
786 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
787 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
788 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
791 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
792 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
793 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
794 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
797 // TODO: get this crap out of here
798 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
799 gGameSettings
.WarmupTime
:= gsWarmupTime
;
800 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
804 procedure ProcStartCustomGame();
808 GameMode
:= LatchGameOptions('mCustomGameMenu');
809 if GameMode
= GM_NONE
then Exit
;
811 g_Console_WriteGameConfig
;
812 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
813 gsMaxLives
, gsGameFlags
, gsPlayers
);
817 procedure ProcStartNetGame();
821 GameMode
:= LatchGameOptions('mNetServerMenu');
822 if GameMode
= GM_NONE
then Exit
;
824 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
826 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
827 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
828 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
829 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
830 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
831 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
834 g_Console_WriteGameConfig
;
835 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
836 gsGameFlags
, gsPlayers
, 0, NetPort
);
839 procedure ProcConnectNetGame();
843 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
845 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
846 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
847 PW
:= TGUIEdit(GetControl('edPW')).Text;
850 g_Console_WriteGameConfig
;
851 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
854 procedure ProcEnterPassword();
858 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
860 NetClientIP
:= PromptIP
;
861 NetClientPort
:= PromptPort
;
862 PW
:= TGUIEdit(GetControl('edPW')).Text;
865 g_Console_WriteGameConfig
;
866 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
869 procedure ProcServerlist();
871 if not NetInitDone
then
873 if (not g_Net_Init()) then
875 g_Console_Add('NET: ERROR: Failed to init ENet!');
882 g_Net_Slist_Set(NetMasterList
);
884 gState
:= STATE_SLIST
;
885 g_ActiveWindow
:= nil;
887 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
892 slReturnPressed
:= True;
893 if g_Net_Slist_Fetch(slCurrent
) then
895 if slCurrent
= nil then
896 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
899 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
900 g_Serverlist_GenerateTable(slCurrent
, slTable
);
903 procedure ProcStartCampaign();
909 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
911 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
912 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
914 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
920 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
923 procedure ProcSelectMap(Sender
: TGUIControl
);
927 wad
, map
, res
: String;
929 win
:= g_GUI_GetWindow('SelectMapMenu');
930 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
932 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
933 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
935 if (wad
= '') or (map
= '') then
936 begin // Ýòî íå êàðòà
937 TGUILabel(GetControl('lbMapName')).Text := '';
938 TGUILabel(GetControl('lbMapAuthor')).Text := '';
939 TGUILabel(GetControl('lbMapSize')).Text := '';
940 TGUIMemo(GetControl('meMapDescription')).SetText('');
941 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
942 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
948 a
:= g_Map_GetMapInfo(res
);
950 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
951 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
952 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
953 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
954 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
955 TGUILabel(win
.GetControl('lbMapScale')).Text :=
956 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
961 procedure ProcSelectWAD(Sender
: TGUIControl
);
966 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
968 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
970 with TGUIListBox(GetControl('lsMapRes')) do
976 list
:= g_Map_GetMapsList(wad
);
990 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
996 win
:= g_GUI_GetWindow('CampaignMenu');
997 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
999 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
1003 TGUILabel(GetControl('lbWADName')).Text := '';
1004 TGUILabel(GetControl('lbWADAuthor')).Text := '';
1005 TGUIMemo(GetControl('meWADDescription')).SetText('');
1008 a
:= g_Game_GetMegaWADInfo(wad
);
1010 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1011 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1012 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1014 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1018 fn
:= g_ExtractWadName(a
.pic
);
1020 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1022 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1027 procedure ProcChangeColor(Sender
: TGUIControl
);
1031 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1032 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1033 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1034 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1035 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1036 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1038 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1039 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1040 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1041 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1042 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1043 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1046 procedure ProcSelectModel(Sender
: TGUIControl
);
1051 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1052 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1053 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1055 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1056 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1057 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1059 ProcChangeColor(nil);
1062 procedure MenuLoadData();
1064 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1066 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1067 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1068 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1069 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1070 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1071 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1072 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1073 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1074 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1075 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1076 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1077 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1078 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1079 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1080 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1081 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1082 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1083 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1084 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1085 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1086 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1087 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1088 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1089 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1090 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1092 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1093 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1094 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1095 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1096 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1097 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1098 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1101 procedure MenuFreeData();
1103 e_CharFont_Remove(gMenuFont
);
1104 e_CharFont_Remove(gMenuSmallFont
);
1106 g_Texture_Delete('MAINMENU_LOGO');
1107 g_Texture_Delete('MAINMENU_MARKER1');
1108 g_Texture_Delete('MAINMENU_MARKER2');
1109 g_Texture_Delete('SCROLL_LEFT');
1110 g_Texture_Delete('SCROLL_RIGHT');
1111 g_Texture_Delete('SCROLL_MIDDLE');
1112 g_Texture_Delete('SCROLL_MARKER');
1113 g_Texture_Delete('EDIT_LEFT');
1114 g_Texture_Delete('EDIT_RIGHT');
1115 g_Texture_Delete('EDIT_MIDDLE');
1116 g_Texture_Delete('BOX1');
1117 g_Texture_Delete('BOX2');
1118 g_Texture_Delete('BOX3');
1119 g_Texture_Delete('BOX4');
1120 g_Texture_Delete('BOX5');
1121 g_Texture_Delete('BOX6');
1122 g_Texture_Delete('BOX7');
1123 g_Texture_Delete('BOX8');
1124 g_Texture_Delete('BOX9');
1125 g_Texture_Delete('BSCROLL_UP_A');
1126 g_Texture_Delete('BSCROLL_UP_U');
1127 g_Texture_Delete('BSCROLL_DOWN_A');
1128 g_Texture_Delete('BSCROLL_DOWN_U');
1129 g_Texture_Delete('BSCROLL_MIDDLE');
1130 g_Texture_Delete('NOPIC');
1132 g_Sound_Delete('MENU_SELECT');
1133 g_Sound_Delete('MENU_OPEN');
1134 g_Sound_Delete('MENU_CLOSE');
1135 g_Sound_Delete('MENU_CHANGE');
1136 g_Sound_Delete('SCROLL_ADD');
1137 g_Sound_Delete('SCROLL_SUB');
1138 g_Sound_Delete('SOUND_PLAYER_FALL');
1141 procedure ProcAuthorsMenu();
1143 gMusic
.SetByName('MUSIC_INTERMUS');
1147 procedure ProcExitMenuKeyDown (yes
: Boolean);
1150 snd
: TPlayableSound
;
1155 g_Game_StopAllSounds(True);
1156 case (Random(18)) of
1157 0: s
:= 'SOUND_MONSTER_PAIN';
1158 1: s
:= 'SOUND_MONSTER_DIE_3';
1159 2: s
:= 'SOUND_MONSTER_SLOP';
1160 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1161 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1162 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1163 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1164 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1165 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1166 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1167 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1168 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1169 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1170 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1171 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1172 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1173 else s
:= 'SOUND_PLAYER_FALL';
1175 snd
:= TPlayableSound
.Create();
1176 res
:= snd
.SetByName(s
);
1177 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1181 while snd
.IsPlaying() do begin end;
1189 procedure ProcLoadMenu();
1196 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1197 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1198 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1202 procedure ProcSaveMenu();
1210 name
:= g_GetSaveName(a
, valid
);
1211 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1212 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1216 procedure ProcSaveGame(Sender
: TGUIControl
);
1220 if g_Game_IsNet
then Exit
;
1221 if g_Game_IsTestMap
then Exit
;
1222 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1223 g_Game_PauseAllSounds(True);
1224 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1226 g_ActiveWindow
:= nil;
1227 g_Game_Pause(False);
1230 procedure ProcLoadGame(Sender
: TGUIControl
);
1234 if g_Game_IsNet
then Exit
;
1235 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1236 if g_LoadGame(a
) then
1238 g_Game_PauseAllSounds(False)
1240 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1242 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1243 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1244 //g_ActiveWindow := nil;
1248 procedure ProcSinglePlayer (n
: Integer);
1249 var wad
, map
: AnsiString;
1252 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1253 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1254 if e_FindResource(AllMapDirs
, wad
) then
1256 wad
:= ExpandFileName(wad
);
1257 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1261 procedure ProcSingle1Player
;
1266 procedure ProcSingle2Players
;
1271 procedure ProcSelectMapMenu();
1274 wad_lb
: TGUIFileListBox
;
1275 map_lb
: TGUIListBox
;
1278 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1279 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1280 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1282 if wad_lb
.SelectedItem() <> '' then
1283 map
:= map_lb
.SelectedItem()
1287 wad_lb
.UpdateFileList();
1290 if wad_lb
.SelectedItem() <> '' then
1293 map_lb
.SelectItem(map
);
1295 if map_lb
.SelectedItem() <> '' then
1299 g_GUI_ShowWindow('SelectMapMenu');
1302 procedure ProcSelectCampaignMenu();
1305 wad_lb
: TGUIFileListBox
;
1307 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1308 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1310 wad_lb
.UpdateFileList();
1312 if wad_lb
.SelectedItem() <> '' then
1313 ProcSelectCampaignWAD(nil);
1316 procedure ProcSetMap();
1318 wad
, map
, res
: String;
1320 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1322 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1323 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1326 if (wad
= '') or (map
= '') then
1329 wad
:= e_FindWadRel(MapDirs
, WAD
);
1331 res
:= wad
+':\'+map
;
1333 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1334 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1337 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1341 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1343 g_Sound_SetupAllVolumes(
1344 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1345 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1349 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1353 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1354 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1356 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1357 g_dbg_scale
:= TempScale
+ 1;
1361 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1365 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1366 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1367 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1368 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1371 procedure ProcOptionsPlayersMIMenu();
1376 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1378 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1380 if a
= '' then Exit
;
1382 i
:= g_PlayerModel_GetIndex(a
);
1383 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1385 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1386 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1387 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1389 if PlayerModelsArray
[i
].HaveWeapon
then
1390 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1392 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1395 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1398 procedure ProcOptionsPlayerP1WeaponMenu();
1402 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1403 if a
= '' then Exit
;
1404 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1407 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1409 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1412 procedure ProcOptionsPlayerP2WeaponMenu();
1416 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1417 if a
= '' then Exit
;
1418 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1421 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1423 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1426 procedure ProcOptionsPlayersAnim();
1430 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1435 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1438 Model
.AnimState
.Loop
:= True;
1442 procedure ProcOptionsPlayersWeap();
1446 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1451 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1455 procedure ProcOptionsPlayersRot();
1459 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1460 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1462 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1466 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1470 g_Options_SetDefault();
1476 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1478 if yes
then ReadOptions();
1482 procedure ProcAuthorsClose();
1484 gMusic
.SetByName('MUSIC_MENU');
1486 gState
:= STATE_MENU
;
1489 procedure ProcGMClose();
1491 g_Game_InGameMenu(False);
1494 procedure ProcGMShow();
1499 if (gGameSettings
.GameType
= GT_SINGLE
) and
1500 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1501 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1502 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1504 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1505 if g_Game_IsTestMap
then
1506 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1507 TGUIMainMenu(g_ActiveWindow
.GetControl(
1508 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1511 procedure ProcChangePlayers();
1513 TeamGame
, Spectator
, AddTwo
: Boolean;
1514 P1Team
{, P2Team}: Byte;
1515 bP2
: TGUITextButton
;
1517 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1518 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1519 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1520 P1Team
:= TEAM_NONE
;
1521 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1523 //P2Team := TEAM_NONE;
1524 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1526 TGUIMainMenu(g_ActiveWindow
.GetControl(
1527 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1528 TGUIMainMenu(g_ActiveWindow
.GetControl(
1529 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1530 TGUIMainMenu(g_ActiveWindow
.GetControl(
1531 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1533 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1534 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1535 bP2
.Enabled
:= AddTwo
and not Spectator
;
1537 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1539 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1540 if gPlayer2
= nil then
1541 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1543 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1545 TGUIMainMenu(g_ActiveWindow
.GetControl(
1546 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1549 procedure ProcJoinRed();
1551 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1553 if g_Game_IsServer
then
1555 if gPlayer1
= nil then
1556 g_Game_AddPlayer(TEAM_RED
)
1559 if gPlayer1
.Team
<> TEAM_RED
then
1561 gPlayer1
.SwitchTeam
;
1562 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1565 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1570 gPlayer1Settings
.Team
:= TEAM_RED
;
1571 MC_SEND_PlayerSettings
;
1572 if gPlayer1
= nil then
1573 g_Game_AddPlayer(TEAM_RED
);
1575 g_ActiveWindow
:= nil;
1576 g_Game_Pause(False);
1579 procedure ProcJoinBlue();
1581 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1583 if g_Game_IsServer
then
1585 if gPlayer1
= nil then
1586 g_Game_AddPlayer(TEAM_BLUE
)
1589 if gPlayer1
.Team
<> TEAM_BLUE
then
1591 gPlayer1
.SwitchTeam
;
1592 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1595 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1600 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1601 MC_SEND_PlayerSettings
;
1602 if gPlayer1
= nil then
1603 g_Game_AddPlayer(TEAM_BLUE
);
1605 g_ActiveWindow
:= nil;
1606 g_Game_Pause(False);
1609 procedure ProcJoinGame();
1611 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1613 if gPlayer1
= nil then
1615 g_ActiveWindow
:= nil;
1616 g_Game_Pause(False);
1619 procedure ProcSwitchP2();
1621 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1623 if gPlayer1
= nil then
1625 if gPlayer2
= nil then
1628 g_Game_RemovePlayer();
1629 g_ActiveWindow
:= nil;
1630 g_Game_Pause(False);
1633 procedure ProcSpectate();
1635 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1638 g_ActiveWindow
:= nil;
1639 g_Game_Pause(False);
1642 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1644 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1647 procedure ProcEndMenuKeyDown (yes
: Boolean);
1649 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1652 procedure ProcSetRussianLanguage
;
1654 if gLanguage
<> LANGUAGE_RUSSIAN
then
1656 gLanguage
:= LANGUAGE_RUSSIAN
;
1657 gLanguageChange
:= True;
1658 gAskLanguage
:= False;
1663 procedure ProcSetEnglishLanguage
;
1665 if gLanguage
<> LANGUAGE_ENGLISH
then
1667 gLanguage
:= LANGUAGE_ENGLISH
;
1668 gLanguageChange
:= True;
1669 gAskLanguage
:= False;
1674 procedure ReadGameSettings();
1678 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1680 with gGameSettings
do
1682 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1683 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1687 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1688 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1690 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1692 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1696 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1697 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1701 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1702 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1704 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1709 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1710 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1711 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1713 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1714 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1715 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1718 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1723 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1725 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1726 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1727 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1729 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1730 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1734 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1735 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1737 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1738 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1739 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1740 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1741 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1742 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1743 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1744 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1748 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1749 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1750 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1751 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1752 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1757 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1758 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1763 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1764 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1769 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1770 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1771 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1776 procedure ProcApplyGameSet();
1780 stat
: TPlayerStatArray
;
1782 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1784 if not g_Game_IsServer
then Exit
;
1786 with gGameSettings
do
1788 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1790 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1791 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1793 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1796 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1798 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1799 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1800 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1801 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1802 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1806 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1808 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1809 Options
:= Options
or GAME_OPTION_DMKEYS
1811 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1814 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1816 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1822 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1824 TimeLimit
:= Max(n
, b
);
1828 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1830 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1837 if GameMode
= GM_DM
then
1839 stat
:= g_Player_GetStats();
1841 for a
:= 0 to High(stat
) do
1842 if stat
[a
].Frags
> b
then
1846 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1848 ScoreLimit
:= Max(n
, b
);
1852 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1854 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1855 if n
< 0 then n
:= 0;
1856 if n
> 255 then n
:= 255;
1862 stat
:= g_Player_GetStats();
1864 for a
:= 0 to High(stat
) do
1865 if stat
[a
].Lives
> b
then
1868 MaxLives
:= Max(n
, b
);
1872 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1874 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1877 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1878 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1882 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1883 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1887 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1888 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1893 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1895 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1896 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1897 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1898 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1902 // don't forget to latch this shit
1903 gsGameFlags
:= Options
;
1904 gsMaxLives
:= MaxLives
;
1905 gsScoreLimit
:= ScoreLimit
;
1906 gsTimeLimit
:= TimeLimit
;
1909 if g_Game_IsNet
then MH_SEND_GameSettings
;
1912 procedure ProcVideoOptionsRes();
1917 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1919 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1920 IntToStr(gWinSizeX
) +
1921 ' x ' + IntToStr(gWinSizeY
) +
1922 ', ' + IntToStr(gBPP
) + ' bpp';
1924 with TGUIListBox(menu
.GetControl('lsResolution')) do
1926 list
:= sys_GetDisplayModes(gBPP
);
1930 ItemIndex
:= Length(list
)
1938 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1944 TempResScale
:= Round(r_pixel_scale
- 1);
1945 with TGUISwitch(menu
.GetControl('swResFactor')) do
1946 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1949 procedure ProcApplyVideoOptions();
1952 Fullscreen
: Boolean;
1953 SWidth
, SHeight
: Integer;
1954 ScaleChanged
: Boolean;
1957 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1959 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1961 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1964 SWidth
:= gWinSizeX
;
1965 SHeight
:= gWinSizeY
;
1966 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1969 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1971 ScaleChanged
:= False;
1972 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1974 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1975 r_pixel_scale
:= TempResScale
+ 1;
1976 ScaleChanged
:= True;
1979 if (SWidth
<> gWinSizeX
) or
1980 (SHeight
<> gWinSizeY
) or
1981 (Fullscreen
<> gFullscreen
) or
1984 gResolutionChange
:= True;
1985 gRC_Width
:= SWidth
;
1986 gRC_Height
:= SHeight
;
1987 gRC_FullScreen
:= Fullscreen
;
1988 gRC_Maximized
:= gWinMaximized
;
1991 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1995 procedure ProcSetFirstRussianLanguage
;
1997 gLanguage
:= LANGUAGE_RUSSIAN
;
1998 gLanguageChange
:= True;
1999 gAskLanguage
:= False;
2002 procedure ProcSetFirstEnglishLanguage
;
2004 gLanguage
:= LANGUAGE_ENGLISH
;
2005 gLanguageChange
:= True;
2006 gAskLanguage
:= False;
2009 procedure ProcRecallAddress();
2011 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2013 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2014 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2018 procedure CreateFirstLanguageMenu();
2022 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2024 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2026 Name
:= 'mmFirstLanguageMenu';
2027 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2028 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2031 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2032 Menu
.MainWindow
:= True;
2033 g_GUI_AddWindow(Menu
);
2036 procedure g_Menu_AskLanguage();
2038 CreateFirstLanguageMenu();
2039 g_GUI_ShowWindow('FirstLanguageMenu');
2042 procedure CreatePlayerOptionsMenu(s
: String);
2047 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2049 a
:= _lc
[I_MENU_PLAYER_1
]
2051 a
:= _lc
[I_MENU_PLAYER_2
];
2052 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2054 Name
:= 'mOptionsPlayers'+s
+'Menu';
2055 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2057 Name
:= 'ed'+s
+'Name';
2061 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2063 Name
:= 'sw'+s
+'Team';
2064 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2065 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2067 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2069 Name
:= 'ls'+s
+'Model';
2071 Items
:= g_PlayerModel_GetNames();
2072 OnChange
:= ProcSelectModel
;
2074 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2076 Name
:= 'sc'+s
+'Red';
2078 OnChange
:= ProcChangeColor
;
2080 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2082 Name
:= 'sc'+s
+'Green';
2084 OnChange
:= ProcChangeColor
;
2086 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2088 Name
:= 'sc'+s
+'Blue';
2090 OnChange
:= ProcChangeColor
;
2093 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2094 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2095 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2096 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2097 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2098 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2099 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2101 Name
:= 'mv'+s
+'Model';
2102 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2103 Y
:= GetControl('ls'+s
+'Model').Y
;
2106 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2107 g_GUI_AddWindow(Menu
);
2110 procedure CreateAllMenus();
2114 a
, cx
, _y
, i
: Integer;
2117 Menu
:= TGUIWindow
.Create('MainMenu');
2118 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2120 Name
:= 'mmMainMenu';
2121 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2122 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2123 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2124 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2125 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2126 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2128 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2130 Color
:= _RGB(255, 255, 255);
2131 X
:= gScreenWidth
-GetWidth
-8;
2132 Y
:= gScreenHeight
-GetHeight
-8;
2134 Menu
.DefControl
:= 'mmMainMenu';
2135 Menu
.MainWindow
:= True;
2136 g_GUI_AddWindow(Menu
);
2138 Menu
:= TGUIWindow
.Create('NewGameMenu');
2139 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2141 Name
:= 'mmNewGameMenu';
2142 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2143 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2144 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2145 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2147 Menu
.DefControl
:= 'mmNewGameMenu';
2148 g_GUI_AddWindow(Menu
);
2150 Menu
:= TGUIWindow
.Create('NetGameMenu');
2151 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2153 Name
:= 'mmNetGameMenu';
2154 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2155 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2157 Menu
.DefControl
:= 'mmNetGameMenu';
2158 g_GUI_AddWindow(Menu
);
2160 Menu
:= TGUIWindow
.Create('NetServerMenu');
2161 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2163 Name
:= 'mNetServerMenu';
2164 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2166 Name
:= 'edSrvName';
2167 OnlyDigits
:= False;
2170 Text := NetServerName
;
2172 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2174 Name
:= 'edSrvPassword';
2175 OnlyDigits
:= False;
2178 Text := NetPassword
;
2180 with AddEdit(_lc
[I_NET_PORT
]) do
2186 Text := IntToStr(NetPort
);
2188 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2190 Name
:= 'edMaxPlayers';
2194 Text := IntToStr(NetMaxClients
);
2196 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2198 Name
:= 'swUseMaster';
2199 AddItem(_lc
[I_MENU_YES
]);
2200 AddItem(_lc
[I_MENU_NO
]);
2201 if NetUseMaster
then
2207 with AddLabel(_lc
[I_MENU_MAP
]) do
2212 OnClick
:= @ProcSelectMapMenu
;
2214 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2216 Name
:= 'swGameMode';
2217 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2218 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2219 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2220 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2221 case g_Game_TextToMode(gsGameMode
) of
2223 GM_DM
: ItemIndex
:= 0;
2224 GM_TDM
: ItemIndex
:= 1;
2225 GM_CTF
: ItemIndex
:= 2;
2227 GM_COOP
: ItemIndex
:= 3;
2229 OnChange
:= ProcSwitchMonstersCustom
;
2231 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2233 Name
:= 'edTimeLimit';
2237 if gsTimeLimit
> 0 then
2238 Text := IntToStr(gsTimeLimit
);
2240 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2242 Name
:= 'edScoreLimit';
2246 if gsScoreLimit
> 0 then
2247 Text := IntToStr(gsScoreLimit
);
2249 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2251 Name
:= 'edMaxLives';
2255 if gsMaxLives
> 0 then
2256 Text := IntToStr(gsMaxLives
);
2258 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2260 Name
:= 'edItemRespawnTime';
2264 if gsItemRespawnTime
> 0 then
2265 Text := IntToStr(gsItemRespawnTime
);
2267 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2269 Name
:= 'swPlayers';
2270 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2271 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2272 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2273 ItemIndex
:= gsPlayers
;
2275 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2277 Name
:= 'swTeamDamage';
2278 AddItem(_lc
[I_MENU_YES
]);
2279 AddItem(_lc
[I_MENU_NO
]);
2280 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2285 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2287 Name
:= 'swTeamHit';
2288 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2289 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2290 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2291 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2292 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2294 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2296 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2301 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2303 Name
:= 'swDeathmatchKeys';
2304 AddItem(_lc
[I_MENU_YES
]);
2305 AddItem(_lc
[I_MENU_NO
]);
2306 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2311 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2313 Name
:= 'swEnableExits';
2314 AddItem(_lc
[I_MENU_YES
]);
2315 AddItem(_lc
[I_MENU_NO
]);
2316 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2321 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2323 Name
:= 'swWeaponStay';
2324 AddItem(_lc
[I_MENU_YES
]);
2325 AddItem(_lc
[I_MENU_NO
]);
2326 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2331 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2333 Name
:= 'swMonsters';
2334 AddItem(_lc
[I_MENU_YES
]);
2335 AddItem(_lc
[I_MENU_NO
]);
2336 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2341 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2344 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2345 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2346 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2348 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2350 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2353 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2355 Name
:= 'swFlagDrop';
2356 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2357 AddItem(_lc
[I_MENU_YES
]);
2358 AddItem(_lc
[I_MENU_NO
]);
2359 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2361 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2367 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2371 Menu
.DefControl
:= 'mNetServerMenu';
2372 g_GUI_AddWindow(Menu
);
2374 Menu
:= TGUIWindow
.Create('NetClientMenu');
2375 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2377 Name
:= 'mNetClientMenu';
2379 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2382 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2388 Text := 'localhost';
2390 with AddEdit(_lc
[I_NET_PORT
]) do
2398 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2401 OnlyDigits
:= False;
2408 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2412 Menu
.DefControl
:= 'mNetClientMenu';
2413 g_GUI_AddWindow(Menu
);
2415 Menu
:= TGUIWindow
.Create('LoadMenu');
2416 Menu
.OnShow
:= ProcLoadMenu
;
2417 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2419 Name
:= 'mmLoadMenu';
2424 Name
:= 'edSlot'+IntToStr(a
);
2427 OnEnter
:= ProcLoadGame
;
2430 Menu
.DefControl
:= 'mmLoadMenu';
2431 g_GUI_AddWindow(Menu
);
2433 Menu
:= TGUIWindow
.Create('SaveMenu');
2434 Menu
.OnShow
:= ProcSaveMenu
;
2435 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2437 Name
:= 'mmSaveMenu';
2442 Name
:= 'edSlot'+IntToStr(a
);
2445 OnChange
:= ProcSaveGame
;
2448 Menu
.DefControl
:= 'mmSaveMenu';
2449 g_GUI_AddWindow(Menu
);
2451 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2452 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2454 Name
:= 'mCustomGameMenu';
2455 with AddLabel(_lc
[I_MENU_MAP
]) do
2460 OnClick
:= @ProcSelectMapMenu
;
2462 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2464 Name
:= 'swGameMode';
2465 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2466 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2467 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2468 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2469 case g_Game_TextToMode(gsGameMode
) of
2471 GM_DM
: ItemIndex
:= 0;
2472 GM_TDM
: ItemIndex
:= 1;
2473 GM_CTF
: ItemIndex
:= 2;
2475 GM_COOP
: ItemIndex
:= 3;
2477 OnChange
:= ProcSwitchMonstersCustom
;
2479 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2481 Name
:= 'edTimeLimit';
2485 if gsTimeLimit
> 0 then
2486 Text := IntToStr(gsTimeLimit
);
2488 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2490 Name
:= 'edScoreLimit';
2494 if gsScoreLimit
> 0 then
2495 Text := IntToStr(gsScoreLimit
);
2497 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2499 Name
:= 'edMaxLives';
2503 if gsMaxLives
> 0 then
2504 Text := IntToStr(gsMaxLives
);
2506 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2508 Name
:= 'edItemRespawnTime';
2512 if gsItemRespawnTime
> 0 then
2513 Text := IntToStr(gsItemRespawnTime
);
2515 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2517 Name
:= 'swPlayers';
2518 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2519 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2520 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2521 ItemIndex
:= gsPlayers
;
2523 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2525 Name
:= 'swTeamDamage';
2526 AddItem(_lc
[I_MENU_YES
]);
2527 AddItem(_lc
[I_MENU_NO
]);
2528 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2533 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2535 Name
:= 'swTeamHit';
2536 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2537 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2538 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2539 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2540 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2542 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2544 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2549 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2551 Name
:= 'swDeathmatchKeys';
2552 AddItem(_lc
[I_MENU_YES
]);
2553 AddItem(_lc
[I_MENU_NO
]);
2554 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2559 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2561 Name
:= 'swEnableExits';
2562 AddItem(_lc
[I_MENU_YES
]);
2563 AddItem(_lc
[I_MENU_NO
]);
2564 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2569 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2571 Name
:= 'swWeaponStay';
2572 AddItem(_lc
[I_MENU_YES
]);
2573 AddItem(_lc
[I_MENU_NO
]);
2574 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2579 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2581 Name
:= 'swMonsters';
2582 AddItem(_lc
[I_MENU_YES
]);
2583 AddItem(_lc
[I_MENU_NO
]);
2584 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2589 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2592 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2593 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2594 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2596 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2598 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2601 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2603 Name
:= 'swFlagDrop';
2604 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2605 AddItem(_lc
[I_MENU_YES
]);
2606 AddItem(_lc
[I_MENU_NO
]);
2607 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2609 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2615 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2619 Menu
.DefControl
:= 'mCustomGameMenu';
2620 g_GUI_AddWindow(Menu
);
2622 Menu
:= TGUIWindow
.Create('CampaignMenu');
2623 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2625 Name
:= 'mCampaignMenu';
2634 with AddFileList('', 15, 4) do
2637 OnChange
:= ProcSelectCampaignWAD
;
2641 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2642 SetBase(MegawadDirs
);
2645 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2647 Name
:= 'lbWADName';
2651 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2653 Name
:= 'lbWADAuthor';
2657 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2658 with AddMemo('', 15, 3) do
2660 Name
:= 'meWADDescription';
2661 Color
:= MENU_ITEMSCTRL_COLOR
;
2663 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2665 Name
:= 'swPlayers';
2666 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2667 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2670 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2674 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2676 Name
:= 'mpWADImage';
2677 DefaultRes
:= 'NOPIC';
2678 X
:= GetControl('lsWAD').X
+4;
2679 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2682 Menu
.DefControl
:= 'mCampaignMenu';
2683 g_GUI_AddWindow(Menu
);
2685 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2686 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2688 Name
:= 'mSelectMapMenu';
2689 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2692 OnChange
:= ProcSelectWAD
;
2696 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2699 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2703 OnChange
:= ProcSelectMap
;
2706 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2708 Name
:= 'lbMapName';
2712 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2714 Name
:= 'lbMapAuthor';
2718 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2720 Name
:= 'lbMapSize';
2724 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2726 Name
:= 'meMapDescription';
2731 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2733 Name
:= 'mpMapPreview';
2734 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2735 Y
:= GetControl('lsMapWAD').Y
;
2737 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2739 Name
:= 'lbMapScale';
2742 Color
:= MENU_ITEMSCTRL_COLOR
;
2743 X
:= GetControl('lsMapWAD').X
+
2744 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2745 2 + MAPPREVIEW_WIDTH
*4;
2746 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2749 Menu
.OnClose
:= ProcSetMap
;
2750 Menu
.DefControl
:= 'mSelectMapMenu';
2751 g_GUI_AddWindow(Menu
);
2753 Menu
:= TGUIWindow
.Create('OptionsMenu');
2754 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2756 Name
:= 'mmOptionsMenu';
2757 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2758 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2759 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2760 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2761 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2762 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2764 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2765 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2767 Menu
.OnClose
:= ProcApplyOptions
;
2768 Menu
.DefControl
:= 'mmOptionsMenu';
2769 g_GUI_AddWindow(Menu
);
2771 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2772 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2773 g_GUI_AddWindow(Menu
);
2775 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2776 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2778 Name
:= 'mOptionsVideoMenu';
2779 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2780 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2786 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2789 AddItem(_lc
[I_MENU_YES
]);
2790 AddItem(_lc
[I_MENU_NO
]);
2792 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2794 Name
:= 'swTextureFilter';
2795 AddItem(_lc
[I_MENU_YES
]);
2796 AddItem(_lc
[I_MENU_NO
]);
2798 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2801 AddItem(_lc
[I_MENU_YES
]);
2802 AddItem(_lc
[I_MENU_NO
]);
2804 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2806 Name
:= 'swLegacyNPOT';
2807 AddItem(_lc
[I_MENU_NO
]);
2808 AddItem(_lc
[I_MENU_YES
]);
2811 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2814 Menu
.DefControl
:= 'mOptionsVideoMenu';
2815 g_GUI_AddWindow(Menu
);
2817 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2818 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2820 Name
:= 'mOptionsVideoResMenu';
2821 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2823 Name
:= 'lbCurrentRes';
2827 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2829 Name
:= 'lsResolution';
2832 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2834 Name
:= 'swFullScreen';
2835 AddItem(_lc
[I_MENU_YES
]);
2836 AddItem(_lc
[I_MENU_NO
]);
2838 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2840 Name
:= 'swResFactor';
2842 for i
:= 2 to gRC_Width
div 640 do
2843 AddItem(IntToStr(i
) + 'x');
2846 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2849 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2850 g_GUI_AddWindow(Menu
);
2852 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2853 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2855 Name
:= 'mOptionsSoundMenu';
2856 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2858 Name
:= 'scMusicLevel';
2860 OnChange
:= ProcChangeSoundSettings
;
2862 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2864 Name
:= 'scSoundLevel';
2866 OnChange
:= ProcChangeSoundSettings
;
2868 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2870 Name
:= 'scMaxSimSounds';
2873 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2875 Name
:= 'swAnnouncer';
2876 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2877 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2878 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2879 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2881 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2882 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2884 Name
:= 'swSoundEffects';
2885 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2886 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2888 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2889 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2891 Name
:= 'swChatSpeech';
2892 AddItem(_lc
[I_MENU_YES
]);
2893 AddItem(_lc
[I_MENU_NO
]);
2895 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2897 Name
:= 'swInactiveSounds';
2898 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2899 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2903 Menu
.DefControl
:= 'mOptionsSoundMenu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2909 Name
:= 'mOptionsGameMenu';
2910 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2912 Name
:= 'scParticlesCount';
2915 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2917 Name
:= 'swBloodCount';
2918 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2919 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2920 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2921 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2922 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2924 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2926 Name
:= 'scShellsMax';
2929 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2931 Name
:= 'scGibsMax';
2934 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2936 Name
:= 'scCorpsesMax';
2939 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2941 Name
:= 'swGibsCount';
2942 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2943 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2944 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2945 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2946 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2948 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2950 Name
:= 'swCorpseType';
2951 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2952 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2954 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2956 Name
:= 'swGibsType';
2957 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2958 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2960 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2962 Name
:= 'swBloodType';
2963 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2964 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2966 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2968 Name
:= 'swScreenFlash';
2969 AddItem(_lc
[I_MENU_NO
]);
2970 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2971 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2973 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2975 Name
:= 'swBackground';
2976 AddItem(_lc
[I_MENU_YES
]);
2977 AddItem(_lc
[I_MENU_NO
]);
2979 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2981 Name
:= 'swMessages';
2982 AddItem(_lc
[I_MENU_YES
]);
2983 AddItem(_lc
[I_MENU_NO
]);
2985 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2987 Name
:= 'swRevertPlayers';
2988 AddItem(_lc
[I_MENU_YES
]);
2989 AddItem(_lc
[I_MENU_NO
]);
2991 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2993 Name
:= 'swChatBubble';
2994 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2995 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2996 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2997 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2998 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3000 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3002 Name
:= 'swPlayerIndicator';
3003 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3004 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3005 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3007 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3009 Name
:= 'swPlayerIndicatorStyle';
3010 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3011 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3013 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3015 Name
:= 'scScaleFactor';
3017 OnChange
:= ProcChangeGameSettings
;
3021 Menu
.DefControl
:= 'mOptionsGameMenu';
3022 g_GUI_AddWindow(Menu
);
3024 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3025 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3027 Name
:= 'mOptionsControlsMenu';
3028 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3029 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3030 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3031 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3032 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3034 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3035 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3036 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3037 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3038 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3039 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3040 if e_HasJoysticks
then
3043 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3045 if g_touch_enabled
then
3048 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3051 Menu
.DefControl
:= 'mOptionsControlsMenu';
3052 g_GUI_AddWindow(Menu
);
3054 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3055 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3057 Name
:= 'mOptionsControlsP1Menu';
3058 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3059 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3060 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3061 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3062 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3063 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3064 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3065 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3066 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3067 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3068 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3070 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3071 g_GUI_AddWindow(Menu
);
3073 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3074 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3076 Name
:= 'mOptionsControlsP1MenuWeapons';
3077 for i
:= WP_FIRST
to WP_LAST
do
3078 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3079 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3081 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3082 g_GUI_AddWindow(Menu
);
3084 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3085 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3087 Name
:= 'mOptionsControlsP2Menu';
3088 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3089 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3090 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3091 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3092 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3093 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3094 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3095 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3096 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3097 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3098 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3100 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3101 g_GUI_AddWindow(Menu
);
3103 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3104 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3106 Name
:= 'mOptionsControlsP2MenuWeapons';
3107 for i
:= WP_FIRST
to WP_LAST
do
3108 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3109 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3111 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3112 g_GUI_AddWindow(Menu
);
3114 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3117 Name
:= 'mOptionsControlsJoystickMenu';
3118 for i
:= 0 to e_MaxJoys
- 1 do
3119 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3121 Name
:= 'scDeadzone' + IntToStr(i
);
3125 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3129 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3131 Name
:= 'mOptionsControlsTouchMenu';
3132 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3134 Name
:= 'swTouchAlt';
3135 AddItem(_lc
[I_MENU_NO
]);
3136 AddItem(_lc
[I_MENU_YES
]);
3137 OnChange
:= ProcChangeTouchSettings
;
3139 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3141 Name
:= 'scTouchSize';
3143 OnChange
:= ProcChangeTouchSettings
;
3145 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3147 Name
:= 'swTouchFire';
3148 AddItem(_lc
[I_MENU_NO
]);
3149 AddItem(_lc
[I_MENU_YES
]);
3151 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3153 Name
:= 'scTouchOffset';
3155 OnChange
:= ProcChangeTouchSettings
;
3158 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3159 g_GUI_AddWindow(Menu
);
3161 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3162 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3164 Name
:= 'mOptionsPlayersMenu';
3165 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3166 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3168 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3169 g_GUI_AddWindow(Menu
);
3171 CreatePlayerOptionsMenu('P1');
3172 CreatePlayerOptionsMenu('P2');
3174 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3175 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3177 Name
:= 'mOptionsPlayersMIMenu';
3178 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3183 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3188 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3190 Name
:= 'meComment';
3193 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3194 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3197 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3201 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3202 g_GUI_AddWindow(Menu
);
3204 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3205 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3207 Name
:= 'mOptionsPlayersP1WeaponMenu';
3208 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3210 Name
:= 'swWeaponAutoswitch';
3211 AddItem(_lc
[I_MENU_NO
]);
3212 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3213 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3215 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3217 Name
:= 'swWeaponAllowEmpty';
3218 AddItem(_lc
[I_MENU_YES
]);
3219 AddItem(_lc
[I_MENU_NO
]);
3221 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3223 Name
:= 'swWeaponAllowFist';
3224 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3225 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3227 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3230 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3231 g_GUI_AddWindow(Menu
);
3233 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3234 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3236 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3237 for i
:= WP_FIRST
to WP_LAST
do
3239 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3241 Name
:= IntToStr(i
);
3242 for a
:= WP_FIRST
to WP_LAST
+1 do
3244 AddItem(IntToStr(a
));
3249 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3251 Name
:= IntToStr(WP_LAST
+1);
3252 for a
:= WP_FIRST
to WP_LAST
+1 do
3254 AddItem(IntToStr(a
));
3256 ItemIndex
:= WP_LAST
+ 1;
3259 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3260 g_GUI_AddWindow(Menu
);
3263 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3264 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3266 Name
:= 'mOptionsPlayersP2WeaponMenu';
3267 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3269 Name
:= 'swWeaponAutoswitch';
3270 AddItem(_lc
[I_MENU_NO
]);
3271 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3272 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3274 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3276 Name
:= 'swWeaponAllowEmpty';
3277 AddItem(_lc
[I_MENU_YES
]);
3278 AddItem(_lc
[I_MENU_NO
]);
3280 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3282 Name
:= 'swWeaponAllowFist';
3283 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3284 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3286 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3289 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3290 g_GUI_AddWindow(Menu
);
3292 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3293 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3295 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3296 for i
:= WP_FIRST
to WP_LAST
do
3298 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3300 Name
:= IntToStr(i
);
3301 for a
:= WP_FIRST
to WP_LAST
+1 do
3303 AddItem(IntToStr(a
));
3308 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3310 Name
:= IntToStr(WP_LAST
+1);
3311 for a
:= WP_FIRST
to WP_LAST
+1 do
3313 AddItem(IntToStr(a
));
3315 ItemIndex
:= WP_LAST
+ 1;
3318 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3319 g_GUI_AddWindow(Menu
);
3321 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3322 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3324 Name
:= 'mOptionsLanguageMenu';
3325 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3326 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3329 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3330 g_GUI_AddWindow(Menu
);
3332 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3333 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3334 g_GUI_AddWindow(Menu
);
3336 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3337 Menu
.BackTexture
:= 'INTER';
3338 Menu
.OnClose
:= ProcAuthorsClose
;
3342 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3344 Color
:= _RGB(255, 0, 0);
3345 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3347 _y
:= _y
+GetHeight();
3349 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3351 Color
:= _RGB(255, 0, 0);
3352 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3354 _y
:= _y
+GetHeight()+32;
3356 // ×òî äåëàë: Êòî äåëàë
3357 cx
:= gScreenWidth
div 2 - 320 + 64;
3358 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3360 Color
:= _RGB(255, 0, 0);
3365 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3367 Color
:= _RGB(255, 255, 255);
3372 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3374 Color
:= _RGB(255, 0, 0);
3379 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3381 Color
:= _RGB(255, 255, 255);
3386 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3388 Color
:= _RGB(255, 255, 255);
3393 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3395 Color
:= _RGB(255, 0, 0);
3400 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3402 Color
:= _RGB(255, 255, 255);
3407 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3409 Color
:= _RGB(255, 0, 0);
3414 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3416 Color
:= _RGB(255, 255, 255);
3419 _y
:= gScreenHeight
- 128;
3422 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3424 Color
:= _RGB(255, 0, 0);
3429 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3431 Color
:= _RGB(255, 255, 255);
3434 _y
:= _y
+GetHeight();
3436 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3438 Color
:= _RGB(255, 255, 255);
3441 _y
:= _y
+GetHeight();
3443 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3445 Color
:= _RGB(255, 255, 255);
3448 _y
:= gScreenHeight
- 32;
3450 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3452 Color
:= _RGB(255, 0, 0);
3453 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3456 g_GUI_AddWindow(Menu
);
3458 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3459 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3460 g_GUI_AddWindow(Menu
);
3462 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3463 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3465 Name
:= 'mmGameSingleMenu';
3466 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3467 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3468 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3469 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3470 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3471 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3473 Menu
.DefControl
:= 'mmGameSingleMenu';
3474 Menu
.MainWindow
:= True;
3475 Menu
.OnClose
:= ProcGMClose
;
3476 Menu
.OnShow
:= ProcGMShow
;
3477 g_GUI_AddWindow(Menu
);
3479 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3480 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3481 g_GUI_AddWindow(Menu
);
3483 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3484 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3485 g_GUI_AddWindow(Menu
);
3487 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3488 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3490 Name
:= 'mmGameCustomMenu';
3491 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3492 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3493 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3494 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3495 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3496 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3497 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3499 Menu
.DefControl
:= 'mmGameCustomMenu';
3500 Menu
.MainWindow
:= True;
3501 Menu
.OnClose
:= ProcGMClose
;
3502 Menu
.OnShow
:= ProcGMShow
;
3503 g_GUI_AddWindow(Menu
);
3505 Menu
:= TGUIWindow
.Create('GameServerMenu');
3506 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3508 Name
:= 'mmGameServerMenu';
3509 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3510 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3511 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3512 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3513 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3515 Menu
.DefControl
:= 'mmGameServerMenu';
3516 Menu
.MainWindow
:= True;
3517 Menu
.OnClose
:= ProcGMClose
;
3518 Menu
.OnShow
:= ProcGMShow
;
3519 g_GUI_AddWindow(Menu
);
3521 Menu
:= TGUIWindow
.Create('GameClientMenu');
3522 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3524 Name
:= 'mmGameClientMenu';
3525 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3526 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3527 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3529 Menu
.DefControl
:= 'mmGameClientMenu';
3530 Menu
.MainWindow
:= True;
3531 Menu
.OnClose
:= ProcGMClose
;
3532 Menu
.OnShow
:= ProcGMShow
;
3533 g_GUI_AddWindow(Menu
);
3535 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3536 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3538 Name
:= 'mClientPasswordMenu';
3539 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3547 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3550 Menu
.DefControl
:= 'mClientPasswordMenu';
3551 g_GUI_AddWindow(Menu
);
3553 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3554 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3556 Name
:= 'mGameSetGameMenu';
3557 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3559 Name
:= 'swTeamDamage';
3560 AddItem(_lc
[I_MENU_YES
]);
3561 AddItem(_lc
[I_MENU_NO
]);
3564 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3566 Name
:= 'swTeamHit';
3567 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3568 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3569 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3570 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3573 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3575 Name
:= 'swDeathmatchKeys';
3576 AddItem(_lc
[I_MENU_YES
]);
3577 AddItem(_lc
[I_MENU_NO
]);
3580 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3582 Name
:= 'edTimeLimit';
3587 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3589 Name
:= 'edScoreLimit';
3594 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3596 Name
:= 'edMaxLives';
3601 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3604 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3605 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3606 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3609 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3611 Name
:= 'swFlagDrop';
3612 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3613 AddItem(_lc
[I_MENU_YES
]);
3614 AddItem(_lc
[I_MENU_NO
]);
3620 Menu
.DefControl
:= 'mGameSetGameMenu';
3621 Menu
.OnClose
:= ProcApplyGameSet
;
3622 g_GUI_AddWindow(Menu
);
3624 Menu
:= TGUIWindow
.Create('TeamMenu');
3625 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3627 Name
:= 'mmTeamMenu';
3628 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3629 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3630 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3631 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3632 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3634 Menu
.DefControl
:= 'mmTeamMenu';
3635 Menu
.OnShow
:= ProcChangePlayers
;
3636 g_GUI_AddWindow(Menu
);
3639 procedure g_Menu_Show_SaveMenu();
3641 if g_Game_IsTestMap
then
3643 if gGameSettings
.GameType
= GT_SINGLE
then
3644 g_GUI_ShowWindow('GameSingleMenu')
3647 if g_Game_IsClient
then
3650 if g_Game_IsNet
then
3653 g_GUI_ShowWindow('GameCustomMenu');
3655 g_GUI_ShowWindow('SaveMenu');
3656 g_Sound_PlayEx('MENU_OPEN');
3659 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3661 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3662 if gGameSettings
.GameType
= GT_SINGLE
then
3664 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3668 if g_Game_IsClient
then exit
;
3669 if g_Game_IsNet
then exit
;
3670 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3672 g_GUI_ShowWindow('LoadMenu');
3673 g_Sound_PlayEx('MENU_OPEN');
3676 procedure g_Menu_Show_GameSetGame();
3678 if gGameSettings
.GameType
= GT_SINGLE
then
3679 g_GUI_ShowWindow('GameSingleMenu')
3682 if g_Game_IsClient
then
3685 if g_Game_IsNet
then
3686 g_GUI_ShowWindow('GameServerMenu')
3688 g_GUI_ShowWindow('GameCustomMenu');
3691 g_GUI_ShowWindow('GameSetGameMenu');
3692 g_Sound_PlayEx('MENU_OPEN');
3695 procedure g_Menu_Show_OptionsVideo();
3697 if gGameSettings
.GameType
= GT_SINGLE
then
3698 g_GUI_ShowWindow('GameSingleMenu')
3701 if g_Game_IsClient
then
3702 g_GUI_ShowWindow('GameClientMenu')
3704 if g_Game_IsNet
then
3705 g_GUI_ShowWindow('GameServerMenu')
3707 g_GUI_ShowWindow('GameCustomMenu');
3710 g_GUI_ShowWindow('OptionsMenu');
3711 g_GUI_ShowWindow('OptionsVideoMenu');
3712 g_Sound_PlayEx('MENU_OPEN');
3715 procedure g_Menu_Show_OptionsSound();
3717 if gGameSettings
.GameType
= GT_SINGLE
then
3718 g_GUI_ShowWindow('GameSingleMenu')
3721 if g_Game_IsClient
then
3722 g_GUI_ShowWindow('GameClientMenu')
3724 if g_Game_IsNet
then
3725 g_GUI_ShowWindow('GameServerMenu')
3727 g_GUI_ShowWindow('GameCustomMenu');
3730 g_GUI_ShowWindow('OptionsMenu');
3731 g_GUI_ShowWindow('OptionsSoundMenu');
3732 g_Sound_PlayEx('MENU_OPEN');
3735 procedure g_Menu_Show_EndGameMenu();
3737 g_GUI_ShowWindow('EndGameMenu');
3738 g_Sound_PlayEx('MENU_OPEN');
3741 procedure g_Menu_Show_QuitGameMenu();
3743 g_GUI_ShowWindow('ExitMenu');
3744 g_Sound_PlayEx('MENU_OPEN');
3747 procedure g_Menu_Init();
3753 procedure g_Menu_Free();
3758 procedure g_Menu_Reset();
3762 g_GUI_SaveMenuPos();
3763 ex
:= g_GUI_Destroy();
3767 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3772 g_Game_SetDebugMode();
3774 g_GUI_LoadMenuPos();