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 list
:= sys_GetDisplayModes(gBPP
);
1763 ItemIndex
:= Length(list
)
1771 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1777 TempResScale
:= Round(r_pixel_scale
- 1);
1778 with TGUISwitch(menu
.GetControl('swResFactor')) do
1779 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1782 procedure ProcApplyVideoOptions();
1785 Fullscreen
: Boolean;
1786 SWidth
, SHeight
: Integer;
1787 ScaleChanged
: Boolean;
1790 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1792 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1794 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1797 SWidth
:= gWinSizeX
;
1798 SHeight
:= gWinSizeY
;
1799 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1802 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1804 ScaleChanged
:= False;
1805 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1807 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1808 r_pixel_scale
:= TempResScale
+ 1;
1809 ScaleChanged
:= True;
1812 if (SWidth
<> gWinSizeX
) or
1813 (SHeight
<> gWinSizeY
) or
1814 (Fullscreen
<> gFullscreen
) or
1817 gResolutionChange
:= True;
1818 gRC_Width
:= SWidth
;
1819 gRC_Height
:= SHeight
;
1820 gRC_FullScreen
:= Fullscreen
;
1821 gRC_Maximized
:= gWinMaximized
;
1824 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1828 procedure ProcSetFirstRussianLanguage
;
1830 gLanguage
:= LANGUAGE_RUSSIAN
;
1831 gLanguageChange
:= True;
1832 gAskLanguage
:= False;
1835 procedure ProcSetFirstEnglishLanguage
;
1837 gLanguage
:= LANGUAGE_ENGLISH
;
1838 gLanguageChange
:= True;
1839 gAskLanguage
:= False;
1842 procedure ProcRecallAddress();
1844 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1846 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1847 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1851 procedure CreateFirstLanguageMenu();
1855 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1857 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, ' '))) do // space to prevent show logo
1859 Name
:= 'mmFirstLanguageMenu';
1860 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1861 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1864 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1865 Menu
.MainWindow
:= True;
1866 g_GUI_AddWindow(Menu
);
1869 procedure g_Menu_AskLanguage();
1871 CreateFirstLanguageMenu();
1872 g_GUI_ShowWindow('FirstLanguageMenu');
1875 procedure CreatePlayerOptionsMenu(s
: String);
1880 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1882 a
:= _lc
[I_MENU_PLAYER_1
]
1884 a
:= _lc
[I_MENU_PLAYER_2
];
1885 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, a
))) do
1887 Name
:= 'mOptionsPlayers'+s
+'Menu';
1888 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1890 Name
:= 'ed'+s
+'Name';
1894 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1896 Name
:= 'sw'+s
+'Team';
1897 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1898 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1900 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1902 Name
:= 'ls'+s
+'Model';
1904 Items
:= g_PlayerModel_GetNames();
1905 OnChange
:= ProcSelectModel
;
1907 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1909 Name
:= 'sc'+s
+'Red';
1911 OnChange
:= ProcChangeColor
;
1913 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1915 Name
:= 'sc'+s
+'Green';
1917 OnChange
:= ProcChangeColor
;
1919 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1921 Name
:= 'sc'+s
+'Blue';
1923 OnChange
:= ProcChangeColor
;
1926 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1927 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1928 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1929 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1931 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1933 Name
:= 'mv'+s
+'Model';
1934 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1935 Y
:= GetControl('ls'+s
+'Model').Y
;
1938 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1939 g_GUI_AddWindow(Menu
);
1942 procedure CreateAllMenus();
1946 a
, cx
, _y
, i
: Integer;
1949 Menu
:= TGUIWindow
.Create('MainMenu');
1950 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
1952 Name
:= 'mmMainMenu';
1953 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1954 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1955 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1956 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1957 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1958 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1960 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), False))) do
1962 Color
:= _RGB(255, 255, 255);
1963 X
:= gScreenWidth
-GetWidth
-8;
1964 Y
:= gScreenHeight
-GetHeight
-8;
1966 Menu
.DefControl
:= 'mmMainMenu';
1967 Menu
.MainWindow
:= True;
1968 g_GUI_AddWindow(Menu
);
1970 Menu
:= TGUIWindow
.Create('NewGameMenu');
1971 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_NEW_GAME
]))) do
1973 Name
:= 'mmNewGameMenu';
1974 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1975 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1976 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1977 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1979 Menu
.DefControl
:= 'mmNewGameMenu';
1980 g_GUI_AddWindow(Menu
);
1982 Menu
:= TGUIWindow
.Create('NetGameMenu');
1983 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MULTIPLAYER
]))) do
1985 Name
:= 'mmNetGameMenu';
1986 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1987 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1989 Menu
.DefControl
:= 'mmNetGameMenu';
1990 g_GUI_AddWindow(Menu
);
1992 Menu
:= TGUIWindow
.Create('NetServerMenu');
1993 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_SERVER
]))) do
1995 Name
:= 'mNetServerMenu';
1996 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1998 Name
:= 'edSrvName';
1999 OnlyDigits
:= False;
2002 Text := NetServerName
;
2004 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2006 Name
:= 'edSrvPassword';
2007 OnlyDigits
:= False;
2010 Text := NetPassword
;
2012 with AddEdit(_lc
[I_NET_PORT
]) do
2018 Text := IntToStr(NetPort
);
2020 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2022 Name
:= 'edMaxPlayers';
2026 Text := IntToStr(NetMaxClients
);
2028 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2030 Name
:= 'swUseMaster';
2031 AddItem(_lc
[I_MENU_YES
]);
2032 AddItem(_lc
[I_MENU_NO
]);
2033 if NetUseMaster
then
2039 with AddLabel(_lc
[I_MENU_MAP
]) do
2044 OnClick
:= @ProcSelectMapMenu
;
2046 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2048 Name
:= 'swGameMode';
2049 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2050 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2051 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2052 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2053 case g_Game_TextToMode(gsGameMode
) of
2055 GM_DM
: ItemIndex
:= 0;
2056 GM_TDM
: ItemIndex
:= 1;
2057 GM_CTF
: ItemIndex
:= 2;
2059 GM_COOP
: ItemIndex
:= 3;
2061 OnChange
:= ProcSwitchMonstersCustom
;
2063 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2065 Name
:= 'edTimeLimit';
2069 if gsTimeLimit
> 0 then
2070 Text := IntToStr(gsTimeLimit
);
2072 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2074 Name
:= 'edGoalLimit';
2078 if gsGoalLimit
> 0 then
2079 Text := IntToStr(gsGoalLimit
);
2081 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2083 Name
:= 'edMaxLives';
2087 if gsMaxLives
> 0 then
2088 Text := IntToStr(gsMaxLives
);
2090 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2092 Name
:= 'edItemRespawnTime';
2096 if gsItemRespawnTime
> 0 then
2097 Text := IntToStr(gsItemRespawnTime
);
2099 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2101 Name
:= 'swPlayers';
2102 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2103 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2104 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2105 ItemIndex
:= gsPlayers
;
2107 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2109 Name
:= 'swTeamDamage';
2110 AddItem(_lc
[I_MENU_YES
]);
2111 AddItem(_lc
[I_MENU_NO
]);
2112 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2117 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2119 Name
:= 'swTeamHit';
2120 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2121 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2122 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2123 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2124 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2126 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2128 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2133 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2135 Name
:= 'swDeathmatchKeys';
2136 AddItem(_lc
[I_MENU_YES
]);
2137 AddItem(_lc
[I_MENU_NO
]);
2138 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2143 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2145 Name
:= 'swEnableExits';
2146 AddItem(_lc
[I_MENU_YES
]);
2147 AddItem(_lc
[I_MENU_NO
]);
2148 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2153 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2155 Name
:= 'swWeaponStay';
2156 AddItem(_lc
[I_MENU_YES
]);
2157 AddItem(_lc
[I_MENU_NO
]);
2158 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2163 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2165 Name
:= 'swMonsters';
2166 AddItem(_lc
[I_MENU_YES
]);
2167 AddItem(_lc
[I_MENU_NO
]);
2168 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2173 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2176 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2177 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2178 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2180 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2182 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2186 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2190 Menu
.DefControl
:= 'mNetServerMenu';
2191 g_GUI_AddWindow(Menu
);
2193 Menu
:= TGUIWindow
.Create('NetClientMenu');
2194 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_CLIENT
]))) do
2196 Name
:= 'mNetClientMenu';
2198 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2201 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2207 Text := 'localhost';
2209 with AddEdit(_lc
[I_NET_PORT
]) do
2217 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2220 OnlyDigits
:= False;
2227 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2231 Menu
.DefControl
:= 'mNetClientMenu';
2232 g_GUI_AddWindow(Menu
);
2234 Menu
:= TGUIWindow
.Create('LoadMenu');
2235 Menu
.OnShow
:= ProcLoadMenu
;
2236 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LOAD_GAME
]))) do
2238 Name
:= 'mmLoadMenu';
2243 Name
:= 'edSlot'+IntToStr(a
);
2246 OnEnter
:= ProcLoadGame
;
2249 Menu
.DefControl
:= 'mmLoadMenu';
2250 g_GUI_AddWindow(Menu
);
2252 Menu
:= TGUIWindow
.Create('SaveMenu');
2253 Menu
.OnShow
:= ProcSaveMenu
;
2254 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SAVE_GAME
]))) do
2256 Name
:= 'mmSaveMenu';
2261 Name
:= 'edSlot'+IntToStr(a
);
2264 OnChange
:= ProcSaveGame
;
2267 Menu
.DefControl
:= 'mmSaveMenu';
2268 g_GUI_AddWindow(Menu
);
2270 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2271 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CUSTOM_GAME
]))) do
2273 Name
:= 'mCustomGameMenu';
2274 with AddLabel(_lc
[I_MENU_MAP
]) do
2279 OnClick
:= @ProcSelectMapMenu
;
2281 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2283 Name
:= 'swGameMode';
2284 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2285 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2286 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2287 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2288 case g_Game_TextToMode(gsGameMode
) of
2290 GM_DM
: ItemIndex
:= 0;
2291 GM_TDM
: ItemIndex
:= 1;
2292 GM_CTF
: ItemIndex
:= 2;
2294 GM_COOP
: ItemIndex
:= 3;
2296 OnChange
:= ProcSwitchMonstersCustom
;
2298 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2300 Name
:= 'edTimeLimit';
2304 if gsTimeLimit
> 0 then
2305 Text := IntToStr(gsTimeLimit
);
2307 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2309 Name
:= 'edGoalLimit';
2313 if gsGoalLimit
> 0 then
2314 Text := IntToStr(gsGoalLimit
);
2316 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2318 Name
:= 'edMaxLives';
2322 if gsMaxLives
> 0 then
2323 Text := IntToStr(gsMaxLives
);
2325 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2327 Name
:= 'edItemRespawnTime';
2331 if gsItemRespawnTime
> 0 then
2332 Text := IntToStr(gsItemRespawnTime
);
2334 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2336 Name
:= 'swPlayers';
2337 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2338 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2339 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2340 ItemIndex
:= gsPlayers
;
2342 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2344 Name
:= 'swTeamDamage';
2345 AddItem(_lc
[I_MENU_YES
]);
2346 AddItem(_lc
[I_MENU_NO
]);
2347 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2352 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2354 Name
:= 'swTeamHit';
2355 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2356 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2357 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2358 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2359 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2361 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2363 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2368 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2370 Name
:= 'swDeathmatchKeys';
2371 AddItem(_lc
[I_MENU_YES
]);
2372 AddItem(_lc
[I_MENU_NO
]);
2373 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2378 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2380 Name
:= 'swEnableExits';
2381 AddItem(_lc
[I_MENU_YES
]);
2382 AddItem(_lc
[I_MENU_NO
]);
2383 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2388 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2390 Name
:= 'swWeaponStay';
2391 AddItem(_lc
[I_MENU_YES
]);
2392 AddItem(_lc
[I_MENU_NO
]);
2393 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2398 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2400 Name
:= 'swMonsters';
2401 AddItem(_lc
[I_MENU_YES
]);
2402 AddItem(_lc
[I_MENU_NO
]);
2403 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2408 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2411 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2412 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2413 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2415 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2417 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2421 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2425 Menu
.DefControl
:= 'mCustomGameMenu';
2426 g_GUI_AddWindow(Menu
);
2428 Menu
:= TGUIWindow
.Create('CampaignMenu');
2429 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CAMPAIGN
]))) do
2431 Name
:= 'mCampaignMenu';
2440 with AddFileList('', 15, 4) do
2443 OnChange
:= ProcSelectCampaignWAD
;
2447 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2448 SetBase(MegawadDirs
);
2451 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2453 Name
:= 'lbWADName';
2457 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2459 Name
:= 'lbWADAuthor';
2463 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2464 with AddMemo('', 15, 3) do
2466 Name
:= 'meWADDescription';
2467 Color
:= MENU_ITEMSCTRL_COLOR
;
2469 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2471 Name
:= 'swPlayers';
2472 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2473 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2476 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2480 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2482 Name
:= 'mpWADImage';
2483 DefaultRes
:= 'NOPIC';
2484 X
:= GetControl('lsWAD').X
+4;
2485 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2488 Menu
.DefControl
:= 'mCampaignMenu';
2489 g_GUI_AddWindow(Menu
);
2491 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2492 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SELECT_MAP
]))) do
2494 Name
:= 'mSelectMapMenu';
2495 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2498 OnChange
:= ProcSelectWAD
;
2502 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2505 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2509 OnChange
:= ProcSelectMap
;
2512 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2514 Name
:= 'lbMapName';
2518 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2520 Name
:= 'lbMapAuthor';
2524 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2526 Name
:= 'lbMapSize';
2530 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2532 Name
:= 'meMapDescription';
2537 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2539 Name
:= 'mpMapPreview';
2540 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2541 Y
:= GetControl('lsMapWAD').Y
;
2543 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', False))) do
2545 Name
:= 'lbMapScale';
2548 Color
:= MENU_ITEMSCTRL_COLOR
;
2549 X
:= GetControl('lsMapWAD').X
+
2550 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2551 2 + MAPPREVIEW_WIDTH
*4;
2552 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2555 Menu
.OnClose
:= ProcSetMap
;
2556 Menu
.DefControl
:= 'mSelectMapMenu';
2557 g_GUI_AddWindow(Menu
);
2559 Menu
:= TGUIWindow
.Create('OptionsMenu');
2560 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_OPTIONS
]))) do
2562 Name
:= 'mmOptionsMenu';
2563 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2564 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2565 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2566 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2567 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2568 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2570 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2571 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2573 Menu
.OnClose
:= ProcApplyOptions
;
2574 Menu
.DefControl
:= 'mmOptionsMenu';
2575 g_GUI_AddWindow(Menu
);
2577 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6), @ProcSavedMenuKeyDown
);
2578 g_GUI_AddWindow(Menu
);
2580 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2581 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2583 Name
:= 'mOptionsVideoMenu';
2584 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2585 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2591 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2594 AddItem(_lc
[I_MENU_YES
]);
2595 AddItem(_lc
[I_MENU_NO
]);
2597 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2599 Name
:= 'swTextureFilter';
2600 AddItem(_lc
[I_MENU_YES
]);
2601 AddItem(_lc
[I_MENU_NO
]);
2603 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2606 AddItem(_lc
[I_MENU_YES
]);
2607 AddItem(_lc
[I_MENU_NO
]);
2609 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2611 Name
:= 'swLegacyNPOT';
2612 AddItem(_lc
[I_MENU_NO
]);
2613 AddItem(_lc
[I_MENU_YES
]);
2616 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2619 Menu
.DefControl
:= 'mOptionsVideoMenu';
2620 g_GUI_AddWindow(Menu
);
2622 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2623 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2625 Name
:= 'mOptionsVideoResMenu';
2626 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2628 Name
:= 'lbCurrentRes';
2632 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2634 Name
:= 'lsResolution';
2637 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2639 Name
:= 'swFullScreen';
2640 AddItem(_lc
[I_MENU_YES
]);
2641 AddItem(_lc
[I_MENU_NO
]);
2643 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2645 Name
:= 'swResFactor';
2647 for i
:= 2 to gRC_Width
div 640 do
2648 AddItem(IntToStr(i
) + 'x');
2651 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2654 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2655 g_GUI_AddWindow(Menu
);
2657 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2658 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2660 Name
:= 'mOptionsSoundMenu';
2661 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2663 Name
:= 'scMusicLevel';
2665 OnChange
:= ProcChangeSoundSettings
;
2667 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2669 Name
:= 'scSoundLevel';
2671 OnChange
:= ProcChangeSoundSettings
;
2673 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2675 Name
:= 'scMaxSimSounds';
2678 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2680 Name
:= 'swAnnouncer';
2681 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2682 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2683 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2684 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2686 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2687 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2689 Name
:= 'swSoundEffects';
2690 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2691 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2693 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2694 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2696 Name
:= 'swChatSpeech';
2697 AddItem(_lc
[I_MENU_YES
]);
2698 AddItem(_lc
[I_MENU_NO
]);
2700 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2702 Name
:= 'swInactiveSounds';
2703 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2704 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2708 Menu
.DefControl
:= 'mOptionsSoundMenu';
2709 g_GUI_AddWindow(Menu
);
2711 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2712 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_GAME_OPTIONS
]))) do
2714 Name
:= 'mOptionsGameMenu';
2715 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2717 Name
:= 'scParticlesCount';
2720 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2722 Name
:= 'swBloodCount';
2723 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2724 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2725 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2726 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2727 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2729 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2731 Name
:= 'scShellsMax';
2734 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2736 Name
:= 'scGibsMax';
2739 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2741 Name
:= 'scCorpsesMax';
2744 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2746 Name
:= 'swGibsCount';
2747 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2748 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2749 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2750 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2751 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2753 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2755 Name
:= 'swCorpseType';
2756 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2757 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2759 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2761 Name
:= 'swGibsType';
2762 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2763 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2765 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2767 Name
:= 'swBloodType';
2768 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2769 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2771 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2773 Name
:= 'swScreenFlash';
2774 AddItem(_lc
[I_MENU_NO
]);
2775 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2776 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2778 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2780 Name
:= 'swBackground';
2781 AddItem(_lc
[I_MENU_YES
]);
2782 AddItem(_lc
[I_MENU_NO
]);
2784 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2786 Name
:= 'swMessages';
2787 AddItem(_lc
[I_MENU_YES
]);
2788 AddItem(_lc
[I_MENU_NO
]);
2790 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2792 Name
:= 'swRevertPlayers';
2793 AddItem(_lc
[I_MENU_YES
]);
2794 AddItem(_lc
[I_MENU_NO
]);
2796 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2798 Name
:= 'swChatBubble';
2799 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2800 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2801 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2802 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2803 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2805 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2807 Name
:= 'swPlayerIndicator';
2808 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2809 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2810 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2812 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2814 Name
:= 'swPlayerIndicatorStyle';
2815 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2816 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2818 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2820 Name
:= 'scScaleFactor';
2822 OnChange
:= ProcChangeGameSettings
;
2826 Menu
.DefControl
:= 'mOptionsGameMenu';
2827 g_GUI_AddWindow(Menu
);
2829 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2830 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2832 Name
:= 'mOptionsControlsMenu';
2833 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2834 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2835 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2836 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2837 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2839 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2840 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2841 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2842 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2843 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2844 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2845 if e_HasJoysticks
then
2848 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2850 if g_touch_enabled
then
2853 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2856 Menu
.DefControl
:= 'mOptionsControlsMenu';
2857 g_GUI_AddWindow(Menu
);
2859 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2860 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2862 Name
:= 'mOptionsControlsP1Menu';
2863 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2864 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2865 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2866 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2867 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2868 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2869 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2870 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2871 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2874 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2875 g_GUI_AddWindow(Menu
);
2877 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2878 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2880 Name
:= 'mOptionsControlsP1MenuWeapons';
2881 for i
:= WP_FIRST
to WP_LAST
do
2882 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2883 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2885 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2886 g_GUI_AddWindow(Menu
);
2888 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2889 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2891 Name
:= 'mOptionsControlsP2Menu';
2892 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2893 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2894 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2895 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2903 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2909 Name
:= 'mOptionsControlsP2MenuWeapons';
2910 for i
:= WP_FIRST
to WP_LAST
do
2911 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2912 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2914 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2918 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2920 Name
:= 'mOptionsControlsJoystickMenu';
2921 for i
:= 0 to e_MaxJoys
- 1 do
2922 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2924 Name
:= 'scDeadzone' + IntToStr(i
);
2928 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2929 g_GUI_AddWindow(Menu
);
2931 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2932 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2934 Name
:= 'mOptionsControlsTouchMenu';
2935 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2937 Name
:= 'swTouchAlt';
2938 AddItem(_lc
[I_MENU_NO
]);
2939 AddItem(_lc
[I_MENU_YES
]);
2940 OnChange
:= ProcChangeTouchSettings
;
2942 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2944 Name
:= 'scTouchSize';
2946 OnChange
:= ProcChangeTouchSettings
;
2948 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2950 Name
:= 'swTouchFire';
2951 AddItem(_lc
[I_MENU_NO
]);
2952 AddItem(_lc
[I_MENU_YES
]);
2954 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2956 Name
:= 'scTouchOffset';
2958 OnChange
:= ProcChangeTouchSettings
;
2961 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2962 g_GUI_AddWindow(Menu
);
2964 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2965 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2967 Name
:= 'mOptionsPlayersMenu';
2968 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2969 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2971 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2972 g_GUI_AddWindow(Menu
);
2974 CreatePlayerOptionsMenu('P1');
2975 CreatePlayerOptionsMenu('P2');
2977 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2978 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_MODEL_INFO
]))) do
2980 Name
:= 'mOptionsPlayersMIMenu';
2981 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2986 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2991 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2993 Name
:= 'meComment';
2996 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2997 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3000 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3004 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3005 g_GUI_AddWindow(Menu
);
3007 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3008 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3010 Name
:= 'mOptionsLanguageMenu';
3011 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3012 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3015 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3016 g_GUI_AddWindow(Menu
);
3018 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6), @ProcDefaultMenuKeyDown
);
3019 g_GUI_AddWindow(Menu
);
3021 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3022 Menu
.BackTexture
:= 'INTER';
3023 Menu
.OnClose
:= ProcAuthorsClose
;
3027 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], False))) do
3029 Color
:= _RGB(255, 0, 0);
3030 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3032 _y
:= _y
+GetHeight();
3034 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), False))) do
3036 Color
:= _RGB(255, 0, 0);
3037 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3039 _y
:= _y
+GetHeight()+32;
3041 // ×òî äåëàë: Êòî äåëàë
3042 cx
:= gScreenWidth
div 2 - 320 + 64;
3043 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], False))) do
3045 Color
:= _RGB(255, 0, 0);
3050 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], False))) do
3052 Color
:= _RGB(255, 255, 255);
3057 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], False))) do
3059 Color
:= _RGB(255, 0, 0);
3064 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], False))) do
3066 Color
:= _RGB(255, 255, 255);
3071 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], False))) do
3073 Color
:= _RGB(255, 255, 255);
3078 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], False))) do
3080 Color
:= _RGB(255, 0, 0);
3085 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], False))) do
3087 Color
:= _RGB(255, 255, 255);
3092 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], False))) do
3094 Color
:= _RGB(255, 0, 0);
3099 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], False))) do
3101 Color
:= _RGB(255, 255, 255);
3104 _y
:= gScreenHeight
- 128;
3107 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], False))) do
3109 Color
:= _RGB(255, 0, 0);
3114 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], False))) do
3116 Color
:= _RGB(255, 255, 255);
3119 _y
:= _y
+GetHeight();
3121 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], False))) do
3123 Color
:= _RGB(255, 255, 255);
3126 _y
:= _y
+GetHeight();
3128 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], False))) do
3130 Color
:= _RGB(255, 255, 255);
3133 _y
:= gScreenHeight
- 32;
3135 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], False))) do
3137 Color
:= _RGB(255, 0, 0);
3138 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3141 g_GUI_AddWindow(Menu
);
3143 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6), @ProcExitMenuKeyDown
);
3144 g_GUI_AddWindow(Menu
);
3146 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3147 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3149 Name
:= 'mmGameSingleMenu';
3150 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3151 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3152 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3153 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3154 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3155 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3157 Menu
.DefControl
:= 'mmGameSingleMenu';
3158 Menu
.MainWindow
:= True;
3159 Menu
.OnClose
:= ProcGMClose
;
3160 Menu
.OnShow
:= ProcGMShow
;
3161 g_GUI_AddWindow(Menu
);
3163 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcEndMenuKeyDown
);
3164 g_GUI_AddWindow(Menu
);
3166 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcRestartMenuKeyDown
);
3167 g_GUI_AddWindow(Menu
);
3169 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3170 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3172 Name
:= 'mmGameCustomMenu';
3173 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3174 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3175 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3176 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3177 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3178 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3179 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3181 Menu
.DefControl
:= 'mmGameCustomMenu';
3182 Menu
.MainWindow
:= True;
3183 Menu
.OnClose
:= ProcGMClose
;
3184 Menu
.OnShow
:= ProcGMShow
;
3185 g_GUI_AddWindow(Menu
);
3187 Menu
:= TGUIWindow
.Create('GameServerMenu');
3188 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3190 Name
:= 'mmGameServerMenu';
3191 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3192 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3193 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3194 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3195 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3197 Menu
.DefControl
:= 'mmGameServerMenu';
3198 Menu
.MainWindow
:= True;
3199 Menu
.OnClose
:= ProcGMClose
;
3200 Menu
.OnShow
:= ProcGMShow
;
3201 g_GUI_AddWindow(Menu
);
3203 Menu
:= TGUIWindow
.Create('GameClientMenu');
3204 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3206 Name
:= 'mmGameClientMenu';
3207 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3208 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3209 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3211 Menu
.DefControl
:= 'mmGameClientMenu';
3212 Menu
.MainWindow
:= True;
3213 Menu
.OnClose
:= ProcGMClose
;
3214 Menu
.OnShow
:= ProcGMShow
;
3215 g_GUI_AddWindow(Menu
);
3217 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3218 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(False, False, _lc
[I_MENU_ENTERPASSWORD
]))) do
3220 Name
:= 'mClientPasswordMenu';
3221 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3229 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3232 Menu
.DefControl
:= 'mClientPasswordMenu';
3233 g_GUI_AddWindow(Menu
);
3235 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3236 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SET_GAME
]))) do
3238 Name
:= 'mGameSetGameMenu';
3239 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3241 Name
:= 'swTeamDamage';
3242 AddItem(_lc
[I_MENU_YES
]);
3243 AddItem(_lc
[I_MENU_NO
]);
3246 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3248 Name
:= 'swTeamHit';
3249 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3250 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3251 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3252 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3255 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3257 Name
:= 'swDeathmatchKeys';
3258 AddItem(_lc
[I_MENU_YES
]);
3259 AddItem(_lc
[I_MENU_NO
]);
3262 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3264 Name
:= 'edTimeLimit';
3269 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3271 Name
:= 'edGoalLimit';
3276 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3278 Name
:= 'edMaxLives';
3283 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3286 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3287 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3288 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3294 Menu
.DefControl
:= 'mGameSetGameMenu';
3295 Menu
.OnClose
:= ProcApplyGameSet
;
3296 g_GUI_AddWindow(Menu
);
3298 Menu
:= TGUIWindow
.Create('TeamMenu');
3299 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3301 Name
:= 'mmTeamMenu';
3302 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3303 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3304 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3305 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3306 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3308 Menu
.DefControl
:= 'mmTeamMenu';
3309 Menu
.OnShow
:= ProcChangePlayers
;
3310 g_GUI_AddWindow(Menu
);
3313 procedure g_Menu_Show_SaveMenu();
3315 if g_Game_IsTestMap
then
3317 if gGameSettings
.GameType
= GT_SINGLE
then
3318 g_GUI_ShowWindow('GameSingleMenu')
3321 if g_Game_IsClient
then
3324 if g_Game_IsNet
then
3327 g_GUI_ShowWindow('GameCustomMenu');
3329 g_GUI_ShowWindow('SaveMenu');
3330 g_Sound_PlayEx('MENU_OPEN');
3333 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3335 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3336 if gGameSettings
.GameType
= GT_SINGLE
then
3338 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3342 if g_Game_IsClient
then exit
;
3343 if g_Game_IsNet
then exit
;
3344 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3346 g_GUI_ShowWindow('LoadMenu');
3347 g_Sound_PlayEx('MENU_OPEN');
3350 procedure g_Menu_Show_GameSetGame();
3352 if gGameSettings
.GameType
= GT_SINGLE
then
3353 g_GUI_ShowWindow('GameSingleMenu')
3356 if g_Game_IsClient
then
3359 if g_Game_IsNet
then
3360 g_GUI_ShowWindow('GameServerMenu')
3362 g_GUI_ShowWindow('GameCustomMenu');
3365 g_GUI_ShowWindow('GameSetGameMenu');
3366 g_Sound_PlayEx('MENU_OPEN');
3369 procedure g_Menu_Show_OptionsVideo();
3371 if gGameSettings
.GameType
= GT_SINGLE
then
3372 g_GUI_ShowWindow('GameSingleMenu')
3375 if g_Game_IsClient
then
3376 g_GUI_ShowWindow('GameClientMenu')
3378 if g_Game_IsNet
then
3379 g_GUI_ShowWindow('GameServerMenu')
3381 g_GUI_ShowWindow('GameCustomMenu');
3384 g_GUI_ShowWindow('OptionsMenu');
3385 g_GUI_ShowWindow('OptionsVideoMenu');
3386 g_Sound_PlayEx('MENU_OPEN');
3389 procedure g_Menu_Show_OptionsSound();
3391 if gGameSettings
.GameType
= GT_SINGLE
then
3392 g_GUI_ShowWindow('GameSingleMenu')
3395 if g_Game_IsClient
then
3396 g_GUI_ShowWindow('GameClientMenu')
3398 if g_Game_IsNet
then
3399 g_GUI_ShowWindow('GameServerMenu')
3401 g_GUI_ShowWindow('GameCustomMenu');
3404 g_GUI_ShowWindow('OptionsMenu');
3405 g_GUI_ShowWindow('OptionsSoundMenu');
3406 g_Sound_PlayEx('MENU_OPEN');
3409 procedure g_Menu_Show_EndGameMenu();
3411 g_GUI_ShowWindow('EndGameMenu');
3412 g_Sound_PlayEx('MENU_OPEN');
3415 procedure g_Menu_Show_QuitGameMenu();
3417 g_GUI_ShowWindow('ExitMenu');
3418 g_Sound_PlayEx('MENU_OPEN');
3421 procedure g_Menu_Init();
3427 procedure g_Menu_Free();
3432 procedure g_Menu_Reset();
3436 g_GUI_SaveMenuPos();
3437 ex
:= g_GUI_Destroy();
3441 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3446 g_Game_SetDebugMode();
3448 g_GUI_LoadMenuPos();