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;
194 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
198 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
201 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
202 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
203 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
204 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
205 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
208 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
211 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
218 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
219 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
220 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
221 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
234 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
235 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
236 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
237 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
238 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
239 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
240 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
241 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
242 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
243 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
244 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
247 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
249 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
258 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
261 for i
:= WP_FIRST
to WP_LAST
do
263 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
265 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
270 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
273 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
274 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
275 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
276 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
277 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
278 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
279 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
280 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
281 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
282 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
283 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
296 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
297 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
298 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
299 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
300 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
301 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
302 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
303 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
304 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
305 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
306 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
307 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
309 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
310 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
311 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
312 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
313 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
314 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
315 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
316 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
317 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
323 for i
:= WP_FIRST
to WP_LAST
do
325 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
326 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
327 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
328 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
332 if e_HasJoysticks
then
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
337 for i
:= 0 to e_MaxJoys
- 1 do
338 if e_JoystickAvailable
[i
] then
339 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
343 if g_touch_enabled
then
345 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
346 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
347 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
348 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
349 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
352 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
353 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
354 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
355 TEAM_RED
, TEAM_BLUE
);
356 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
358 gPlayer1Settings
.Model
:= Model
.GetName();
359 gPlayer1Settings
.Color
:= Model
.Color
;
362 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
363 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
364 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
365 TEAM_RED
, TEAM_BLUE
);
366 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
368 gPlayer2Settings
.Model
:= Model
.GetName();
369 gPlayer2Settings
.Color
:= Model
.Color
;
372 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
373 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
374 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
375 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
376 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
379 for i
:= WP_FIRST
to WP_LAST
+1 do
381 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
386 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
387 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
388 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
389 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
392 for i
:= WP_FIRST
to WP_LAST
+1 do
394 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
398 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
399 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
401 if g_Game_IsServer
then
403 if gPlayer1
<> nil then
405 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
406 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
407 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
408 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
410 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
412 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
413 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
414 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
415 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
416 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
419 if gPlayer2
<> nil then
421 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
422 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
423 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
424 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
426 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
428 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
429 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
430 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
431 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
432 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
436 if g_Game_IsClient
then
438 MC_SEND_PlayerSettings
;
439 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
442 g_Console_WriteGameConfig
;
445 procedure ReadOptions();
450 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
452 with TGUISwitch(menu
.GetControl('swBPP')) do
458 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
459 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
461 with TGUISwitch(menu
.GetControl('swVSync')) do
462 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
464 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
465 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
467 with TGUISwitch(menu
.GetControl('swInterp')) do
468 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
470 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
472 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
473 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
474 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
476 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
477 if gMuteWhenInactive
then
482 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
484 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
485 if gSoundEffectsDF
then
490 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
491 if gUseChatSounds
then
496 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
516 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
520 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
524 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
527 for i
:= WP_FIRST
to WP_LAST
do
529 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
530 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
534 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
551 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
552 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
553 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
554 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
555 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
556 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
557 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
558 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
559 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
562 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
565 for i
:= WP_FIRST
to WP_LAST
do
567 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
568 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
572 if e_HasJoysticks
then
574 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
577 for i
:= 0 to e_MaxJoys
- 1 do
578 if e_JoystickAvailable
[i
] then
579 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
583 if g_touch_enabled
then
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
586 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
587 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
588 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
589 with TGUISwitch(menu
.GetControl('swTouchFire')) do
590 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
591 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
594 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
597 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
598 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
599 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
600 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
603 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
606 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
608 {$IFDEF ENABLE_SHELLS}
609 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
612 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
614 {$IFDEF ENABLE_CORPSES}
615 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
617 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
619 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
622 with TGUISwitch(menu
.GetControl('swBloodType')) do
623 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
625 with TGUISwitch(menu
.GetControl('swCorpseType')) do
626 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
628 with TGUISwitch(menu
.GetControl('swGibsType')) do
629 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
632 with TGUISwitch(menu
.GetControl('swGibsCount')) do
644 with TGUISwitch(menu
.GetControl('swBackGround')) do
645 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
647 with TGUISwitch(menu
.GetControl('swMessages')) do
648 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
650 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
651 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
653 with TGUISwitch(menu
.GetControl('swChatBubble')) do
654 ItemIndex
:= gChatBubble
;
656 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
657 ItemIndex
:= gPlayerIndicator
;
659 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
660 ItemIndex
:= gPlayerIndicatorStyle
;
662 TempScale
:= Round(g_dbg_scale
- 1);
663 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
665 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
667 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
668 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
670 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
671 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
673 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
674 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
675 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
677 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
678 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
679 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
680 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
681 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
682 for i
:= WP_FIRST
to WP_LAST
+1 do
684 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
685 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
688 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
689 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
690 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
691 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
692 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
693 for i
:= WP_FIRST
to WP_LAST
+1 do
695 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
696 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
699 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
701 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
702 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
704 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
705 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
707 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
708 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
709 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
711 ProcSelectModel(nil);
714 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
716 // don't turn off monsters in DM
718 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
719 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
720 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
725 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
726 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
727 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
728 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
732 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
734 // don't turn off monsters in DM
736 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
737 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
738 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
740 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
743 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
744 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
745 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
746 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
750 function LatchGameOptions(const MenuName
: string): Byte;
756 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
758 Map
:= TGUILabel(GetControl('lbMap')).Text;
761 if not isWadPath(Map
) then
764 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
765 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
766 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
767 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
768 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
769 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
770 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
774 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
775 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
776 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
777 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
778 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
779 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
780 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
781 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
782 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
783 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
785 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
786 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
787 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
788 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
791 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
792 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
793 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
794 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
797 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
798 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
799 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
800 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
803 // TODO: get this crap out of here
804 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
805 gGameSettings
.WarmupTime
:= gsWarmupTime
;
806 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
810 procedure ProcStartCustomGame();
814 GameMode
:= LatchGameOptions('mCustomGameMenu');
815 if GameMode
= GM_NONE
then Exit
;
817 g_Console_WriteGameConfig
;
818 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
819 gsMaxLives
, gsGameFlags
, gsPlayers
);
823 procedure ProcStartNetGame();
827 GameMode
:= LatchGameOptions('mNetServerMenu');
828 if GameMode
= GM_NONE
then Exit
;
830 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
832 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
833 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
834 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
835 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
836 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
837 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
840 g_Console_WriteGameConfig
;
841 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
842 gsGameFlags
, gsPlayers
, 0, NetPort
);
845 procedure ProcConnectNetGame();
849 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
851 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
852 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
853 PW
:= TGUIEdit(GetControl('edPW')).Text;
856 g_Console_WriteGameConfig
;
857 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
860 procedure ProcEnterPassword();
864 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
866 NetClientIP
:= PromptIP
;
867 NetClientPort
:= PromptPort
;
868 PW
:= TGUIEdit(GetControl('edPW')).Text;
871 g_Console_WriteGameConfig
;
872 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
875 procedure ProcServerlist();
877 if not NetInitDone
then
879 if (not g_Net_Init()) then
881 g_Console_Add('NET: ERROR: Failed to init ENet!');
888 g_Net_Slist_Set(NetMasterList
);
890 gState
:= STATE_SLIST
;
891 g_ActiveWindow
:= nil;
893 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
895 {$IFDEF ENABLE_RENDER}
899 slReturnPressed
:= True;
900 if g_Net_Slist_Fetch(slCurrent
) then
902 if slCurrent
= nil then
903 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
906 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
907 g_Serverlist_GenerateTable(slCurrent
, slTable
);
910 procedure ProcStartCampaign();
916 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
918 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
919 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
921 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
927 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
930 procedure ProcSelectMap(Sender
: TGUIControl
);
934 wad
, map
, res
: String;
936 win
:= g_GUI_GetWindow('SelectMapMenu');
937 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
939 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
940 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
942 if (wad
= '') or (map
= '') then
943 begin // Ýòî íå êàðòà
944 TGUILabel(GetControl('lbMapName')).Text := '';
945 TGUILabel(GetControl('lbMapAuthor')).Text := '';
946 TGUILabel(GetControl('lbMapSize')).Text := '';
947 TGUIMemo(GetControl('meMapDescription')).SetText('');
948 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
949 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
955 a
:= g_Map_GetMapInfo(res
);
957 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
958 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
959 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
960 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
961 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
962 TGUILabel(win
.GetControl('lbMapScale')).Text :=
963 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
968 procedure ProcSelectWAD(Sender
: TGUIControl
);
973 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
975 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
977 with TGUIListBox(GetControl('lsMapRes')) do
983 list
:= g_Map_GetMapsList(wad
);
997 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
1003 win
:= g_GUI_GetWindow('CampaignMenu');
1004 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
1006 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
1010 TGUILabel(GetControl('lbWADName')).Text := '';
1011 TGUILabel(GetControl('lbWADAuthor')).Text := '';
1012 TGUIMemo(GetControl('meWADDescription')).SetText('');
1015 a
:= g_Game_GetMegaWADInfo(wad
);
1017 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1018 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1019 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1021 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1025 fn
:= g_ExtractWadName(a
.pic
);
1027 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1029 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1034 procedure ProcChangeColor(Sender
: TGUIControl
);
1038 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1039 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1040 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1041 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1042 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1043 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1045 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1046 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1047 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1048 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1049 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1050 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1053 procedure ProcSelectModel(Sender
: TGUIControl
);
1058 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1059 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1060 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1062 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1063 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1064 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1066 ProcChangeColor(nil);
1069 procedure MenuLoadData();
1071 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1073 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1074 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1075 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1076 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1077 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1078 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1079 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1082 procedure MenuFreeData();
1084 g_Sound_Delete('MENU_SELECT');
1085 g_Sound_Delete('MENU_OPEN');
1086 g_Sound_Delete('MENU_CLOSE');
1087 g_Sound_Delete('MENU_CHANGE');
1088 g_Sound_Delete('SCROLL_ADD');
1089 g_Sound_Delete('SCROLL_SUB');
1090 g_Sound_Delete('SOUND_PLAYER_FALL');
1093 procedure ProcAuthorsMenu();
1095 gMusic
.SetByName('MUSIC_INTERMUS');
1099 procedure ProcExitMenuKeyDown (yes
: Boolean);
1102 snd
: TPlayableSound
;
1107 g_Game_StopAllSounds(True);
1108 case (Random(18)) of
1109 0: s
:= 'SOUND_MONSTER_PAIN';
1110 1: s
:= 'SOUND_MONSTER_DIE_3';
1111 2: s
:= 'SOUND_MONSTER_SLOP';
1112 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1113 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1114 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1115 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1116 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1117 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1118 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1119 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1120 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1121 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1122 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1123 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1124 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1125 else s
:= 'SOUND_PLAYER_FALL';
1127 snd
:= TPlayableSound
.Create();
1128 res
:= snd
.SetByName(s
);
1129 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1133 while snd
.IsPlaying() do begin end;
1141 procedure ProcLoadMenu();
1148 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1149 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1150 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1154 procedure ProcSaveMenu();
1162 name
:= g_GetSaveName(a
, valid
);
1163 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1164 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1168 procedure ProcSaveGame(Sender
: TGUIControl
);
1172 if g_Game_IsNet
then Exit
;
1173 if g_Game_IsTestMap
then Exit
;
1174 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1175 g_Game_PauseAllSounds(True);
1176 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1178 g_ActiveWindow
:= nil;
1179 g_Game_Pause(False);
1182 procedure ProcLoadGame(Sender
: TGUIControl
);
1186 if g_Game_IsNet
then Exit
;
1187 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1188 if g_LoadGame(a
) then
1190 g_Game_PauseAllSounds(False)
1192 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1194 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1195 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1196 //g_ActiveWindow := nil;
1200 procedure ProcSinglePlayer (n
: Integer);
1201 var wad
, map
: AnsiString;
1204 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1205 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1206 if e_FindResource(AllMapDirs
, wad
) then
1208 wad
:= ExpandFileName(wad
);
1209 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1213 procedure ProcSingle1Player
;
1218 procedure ProcSingle2Players
;
1223 procedure ProcSelectMapMenu();
1226 wad_lb
: TGUIFileListBox
;
1227 map_lb
: TGUIListBox
;
1230 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1231 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1232 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1234 if wad_lb
.SelectedItem() <> '' then
1235 map
:= map_lb
.SelectedItem()
1239 wad_lb
.UpdateFileList();
1242 if wad_lb
.SelectedItem() <> '' then
1245 map_lb
.SelectItem(map
);
1247 if map_lb
.SelectedItem() <> '' then
1251 g_GUI_ShowWindow('SelectMapMenu');
1254 procedure ProcSelectCampaignMenu();
1257 wad_lb
: TGUIFileListBox
;
1259 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1260 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1262 wad_lb
.UpdateFileList();
1264 if wad_lb
.SelectedItem() <> '' then
1265 ProcSelectCampaignWAD(nil);
1268 procedure ProcSetMap();
1270 wad
, map
, res
: String;
1272 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1274 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1275 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1278 if (wad
= '') or (map
= '') then
1281 wad
:= e_FindWadRel(MapDirs
, WAD
);
1283 res
:= wad
+':\'+map
;
1285 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1286 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1289 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1293 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1295 g_Sound_SetupAllVolumes(
1296 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1297 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1301 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1306 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1308 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1309 g_dbg_scale
:= TempScale
+ 1;
1313 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1317 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1318 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1319 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1320 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1323 procedure ProcOptionsPlayersMIMenu();
1328 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1330 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1332 if a
= '' then Exit
;
1334 i
:= g_PlayerModel_GetIndex(a
);
1335 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1337 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1338 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1339 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1341 if PlayerModelsArray
[i
].HaveWeapon
then
1342 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1344 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1347 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1350 procedure ProcOptionsPlayerP1WeaponMenu();
1354 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1355 if a
= '' then Exit
;
1356 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1359 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1361 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1364 procedure ProcOptionsPlayerP2WeaponMenu();
1368 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1369 if a
= '' then Exit
;
1370 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1373 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1375 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1378 procedure ProcOptionsPlayersAnim();
1382 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1387 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1390 Model
.AnimState
.Loop
:= True;
1394 procedure ProcOptionsPlayersWeap();
1398 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1403 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1407 procedure ProcOptionsPlayersRot();
1411 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1412 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1414 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1418 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1422 g_Options_SetDefault();
1428 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1430 if yes
then ReadOptions();
1434 procedure ProcAuthorsClose();
1436 gMusic
.SetByName('MUSIC_MENU');
1438 gState
:= STATE_MENU
;
1441 procedure ProcGMClose();
1443 g_Game_InGameMenu(False);
1446 procedure ProcGMShow();
1451 if (gGameSettings
.GameType
= GT_SINGLE
) and
1452 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1453 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1454 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1456 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1457 if g_Game_IsTestMap
then
1458 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1459 TGUIMainMenu(g_ActiveWindow
.GetControl(
1460 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1463 procedure ProcChangePlayers();
1465 TeamGame
, Spectator
, AddTwo
: Boolean;
1466 P1Team
{, P2Team}: Byte;
1467 bP2
: TGUITextButton
;
1469 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1470 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1471 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1472 P1Team
:= TEAM_NONE
;
1473 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1475 //P2Team := TEAM_NONE;
1476 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1478 TGUIMainMenu(g_ActiveWindow
.GetControl(
1479 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1480 TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1482 TGUIMainMenu(g_ActiveWindow
.GetControl(
1483 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1485 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1486 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1487 bP2
.Enabled
:= AddTwo
and not Spectator
;
1489 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1491 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1492 if gPlayer2
= nil then
1493 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1495 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1497 TGUIMainMenu(g_ActiveWindow
.GetControl(
1498 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1501 procedure ProcJoinRed();
1503 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1505 if g_Game_IsServer
then
1507 if gPlayer1
= nil then
1508 g_Game_AddPlayer(TEAM_RED
)
1511 if gPlayer1
.Team
<> TEAM_RED
then
1513 gPlayer1
.SwitchTeam
;
1514 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1517 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1522 gPlayer1Settings
.Team
:= TEAM_RED
;
1523 MC_SEND_PlayerSettings
;
1524 if gPlayer1
= nil then
1525 g_Game_AddPlayer(TEAM_RED
);
1527 g_ActiveWindow
:= nil;
1528 g_Game_Pause(False);
1531 procedure ProcJoinBlue();
1533 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1535 if g_Game_IsServer
then
1537 if gPlayer1
= nil then
1538 g_Game_AddPlayer(TEAM_BLUE
)
1541 if gPlayer1
.Team
<> TEAM_BLUE
then
1543 gPlayer1
.SwitchTeam
;
1544 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1547 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1552 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1553 MC_SEND_PlayerSettings
;
1554 if gPlayer1
= nil then
1555 g_Game_AddPlayer(TEAM_BLUE
);
1557 g_ActiveWindow
:= nil;
1558 g_Game_Pause(False);
1561 procedure ProcJoinGame();
1563 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1565 if gPlayer1
= nil then
1567 g_ActiveWindow
:= nil;
1568 g_Game_Pause(False);
1571 procedure ProcSwitchP2();
1573 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1575 if gPlayer1
= nil then
1577 if gPlayer2
= nil then
1580 g_Game_RemovePlayer();
1581 g_ActiveWindow
:= nil;
1582 g_Game_Pause(False);
1585 procedure ProcSpectate();
1587 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1590 g_ActiveWindow
:= nil;
1591 g_Game_Pause(False);
1594 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1596 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1599 procedure ProcEndMenuKeyDown (yes
: Boolean);
1601 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1604 procedure ProcSetRussianLanguage
;
1606 if gLanguage
<> LANGUAGE_RUSSIAN
then
1608 gLanguage
:= LANGUAGE_RUSSIAN
;
1609 gLanguageChange
:= True;
1610 gAskLanguage
:= False;
1615 procedure ProcSetEnglishLanguage
;
1617 if gLanguage
<> LANGUAGE_ENGLISH
then
1619 gLanguage
:= LANGUAGE_ENGLISH
;
1620 gLanguageChange
:= True;
1621 gAskLanguage
:= False;
1626 procedure ReadGameSettings();
1630 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1632 with gGameSettings
do
1634 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1635 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1639 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1640 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1642 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1644 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1648 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1649 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1653 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1654 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1656 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1661 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1662 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1663 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1665 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1666 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1667 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1670 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1675 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1677 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1678 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1679 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1681 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1682 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1686 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1687 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1689 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1690 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1691 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1692 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1693 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1694 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1695 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1696 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1700 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1701 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1702 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1703 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1704 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1709 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1710 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1715 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1716 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1721 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1722 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1723 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1728 procedure ProcApplyGameSet();
1732 stat
: TPlayerStatArray
;
1734 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1736 if not g_Game_IsServer
then Exit
;
1738 with gGameSettings
do
1740 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1742 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1743 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1745 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1748 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1750 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1751 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1752 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1753 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1754 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1758 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1760 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1761 Options
:= Options
or GAME_OPTION_DMKEYS
1763 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1766 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1768 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1774 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1776 TimeLimit
:= Max(n
, b
);
1780 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1782 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1789 if GameMode
= GM_DM
then
1791 stat
:= g_Player_GetStats();
1793 for a
:= 0 to High(stat
) do
1794 if stat
[a
].Frags
> b
then
1798 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1800 ScoreLimit
:= Max(n
, b
);
1804 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1806 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1807 if n
< 0 then n
:= 0;
1808 if n
> 255 then n
:= 255;
1814 stat
:= g_Player_GetStats();
1816 for a
:= 0 to High(stat
) do
1817 if stat
[a
].Lives
> b
then
1820 MaxLives
:= Max(n
, b
);
1824 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1826 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1829 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1830 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1834 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1835 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1839 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1840 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1845 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1847 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1848 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1849 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1850 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1854 // don't forget to latch this shit
1855 gsGameFlags
:= Options
;
1856 gsMaxLives
:= MaxLives
;
1857 gsScoreLimit
:= ScoreLimit
;
1858 gsTimeLimit
:= TimeLimit
;
1861 if g_Game_IsNet
then MH_SEND_GameSettings
;
1864 procedure ProcVideoOptionsRes();
1869 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1871 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1872 IntToStr(gWinSizeX
) +
1873 ' x ' + IntToStr(gWinSizeY
) +
1874 ', ' + IntToStr(gBPP
) + ' bpp';
1876 with TGUIListBox(menu
.GetControl('lsResolution')) do
1878 {$IFDEF ENABLE_SYSTEM}
1879 list
:= sys_GetDisplayModes(gBPP
);
1886 ItemIndex
:= Length(list
)
1894 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1900 TempResScale
:= Round(r_pixel_scale
- 1);
1901 with TGUISwitch(menu
.GetControl('swResFactor')) do
1902 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1905 procedure ProcApplyVideoOptions();
1908 Fullscreen
: Boolean;
1909 SWidth
, SHeight
: Integer;
1910 ScaleChanged
: Boolean;
1913 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1915 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1917 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1920 SWidth
:= gWinSizeX
;
1921 SHeight
:= gWinSizeY
;
1922 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1925 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1927 ScaleChanged
:= False;
1928 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1930 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1931 r_pixel_scale
:= TempResScale
+ 1;
1932 ScaleChanged
:= True;
1935 if (SWidth
<> gWinSizeX
) or
1936 (SHeight
<> gWinSizeY
) or
1937 (Fullscreen
<> gFullscreen
) or
1940 gResolutionChange
:= True;
1941 gRC_Width
:= SWidth
;
1942 gRC_Height
:= SHeight
;
1943 gRC_FullScreen
:= Fullscreen
;
1944 gRC_Maximized
:= gWinMaximized
;
1947 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1951 procedure ProcSetFirstRussianLanguage
;
1953 gLanguage
:= LANGUAGE_RUSSIAN
;
1954 gLanguageChange
:= True;
1955 gAskLanguage
:= False;
1958 procedure ProcSetFirstEnglishLanguage
;
1960 gLanguage
:= LANGUAGE_ENGLISH
;
1961 gLanguageChange
:= True;
1962 gAskLanguage
:= False;
1965 procedure ProcRecallAddress();
1967 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1969 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1970 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1974 procedure CreateFirstLanguageMenu();
1978 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1980 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, ' '))) do // space to prevent show logo
1982 Name
:= 'mmFirstLanguageMenu';
1983 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1984 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1987 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1988 Menu
.MainWindow
:= True;
1989 g_GUI_AddWindow(Menu
);
1992 procedure g_Menu_AskLanguage();
1994 CreateFirstLanguageMenu();
1995 g_GUI_ShowWindow('FirstLanguageMenu');
1998 procedure CreatePlayerOptionsMenu(s
: String);
2003 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2005 a
:= _lc
[I_MENU_PLAYER_1
]
2007 a
:= _lc
[I_MENU_PLAYER_2
];
2008 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, a
))) do
2010 Name
:= 'mOptionsPlayers'+s
+'Menu';
2011 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2013 Name
:= 'ed'+s
+'Name';
2017 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2019 Name
:= 'sw'+s
+'Team';
2020 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2021 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2023 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2025 Name
:= 'ls'+s
+'Model';
2027 Items
:= g_PlayerModel_GetNames();
2028 OnChange
:= ProcSelectModel
;
2030 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2032 Name
:= 'sc'+s
+'Red';
2034 OnChange
:= ProcChangeColor
;
2036 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2038 Name
:= 'sc'+s
+'Green';
2040 OnChange
:= ProcChangeColor
;
2042 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2044 Name
:= 'sc'+s
+'Blue';
2046 OnChange
:= ProcChangeColor
;
2049 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2050 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2051 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2052 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2053 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2054 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2055 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2057 Name
:= 'mv'+s
+'Model';
2058 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2059 Y
:= GetControl('ls'+s
+'Model').Y
;
2062 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2063 g_GUI_AddWindow(Menu
);
2066 procedure CreateAllMenus();
2070 a
, cx
, _y
, i
: Integer;
2073 Menu
:= TGUIWindow
.Create('MainMenu');
2074 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, '' (*_lc[I_MENU_MAIN_MENU]*) ))) do
2076 Name
:= 'mmMainMenu';
2077 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2078 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2079 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2080 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2081 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2082 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2084 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), False))) do
2086 Color
:= _RGB(255, 255, 255);
2087 X
:= gScreenWidth
-GetWidth
-8;
2088 Y
:= gScreenHeight
-GetHeight
-8;
2090 Menu
.DefControl
:= 'mmMainMenu';
2091 Menu
.MainWindow
:= True;
2092 g_GUI_AddWindow(Menu
);
2094 Menu
:= TGUIWindow
.Create('NewGameMenu');
2095 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_NEW_GAME
]))) do
2097 Name
:= 'mmNewGameMenu';
2098 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2099 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2100 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2101 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2103 Menu
.DefControl
:= 'mmNewGameMenu';
2104 g_GUI_AddWindow(Menu
);
2106 Menu
:= TGUIWindow
.Create('NetGameMenu');
2107 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MULTIPLAYER
]))) do
2109 Name
:= 'mmNetGameMenu';
2110 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2111 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2113 Menu
.DefControl
:= 'mmNetGameMenu';
2114 g_GUI_AddWindow(Menu
);
2116 Menu
:= TGUIWindow
.Create('NetServerMenu');
2117 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_SERVER
]))) do
2119 Name
:= 'mNetServerMenu';
2120 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2122 Name
:= 'edSrvName';
2123 OnlyDigits
:= False;
2126 Text := NetServerName
;
2128 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2130 Name
:= 'edSrvPassword';
2131 OnlyDigits
:= False;
2134 Text := NetPassword
;
2136 with AddEdit(_lc
[I_NET_PORT
]) do
2142 Text := IntToStr(NetPort
);
2144 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2146 Name
:= 'edMaxPlayers';
2150 Text := IntToStr(NetMaxClients
);
2152 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2154 Name
:= 'swUseMaster';
2155 AddItem(_lc
[I_MENU_YES
]);
2156 AddItem(_lc
[I_MENU_NO
]);
2157 if NetUseMaster
then
2163 with AddLabel(_lc
[I_MENU_MAP
]) do
2168 OnClick
:= @ProcSelectMapMenu
;
2170 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2172 Name
:= 'swGameMode';
2173 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2174 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2175 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2176 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2177 case g_Game_TextToMode(gsGameMode
) of
2179 GM_DM
: ItemIndex
:= 0;
2180 GM_TDM
: ItemIndex
:= 1;
2181 GM_CTF
: ItemIndex
:= 2;
2183 GM_COOP
: ItemIndex
:= 3;
2185 OnChange
:= ProcSwitchMonstersCustom
;
2187 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2189 Name
:= 'edTimeLimit';
2193 if gsTimeLimit
> 0 then
2194 Text := IntToStr(gsTimeLimit
);
2196 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2198 Name
:= 'edScoreLimit';
2202 if gsScoreLimit
> 0 then
2203 Text := IntToStr(gsScoreLimit
);
2205 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2207 Name
:= 'edMaxLives';
2211 if gsMaxLives
> 0 then
2212 Text := IntToStr(gsMaxLives
);
2214 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2216 Name
:= 'edItemRespawnTime';
2220 if gsItemRespawnTime
> 0 then
2221 Text := IntToStr(gsItemRespawnTime
);
2223 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2225 Name
:= 'swPlayers';
2226 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2227 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2228 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2229 ItemIndex
:= gsPlayers
;
2231 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2233 Name
:= 'swTeamDamage';
2234 AddItem(_lc
[I_MENU_YES
]);
2235 AddItem(_lc
[I_MENU_NO
]);
2236 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2241 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2243 Name
:= 'swTeamHit';
2244 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2245 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2246 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2247 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2248 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2250 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2252 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2257 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2259 Name
:= 'swDeathmatchKeys';
2260 AddItem(_lc
[I_MENU_YES
]);
2261 AddItem(_lc
[I_MENU_NO
]);
2262 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2267 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2269 Name
:= 'swEnableExits';
2270 AddItem(_lc
[I_MENU_YES
]);
2271 AddItem(_lc
[I_MENU_NO
]);
2272 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2277 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2279 Name
:= 'swWeaponStay';
2280 AddItem(_lc
[I_MENU_YES
]);
2281 AddItem(_lc
[I_MENU_NO
]);
2282 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2287 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2289 Name
:= 'swMonsters';
2290 AddItem(_lc
[I_MENU_YES
]);
2291 AddItem(_lc
[I_MENU_NO
]);
2292 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2297 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2300 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2301 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2302 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2304 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2306 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2309 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2311 Name
:= 'swFlagDrop';
2312 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2313 AddItem(_lc
[I_MENU_YES
]);
2314 AddItem(_lc
[I_MENU_NO
]);
2315 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2317 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2323 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2327 Menu
.DefControl
:= 'mNetServerMenu';
2328 g_GUI_AddWindow(Menu
);
2330 Menu
:= TGUIWindow
.Create('NetClientMenu');
2331 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_START_CLIENT
]))) do
2333 Name
:= 'mNetClientMenu';
2335 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2338 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2344 Text := 'localhost';
2346 with AddEdit(_lc
[I_NET_PORT
]) do
2354 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2357 OnlyDigits
:= False;
2364 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2368 Menu
.DefControl
:= 'mNetClientMenu';
2369 g_GUI_AddWindow(Menu
);
2371 Menu
:= TGUIWindow
.Create('LoadMenu');
2372 Menu
.OnShow
:= ProcLoadMenu
;
2373 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LOAD_GAME
]))) do
2375 Name
:= 'mmLoadMenu';
2380 Name
:= 'edSlot'+IntToStr(a
);
2383 OnEnter
:= ProcLoadGame
;
2386 Menu
.DefControl
:= 'mmLoadMenu';
2387 g_GUI_AddWindow(Menu
);
2389 Menu
:= TGUIWindow
.Create('SaveMenu');
2390 Menu
.OnShow
:= ProcSaveMenu
;
2391 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SAVE_GAME
]))) do
2393 Name
:= 'mmSaveMenu';
2398 Name
:= 'edSlot'+IntToStr(a
);
2401 OnChange
:= ProcSaveGame
;
2404 Menu
.DefControl
:= 'mmSaveMenu';
2405 g_GUI_AddWindow(Menu
);
2407 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2408 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CUSTOM_GAME
]))) do
2410 Name
:= 'mCustomGameMenu';
2411 with AddLabel(_lc
[I_MENU_MAP
]) do
2416 OnClick
:= @ProcSelectMapMenu
;
2418 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2420 Name
:= 'swGameMode';
2421 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2422 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2423 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2424 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2425 case g_Game_TextToMode(gsGameMode
) of
2427 GM_DM
: ItemIndex
:= 0;
2428 GM_TDM
: ItemIndex
:= 1;
2429 GM_CTF
: ItemIndex
:= 2;
2431 GM_COOP
: ItemIndex
:= 3;
2433 OnChange
:= ProcSwitchMonstersCustom
;
2435 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2437 Name
:= 'edTimeLimit';
2441 if gsTimeLimit
> 0 then
2442 Text := IntToStr(gsTimeLimit
);
2444 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2446 Name
:= 'edScoreLimit';
2450 if gsScoreLimit
> 0 then
2451 Text := IntToStr(gsScoreLimit
);
2453 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2455 Name
:= 'edMaxLives';
2459 if gsMaxLives
> 0 then
2460 Text := IntToStr(gsMaxLives
);
2462 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2464 Name
:= 'edItemRespawnTime';
2468 if gsItemRespawnTime
> 0 then
2469 Text := IntToStr(gsItemRespawnTime
);
2471 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2473 Name
:= 'swPlayers';
2474 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2475 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2476 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2477 ItemIndex
:= gsPlayers
;
2479 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2481 Name
:= 'swTeamDamage';
2482 AddItem(_lc
[I_MENU_YES
]);
2483 AddItem(_lc
[I_MENU_NO
]);
2484 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2489 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2491 Name
:= 'swTeamHit';
2492 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2493 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2494 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2495 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2496 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2498 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2500 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2505 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2507 Name
:= 'swDeathmatchKeys';
2508 AddItem(_lc
[I_MENU_YES
]);
2509 AddItem(_lc
[I_MENU_NO
]);
2510 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2515 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2517 Name
:= 'swEnableExits';
2518 AddItem(_lc
[I_MENU_YES
]);
2519 AddItem(_lc
[I_MENU_NO
]);
2520 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2525 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2527 Name
:= 'swWeaponStay';
2528 AddItem(_lc
[I_MENU_YES
]);
2529 AddItem(_lc
[I_MENU_NO
]);
2530 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2535 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2537 Name
:= 'swMonsters';
2538 AddItem(_lc
[I_MENU_YES
]);
2539 AddItem(_lc
[I_MENU_NO
]);
2540 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2545 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2548 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2549 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2550 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2552 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2554 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2557 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2559 Name
:= 'swFlagDrop';
2560 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2561 AddItem(_lc
[I_MENU_YES
]);
2562 AddItem(_lc
[I_MENU_NO
]);
2563 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2565 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2571 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2575 Menu
.DefControl
:= 'mCustomGameMenu';
2576 g_GUI_AddWindow(Menu
);
2578 Menu
:= TGUIWindow
.Create('CampaignMenu');
2579 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CAMPAIGN
]))) do
2581 Name
:= 'mCampaignMenu';
2590 with AddFileList('', 15, 4) do
2593 OnChange
:= ProcSelectCampaignWAD
;
2597 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2598 SetBase(MegawadDirs
);
2601 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2603 Name
:= 'lbWADName';
2607 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2609 Name
:= 'lbWADAuthor';
2613 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2614 with AddMemo('', 15, 3) do
2616 Name
:= 'meWADDescription';
2617 Color
:= MENU_ITEMSCTRL_COLOR
;
2619 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2621 Name
:= 'swPlayers';
2622 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2623 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2626 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2630 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2632 Name
:= 'mpWADImage';
2633 DefaultRes
:= 'NOPIC';
2634 X
:= GetControl('lsWAD').X
+4;
2635 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2638 Menu
.DefControl
:= 'mCampaignMenu';
2639 g_GUI_AddWindow(Menu
);
2641 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2642 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SELECT_MAP
]))) do
2644 Name
:= 'mSelectMapMenu';
2645 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2648 OnChange
:= ProcSelectWAD
;
2652 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2655 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2659 OnChange
:= ProcSelectMap
;
2662 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2664 Name
:= 'lbMapName';
2668 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2670 Name
:= 'lbMapAuthor';
2674 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2676 Name
:= 'lbMapSize';
2680 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2682 Name
:= 'meMapDescription';
2687 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2689 Name
:= 'mpMapPreview';
2690 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2691 Y
:= GetControl('lsMapWAD').Y
;
2693 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', False))) do
2695 Name
:= 'lbMapScale';
2698 Color
:= MENU_ITEMSCTRL_COLOR
;
2699 X
:= GetControl('lsMapWAD').X
+
2700 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2701 2 + MAPPREVIEW_WIDTH
*4;
2702 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2705 Menu
.OnClose
:= ProcSetMap
;
2706 Menu
.DefControl
:= 'mSelectMapMenu';
2707 g_GUI_AddWindow(Menu
);
2709 Menu
:= TGUIWindow
.Create('OptionsMenu');
2710 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_OPTIONS
]))) do
2712 Name
:= 'mmOptionsMenu';
2713 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2714 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2715 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2716 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2717 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2718 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2720 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2721 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2723 Menu
.OnClose
:= ProcApplyOptions
;
2724 Menu
.DefControl
:= 'mmOptionsMenu';
2725 g_GUI_AddWindow(Menu
);
2727 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6), @ProcSavedMenuKeyDown
);
2728 g_GUI_AddWindow(Menu
);
2730 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2731 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2733 Name
:= 'mOptionsVideoMenu';
2734 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2735 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2741 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2744 AddItem(_lc
[I_MENU_YES
]);
2745 AddItem(_lc
[I_MENU_NO
]);
2747 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2749 Name
:= 'swTextureFilter';
2750 AddItem(_lc
[I_MENU_YES
]);
2751 AddItem(_lc
[I_MENU_NO
]);
2753 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2756 AddItem(_lc
[I_MENU_YES
]);
2757 AddItem(_lc
[I_MENU_NO
]);
2759 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2761 Name
:= 'swLegacyNPOT';
2762 AddItem(_lc
[I_MENU_NO
]);
2763 AddItem(_lc
[I_MENU_YES
]);
2766 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2769 Menu
.DefControl
:= 'mOptionsVideoMenu';
2770 g_GUI_AddWindow(Menu
);
2772 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2773 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2775 Name
:= 'mOptionsVideoResMenu';
2776 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2778 Name
:= 'lbCurrentRes';
2782 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2784 Name
:= 'lsResolution';
2787 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2789 Name
:= 'swFullScreen';
2790 AddItem(_lc
[I_MENU_YES
]);
2791 AddItem(_lc
[I_MENU_NO
]);
2793 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2795 Name
:= 'swResFactor';
2797 for i
:= 2 to gRC_Width
div 640 do
2798 AddItem(IntToStr(i
) + 'x');
2801 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2804 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2805 g_GUI_AddWindow(Menu
);
2807 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2808 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2810 Name
:= 'mOptionsSoundMenu';
2811 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2813 Name
:= 'scMusicLevel';
2815 OnChange
:= ProcChangeSoundSettings
;
2817 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2819 Name
:= 'scSoundLevel';
2821 OnChange
:= ProcChangeSoundSettings
;
2823 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2825 Name
:= 'scMaxSimSounds';
2828 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2830 Name
:= 'swAnnouncer';
2831 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2832 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2833 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2834 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2836 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2837 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2839 Name
:= 'swSoundEffects';
2840 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2841 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2843 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2844 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2846 Name
:= 'swChatSpeech';
2847 AddItem(_lc
[I_MENU_YES
]);
2848 AddItem(_lc
[I_MENU_NO
]);
2850 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2852 Name
:= 'swInactiveSounds';
2853 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2854 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2858 Menu
.DefControl
:= 'mOptionsSoundMenu';
2859 g_GUI_AddWindow(Menu
);
2861 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2862 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_GAME_OPTIONS
]))) do
2864 Name
:= 'mOptionsGameMenu';
2865 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2867 Name
:= 'scParticlesCount';
2870 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2872 Name
:= 'swBloodCount';
2873 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2874 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2875 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2876 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2877 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2879 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2881 Name
:= 'scShellsMax';
2884 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2886 Name
:= 'scGibsMax';
2889 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2891 Name
:= 'scCorpsesMax';
2894 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2896 Name
:= 'swGibsCount';
2897 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2898 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2899 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2900 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2901 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2903 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2905 Name
:= 'swCorpseType';
2906 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2907 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2909 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2911 Name
:= 'swGibsType';
2912 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2913 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2915 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2917 Name
:= 'swBloodType';
2918 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2919 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2921 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2923 Name
:= 'swScreenFlash';
2924 AddItem(_lc
[I_MENU_NO
]);
2925 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2926 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2928 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2930 Name
:= 'swBackground';
2931 AddItem(_lc
[I_MENU_YES
]);
2932 AddItem(_lc
[I_MENU_NO
]);
2934 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2936 Name
:= 'swMessages';
2937 AddItem(_lc
[I_MENU_YES
]);
2938 AddItem(_lc
[I_MENU_NO
]);
2940 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2942 Name
:= 'swRevertPlayers';
2943 AddItem(_lc
[I_MENU_YES
]);
2944 AddItem(_lc
[I_MENU_NO
]);
2946 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2948 Name
:= 'swChatBubble';
2949 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2950 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2951 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2952 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2953 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2955 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2957 Name
:= 'swPlayerIndicator';
2958 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2959 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2960 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2962 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2964 Name
:= 'swPlayerIndicatorStyle';
2965 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2966 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2968 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2970 Name
:= 'scScaleFactor';
2972 OnChange
:= ProcChangeGameSettings
;
2976 Menu
.DefControl
:= 'mOptionsGameMenu';
2977 g_GUI_AddWindow(Menu
);
2979 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2980 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2982 Name
:= 'mOptionsControlsMenu';
2983 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2984 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2985 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2986 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2987 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2989 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2990 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2991 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2992 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2993 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2994 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2995 if e_HasJoysticks
then
2998 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3000 if g_touch_enabled
then
3003 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3006 Menu
.DefControl
:= 'mOptionsControlsMenu';
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3012 Name
:= 'mOptionsControlsP1Menu';
3013 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3014 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3015 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3016 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3017 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3018 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3019 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3020 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3021 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3022 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3023 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3025 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3026 g_GUI_AddWindow(Menu
);
3028 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3029 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3031 Name
:= 'mOptionsControlsP1MenuWeapons';
3032 for i
:= WP_FIRST
to WP_LAST
do
3033 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3034 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3036 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3037 g_GUI_AddWindow(Menu
);
3039 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3040 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3042 Name
:= 'mOptionsControlsP2Menu';
3043 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3044 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3045 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3046 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3047 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3048 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3049 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3050 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3051 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3052 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3053 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3055 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3056 g_GUI_AddWindow(Menu
);
3058 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3059 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3061 Name
:= 'mOptionsControlsP2MenuWeapons';
3062 for i
:= WP_FIRST
to WP_LAST
do
3063 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3064 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3066 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3067 g_GUI_AddWindow(Menu
);
3069 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3070 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3072 Name
:= 'mOptionsControlsJoystickMenu';
3073 for i
:= 0 to e_MaxJoys
- 1 do
3074 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3076 Name
:= 'scDeadzone' + IntToStr(i
);
3080 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3081 g_GUI_AddWindow(Menu
);
3083 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3084 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3086 Name
:= 'mOptionsControlsTouchMenu';
3087 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3089 Name
:= 'swTouchAlt';
3090 AddItem(_lc
[I_MENU_NO
]);
3091 AddItem(_lc
[I_MENU_YES
]);
3092 OnChange
:= ProcChangeTouchSettings
;
3094 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3096 Name
:= 'scTouchSize';
3098 OnChange
:= ProcChangeTouchSettings
;
3100 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3102 Name
:= 'swTouchFire';
3103 AddItem(_lc
[I_MENU_NO
]);
3104 AddItem(_lc
[I_MENU_YES
]);
3106 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3108 Name
:= 'scTouchOffset';
3110 OnChange
:= ProcChangeTouchSettings
;
3113 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3114 g_GUI_AddWindow(Menu
);
3116 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3117 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3119 Name
:= 'mOptionsPlayersMenu';
3120 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3121 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3123 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3124 g_GUI_AddWindow(Menu
);
3126 CreatePlayerOptionsMenu('P1');
3127 CreatePlayerOptionsMenu('P2');
3129 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3130 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_MODEL_INFO
]))) do
3132 Name
:= 'mOptionsPlayersMIMenu';
3133 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3138 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3143 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3145 Name
:= 'meComment';
3148 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3149 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3152 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3156 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3157 g_GUI_AddWindow(Menu
);
3159 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3160 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON
]))) do
3162 Name
:= 'mOptionsPlayersP1WeaponMenu';
3163 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3165 Name
:= 'swWeaponAutoswitch';
3166 AddItem(_lc
[I_MENU_NO
]);
3167 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3168 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3170 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3172 Name
:= 'swWeaponAllowEmpty';
3173 AddItem(_lc
[I_MENU_YES
]);
3174 AddItem(_lc
[I_MENU_NO
]);
3176 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3178 Name
:= 'swWeaponAllowFist';
3179 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3180 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3182 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3185 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3186 g_GUI_AddWindow(Menu
);
3188 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3189 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3191 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3192 for i
:= WP_FIRST
to WP_LAST
do
3194 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3196 Name
:= IntToStr(i
);
3197 for a
:= WP_FIRST
to WP_LAST
+1 do
3199 AddItem(IntToStr(a
));
3204 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3206 Name
:= IntToStr(WP_LAST
+1);
3207 for a
:= WP_FIRST
to WP_LAST
+1 do
3209 AddItem(IntToStr(a
));
3211 ItemIndex
:= WP_LAST
+ 1;
3214 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3215 g_GUI_AddWindow(Menu
);
3218 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3219 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON
]))) do
3221 Name
:= 'mOptionsPlayersP2WeaponMenu';
3222 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3224 Name
:= 'swWeaponAutoswitch';
3225 AddItem(_lc
[I_MENU_NO
]);
3226 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3227 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3229 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3231 Name
:= 'swWeaponAllowEmpty';
3232 AddItem(_lc
[I_MENU_YES
]);
3233 AddItem(_lc
[I_MENU_NO
]);
3235 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3237 Name
:= 'swWeaponAllowFist';
3238 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3239 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3241 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3244 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3245 g_GUI_AddWindow(Menu
);
3247 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3248 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3250 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3251 for i
:= WP_FIRST
to WP_LAST
do
3253 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3255 Name
:= IntToStr(i
);
3256 for a
:= WP_FIRST
to WP_LAST
+1 do
3258 AddItem(IntToStr(a
));
3263 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3265 Name
:= IntToStr(WP_LAST
+1);
3266 for a
:= WP_FIRST
to WP_LAST
+1 do
3268 AddItem(IntToStr(a
));
3270 ItemIndex
:= WP_LAST
+ 1;
3273 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3274 g_GUI_AddWindow(Menu
);
3276 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3277 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3279 Name
:= 'mOptionsLanguageMenu';
3280 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3281 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3284 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3285 g_GUI_AddWindow(Menu
);
3287 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6), @ProcDefaultMenuKeyDown
);
3288 g_GUI_AddWindow(Menu
);
3290 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3291 Menu
.BackTexture
:= GameWad
+ ':/TEXTURES/INTER';
3292 Menu
.OnClose
:= ProcAuthorsClose
;
3296 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], False))) do
3298 Color
:= _RGB(255, 0, 0);
3299 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3301 _y
:= _y
+GetHeight();
3303 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), False))) do
3305 Color
:= _RGB(255, 0, 0);
3306 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3308 _y
:= _y
+GetHeight()+32;
3310 // ×òî äåëàë: Êòî äåëàë
3311 cx
:= gScreenWidth
div 2 - 320 + 64;
3312 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], False))) do
3314 Color
:= _RGB(255, 0, 0);
3319 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], False))) do
3321 Color
:= _RGB(255, 255, 255);
3326 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], False))) do
3328 Color
:= _RGB(255, 0, 0);
3333 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], False))) do
3335 Color
:= _RGB(255, 255, 255);
3340 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], False))) do
3342 Color
:= _RGB(255, 255, 255);
3347 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], False))) do
3349 Color
:= _RGB(255, 0, 0);
3354 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], False))) do
3356 Color
:= _RGB(255, 255, 255);
3361 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], False))) do
3363 Color
:= _RGB(255, 0, 0);
3368 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], False))) do
3370 Color
:= _RGB(255, 255, 255);
3373 _y
:= gScreenHeight
- 128;
3376 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], False))) do
3378 Color
:= _RGB(255, 0, 0);
3383 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], False))) do
3385 Color
:= _RGB(255, 255, 255);
3388 _y
:= _y
+GetHeight();
3390 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], False))) do
3392 Color
:= _RGB(255, 255, 255);
3395 _y
:= _y
+GetHeight();
3397 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], False))) do
3399 Color
:= _RGB(255, 255, 255);
3402 _y
:= gScreenHeight
- 32;
3404 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], False))) do
3406 Color
:= _RGB(255, 0, 0);
3407 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3410 g_GUI_AddWindow(Menu
);
3412 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6), @ProcExitMenuKeyDown
);
3413 g_GUI_AddWindow(Menu
);
3415 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3416 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3418 Name
:= 'mmGameSingleMenu';
3419 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3420 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3421 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3422 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3423 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3424 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3426 Menu
.DefControl
:= 'mmGameSingleMenu';
3427 Menu
.MainWindow
:= True;
3428 Menu
.OnClose
:= ProcGMClose
;
3429 Menu
.OnShow
:= ProcGMShow
;
3430 g_GUI_AddWindow(Menu
);
3432 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcEndMenuKeyDown
);
3433 g_GUI_AddWindow(Menu
);
3435 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6), @ProcRestartMenuKeyDown
);
3436 g_GUI_AddWindow(Menu
);
3438 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3439 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3441 Name
:= 'mmGameCustomMenu';
3442 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3443 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3444 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3445 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3446 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3447 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3448 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3450 Menu
.DefControl
:= 'mmGameCustomMenu';
3451 Menu
.MainWindow
:= True;
3452 Menu
.OnClose
:= ProcGMClose
;
3453 Menu
.OnShow
:= ProcGMShow
;
3454 g_GUI_AddWindow(Menu
);
3456 Menu
:= TGUIWindow
.Create('GameServerMenu');
3457 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3459 Name
:= 'mmGameServerMenu';
3460 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3461 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3462 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3463 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3464 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3466 Menu
.DefControl
:= 'mmGameServerMenu';
3467 Menu
.MainWindow
:= True;
3468 Menu
.OnClose
:= ProcGMClose
;
3469 Menu
.OnShow
:= ProcGMShow
;
3470 g_GUI_AddWindow(Menu
);
3472 Menu
:= TGUIWindow
.Create('GameClientMenu');
3473 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_MAIN_MENU
]))) do
3475 Name
:= 'mmGameClientMenu';
3476 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3477 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3478 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3480 Menu
.DefControl
:= 'mmGameClientMenu';
3481 Menu
.MainWindow
:= True;
3482 Menu
.OnClose
:= ProcGMClose
;
3483 Menu
.OnShow
:= ProcGMShow
;
3484 g_GUI_AddWindow(Menu
);
3486 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3487 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(False, False, _lc
[I_MENU_ENTERPASSWORD
]))) do
3489 Name
:= 'mClientPasswordMenu';
3490 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3498 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3501 Menu
.DefControl
:= 'mClientPasswordMenu';
3502 g_GUI_AddWindow(Menu
);
3504 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3505 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(True, False, _lc
[I_MENU_SET_GAME
]))) do
3507 Name
:= 'mGameSetGameMenu';
3508 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3510 Name
:= 'swTeamDamage';
3511 AddItem(_lc
[I_MENU_YES
]);
3512 AddItem(_lc
[I_MENU_NO
]);
3515 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3517 Name
:= 'swTeamHit';
3518 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3519 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3520 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3521 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3524 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3526 Name
:= 'swDeathmatchKeys';
3527 AddItem(_lc
[I_MENU_YES
]);
3528 AddItem(_lc
[I_MENU_NO
]);
3531 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3533 Name
:= 'edTimeLimit';
3538 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3540 Name
:= 'edScoreLimit';
3545 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3547 Name
:= 'edMaxLives';
3552 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3555 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3556 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3557 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3560 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3562 Name
:= 'swFlagDrop';
3563 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3564 AddItem(_lc
[I_MENU_YES
]);
3565 AddItem(_lc
[I_MENU_NO
]);
3571 Menu
.DefControl
:= 'mGameSetGameMenu';
3572 Menu
.OnClose
:= ProcApplyGameSet
;
3573 g_GUI_AddWindow(Menu
);
3575 Menu
:= TGUIWindow
.Create('TeamMenu');
3576 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(True, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3578 Name
:= 'mmTeamMenu';
3579 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3580 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3581 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3582 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3583 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3585 Menu
.DefControl
:= 'mmTeamMenu';
3586 Menu
.OnShow
:= ProcChangePlayers
;
3587 g_GUI_AddWindow(Menu
);
3590 procedure g_Menu_Show_SaveMenu();
3592 if g_Game_IsTestMap
then
3594 if gGameSettings
.GameType
= GT_SINGLE
then
3595 g_GUI_ShowWindow('GameSingleMenu')
3598 if g_Game_IsClient
then
3601 if g_Game_IsNet
then
3604 g_GUI_ShowWindow('GameCustomMenu');
3606 g_GUI_ShowWindow('SaveMenu');
3607 g_Sound_PlayEx('MENU_OPEN');
3610 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3612 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3613 if gGameSettings
.GameType
= GT_SINGLE
then
3615 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3619 if g_Game_IsClient
then exit
;
3620 if g_Game_IsNet
then exit
;
3621 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3623 g_GUI_ShowWindow('LoadMenu');
3624 g_Sound_PlayEx('MENU_OPEN');
3627 procedure g_Menu_Show_GameSetGame();
3629 if gGameSettings
.GameType
= GT_SINGLE
then
3630 g_GUI_ShowWindow('GameSingleMenu')
3633 if g_Game_IsClient
then
3636 if g_Game_IsNet
then
3637 g_GUI_ShowWindow('GameServerMenu')
3639 g_GUI_ShowWindow('GameCustomMenu');
3642 g_GUI_ShowWindow('GameSetGameMenu');
3643 g_Sound_PlayEx('MENU_OPEN');
3646 procedure g_Menu_Show_OptionsVideo();
3648 if gGameSettings
.GameType
= GT_SINGLE
then
3649 g_GUI_ShowWindow('GameSingleMenu')
3652 if g_Game_IsClient
then
3653 g_GUI_ShowWindow('GameClientMenu')
3655 if g_Game_IsNet
then
3656 g_GUI_ShowWindow('GameServerMenu')
3658 g_GUI_ShowWindow('GameCustomMenu');
3661 g_GUI_ShowWindow('OptionsMenu');
3662 g_GUI_ShowWindow('OptionsVideoMenu');
3663 g_Sound_PlayEx('MENU_OPEN');
3666 procedure g_Menu_Show_OptionsSound();
3668 if gGameSettings
.GameType
= GT_SINGLE
then
3669 g_GUI_ShowWindow('GameSingleMenu')
3672 if g_Game_IsClient
then
3673 g_GUI_ShowWindow('GameClientMenu')
3675 if g_Game_IsNet
then
3676 g_GUI_ShowWindow('GameServerMenu')
3678 g_GUI_ShowWindow('GameCustomMenu');
3681 g_GUI_ShowWindow('OptionsMenu');
3682 g_GUI_ShowWindow('OptionsSoundMenu');
3683 g_Sound_PlayEx('MENU_OPEN');
3686 procedure g_Menu_Show_EndGameMenu();
3688 g_GUI_ShowWindow('EndGameMenu');
3689 g_Sound_PlayEx('MENU_OPEN');
3692 procedure g_Menu_Show_QuitGameMenu();
3694 g_GUI_ShowWindow('ExitMenu');
3695 g_Sound_PlayEx('MENU_OPEN');
3698 procedure g_Menu_Init();
3704 procedure g_Menu_Free();
3709 procedure g_Menu_Reset();
3713 g_GUI_SaveMenuPos();
3714 ex
:= g_GUI_Destroy();
3718 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3723 g_Game_SetDebugMode();
3725 g_GUI_LoadMenuPos();