1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
48 {$IFDEF ENABLE_SHELLS}
51 {$IFDEF ENABLE_CORPSES}
54 {$IFDEF ENABLE_RENDER}
57 {$IFDEF ENABLE_SYSTEM}
61 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
62 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
63 MAPDEF
, Math
, g_saveload
,
65 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
69 type TYNCallback
= procedure (yes
:Boolean);
71 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
73 if win
.UserData
= nil then exit
;
75 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
76 IK_N
: TYNCallback(win
.UserData
)(false);
80 procedure YesButtonCB (ctl
: TGUITextButton
);
82 if ctl
.UserData
= nil then exit
;
83 TYNCallback(ctl
.UserData
)(true);
86 procedure NoButtonCB (ctl
: TGUITextButton
);
88 if ctl
.UserData
= nil then exit
;
89 TYNCallback(ctl
.UserData
)(false);
92 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
96 //if length(Text) = 0 then exit;
97 Result
:= TGUIWindow
.Create(WinName
);
100 //OnKeyDownEx := @YNKeyDownProc;
101 //UserData := @ActionProc;
102 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
105 Name
:= '__temp_yes_no_menu:'+WinName
;
107 AddText(Text, MaxLen
);
108 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
109 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
111 DefControl
:= '__temp_yes_no_menu:'+WinName
;
117 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
118 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
120 procedure ProcApplyOptions();
125 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
127 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
132 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
134 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
135 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
136 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
138 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
140 g_Sound_SetupAllVolumes(
141 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
142 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
145 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
146 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
147 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
148 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
149 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
151 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
154 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
156 {$IFDEF ENABLE_SHELLS}
157 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
160 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
162 {$IFDEF ENABLE_CORPSES}
163 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
167 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
172 else gGibsCount
:= 48;
176 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
177 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
178 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
179 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
180 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
181 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
182 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
183 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
184 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
185 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
186 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
187 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
189 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
190 g_dbg_scale
:= TempScale
+ 1;
193 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
197 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
199 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
201 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
202 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
203 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
204 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
207 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
210 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
211 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
212 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
213 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
214 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
215 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
216 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
217 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
218 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
219 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
231 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
232 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
233 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
234 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
235 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
236 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
237 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
238 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
239 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
240 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
247 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
249 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
253 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
256 for i
:= WP_FIRST
to WP_LAST
do
258 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
260 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
265 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
268 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
269 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
270 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
271 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
272 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
273 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
274 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
275 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
276 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
277 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
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_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
289 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
290 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
291 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
292 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
293 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
294 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
295 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
296 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
297 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
298 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
302 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
304 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
305 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
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');
311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
314 for i
:= WP_FIRST
to WP_LAST
do
316 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
317 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
318 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
319 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
323 if e_HasJoysticks
then
325 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
328 for i
:= 0 to e_MaxJoys
- 1 do
329 if e_JoystickAvailable
[i
] then
330 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
334 if g_touch_enabled
then
336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
337 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
338 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
339 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
340 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
343 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
345 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
346 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
347 TEAM_RED
, TEAM_BLUE
);
349 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
351 gPlayer1Settings
.Model
:= Model
.GetName();
352 gPlayer1Settings
.Color
:= Model
.Color
;
355 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 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
367 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
369 if g_Game_IsServer
then
371 if gPlayer1
<> nil then
373 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
374 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
375 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
376 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
378 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
381 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
384 if gPlayer2
<> nil then
386 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
387 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
388 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
389 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
391 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
396 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
398 g_Console_WriteGameConfig
;
401 procedure ReadOptions();
406 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
408 with TGUISwitch(menu
.GetControl('swBPP')) do
414 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
415 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
417 with TGUISwitch(menu
.GetControl('swVSync')) do
418 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
420 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
421 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
423 with TGUISwitch(menu
.GetControl('swInterp')) do
424 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
426 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
428 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
429 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
430 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
432 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
433 if gMuteWhenInactive
then
438 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
440 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
441 if gSoundEffectsDF
then
446 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
447 if gUseChatSounds
then
452 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
457 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
458 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
459 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
460 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
478 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
481 for i
:= WP_FIRST
to WP_LAST
do
483 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
484 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
488 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
517 for i
:= WP_FIRST
to WP_LAST
do
519 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
520 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
524 if e_HasJoysticks
then
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
529 for i
:= 0 to e_MaxJoys
- 1 do
530 if e_JoystickAvailable
[i
] then
531 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
535 if g_touch_enabled
then
537 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
538 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
539 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
540 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
541 with TGUISwitch(menu
.GetControl('swTouchFire')) do
542 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
543 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
546 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
549 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
550 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
551 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
552 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
555 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
558 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
560 {$IFDEF ENABLE_SHELLS}
561 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
564 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
566 {$IFDEF ENABLE_CORPSES}
567 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
569 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
571 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
574 with TGUISwitch(menu
.GetControl('swBloodType')) do
575 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
577 with TGUISwitch(menu
.GetControl('swCorpseType')) do
578 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
580 with TGUISwitch(menu
.GetControl('swGibsType')) do
581 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
584 with TGUISwitch(menu
.GetControl('swGibsCount')) do
596 with TGUISwitch(menu
.GetControl('swBackGround')) do
597 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
599 with TGUISwitch(menu
.GetControl('swMessages')) do
600 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
602 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
603 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
605 with TGUISwitch(menu
.GetControl('swChatBubble')) do
606 ItemIndex
:= gChatBubble
;
608 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
609 ItemIndex
:= gPlayerIndicator
;
611 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
612 ItemIndex
:= gPlayerIndicatorStyle
;
614 TempScale
:= Round(g_dbg_scale
- 1);
615 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
617 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
619 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
620 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
622 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
623 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
625 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
626 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
627 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
629 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
631 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
632 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
634 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
635 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
637 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
638 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
639 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
641 ProcSelectModel(nil);
644 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
646 // don't turn off monsters in DM
648 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
649 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
650 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
652 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
655 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
656 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
657 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
658 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
662 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
664 // don't turn off monsters in DM
666 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
667 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
668 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
670 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
673 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
674 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
675 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
676 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
680 function LatchGameOptions(const MenuName
: string): Byte;
686 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
688 Map
:= TGUILabel(GetControl('lbMap')).Text;
691 if not isWadPath(Map
) then
694 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
695 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
696 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
697 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
698 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
699 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
700 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
704 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
705 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
706 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
707 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
708 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
709 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
710 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
711 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
712 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
713 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
715 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
716 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
717 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
718 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
721 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
722 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
723 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
724 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
727 // TODO: get this crap out of here
728 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
729 gGameSettings
.WarmupTime
:= gsWarmupTime
;
730 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
734 procedure ProcStartCustomGame();
738 GameMode
:= LatchGameOptions('mCustomGameMenu');
739 if GameMode
= GM_NONE
then Exit
;
741 g_Console_WriteGameConfig
;
742 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
743 gsMaxLives
, gsGameFlags
, gsPlayers
);
747 procedure ProcStartNetGame();
751 GameMode
:= LatchGameOptions('mNetServerMenu');
752 if GameMode
= GM_NONE
then Exit
;
754 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
756 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
757 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
758 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
759 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
760 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
761 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
764 g_Console_WriteGameConfig
;
765 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
766 gsGameFlags
, gsPlayers
, 0, NetPort
);
769 procedure ProcConnectNetGame();
773 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
775 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
776 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
777 PW
:= TGUIEdit(GetControl('edPW')).Text;
780 g_Console_WriteGameConfig
;
781 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
784 procedure ProcEnterPassword();
788 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
790 NetClientIP
:= PromptIP
;
791 NetClientPort
:= PromptPort
;
792 PW
:= TGUIEdit(GetControl('edPW')).Text;
795 g_Console_WriteGameConfig
;
796 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
799 procedure ProcServerlist();
801 if not NetInitDone
then
803 if (not g_Net_Init()) then
805 g_Console_Add('NET: ERROR: Failed to init ENet!');
812 g_Net_Slist_Set(NetMasterList
);
814 gState
:= STATE_SLIST
;
815 g_ActiveWindow
:= nil;
817 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
819 {$IFDEF ENABLE_RENDER}
822 {$IFDEF ENABLE_SYSTEM}
826 slReturnPressed
:= True;
827 if g_Net_Slist_Fetch(slCurrent
) then
829 if slCurrent
= nil then
830 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
833 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
834 g_Serverlist_GenerateTable(slCurrent
, slTable
);
837 procedure ProcStartCampaign();
843 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
845 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
846 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
848 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
854 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
857 procedure ProcSelectMap(Sender
: TGUIControl
);
861 wad
, map
, res
: String;
863 win
:= g_GUI_GetWindow('SelectMapMenu');
864 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
866 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
867 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
869 if (wad
= '') or (map
= '') then
870 begin // Ýòî íå êàðòà
871 TGUILabel(GetControl('lbMapName')).Text := '';
872 TGUILabel(GetControl('lbMapAuthor')).Text := '';
873 TGUILabel(GetControl('lbMapSize')).Text := '';
874 TGUIMemo(GetControl('meMapDescription')).SetText('');
875 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
876 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
882 a
:= g_Map_GetMapInfo(res
);
884 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
885 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
886 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
887 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
888 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
889 TGUILabel(win
.GetControl('lbMapScale')).Text :=
890 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
895 procedure ProcSelectWAD(Sender
: TGUIControl
);
900 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
902 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
904 with TGUIListBox(GetControl('lsMapRes')) do
910 list
:= g_Map_GetMapsList(wad
);
924 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
930 win
:= g_GUI_GetWindow('CampaignMenu');
931 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
933 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
937 TGUILabel(GetControl('lbWADName')).Text := '';
938 TGUILabel(GetControl('lbWADAuthor')).Text := '';
939 TGUIMemo(GetControl('meWADDescription')).SetText('');
942 a
:= g_Game_GetMegaWADInfo(wad
);
944 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
945 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
946 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
948 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
952 fn
:= g_ExtractWadName(a
.pic
);
954 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
956 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
961 procedure ProcChangeColor(Sender
: TGUIControl
);
965 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
966 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
967 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
968 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
969 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
970 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
972 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
973 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
974 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
975 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
976 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
977 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
980 procedure ProcSelectModel(Sender
: TGUIControl
);
985 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
986 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
987 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
989 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
990 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
991 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
993 ProcChangeColor(nil);
996 procedure MenuLoadData();
998 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1000 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1001 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1002 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1003 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1004 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1005 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1006 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1009 procedure MenuFreeData();
1011 g_Sound_Delete('MENU_SELECT');
1012 g_Sound_Delete('MENU_OPEN');
1013 g_Sound_Delete('MENU_CLOSE');
1014 g_Sound_Delete('MENU_CHANGE');
1015 g_Sound_Delete('SCROLL_ADD');
1016 g_Sound_Delete('SCROLL_SUB');
1017 g_Sound_Delete('SOUND_PLAYER_FALL');
1020 procedure ProcAuthorsMenu();
1022 gMusic
.SetByName('MUSIC_INTERMUS');
1026 procedure ProcExitMenuKeyDown (yes
: Boolean);
1029 snd
: TPlayableSound
;
1034 g_Game_StopAllSounds(True);
1035 case (Random(18)) of
1036 0: s
:= 'SOUND_MONSTER_PAIN';
1037 1: s
:= 'SOUND_MONSTER_DIE_3';
1038 2: s
:= 'SOUND_MONSTER_SLOP';
1039 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1040 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1041 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1042 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1043 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1044 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1045 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1046 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1047 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1048 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1049 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1050 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1051 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1052 else s
:= 'SOUND_PLAYER_FALL';
1054 snd
:= TPlayableSound
.Create();
1055 res
:= snd
.SetByName(s
);
1056 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1060 while snd
.IsPlaying() do begin end;
1068 procedure ProcLoadMenu();
1075 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1076 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1077 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1081 procedure ProcSaveMenu();
1089 name
:= g_GetSaveName(a
, valid
);
1090 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1091 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1095 procedure ProcSaveGame(Sender
: TGUIControl
);
1099 if g_Game_IsNet
then Exit
;
1100 if g_Game_IsTestMap
then Exit
;
1101 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1102 g_Game_PauseAllSounds(True);
1103 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1105 g_ActiveWindow
:= nil;
1106 g_Game_Pause(False);
1109 procedure ProcLoadGame(Sender
: TGUIControl
);
1113 if g_Game_IsNet
then Exit
;
1114 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1115 if g_LoadGame(a
) then
1117 g_Game_PauseAllSounds(False)
1119 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1121 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1122 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1123 //g_ActiveWindow := nil;
1127 procedure ProcSinglePlayer (n
: Integer);
1128 var wad
, map
: AnsiString;
1131 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1132 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1133 if e_FindResource(AllMapDirs
, wad
) then
1135 wad
:= ExpandFileName(wad
);
1136 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1140 procedure ProcSingle1Player
;
1145 procedure ProcSingle2Players
;
1150 procedure ProcSelectMapMenu();
1153 wad_lb
: TGUIFileListBox
;
1154 map_lb
: TGUIListBox
;
1157 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1158 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1159 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1161 if wad_lb
.SelectedItem() <> '' then
1162 map
:= map_lb
.SelectedItem()
1166 wad_lb
.UpdateFileList();
1169 if wad_lb
.SelectedItem() <> '' then
1172 map_lb
.SelectItem(map
);
1174 if map_lb
.SelectedItem() <> '' then
1178 g_GUI_ShowWindow('SelectMapMenu');
1181 procedure ProcSelectCampaignMenu();
1184 wad_lb
: TGUIFileListBox
;
1186 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1187 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1189 wad_lb
.UpdateFileList();
1191 if wad_lb
.SelectedItem() <> '' then
1192 ProcSelectCampaignWAD(nil);
1195 procedure ProcSetMap();
1197 wad
, map
, res
: String;
1199 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1201 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1202 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1205 if (wad
= '') or (map
= '') then
1208 wad
:= e_FindWadRel(MapDirs
, WAD
);
1210 res
:= wad
+':\'+map
;
1212 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1213 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1216 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1220 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1222 g_Sound_SetupAllVolumes(
1223 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1224 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1228 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1232 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1233 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1235 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1236 g_dbg_scale
:= TempScale
+ 1;
1240 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1244 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1245 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1246 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1247 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1250 procedure ProcOptionsPlayersMIMenu();
1255 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1257 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1259 if a
= '' then Exit
;
1261 i
:= g_PlayerModel_GetIndex(a
);
1262 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1264 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1265 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1266 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1268 if PlayerModelsArray
[i
].HaveWeapon
then
1269 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1271 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1274 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1277 procedure ProcOptionsPlayersAnim();
1281 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1286 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1289 Model
.AnimState
.Loop
:= True;
1293 procedure ProcOptionsPlayersWeap();
1297 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1302 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1306 procedure ProcOptionsPlayersRot();
1310 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1311 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1313 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1317 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1321 g_Options_SetDefault();
1327 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1329 if yes
then ReadOptions();
1333 procedure ProcAuthorsClose();
1335 gMusic
.SetByName('MUSIC_MENU');
1337 gState
:= STATE_MENU
;
1340 procedure ProcGMClose();
1342 g_Game_InGameMenu(False);
1345 procedure ProcGMShow();
1350 if (gGameSettings
.GameType
= GT_SINGLE
) and
1351 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1352 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1353 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1355 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1356 if g_Game_IsTestMap
then
1357 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1358 TGUIMainMenu(g_ActiveWindow
.GetControl(
1359 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1362 procedure ProcChangePlayers();
1364 TeamGame
, Spectator
, AddTwo
: Boolean;
1365 P1Team
{, P2Team}: Byte;
1366 bP2
: TGUITextButton
;
1368 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1369 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1370 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1371 P1Team
:= TEAM_NONE
;
1372 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1374 //P2Team := TEAM_NONE;
1375 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1377 TGUIMainMenu(g_ActiveWindow
.GetControl(
1378 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1379 TGUIMainMenu(g_ActiveWindow
.GetControl(
1380 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1381 TGUIMainMenu(g_ActiveWindow
.GetControl(
1382 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1384 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1385 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1386 bP2
.Enabled
:= AddTwo
and not Spectator
;
1388 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1390 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1391 if gPlayer2
= nil then
1392 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1394 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1396 TGUIMainMenu(g_ActiveWindow
.GetControl(
1397 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1400 procedure ProcJoinRed();
1402 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1404 if g_Game_IsServer
then
1406 if gPlayer1
= nil then
1407 g_Game_AddPlayer(TEAM_RED
)
1410 if gPlayer1
.Team
<> TEAM_RED
then
1412 gPlayer1
.SwitchTeam
;
1413 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1416 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1421 gPlayer1Settings
.Team
:= TEAM_RED
;
1422 MC_SEND_PlayerSettings
;
1423 if gPlayer1
= nil then
1424 g_Game_AddPlayer(TEAM_RED
);
1426 g_ActiveWindow
:= nil;
1427 g_Game_Pause(False);
1430 procedure ProcJoinBlue();
1432 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1434 if g_Game_IsServer
then
1436 if gPlayer1
= nil then
1437 g_Game_AddPlayer(TEAM_BLUE
)
1440 if gPlayer1
.Team
<> TEAM_BLUE
then
1442 gPlayer1
.SwitchTeam
;
1443 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1446 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1451 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1452 MC_SEND_PlayerSettings
;
1453 if gPlayer1
= nil then
1454 g_Game_AddPlayer(TEAM_BLUE
);
1456 g_ActiveWindow
:= nil;
1457 g_Game_Pause(False);
1460 procedure ProcJoinGame();
1462 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1464 if gPlayer1
= nil then
1466 g_ActiveWindow
:= nil;
1467 g_Game_Pause(False);
1470 procedure ProcSwitchP2();
1472 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1474 if gPlayer1
= nil then
1476 if gPlayer2
= nil then
1479 g_Game_RemovePlayer();
1480 g_ActiveWindow
:= nil;
1481 g_Game_Pause(False);
1484 procedure ProcSpectate();
1486 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1489 g_ActiveWindow
:= nil;
1490 g_Game_Pause(False);
1493 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1495 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1498 procedure ProcEndMenuKeyDown (yes
: Boolean);
1500 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1503 procedure ProcSetRussianLanguage
;
1505 if gLanguage
<> LANGUAGE_RUSSIAN
then
1507 gLanguage
:= LANGUAGE_RUSSIAN
;
1508 gLanguageChange
:= True;
1509 gAskLanguage
:= False;
1514 procedure ProcSetEnglishLanguage
;
1516 if gLanguage
<> LANGUAGE_ENGLISH
then
1518 gLanguage
:= LANGUAGE_ENGLISH
;
1519 gLanguageChange
:= True;
1520 gAskLanguage
:= False;
1525 procedure ReadGameSettings();
1529 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1531 with gGameSettings
do
1533 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1534 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1538 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1539 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1541 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1543 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1547 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1548 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1553 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1554 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1555 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1557 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1558 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1559 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1562 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1567 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1569 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1570 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1571 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1573 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1574 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1578 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1579 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1581 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1582 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1583 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1584 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1585 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1586 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1587 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1591 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1592 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1593 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1594 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1595 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1600 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1601 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1606 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1607 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1612 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1613 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1618 procedure ProcApplyGameSet();
1622 stat
: TPlayerStatArray
;
1624 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1626 if not g_Game_IsServer
then Exit
;
1628 with gGameSettings
do
1630 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1632 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1633 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1635 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1638 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1640 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1641 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1642 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1643 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1644 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1648 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1650 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1651 Options
:= Options
or GAME_OPTION_DMKEYS
1653 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1656 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1658 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1664 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1666 TimeLimit
:= Max(n
, b
);
1670 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1672 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1679 if GameMode
= GM_DM
then
1681 stat
:= g_Player_GetStats();
1683 for a
:= 0 to High(stat
) do
1684 if stat
[a
].Frags
> b
then
1688 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1690 GoalLimit
:= Max(n
, b
);
1694 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1696 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1697 if n
< 0 then n
:= 0;
1698 if n
> 255 then n
:= 255;
1704 stat
:= g_Player_GetStats();
1706 for a
:= 0 to High(stat
) do
1707 if stat
[a
].Lives
> b
then
1710 MaxLives
:= Max(n
, b
);
1714 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1716 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1719 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1720 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1724 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1725 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1729 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1730 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1735 // don't forget to latch this shit
1736 gsGameFlags
:= Options
;
1737 gsMaxLives
:= MaxLives
;
1738 gsGoalLimit
:= GoalLimit
;
1739 gsTimeLimit
:= TimeLimit
;
1742 if g_Game_IsNet
then MH_SEND_GameSettings
;
1745 procedure ProcVideoOptionsRes();
1750 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1752 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1753 IntToStr(gWinSizeX
) +
1754 ' x ' + IntToStr(gWinSizeY
) +
1755 ', ' + IntToStr(gBPP
) + ' bpp';
1757 with TGUIListBox(menu
.GetControl('lsResolution')) do
1759 list
:= sys_GetDisplayModes(gBPP
);
1763 ItemIndex
:= Length(list
)
1771 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1777 TempResScale
:= Round(r_pixel_scale
- 1);
1778 with TGUISwitch(menu
.GetControl('swResFactor')) do
1779 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1782 procedure ProcApplyVideoOptions();
1785 Fullscreen
: Boolean;
1786 SWidth
, SHeight
: Integer;
1787 ScaleChanged
: Boolean;
1790 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1792 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1794 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1797 SWidth
:= gWinSizeX
;
1798 SHeight
:= gWinSizeY
;
1799 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1802 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1804 ScaleChanged
:= False;
1805 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1807 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1808 r_pixel_scale
:= TempResScale
+ 1;
1809 ScaleChanged
:= True;
1812 if (SWidth
<> gWinSizeX
) or
1813 (SHeight
<> gWinSizeY
) or
1814 (Fullscreen
<> gFullscreen
) or
1817 gResolutionChange
:= True;
1818 gRC_Width
:= SWidth
;
1819 gRC_Height
:= SHeight
;
1820 gRC_FullScreen
:= Fullscreen
;
1821 gRC_Maximized
:= gWinMaximized
;
1824 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1828 procedure ProcSetFirstRussianLanguage
;
1830 gLanguage
:= LANGUAGE_RUSSIAN
;
1831 gLanguageChange
:= True;
1832 gAskLanguage
:= False;
1835 procedure ProcSetFirstEnglishLanguage
;
1837 gLanguage
:= LANGUAGE_ENGLISH
;
1838 gLanguageChange
:= True;
1839 gAskLanguage
:= False;
1842 procedure ProcRecallAddress();
1844 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1846 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1847 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1851 procedure CreateFirstLanguageMenu();
1855 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1857 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do // space to prevent show logo
1859 Name
:= 'mmFirstLanguageMenu';
1860 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1861 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1864 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1865 Menu
.MainWindow
:= True;
1866 g_GUI_AddWindow(Menu
);
1869 procedure g_Menu_AskLanguage();
1871 CreateFirstLanguageMenu();
1872 g_GUI_ShowWindow('FirstLanguageMenu');
1875 procedure CreatePlayerOptionsMenu(s
: String);
1880 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1882 a
:= _lc
[I_MENU_PLAYER_1
]
1884 a
:= _lc
[I_MENU_PLAYER_2
];
1885 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1887 Name
:= 'mOptionsPlayers'+s
+'Menu';
1888 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1890 Name
:= 'ed'+s
+'Name';
1894 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1896 Name
:= 'sw'+s
+'Team';
1897 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1898 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1900 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1902 Name
:= 'ls'+s
+'Model';
1904 Items
:= g_PlayerModel_GetNames();
1905 OnChange
:= ProcSelectModel
;
1907 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1909 Name
:= 'sc'+s
+'Red';
1911 OnChange
:= ProcChangeColor
;
1913 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1915 Name
:= 'sc'+s
+'Green';
1917 OnChange
:= ProcChangeColor
;
1919 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1921 Name
:= 'sc'+s
+'Blue';
1923 OnChange
:= ProcChangeColor
;
1926 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1927 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1928 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1929 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1931 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1933 Name
:= 'mv'+s
+'Model';
1934 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1935 Y
:= GetControl('ls'+s
+'Model').Y
;
1938 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1939 g_GUI_AddWindow(Menu
);
1942 procedure CreateAllMenus();
1946 a
, cx
, _y
, i
: Integer;
1949 Menu
:= TGUIWindow
.Create('MainMenu');
1950 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
1952 Name
:= 'mmMainMenu';
1953 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1954 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1955 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1956 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1957 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1958 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1960 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1962 Color
:= _RGB(255, 255, 255);
1963 X
:= gScreenWidth
-GetWidth
-8;
1964 Y
:= gScreenHeight
-GetHeight
-8;
1966 Menu
.DefControl
:= 'mmMainMenu';
1967 Menu
.MainWindow
:= True;
1968 g_GUI_AddWindow(Menu
);
1970 Menu
:= TGUIWindow
.Create('NewGameMenu');
1971 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1973 Name
:= 'mmNewGameMenu';
1974 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1975 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1976 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1977 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1979 Menu
.DefControl
:= 'mmNewGameMenu';
1980 g_GUI_AddWindow(Menu
);
1982 Menu
:= TGUIWindow
.Create('NetGameMenu');
1983 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1985 Name
:= 'mmNetGameMenu';
1986 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1987 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1989 Menu
.DefControl
:= 'mmNetGameMenu';
1990 g_GUI_AddWindow(Menu
);
1992 Menu
:= TGUIWindow
.Create('NetServerMenu');
1993 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1995 Name
:= 'mNetServerMenu';
1996 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1998 Name
:= 'edSrvName';
1999 OnlyDigits
:= False;
2002 Text := NetServerName
;
2004 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2006 Name
:= 'edSrvPassword';
2007 OnlyDigits
:= False;
2010 Text := NetPassword
;
2012 with AddEdit(_lc
[I_NET_PORT
]) do
2018 Text := IntToStr(NetPort
);
2020 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2022 Name
:= 'edMaxPlayers';
2026 Text := IntToStr(NetMaxClients
);
2028 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2030 Name
:= 'swUseMaster';
2031 AddItem(_lc
[I_MENU_YES
]);
2032 AddItem(_lc
[I_MENU_NO
]);
2033 if NetUseMaster
then
2039 with AddLabel(_lc
[I_MENU_MAP
]) do
2044 OnClick
:= @ProcSelectMapMenu
;
2046 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2048 Name
:= 'swGameMode';
2049 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2050 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2051 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2052 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2053 case g_Game_TextToMode(gsGameMode
) of
2055 GM_DM
: ItemIndex
:= 0;
2056 GM_TDM
: ItemIndex
:= 1;
2057 GM_CTF
: ItemIndex
:= 2;
2059 GM_COOP
: ItemIndex
:= 3;
2061 OnChange
:= ProcSwitchMonstersCustom
;
2063 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2065 Name
:= 'edTimeLimit';
2069 if gsTimeLimit
> 0 then
2070 Text := IntToStr(gsTimeLimit
);
2072 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2074 Name
:= 'edGoalLimit';
2078 if gsGoalLimit
> 0 then
2079 Text := IntToStr(gsGoalLimit
);
2081 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2083 Name
:= 'edMaxLives';
2087 if gsMaxLives
> 0 then
2088 Text := IntToStr(gsMaxLives
);
2090 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2092 Name
:= 'edItemRespawnTime';
2096 if gsItemRespawnTime
> 0 then
2097 Text := IntToStr(gsItemRespawnTime
);
2099 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2101 Name
:= 'swPlayers';
2102 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2103 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2104 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2105 ItemIndex
:= gsPlayers
;
2107 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2109 Name
:= 'swTeamDamage';
2110 AddItem(_lc
[I_MENU_YES
]);
2111 AddItem(_lc
[I_MENU_NO
]);
2112 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2117 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2119 Name
:= 'swTeamHit';
2120 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2121 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2122 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2123 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2124 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2126 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2128 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2133 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2135 Name
:= 'swDeathmatchKeys';
2136 AddItem(_lc
[I_MENU_YES
]);
2137 AddItem(_lc
[I_MENU_NO
]);
2138 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2143 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2145 Name
:= 'swEnableExits';
2146 AddItem(_lc
[I_MENU_YES
]);
2147 AddItem(_lc
[I_MENU_NO
]);
2148 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2153 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2155 Name
:= 'swWeaponStay';
2156 AddItem(_lc
[I_MENU_YES
]);
2157 AddItem(_lc
[I_MENU_NO
]);
2158 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2163 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2165 Name
:= 'swMonsters';
2166 AddItem(_lc
[I_MENU_YES
]);
2167 AddItem(_lc
[I_MENU_NO
]);
2168 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2173 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2176 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2177 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2178 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2180 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2182 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2186 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2190 Menu
.DefControl
:= 'mNetServerMenu';
2191 g_GUI_AddWindow(Menu
);
2193 Menu
:= TGUIWindow
.Create('NetClientMenu');
2194 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2196 Name
:= 'mNetClientMenu';
2198 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2201 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2207 Text := 'localhost';
2209 with AddEdit(_lc
[I_NET_PORT
]) do
2217 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2220 OnlyDigits
:= False;
2227 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2231 Menu
.DefControl
:= 'mNetClientMenu';
2232 g_GUI_AddWindow(Menu
);
2234 Menu
:= TGUIWindow
.Create('LoadMenu');
2235 Menu
.OnShow
:= ProcLoadMenu
;
2236 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2238 Name
:= 'mmLoadMenu';
2243 Name
:= 'edSlot'+IntToStr(a
);
2246 OnEnter
:= ProcLoadGame
;
2249 Menu
.DefControl
:= 'mmLoadMenu';
2250 g_GUI_AddWindow(Menu
);
2252 Menu
:= TGUIWindow
.Create('SaveMenu');
2253 Menu
.OnShow
:= ProcSaveMenu
;
2254 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2256 Name
:= 'mmSaveMenu';
2261 Name
:= 'edSlot'+IntToStr(a
);
2264 OnChange
:= ProcSaveGame
;
2267 Menu
.DefControl
:= 'mmSaveMenu';
2268 g_GUI_AddWindow(Menu
);
2270 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2271 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2273 Name
:= 'mCustomGameMenu';
2274 with AddLabel(_lc
[I_MENU_MAP
]) do
2279 OnClick
:= @ProcSelectMapMenu
;
2281 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2283 Name
:= 'swGameMode';
2284 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2285 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2286 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2287 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2288 case g_Game_TextToMode(gsGameMode
) of
2290 GM_DM
: ItemIndex
:= 0;
2291 GM_TDM
: ItemIndex
:= 1;
2292 GM_CTF
: ItemIndex
:= 2;
2294 GM_COOP
: ItemIndex
:= 3;
2296 OnChange
:= ProcSwitchMonstersCustom
;
2298 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2300 Name
:= 'edTimeLimit';
2304 if gsTimeLimit
> 0 then
2305 Text := IntToStr(gsTimeLimit
);
2307 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2309 Name
:= 'edGoalLimit';
2313 if gsGoalLimit
> 0 then
2314 Text := IntToStr(gsGoalLimit
);
2316 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2318 Name
:= 'edMaxLives';
2322 if gsMaxLives
> 0 then
2323 Text := IntToStr(gsMaxLives
);
2325 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2327 Name
:= 'edItemRespawnTime';
2331 if gsItemRespawnTime
> 0 then
2332 Text := IntToStr(gsItemRespawnTime
);
2334 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2336 Name
:= 'swPlayers';
2337 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2338 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2339 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2340 ItemIndex
:= gsPlayers
;
2342 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2344 Name
:= 'swTeamDamage';
2345 AddItem(_lc
[I_MENU_YES
]);
2346 AddItem(_lc
[I_MENU_NO
]);
2347 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2352 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2354 Name
:= 'swTeamHit';
2355 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2356 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2357 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2358 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2359 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2361 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2363 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2368 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2370 Name
:= 'swDeathmatchKeys';
2371 AddItem(_lc
[I_MENU_YES
]);
2372 AddItem(_lc
[I_MENU_NO
]);
2373 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2378 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2380 Name
:= 'swEnableExits';
2381 AddItem(_lc
[I_MENU_YES
]);
2382 AddItem(_lc
[I_MENU_NO
]);
2383 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2388 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2390 Name
:= 'swWeaponStay';
2391 AddItem(_lc
[I_MENU_YES
]);
2392 AddItem(_lc
[I_MENU_NO
]);
2393 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2398 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2400 Name
:= 'swMonsters';
2401 AddItem(_lc
[I_MENU_YES
]);
2402 AddItem(_lc
[I_MENU_NO
]);
2403 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2408 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2411 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2412 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2413 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2415 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2417 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2421 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2425 Menu
.DefControl
:= 'mCustomGameMenu';
2426 g_GUI_AddWindow(Menu
);
2428 Menu
:= TGUIWindow
.Create('CampaignMenu');
2429 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2431 Name
:= 'mCampaignMenu';
2440 with AddFileList('', 15, 4) do
2443 OnChange
:= ProcSelectCampaignWAD
;
2447 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2448 SetBase(MegawadDirs
);
2451 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2453 Name
:= 'lbWADName';
2457 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2459 Name
:= 'lbWADAuthor';
2463 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2464 with AddMemo('', 15, 3) do
2466 Name
:= 'meWADDescription';
2467 Color
:= MENU_ITEMSCTRL_COLOR
;
2469 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2471 Name
:= 'swPlayers';
2472 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2473 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2476 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2480 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2482 Name
:= 'mpWADImage';
2483 DefaultRes
:= 'NOPIC';
2484 X
:= GetControl('lsWAD').X
+4;
2485 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2488 Menu
.DefControl
:= 'mCampaignMenu';
2489 g_GUI_AddWindow(Menu
);
2491 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2492 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2494 Name
:= 'mSelectMapMenu';
2495 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2498 OnChange
:= ProcSelectWAD
;
2502 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2505 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2509 OnChange
:= ProcSelectMap
;
2512 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2514 Name
:= 'lbMapName';
2518 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2520 Name
:= 'lbMapAuthor';
2524 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2526 Name
:= 'lbMapSize';
2530 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2532 Name
:= 'meMapDescription';
2537 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2539 Name
:= 'mpMapPreview';
2540 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2541 Y
:= GetControl('lsMapWAD').Y
;
2543 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2545 Name
:= 'lbMapScale';
2548 Color
:= MENU_ITEMSCTRL_COLOR
;
2549 X
:= GetControl('lsMapWAD').X
+
2550 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2551 2 + MAPPREVIEW_WIDTH
*4;
2552 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2555 Menu
.OnClose
:= ProcSetMap
;
2556 Menu
.DefControl
:= 'mSelectMapMenu';
2557 g_GUI_AddWindow(Menu
);
2559 Menu
:= TGUIWindow
.Create('OptionsMenu');
2560 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2562 Name
:= 'mmOptionsMenu';
2563 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2564 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2565 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2566 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2567 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2568 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2570 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2571 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2573 Menu
.OnClose
:= ProcApplyOptions
;
2574 Menu
.DefControl
:= 'mmOptionsMenu';
2575 g_GUI_AddWindow(Menu
);
2577 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2578 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2579 g_GUI_AddWindow(Menu
);
2581 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2582 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2584 Name
:= 'mOptionsVideoMenu';
2585 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2586 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2592 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2595 AddItem(_lc
[I_MENU_YES
]);
2596 AddItem(_lc
[I_MENU_NO
]);
2598 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2600 Name
:= 'swTextureFilter';
2601 AddItem(_lc
[I_MENU_YES
]);
2602 AddItem(_lc
[I_MENU_NO
]);
2604 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2607 AddItem(_lc
[I_MENU_YES
]);
2608 AddItem(_lc
[I_MENU_NO
]);
2610 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2612 Name
:= 'swLegacyNPOT';
2613 AddItem(_lc
[I_MENU_NO
]);
2614 AddItem(_lc
[I_MENU_YES
]);
2617 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2620 Menu
.DefControl
:= 'mOptionsVideoMenu';
2621 g_GUI_AddWindow(Menu
);
2623 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2624 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2626 Name
:= 'mOptionsVideoResMenu';
2627 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2629 Name
:= 'lbCurrentRes';
2633 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2635 Name
:= 'lsResolution';
2638 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2640 Name
:= 'swFullScreen';
2641 AddItem(_lc
[I_MENU_YES
]);
2642 AddItem(_lc
[I_MENU_NO
]);
2644 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2646 Name
:= 'swResFactor';
2648 for i
:= 2 to gRC_Width
div 640 do
2649 AddItem(IntToStr(i
) + 'x');
2652 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2655 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2659 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2661 Name
:= 'mOptionsSoundMenu';
2662 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2664 Name
:= 'scMusicLevel';
2666 OnChange
:= ProcChangeSoundSettings
;
2668 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2670 Name
:= 'scSoundLevel';
2672 OnChange
:= ProcChangeSoundSettings
;
2674 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2676 Name
:= 'scMaxSimSounds';
2679 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2681 Name
:= 'swAnnouncer';
2682 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2683 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2684 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2685 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2687 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2688 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2690 Name
:= 'swSoundEffects';
2691 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2692 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2694 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2695 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2697 Name
:= 'swChatSpeech';
2698 AddItem(_lc
[I_MENU_YES
]);
2699 AddItem(_lc
[I_MENU_NO
]);
2701 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2703 Name
:= 'swInactiveSounds';
2704 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2705 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2709 Menu
.DefControl
:= 'mOptionsSoundMenu';
2710 g_GUI_AddWindow(Menu
);
2712 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2713 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2715 Name
:= 'mOptionsGameMenu';
2716 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2718 Name
:= 'scParticlesCount';
2721 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2723 Name
:= 'swBloodCount';
2724 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2725 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2726 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2727 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2728 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2730 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2732 Name
:= 'scShellsMax';
2735 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2737 Name
:= 'scGibsMax';
2740 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2742 Name
:= 'scCorpsesMax';
2745 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2747 Name
:= 'swGibsCount';
2748 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2749 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2750 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2751 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2752 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2754 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2756 Name
:= 'swCorpseType';
2757 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2758 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2760 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2762 Name
:= 'swGibsType';
2763 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2764 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2766 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2768 Name
:= 'swBloodType';
2769 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2770 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2772 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2774 Name
:= 'swScreenFlash';
2775 AddItem(_lc
[I_MENU_NO
]);
2776 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2777 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2779 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2781 Name
:= 'swBackground';
2782 AddItem(_lc
[I_MENU_YES
]);
2783 AddItem(_lc
[I_MENU_NO
]);
2785 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2787 Name
:= 'swMessages';
2788 AddItem(_lc
[I_MENU_YES
]);
2789 AddItem(_lc
[I_MENU_NO
]);
2791 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2793 Name
:= 'swRevertPlayers';
2794 AddItem(_lc
[I_MENU_YES
]);
2795 AddItem(_lc
[I_MENU_NO
]);
2797 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2799 Name
:= 'swChatBubble';
2800 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2801 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2802 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2803 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2804 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2806 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2808 Name
:= 'swPlayerIndicator';
2809 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2810 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2811 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2813 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2815 Name
:= 'swPlayerIndicatorStyle';
2816 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2817 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2819 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2821 Name
:= 'scScaleFactor';
2823 OnChange
:= ProcChangeGameSettings
;
2827 Menu
.DefControl
:= 'mOptionsGameMenu';
2828 g_GUI_AddWindow(Menu
);
2830 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2831 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2833 Name
:= 'mOptionsControlsMenu';
2834 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2835 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2836 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2837 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2838 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2840 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2841 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2842 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2843 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2844 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2845 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2846 if e_HasJoysticks
then
2849 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2851 if g_touch_enabled
then
2854 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2857 Menu
.DefControl
:= 'mOptionsControlsMenu';
2858 g_GUI_AddWindow(Menu
);
2860 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2861 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2863 Name
:= 'mOptionsControlsP1Menu';
2864 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2865 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2866 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2867 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2868 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2869 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2870 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2871 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2873 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2875 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2876 g_GUI_AddWindow(Menu
);
2878 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2879 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2881 Name
:= 'mOptionsControlsP1MenuWeapons';
2882 for i
:= WP_FIRST
to WP_LAST
do
2883 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2884 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2886 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2887 g_GUI_AddWindow(Menu
);
2889 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2890 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2892 Name
:= 'mOptionsControlsP2Menu';
2893 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2894 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2895 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2904 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2905 g_GUI_AddWindow(Menu
);
2907 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2908 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2910 Name
:= 'mOptionsControlsP2MenuWeapons';
2911 for i
:= WP_FIRST
to WP_LAST
do
2912 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2913 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2915 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2916 g_GUI_AddWindow(Menu
);
2918 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2919 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2921 Name
:= 'mOptionsControlsJoystickMenu';
2922 for i
:= 0 to e_MaxJoys
- 1 do
2923 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2925 Name
:= 'scDeadzone' + IntToStr(i
);
2929 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2930 g_GUI_AddWindow(Menu
);
2932 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2933 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2935 Name
:= 'mOptionsControlsTouchMenu';
2936 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2938 Name
:= 'swTouchAlt';
2939 AddItem(_lc
[I_MENU_NO
]);
2940 AddItem(_lc
[I_MENU_YES
]);
2941 OnChange
:= ProcChangeTouchSettings
;
2943 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2945 Name
:= 'scTouchSize';
2947 OnChange
:= ProcChangeTouchSettings
;
2949 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2951 Name
:= 'swTouchFire';
2952 AddItem(_lc
[I_MENU_NO
]);
2953 AddItem(_lc
[I_MENU_YES
]);
2955 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2957 Name
:= 'scTouchOffset';
2959 OnChange
:= ProcChangeTouchSettings
;
2962 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2968 Name
:= 'mOptionsPlayersMenu';
2969 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2970 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2972 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2973 g_GUI_AddWindow(Menu
);
2975 CreatePlayerOptionsMenu('P1');
2976 CreatePlayerOptionsMenu('P2');
2978 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2979 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2981 Name
:= 'mOptionsPlayersMIMenu';
2982 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2987 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2992 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2994 Name
:= 'meComment';
2997 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2998 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3001 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3005 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3006 g_GUI_AddWindow(Menu
);
3008 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3009 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3011 Name
:= 'mOptionsLanguageMenu';
3012 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3013 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3016 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3017 g_GUI_AddWindow(Menu
);
3019 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3020 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3021 g_GUI_AddWindow(Menu
);
3023 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3024 Menu
.BackTexture
:= 'INTER';
3025 Menu
.OnClose
:= ProcAuthorsClose
;
3029 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3031 Color
:= _RGB(255, 0, 0);
3032 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3034 _y
:= _y
+GetHeight();
3036 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3038 Color
:= _RGB(255, 0, 0);
3039 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3041 _y
:= _y
+GetHeight()+32;
3043 // ×òî äåëàë: Êòî äåëàë
3044 cx
:= gScreenWidth
div 2 - 320 + 64;
3045 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3047 Color
:= _RGB(255, 0, 0);
3052 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3054 Color
:= _RGB(255, 255, 255);
3059 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3061 Color
:= _RGB(255, 0, 0);
3066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3068 Color
:= _RGB(255, 255, 255);
3073 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3075 Color
:= _RGB(255, 255, 255);
3080 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3082 Color
:= _RGB(255, 0, 0);
3087 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3089 Color
:= _RGB(255, 255, 255);
3094 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3096 Color
:= _RGB(255, 0, 0);
3101 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3103 Color
:= _RGB(255, 255, 255);
3106 _y
:= gScreenHeight
- 128;
3109 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3111 Color
:= _RGB(255, 0, 0);
3116 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3118 Color
:= _RGB(255, 255, 255);
3121 _y
:= _y
+GetHeight();
3123 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3125 Color
:= _RGB(255, 255, 255);
3128 _y
:= _y
+GetHeight();
3130 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3132 Color
:= _RGB(255, 255, 255);
3135 _y
:= gScreenHeight
- 32;
3137 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3139 Color
:= _RGB(255, 0, 0);
3140 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3143 g_GUI_AddWindow(Menu
);
3145 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3146 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3147 g_GUI_AddWindow(Menu
);
3149 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3150 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3152 Name
:= 'mmGameSingleMenu';
3153 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3154 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3155 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3156 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3157 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3158 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3160 Menu
.DefControl
:= 'mmGameSingleMenu';
3161 Menu
.MainWindow
:= True;
3162 Menu
.OnClose
:= ProcGMClose
;
3163 Menu
.OnShow
:= ProcGMShow
;
3164 g_GUI_AddWindow(Menu
);
3166 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3167 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3168 g_GUI_AddWindow(Menu
);
3170 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3171 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3172 g_GUI_AddWindow(Menu
);
3174 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3175 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3177 Name
:= 'mmGameCustomMenu';
3178 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3179 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3180 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3181 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3182 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3183 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3184 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3186 Menu
.DefControl
:= 'mmGameCustomMenu';
3187 Menu
.MainWindow
:= True;
3188 Menu
.OnClose
:= ProcGMClose
;
3189 Menu
.OnShow
:= ProcGMShow
;
3190 g_GUI_AddWindow(Menu
);
3192 Menu
:= TGUIWindow
.Create('GameServerMenu');
3193 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3195 Name
:= 'mmGameServerMenu';
3196 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3197 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3198 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3199 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3200 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3202 Menu
.DefControl
:= 'mmGameServerMenu';
3203 Menu
.MainWindow
:= True;
3204 Menu
.OnClose
:= ProcGMClose
;
3205 Menu
.OnShow
:= ProcGMShow
;
3206 g_GUI_AddWindow(Menu
);
3208 Menu
:= TGUIWindow
.Create('GameClientMenu');
3209 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3211 Name
:= 'mmGameClientMenu';
3212 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3213 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3214 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3216 Menu
.DefControl
:= 'mmGameClientMenu';
3217 Menu
.MainWindow
:= True;
3218 Menu
.OnClose
:= ProcGMClose
;
3219 Menu
.OnShow
:= ProcGMShow
;
3220 g_GUI_AddWindow(Menu
);
3222 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3223 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3225 Name
:= 'mClientPasswordMenu';
3226 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3234 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3237 Menu
.DefControl
:= 'mClientPasswordMenu';
3238 g_GUI_AddWindow(Menu
);
3240 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3241 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3243 Name
:= 'mGameSetGameMenu';
3244 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3246 Name
:= 'swTeamDamage';
3247 AddItem(_lc
[I_MENU_YES
]);
3248 AddItem(_lc
[I_MENU_NO
]);
3251 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3253 Name
:= 'swTeamHit';
3254 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3255 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3256 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3257 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3260 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3262 Name
:= 'swDeathmatchKeys';
3263 AddItem(_lc
[I_MENU_YES
]);
3264 AddItem(_lc
[I_MENU_NO
]);
3267 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3269 Name
:= 'edTimeLimit';
3274 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3276 Name
:= 'edGoalLimit';
3281 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3283 Name
:= 'edMaxLives';
3288 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3291 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3292 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3293 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3299 Menu
.DefControl
:= 'mGameSetGameMenu';
3300 Menu
.OnClose
:= ProcApplyGameSet
;
3301 g_GUI_AddWindow(Menu
);
3303 Menu
:= TGUIWindow
.Create('TeamMenu');
3304 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3306 Name
:= 'mmTeamMenu';
3307 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3308 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3309 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3310 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3311 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3313 Menu
.DefControl
:= 'mmTeamMenu';
3314 Menu
.OnShow
:= ProcChangePlayers
;
3315 g_GUI_AddWindow(Menu
);
3318 procedure g_Menu_Show_SaveMenu();
3320 if g_Game_IsTestMap
then
3322 if gGameSettings
.GameType
= GT_SINGLE
then
3323 g_GUI_ShowWindow('GameSingleMenu')
3326 if g_Game_IsClient
then
3329 if g_Game_IsNet
then
3332 g_GUI_ShowWindow('GameCustomMenu');
3334 g_GUI_ShowWindow('SaveMenu');
3335 g_Sound_PlayEx('MENU_OPEN');
3338 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3340 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3341 if gGameSettings
.GameType
= GT_SINGLE
then
3343 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3347 if g_Game_IsClient
then exit
;
3348 if g_Game_IsNet
then exit
;
3349 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3351 g_GUI_ShowWindow('LoadMenu');
3352 g_Sound_PlayEx('MENU_OPEN');
3355 procedure g_Menu_Show_GameSetGame();
3357 if gGameSettings
.GameType
= GT_SINGLE
then
3358 g_GUI_ShowWindow('GameSingleMenu')
3361 if g_Game_IsClient
then
3364 if g_Game_IsNet
then
3365 g_GUI_ShowWindow('GameServerMenu')
3367 g_GUI_ShowWindow('GameCustomMenu');
3370 g_GUI_ShowWindow('GameSetGameMenu');
3371 g_Sound_PlayEx('MENU_OPEN');
3374 procedure g_Menu_Show_OptionsVideo();
3376 if gGameSettings
.GameType
= GT_SINGLE
then
3377 g_GUI_ShowWindow('GameSingleMenu')
3380 if g_Game_IsClient
then
3381 g_GUI_ShowWindow('GameClientMenu')
3383 if g_Game_IsNet
then
3384 g_GUI_ShowWindow('GameServerMenu')
3386 g_GUI_ShowWindow('GameCustomMenu');
3389 g_GUI_ShowWindow('OptionsMenu');
3390 g_GUI_ShowWindow('OptionsVideoMenu');
3391 g_Sound_PlayEx('MENU_OPEN');
3394 procedure g_Menu_Show_OptionsSound();
3396 if gGameSettings
.GameType
= GT_SINGLE
then
3397 g_GUI_ShowWindow('GameSingleMenu')
3400 if g_Game_IsClient
then
3401 g_GUI_ShowWindow('GameClientMenu')
3403 if g_Game_IsNet
then
3404 g_GUI_ShowWindow('GameServerMenu')
3406 g_GUI_ShowWindow('GameCustomMenu');
3409 g_GUI_ShowWindow('OptionsMenu');
3410 g_GUI_ShowWindow('OptionsSoundMenu');
3411 g_Sound_PlayEx('MENU_OPEN');
3414 procedure g_Menu_Show_EndGameMenu();
3416 g_GUI_ShowWindow('EndGameMenu');
3417 g_Sound_PlayEx('MENU_OPEN');
3420 procedure g_Menu_Show_QuitGameMenu();
3422 g_GUI_ShowWindow('ExitMenu');
3423 g_Sound_PlayEx('MENU_OPEN');
3426 procedure g_Menu_Init();
3432 procedure g_Menu_Free();
3437 procedure g_Menu_Reset();
3441 g_GUI_SaveMenuPos();
3442 ex
:= g_GUI_Destroy();
3446 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3451 g_Game_SetDebugMode();
3453 g_GUI_LoadMenuPos();