1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
48 {$IFDEF ENABLE_SHELLS}
51 {$IFDEF ENABLE_CORPSES}
54 {$IFDEF ENABLE_RENDER}
57 {$IFDEF ENABLE_SYSTEM}
61 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
62 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
63 MAPDEF
, Math
, g_saveload
,
65 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
69 type TYNCallback
= procedure (yes
:Boolean);
71 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
73 if win
.UserData
= nil then exit
;
75 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
76 IK_N
: TYNCallback(win
.UserData
)(false);
80 procedure YesButtonCB (ctl
: TGUITextButton
);
82 if ctl
.UserData
= nil then exit
;
83 TYNCallback(ctl
.UserData
)(true);
86 procedure NoButtonCB (ctl
: TGUITextButton
);
88 if ctl
.UserData
= nil then exit
;
89 TYNCallback(ctl
.UserData
)(false);
92 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; ActionProc
: TYNCallback
): TGUIWindow
;
96 //if length(Text) = 0 then exit;
97 Result
:= TGUIWindow
.Create(WinName
);
100 //OnKeyDownEx := @YNKeyDownProc;
101 //UserData := @ActionProc;
102 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(False, False, '')));
105 Name
:= '__temp_yes_no_menu:'+WinName
;
107 AddText(Text, MaxLen
);
108 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
109 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
111 DefControl
:= '__temp_yes_no_menu:'+WinName
;
117 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
118 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
120 procedure ProcApplyOptions();
125 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
127 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
132 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
134 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
135 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
136 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
138 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
140 g_Sound_SetupAllVolumes(
141 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
142 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
145 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
146 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
147 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
148 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
149 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
151 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
154 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
156 {$IFDEF ENABLE_SHELLS}
157 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
160 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
162 {$IFDEF ENABLE_CORPSES}
163 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
167 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
172 else gGibsCount
:= 48;
176 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
177 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
178 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
179 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
180 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
181 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
182 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
183 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
184 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
185 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
186 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
187 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
189 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
190 g_dbg_scale
:= TempScale
+ 1;
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 {$IFDEF ENABLE_SYSTEM}
1760 list
:= sys_GetDisplayModes(gBPP
);
1767 ItemIndex
:= Length(list
)
1775 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1781 TempResScale
:= Round(r_pixel_scale
- 1);
1782 with TGUISwitch(menu
.GetControl('swResFactor')) do
1783 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1786 procedure ProcApplyVideoOptions();
1789 Fullscreen
: Boolean;
1790 SWidth
, SHeight
: Integer;
1791 ScaleChanged
: Boolean;
1794 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1796 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1798 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1801 SWidth
:= gWinSizeX
;
1802 SHeight
:= gWinSizeY
;
1803 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1806 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1808 ScaleChanged
:= False;
1809 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1811 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1812 r_pixel_scale
:= TempResScale
+ 1;
1813 ScaleChanged
:= True;
1816 if (SWidth
<> gWinSizeX
) or
1817 (SHeight
<> gWinSizeY
) or
1818 (Fullscreen
<> gFullscreen
) or
1821 gResolutionChange
:= True;
1822 gRC_Width
:= SWidth
;
1823 gRC_Height
:= SHeight
;
1824 gRC_FullScreen
:= Fullscreen
;
1825 gRC_Maximized
:= gWinMaximized
;
1828 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1832 procedure ProcSetFirstRussianLanguage
;
1834 gLanguage
:= LANGUAGE_RUSSIAN
;
1835 gLanguageChange
:= True;
1836 gAskLanguage
:= False;
1839 procedure ProcSetFirstEnglishLanguage
;
1841 gLanguage
:= LANGUAGE_ENGLISH
;
1842 gLanguageChange
:= True;
1843 gAskLanguage
:= False;
1846 procedure ProcRecallAddress();
1848 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1850 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1851 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1855 procedure CreateFirstLanguageMenu();
1859 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1861 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, ' '))) do // space to prevent show logo
1863 Name
:= 'mmFirstLanguageMenu';
1864 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1865 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1868 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1869 Menu
.MainWindow
:= True;
1870 g_GUI_AddWindow(Menu
);
1873 procedure g_Menu_AskLanguage();
1875 CreateFirstLanguageMenu();
1876 g_GUI_ShowWindow('FirstLanguageMenu');
1879 procedure CreatePlayerOptionsMenu(s
: String);
1884 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1886 a
:= _lc
[I_MENU_PLAYER_1
]
1888 a
:= _lc
[I_MENU_PLAYER_2
];
1889 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, a
))) do
1891 Name
:= 'mOptionsPlayers'+s
+'Menu';
1892 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1894 Name
:= 'ed'+s
+'Name';
1898 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1900 Name
:= 'sw'+s
+'Team';
1901 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1902 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1904 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1906 Name
:= 'ls'+s
+'Model';
1908 Items
:= g_PlayerModel_GetNames();
1909 OnChange
:= ProcSelectModel
;
1911 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1913 Name
:= 'sc'+s
+'Red';
1915 OnChange
:= ProcChangeColor
;
1917 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1919 Name
:= 'sc'+s
+'Green';
1921 OnChange
:= ProcChangeColor
;
1923 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1925 Name
:= 'sc'+s
+'Blue';
1927 OnChange
:= ProcChangeColor
;
1930 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1931 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1932 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1933 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1935 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1937 Name
:= 'mv'+s
+'Model';
1938 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1939 Y
:= GetControl('ls'+s
+'Model').Y
;
1942 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1943 g_GUI_AddWindow(Menu
);
1946 procedure CreateAllMenus();
1950 a
, cx
, _y
, i
: Integer;
1953 Menu
:= TGUIWindow
.Create('MainMenu');
1954 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
1956 Name
:= 'mmMainMenu';
1957 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1958 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1959 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1960 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1961 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1962 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1964 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), False))) do
1966 Color
:= _RGB(255, 255, 255);
1967 X
:= gScreenWidth
-GetWidth
-8;
1968 Y
:= gScreenHeight
-GetHeight
-8;
1970 Menu
.DefControl
:= 'mmMainMenu';
1971 Menu
.MainWindow
:= True;
1972 g_GUI_AddWindow(Menu
);
1974 Menu
:= TGUIWindow
.Create('NewGameMenu');
1975 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_NEW_GAME
]))) do
1977 Name
:= 'mmNewGameMenu';
1978 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1979 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1980 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1981 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1983 Menu
.DefControl
:= 'mmNewGameMenu';
1984 g_GUI_AddWindow(Menu
);
1986 Menu
:= TGUIWindow
.Create('NetGameMenu');
1987 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MULTIPLAYER
]))) do
1989 Name
:= 'mmNetGameMenu';
1990 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1991 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1993 Menu
.DefControl
:= 'mmNetGameMenu';
1994 g_GUI_AddWindow(Menu
);
1996 Menu
:= TGUIWindow
.Create('NetServerMenu');
1997 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_SERVER
]))) do
1999 Name
:= 'mNetServerMenu';
2000 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2002 Name
:= 'edSrvName';
2003 OnlyDigits
:= False;
2006 Text := NetServerName
;
2008 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2010 Name
:= 'edSrvPassword';
2011 OnlyDigits
:= False;
2014 Text := NetPassword
;
2016 with AddEdit(_lc
[I_NET_PORT
]) do
2022 Text := IntToStr(NetPort
);
2024 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2026 Name
:= 'edMaxPlayers';
2030 Text := IntToStr(NetMaxClients
);
2032 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2034 Name
:= 'swUseMaster';
2035 AddItem(_lc
[I_MENU_YES
]);
2036 AddItem(_lc
[I_MENU_NO
]);
2037 if NetUseMaster
then
2043 with AddLabel(_lc
[I_MENU_MAP
]) do
2048 OnClick
:= @ProcSelectMapMenu
;
2050 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2052 Name
:= 'swGameMode';
2053 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2054 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2055 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2056 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2057 case g_Game_TextToMode(gsGameMode
) of
2059 GM_DM
: ItemIndex
:= 0;
2060 GM_TDM
: ItemIndex
:= 1;
2061 GM_CTF
: ItemIndex
:= 2;
2063 GM_COOP
: ItemIndex
:= 3;
2065 OnChange
:= ProcSwitchMonstersCustom
;
2067 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2069 Name
:= 'edTimeLimit';
2073 if gsTimeLimit
> 0 then
2074 Text := IntToStr(gsTimeLimit
);
2076 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2078 Name
:= 'edGoalLimit';
2082 if gsGoalLimit
> 0 then
2083 Text := IntToStr(gsGoalLimit
);
2085 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2087 Name
:= 'edMaxLives';
2091 if gsMaxLives
> 0 then
2092 Text := IntToStr(gsMaxLives
);
2094 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2096 Name
:= 'edItemRespawnTime';
2100 if gsItemRespawnTime
> 0 then
2101 Text := IntToStr(gsItemRespawnTime
);
2103 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2105 Name
:= 'swPlayers';
2106 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2107 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2108 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2109 ItemIndex
:= gsPlayers
;
2111 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2113 Name
:= 'swTeamDamage';
2114 AddItem(_lc
[I_MENU_YES
]);
2115 AddItem(_lc
[I_MENU_NO
]);
2116 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2121 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2123 Name
:= 'swTeamHit';
2124 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2125 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2126 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2127 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2128 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2130 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2132 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2137 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2139 Name
:= 'swDeathmatchKeys';
2140 AddItem(_lc
[I_MENU_YES
]);
2141 AddItem(_lc
[I_MENU_NO
]);
2142 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2147 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2149 Name
:= 'swEnableExits';
2150 AddItem(_lc
[I_MENU_YES
]);
2151 AddItem(_lc
[I_MENU_NO
]);
2152 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2157 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2159 Name
:= 'swWeaponStay';
2160 AddItem(_lc
[I_MENU_YES
]);
2161 AddItem(_lc
[I_MENU_NO
]);
2162 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2167 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2169 Name
:= 'swMonsters';
2170 AddItem(_lc
[I_MENU_YES
]);
2171 AddItem(_lc
[I_MENU_NO
]);
2172 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2177 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2180 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2181 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2182 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2184 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2186 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2190 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2194 Menu
.DefControl
:= 'mNetServerMenu';
2195 g_GUI_AddWindow(Menu
);
2197 Menu
:= TGUIWindow
.Create('NetClientMenu');
2198 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_CLIENT
]))) do
2200 Name
:= 'mNetClientMenu';
2202 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2205 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2211 Text := 'localhost';
2213 with AddEdit(_lc
[I_NET_PORT
]) do
2221 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2224 OnlyDigits
:= False;
2231 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2235 Menu
.DefControl
:= 'mNetClientMenu';
2236 g_GUI_AddWindow(Menu
);
2238 Menu
:= TGUIWindow
.Create('LoadMenu');
2239 Menu
.OnShow
:= ProcLoadMenu
;
2240 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LOAD_GAME
]))) do
2242 Name
:= 'mmLoadMenu';
2247 Name
:= 'edSlot'+IntToStr(a
);
2250 OnEnter
:= ProcLoadGame
;
2253 Menu
.DefControl
:= 'mmLoadMenu';
2254 g_GUI_AddWindow(Menu
);
2256 Menu
:= TGUIWindow
.Create('SaveMenu');
2257 Menu
.OnShow
:= ProcSaveMenu
;
2258 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SAVE_GAME
]))) do
2260 Name
:= 'mmSaveMenu';
2265 Name
:= 'edSlot'+IntToStr(a
);
2268 OnChange
:= ProcSaveGame
;
2271 Menu
.DefControl
:= 'mmSaveMenu';
2272 g_GUI_AddWindow(Menu
);
2274 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2275 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CUSTOM_GAME
]))) do
2277 Name
:= 'mCustomGameMenu';
2278 with AddLabel(_lc
[I_MENU_MAP
]) do
2283 OnClick
:= @ProcSelectMapMenu
;
2285 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2287 Name
:= 'swGameMode';
2288 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2289 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2290 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2291 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2292 case g_Game_TextToMode(gsGameMode
) of
2294 GM_DM
: ItemIndex
:= 0;
2295 GM_TDM
: ItemIndex
:= 1;
2296 GM_CTF
: ItemIndex
:= 2;
2298 GM_COOP
: ItemIndex
:= 3;
2300 OnChange
:= ProcSwitchMonstersCustom
;
2302 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2304 Name
:= 'edTimeLimit';
2308 if gsTimeLimit
> 0 then
2309 Text := IntToStr(gsTimeLimit
);
2311 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2313 Name
:= 'edGoalLimit';
2317 if gsGoalLimit
> 0 then
2318 Text := IntToStr(gsGoalLimit
);
2320 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2322 Name
:= 'edMaxLives';
2326 if gsMaxLives
> 0 then
2327 Text := IntToStr(gsMaxLives
);
2329 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2331 Name
:= 'edItemRespawnTime';
2335 if gsItemRespawnTime
> 0 then
2336 Text := IntToStr(gsItemRespawnTime
);
2338 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2340 Name
:= 'swPlayers';
2341 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2342 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2343 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2344 ItemIndex
:= gsPlayers
;
2346 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2348 Name
:= 'swTeamDamage';
2349 AddItem(_lc
[I_MENU_YES
]);
2350 AddItem(_lc
[I_MENU_NO
]);
2351 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2356 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2358 Name
:= 'swTeamHit';
2359 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2360 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2361 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2362 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2363 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2365 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2367 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2372 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2374 Name
:= 'swDeathmatchKeys';
2375 AddItem(_lc
[I_MENU_YES
]);
2376 AddItem(_lc
[I_MENU_NO
]);
2377 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2382 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2384 Name
:= 'swEnableExits';
2385 AddItem(_lc
[I_MENU_YES
]);
2386 AddItem(_lc
[I_MENU_NO
]);
2387 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2392 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2394 Name
:= 'swWeaponStay';
2395 AddItem(_lc
[I_MENU_YES
]);
2396 AddItem(_lc
[I_MENU_NO
]);
2397 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2402 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2404 Name
:= 'swMonsters';
2405 AddItem(_lc
[I_MENU_YES
]);
2406 AddItem(_lc
[I_MENU_NO
]);
2407 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2412 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2415 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2416 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2417 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2419 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2421 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2425 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2429 Menu
.DefControl
:= 'mCustomGameMenu';
2430 g_GUI_AddWindow(Menu
);
2432 Menu
:= TGUIWindow
.Create('CampaignMenu');
2433 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CAMPAIGN
]))) do
2435 Name
:= 'mCampaignMenu';
2444 with AddFileList('', 15, 4) do
2447 OnChange
:= ProcSelectCampaignWAD
;
2451 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2452 SetBase(MegawadDirs
);
2455 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2457 Name
:= 'lbWADName';
2461 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2463 Name
:= 'lbWADAuthor';
2467 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2468 with AddMemo('', 15, 3) do
2470 Name
:= 'meWADDescription';
2471 Color
:= MENU_ITEMSCTRL_COLOR
;
2473 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2475 Name
:= 'swPlayers';
2476 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2477 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2480 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2484 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2486 Name
:= 'mpWADImage';
2487 DefaultRes
:= 'NOPIC';
2488 X
:= GetControl('lsWAD').X
+4;
2489 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2492 Menu
.DefControl
:= 'mCampaignMenu';
2493 g_GUI_AddWindow(Menu
);
2495 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2496 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SELECT_MAP
]))) do
2498 Name
:= 'mSelectMapMenu';
2499 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2502 OnChange
:= ProcSelectWAD
;
2506 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2509 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2513 OnChange
:= ProcSelectMap
;
2516 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2518 Name
:= 'lbMapName';
2522 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2524 Name
:= 'lbMapAuthor';
2528 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2530 Name
:= 'lbMapSize';
2534 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2536 Name
:= 'meMapDescription';
2541 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2543 Name
:= 'mpMapPreview';
2544 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2545 Y
:= GetControl('lsMapWAD').Y
;
2547 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', False))) do
2549 Name
:= 'lbMapScale';
2552 Color
:= MENU_ITEMSCTRL_COLOR
;
2553 X
:= GetControl('lsMapWAD').X
+
2554 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2555 2 + MAPPREVIEW_WIDTH
*4;
2556 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2559 Menu
.OnClose
:= ProcSetMap
;
2560 Menu
.DefControl
:= 'mSelectMapMenu';
2561 g_GUI_AddWindow(Menu
);
2563 Menu
:= TGUIWindow
.Create('OptionsMenu');
2564 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_OPTIONS
]))) do
2566 Name
:= 'mmOptionsMenu';
2567 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2568 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2569 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2570 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2571 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2572 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2574 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2575 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2577 Menu
.OnClose
:= ProcApplyOptions
;
2578 Menu
.DefControl
:= 'mmOptionsMenu';
2579 g_GUI_AddWindow(Menu
);
2581 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6), @ProcSavedMenuKeyDown
);
2582 g_GUI_AddWindow(Menu
);
2584 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2585 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2587 Name
:= 'mOptionsVideoMenu';
2588 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2589 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2595 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2598 AddItem(_lc
[I_MENU_YES
]);
2599 AddItem(_lc
[I_MENU_NO
]);
2601 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2603 Name
:= 'swTextureFilter';
2604 AddItem(_lc
[I_MENU_YES
]);
2605 AddItem(_lc
[I_MENU_NO
]);
2607 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2610 AddItem(_lc
[I_MENU_YES
]);
2611 AddItem(_lc
[I_MENU_NO
]);
2613 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2615 Name
:= 'swLegacyNPOT';
2616 AddItem(_lc
[I_MENU_NO
]);
2617 AddItem(_lc
[I_MENU_YES
]);
2620 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2623 Menu
.DefControl
:= 'mOptionsVideoMenu';
2624 g_GUI_AddWindow(Menu
);
2626 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2627 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2629 Name
:= 'mOptionsVideoResMenu';
2630 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2632 Name
:= 'lbCurrentRes';
2636 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2638 Name
:= 'lsResolution';
2641 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2643 Name
:= 'swFullScreen';
2644 AddItem(_lc
[I_MENU_YES
]);
2645 AddItem(_lc
[I_MENU_NO
]);
2647 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2649 Name
:= 'swResFactor';
2651 for i
:= 2 to gRC_Width
div 640 do
2652 AddItem(IntToStr(i
) + 'x');
2655 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2658 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2659 g_GUI_AddWindow(Menu
);
2661 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2662 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2664 Name
:= 'mOptionsSoundMenu';
2665 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2667 Name
:= 'scMusicLevel';
2669 OnChange
:= ProcChangeSoundSettings
;
2671 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2673 Name
:= 'scSoundLevel';
2675 OnChange
:= ProcChangeSoundSettings
;
2677 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2679 Name
:= 'scMaxSimSounds';
2682 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2684 Name
:= 'swAnnouncer';
2685 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2686 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2687 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2688 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2690 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2691 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2693 Name
:= 'swSoundEffects';
2694 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2695 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2697 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2698 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2700 Name
:= 'swChatSpeech';
2701 AddItem(_lc
[I_MENU_YES
]);
2702 AddItem(_lc
[I_MENU_NO
]);
2704 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2706 Name
:= 'swInactiveSounds';
2707 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2708 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2712 Menu
.DefControl
:= 'mOptionsSoundMenu';
2713 g_GUI_AddWindow(Menu
);
2715 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2716 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_GAME_OPTIONS
]))) do
2718 Name
:= 'mOptionsGameMenu';
2719 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2721 Name
:= 'scParticlesCount';
2724 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2726 Name
:= 'swBloodCount';
2727 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2728 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2729 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2730 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2731 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2733 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2735 Name
:= 'scShellsMax';
2738 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2740 Name
:= 'scGibsMax';
2743 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2745 Name
:= 'scCorpsesMax';
2748 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2750 Name
:= 'swGibsCount';
2751 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2752 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2753 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2754 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2755 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2757 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2759 Name
:= 'swCorpseType';
2760 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2761 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2763 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2765 Name
:= 'swGibsType';
2766 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2767 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2769 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2771 Name
:= 'swBloodType';
2772 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2773 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2775 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2777 Name
:= 'swScreenFlash';
2778 AddItem(_lc
[I_MENU_NO
]);
2779 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2780 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2782 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2784 Name
:= 'swBackground';
2785 AddItem(_lc
[I_MENU_YES
]);
2786 AddItem(_lc
[I_MENU_NO
]);
2788 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2790 Name
:= 'swMessages';
2791 AddItem(_lc
[I_MENU_YES
]);
2792 AddItem(_lc
[I_MENU_NO
]);
2794 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2796 Name
:= 'swRevertPlayers';
2797 AddItem(_lc
[I_MENU_YES
]);
2798 AddItem(_lc
[I_MENU_NO
]);
2800 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2802 Name
:= 'swChatBubble';
2803 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2804 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2805 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2806 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2807 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2809 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2811 Name
:= 'swPlayerIndicator';
2812 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2813 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2814 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2816 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2818 Name
:= 'swPlayerIndicatorStyle';
2819 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2820 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2822 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2824 Name
:= 'scScaleFactor';
2826 OnChange
:= ProcChangeGameSettings
;
2830 Menu
.DefControl
:= 'mOptionsGameMenu';
2831 g_GUI_AddWindow(Menu
);
2833 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2834 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2836 Name
:= 'mOptionsControlsMenu';
2837 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2838 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2839 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2840 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2841 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2843 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2844 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2845 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2846 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2847 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2848 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2849 if e_HasJoysticks
then
2852 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2854 if g_touch_enabled
then
2857 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2860 Menu
.DefControl
:= 'mOptionsControlsMenu';
2861 g_GUI_AddWindow(Menu
);
2863 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2864 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2866 Name
:= 'mOptionsControlsP1Menu';
2867 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2868 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2869 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2870 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2871 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2873 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2874 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2875 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2876 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2878 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2879 g_GUI_AddWindow(Menu
);
2881 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2882 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2884 Name
:= 'mOptionsControlsP1MenuWeapons';
2885 for i
:= WP_FIRST
to WP_LAST
do
2886 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2887 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2889 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2890 g_GUI_AddWindow(Menu
);
2892 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2893 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2895 Name
:= 'mOptionsControlsP2Menu';
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2903 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2904 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2905 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2907 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2908 g_GUI_AddWindow(Menu
);
2910 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2911 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2913 Name
:= 'mOptionsControlsP2MenuWeapons';
2914 for i
:= WP_FIRST
to WP_LAST
do
2915 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2916 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2918 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2919 g_GUI_AddWindow(Menu
);
2921 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2922 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2924 Name
:= 'mOptionsControlsJoystickMenu';
2925 for i
:= 0 to e_MaxJoys
- 1 do
2926 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2928 Name
:= 'scDeadzone' + IntToStr(i
);
2932 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2933 g_GUI_AddWindow(Menu
);
2935 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2936 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2938 Name
:= 'mOptionsControlsTouchMenu';
2939 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2941 Name
:= 'swTouchAlt';
2942 AddItem(_lc
[I_MENU_NO
]);
2943 AddItem(_lc
[I_MENU_YES
]);
2944 OnChange
:= ProcChangeTouchSettings
;
2946 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2948 Name
:= 'scTouchSize';
2950 OnChange
:= ProcChangeTouchSettings
;
2952 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2954 Name
:= 'swTouchFire';
2955 AddItem(_lc
[I_MENU_NO
]);
2956 AddItem(_lc
[I_MENU_YES
]);
2958 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2960 Name
:= 'scTouchOffset';
2962 OnChange
:= ProcChangeTouchSettings
;
2965 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2966 g_GUI_AddWindow(Menu
);
2968 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2969 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2971 Name
:= 'mOptionsPlayersMenu';
2972 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2973 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2975 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2976 g_GUI_AddWindow(Menu
);
2978 CreatePlayerOptionsMenu('P1');
2979 CreatePlayerOptionsMenu('P2');
2981 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2982 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_MODEL_INFO
]))) do
2984 Name
:= 'mOptionsPlayersMIMenu';
2985 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2990 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2995 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2997 Name
:= 'meComment';
3000 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3001 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3004 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3008 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3009 g_GUI_AddWindow(Menu
);
3011 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3012 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3014 Name
:= 'mOptionsLanguageMenu';
3015 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3016 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3019 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3020 g_GUI_AddWindow(Menu
);
3022 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6), @ProcDefaultMenuKeyDown
);
3023 g_GUI_AddWindow(Menu
);
3025 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3026 Menu
.BackTexture
:= 'INTER';
3027 Menu
.OnClose
:= ProcAuthorsClose
;
3031 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], False))) do
3033 Color
:= _RGB(255, 0, 0);
3034 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3036 _y
:= _y
+GetHeight();
3038 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), False))) do
3040 Color
:= _RGB(255, 0, 0);
3041 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3043 _y
:= _y
+GetHeight()+32;
3045 // ×òî äåëàë: Êòî äåëàë
3046 cx
:= gScreenWidth
div 2 - 320 + 64;
3047 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], False))) do
3049 Color
:= _RGB(255, 0, 0);
3054 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], False))) do
3056 Color
:= _RGB(255, 255, 255);
3061 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], False))) do
3063 Color
:= _RGB(255, 0, 0);
3068 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], False))) do
3070 Color
:= _RGB(255, 255, 255);
3075 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], False))) do
3077 Color
:= _RGB(255, 255, 255);
3082 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], False))) do
3084 Color
:= _RGB(255, 0, 0);
3089 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], False))) do
3091 Color
:= _RGB(255, 255, 255);
3096 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], False))) do
3098 Color
:= _RGB(255, 0, 0);
3103 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], False))) do
3105 Color
:= _RGB(255, 255, 255);
3108 _y
:= gScreenHeight
- 128;
3111 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], False))) do
3113 Color
:= _RGB(255, 0, 0);
3118 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], False))) do
3120 Color
:= _RGB(255, 255, 255);
3123 _y
:= _y
+GetHeight();
3125 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], False))) do
3127 Color
:= _RGB(255, 255, 255);
3130 _y
:= _y
+GetHeight();
3132 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], False))) do
3134 Color
:= _RGB(255, 255, 255);
3137 _y
:= gScreenHeight
- 32;
3139 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], False))) do
3141 Color
:= _RGB(255, 0, 0);
3142 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3145 g_GUI_AddWindow(Menu
);
3147 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6), @ProcExitMenuKeyDown
);
3148 g_GUI_AddWindow(Menu
);
3150 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3151 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3153 Name
:= 'mmGameSingleMenu';
3154 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3155 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3156 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3157 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3158 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3159 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3161 Menu
.DefControl
:= 'mmGameSingleMenu';
3162 Menu
.MainWindow
:= True;
3163 Menu
.OnClose
:= ProcGMClose
;
3164 Menu
.OnShow
:= ProcGMShow
;
3165 g_GUI_AddWindow(Menu
);
3167 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcEndMenuKeyDown
);
3168 g_GUI_AddWindow(Menu
);
3170 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcRestartMenuKeyDown
);
3171 g_GUI_AddWindow(Menu
);
3173 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3174 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3176 Name
:= 'mmGameCustomMenu';
3177 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3178 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3179 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3180 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3181 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3182 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3183 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3185 Menu
.DefControl
:= 'mmGameCustomMenu';
3186 Menu
.MainWindow
:= True;
3187 Menu
.OnClose
:= ProcGMClose
;
3188 Menu
.OnShow
:= ProcGMShow
;
3189 g_GUI_AddWindow(Menu
);
3191 Menu
:= TGUIWindow
.Create('GameServerMenu');
3192 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3194 Name
:= 'mmGameServerMenu';
3195 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3196 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3197 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3198 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3199 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3201 Menu
.DefControl
:= 'mmGameServerMenu';
3202 Menu
.MainWindow
:= True;
3203 Menu
.OnClose
:= ProcGMClose
;
3204 Menu
.OnShow
:= ProcGMShow
;
3205 g_GUI_AddWindow(Menu
);
3207 Menu
:= TGUIWindow
.Create('GameClientMenu');
3208 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3210 Name
:= 'mmGameClientMenu';
3211 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3212 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3213 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3215 Menu
.DefControl
:= 'mmGameClientMenu';
3216 Menu
.MainWindow
:= True;
3217 Menu
.OnClose
:= ProcGMClose
;
3218 Menu
.OnShow
:= ProcGMShow
;
3219 g_GUI_AddWindow(Menu
);
3221 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3222 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(False, False, _lc
[I_MENU_ENTERPASSWORD
]))) do
3224 Name
:= 'mClientPasswordMenu';
3225 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3233 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3236 Menu
.DefControl
:= 'mClientPasswordMenu';
3237 g_GUI_AddWindow(Menu
);
3239 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3240 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SET_GAME
]))) do
3242 Name
:= 'mGameSetGameMenu';
3243 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3245 Name
:= 'swTeamDamage';
3246 AddItem(_lc
[I_MENU_YES
]);
3247 AddItem(_lc
[I_MENU_NO
]);
3250 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3252 Name
:= 'swTeamHit';
3253 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3254 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3255 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3256 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3259 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3261 Name
:= 'swDeathmatchKeys';
3262 AddItem(_lc
[I_MENU_YES
]);
3263 AddItem(_lc
[I_MENU_NO
]);
3266 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3268 Name
:= 'edTimeLimit';
3273 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3275 Name
:= 'edGoalLimit';
3280 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3282 Name
:= 'edMaxLives';
3287 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3290 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3291 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3292 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3298 Menu
.DefControl
:= 'mGameSetGameMenu';
3299 Menu
.OnClose
:= ProcApplyGameSet
;
3300 g_GUI_AddWindow(Menu
);
3302 Menu
:= TGUIWindow
.Create('TeamMenu');
3303 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3305 Name
:= 'mmTeamMenu';
3306 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3307 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3308 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3309 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3310 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3312 Menu
.DefControl
:= 'mmTeamMenu';
3313 Menu
.OnShow
:= ProcChangePlayers
;
3314 g_GUI_AddWindow(Menu
);
3317 procedure g_Menu_Show_SaveMenu();
3319 if g_Game_IsTestMap
then
3321 if gGameSettings
.GameType
= GT_SINGLE
then
3322 g_GUI_ShowWindow('GameSingleMenu')
3325 if g_Game_IsClient
then
3328 if g_Game_IsNet
then
3331 g_GUI_ShowWindow('GameCustomMenu');
3333 g_GUI_ShowWindow('SaveMenu');
3334 g_Sound_PlayEx('MENU_OPEN');
3337 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3339 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3340 if gGameSettings
.GameType
= GT_SINGLE
then
3342 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3346 if g_Game_IsClient
then exit
;
3347 if g_Game_IsNet
then exit
;
3348 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3350 g_GUI_ShowWindow('LoadMenu');
3351 g_Sound_PlayEx('MENU_OPEN');
3354 procedure g_Menu_Show_GameSetGame();
3356 if gGameSettings
.GameType
= GT_SINGLE
then
3357 g_GUI_ShowWindow('GameSingleMenu')
3360 if g_Game_IsClient
then
3363 if g_Game_IsNet
then
3364 g_GUI_ShowWindow('GameServerMenu')
3366 g_GUI_ShowWindow('GameCustomMenu');
3369 g_GUI_ShowWindow('GameSetGameMenu');
3370 g_Sound_PlayEx('MENU_OPEN');
3373 procedure g_Menu_Show_OptionsVideo();
3375 if gGameSettings
.GameType
= GT_SINGLE
then
3376 g_GUI_ShowWindow('GameSingleMenu')
3379 if g_Game_IsClient
then
3380 g_GUI_ShowWindow('GameClientMenu')
3382 if g_Game_IsNet
then
3383 g_GUI_ShowWindow('GameServerMenu')
3385 g_GUI_ShowWindow('GameCustomMenu');
3388 g_GUI_ShowWindow('OptionsMenu');
3389 g_GUI_ShowWindow('OptionsVideoMenu');
3390 g_Sound_PlayEx('MENU_OPEN');
3393 procedure g_Menu_Show_OptionsSound();
3395 if gGameSettings
.GameType
= GT_SINGLE
then
3396 g_GUI_ShowWindow('GameSingleMenu')
3399 if g_Game_IsClient
then
3400 g_GUI_ShowWindow('GameClientMenu')
3402 if g_Game_IsNet
then
3403 g_GUI_ShowWindow('GameServerMenu')
3405 g_GUI_ShowWindow('GameCustomMenu');
3408 g_GUI_ShowWindow('OptionsMenu');
3409 g_GUI_ShowWindow('OptionsSoundMenu');
3410 g_Sound_PlayEx('MENU_OPEN');
3413 procedure g_Menu_Show_EndGameMenu();
3415 g_GUI_ShowWindow('EndGameMenu');
3416 g_Sound_PlayEx('MENU_OPEN');
3419 procedure g_Menu_Show_QuitGameMenu();
3421 g_GUI_ShowWindow('ExitMenu');
3422 g_Sound_PlayEx('MENU_OPEN');
3425 procedure g_Menu_Init();
3431 procedure g_Menu_Free();
3436 procedure g_Menu_Reset();
3440 g_GUI_SaveMenuPos();
3441 ex
:= g_GUI_Destroy();
3445 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3450 g_Game_SetDebugMode();
3452 g_GUI_LoadMenuPos();