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 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
49 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
50 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
51 MAPDEF
, Math
, g_saveload
,
53 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
54 utils
, wadreader
, g_system
, r_render
, r_game
;
57 type TYNCallback
= procedure (yes
:Boolean);
59 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
61 if win
.UserData
= nil then exit
;
63 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
64 IK_N
: TYNCallback(win
.UserData
)(false);
68 procedure YesButtonCB (ctl
: TGUITextButton
);
70 if ctl
.UserData
= nil then exit
;
71 TYNCallback(ctl
.UserData
)(true);
74 procedure NoButtonCB (ctl
: TGUITextButton
);
76 if ctl
.UserData
= nil then exit
;
77 TYNCallback(ctl
.UserData
)(false);
80 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
84 //if length(Text) = 0 then exit;
85 Result
:= TGUIWindow
.Create(WinName
);
88 //OnKeyDownEx := @YNKeyDownProc;
89 //UserData := @ActionProc;
90 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
93 Name
:= '__temp_yes_no_menu:'+WinName
;
95 AddText(Text, MaxLen
);
96 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
97 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
99 DefControl
:= '__temp_yes_no_menu:'+WinName
;
105 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
106 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
108 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
123 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
124 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
126 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
128 g_Sound_SetupAllVolumes(
129 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
130 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
133 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
134 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
135 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
136 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
137 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
139 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
142 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
148 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
151 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
156 else gGibsCount
:= 48;
160 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
161 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
162 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
163 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
164 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
165 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
166 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
167 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
168 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
169 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
170 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
171 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
173 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
174 g_dbg_scale
:= TempScale
+ 1;
178 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
182 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
183 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
184 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
185 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
186 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
187 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
188 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
189 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
192 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
201 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
202 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
203 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
204 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
205 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
222 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
223 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
224 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
225 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
226 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
227 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
228 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
245 for i
:= WP_FIRST
to WP_LAST
do
247 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
249 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
254 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
261 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
262 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
263 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
264 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
265 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
266 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
267 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
284 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
285 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
286 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
287 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
288 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
289 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
290 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
304 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
307 for i
:= WP_FIRST
to WP_LAST
do
309 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
310 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
311 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
312 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
316 if e_HasJoysticks
then
318 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
321 for i
:= 0 to e_MaxJoys
- 1 do
322 if e_JoystickAvailable
[i
] then
323 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
327 if g_touch_enabled
then
329 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
330 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
331 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
332 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
333 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
337 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
338 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
339 TEAM_RED
, TEAM_BLUE
);
340 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
342 gPlayer1Settings
.Model
:= Model
.GetName();
343 gPlayer1Settings
.Color
:= Model
.Color
;
346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
347 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
348 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
349 TEAM_RED
, TEAM_BLUE
);
350 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
352 gPlayer2Settings
.Model
:= Model
.GetName();
353 gPlayer2Settings
.Color
:= Model
.Color
;
356 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
357 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
358 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
359 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
360 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
363 for i
:= WP_FIRST
to WP_LAST
+1 do
365 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
369 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
370 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
371 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
372 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
373 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
376 for i
:= WP_FIRST
to WP_LAST
+1 do
378 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
382 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
383 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
385 if g_Game_IsServer
then
387 if gPlayer1
<> nil then
389 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
390 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
391 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
392 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
394 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
396 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
397 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
398 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
399 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
400 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
403 if gPlayer2
<> nil then
405 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
406 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
407 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
408 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
410 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
412 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
413 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
414 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
415 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
416 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
420 if g_Game_IsClient
then
422 MC_SEND_PlayerSettings
;
423 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
426 g_Console_WriteGameConfig
;
429 procedure ReadOptions();
434 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
436 with TGUISwitch(menu
.GetControl('swBPP')) do
442 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
443 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
445 with TGUISwitch(menu
.GetControl('swVSync')) do
446 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
448 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
449 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
451 with TGUISwitch(menu
.GetControl('swInterp')) do
452 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
454 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
456 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
457 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
458 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
460 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
461 if gMuteWhenInactive
then
466 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
468 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
469 if gSoundEffectsDF
then
474 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
475 if gUseChatSounds
then
480 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
508 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
511 for i
:= WP_FIRST
to WP_LAST
do
513 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
514 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
522 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
523 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
524 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
525 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
546 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
549 for i
:= WP_FIRST
to WP_LAST
do
551 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
552 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
556 if e_HasJoysticks
then
558 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
561 for i
:= 0 to e_MaxJoys
- 1 do
562 if e_JoystickAvailable
[i
] then
563 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
567 if g_touch_enabled
then
569 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
570 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
571 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
572 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
573 with TGUISwitch(menu
.GetControl('swTouchFire')) do
574 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
575 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
578 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
581 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
582 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
583 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
584 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
587 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
590 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
592 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
594 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
596 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
597 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
599 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
602 with TGUISwitch(menu
.GetControl('swBloodType')) do
603 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
605 with TGUISwitch(menu
.GetControl('swCorpseType')) do
606 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
608 with TGUISwitch(menu
.GetControl('swGibsType')) do
609 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
612 with TGUISwitch(menu
.GetControl('swGibsCount')) do
624 with TGUISwitch(menu
.GetControl('swBackGround')) do
625 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
627 with TGUISwitch(menu
.GetControl('swMessages')) do
628 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
630 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
631 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
633 with TGUISwitch(menu
.GetControl('swChatBubble')) do
634 ItemIndex
:= gChatBubble
;
636 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
637 ItemIndex
:= gPlayerIndicator
;
639 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
640 ItemIndex
:= gPlayerIndicatorStyle
;
642 TempScale
:= Round(g_dbg_scale
- 1);
643 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
645 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
647 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
648 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
650 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
651 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
653 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
654 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
655 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
657 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
658 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
659 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
660 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
661 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
662 for i
:= WP_FIRST
to WP_LAST
+1 do
664 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
665 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
668 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
669 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
670 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
671 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
672 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
673 for i
:= WP_FIRST
to WP_LAST
+1 do
675 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
676 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
679 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
681 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
682 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
684 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
685 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
687 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
688 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
689 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
691 ProcSelectModel(nil);
694 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
696 // don't turn off monsters in DM
698 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
699 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
700 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
702 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
705 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
706 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
707 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
708 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
712 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
714 // don't turn off monsters in DM
716 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
717 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
718 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
720 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
723 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
724 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
725 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
726 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
730 function LatchGameOptions(const MenuName
: string): Byte;
736 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
738 Map
:= TGUILabel(GetControl('lbMap')).Text;
741 if not isWadPath(Map
) then
744 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
745 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
746 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
747 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
748 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
749 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
750 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
754 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
755 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
756 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
757 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
758 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
759 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
760 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
761 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
762 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
763 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
765 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
766 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
767 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
768 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
771 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
772 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
773 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
774 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
777 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
778 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
779 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
780 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
783 // TODO: get this crap out of here
784 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
785 gGameSettings
.WarmupTime
:= gsWarmupTime
;
786 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
790 procedure ProcStartCustomGame();
794 GameMode
:= LatchGameOptions('mCustomGameMenu');
795 if GameMode
= GM_NONE
then Exit
;
797 g_Console_WriteGameConfig
;
798 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
799 gsMaxLives
, gsGameFlags
, gsPlayers
);
803 procedure ProcStartNetGame();
807 GameMode
:= LatchGameOptions('mNetServerMenu');
808 if GameMode
= GM_NONE
then Exit
;
810 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
812 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
813 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
814 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
815 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
816 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
817 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
820 g_Console_WriteGameConfig
;
821 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
822 gsGameFlags
, gsPlayers
, 0, NetPort
);
825 procedure ProcConnectNetGame();
829 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
831 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
832 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
833 PW
:= TGUIEdit(GetControl('edPW')).Text;
836 g_Console_WriteGameConfig
;
837 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
840 procedure ProcEnterPassword();
844 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
846 NetClientIP
:= PromptIP
;
847 NetClientPort
:= PromptPort
;
848 PW
:= TGUIEdit(GetControl('edPW')).Text;
851 g_Console_WriteGameConfig
;
852 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
855 procedure ProcServerlist();
857 if not NetInitDone
then
859 if (not g_Net_Init()) then
861 g_Console_Add('NET: ERROR: Failed to init ENet!');
868 g_Net_Slist_Set(NetMasterList
);
870 gState
:= STATE_SLIST
;
871 g_ActiveWindow
:= nil;
873 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
878 slReturnPressed
:= True;
879 if g_Net_Slist_Fetch(slCurrent
) then
881 if slCurrent
= nil then
882 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
885 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
886 g_Serverlist_GenerateTable(slCurrent
, slTable
);
889 procedure ProcStartCampaign();
895 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
897 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
898 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
900 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
906 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
909 procedure ProcSelectMap(Sender
: TGUIControl
);
913 wad
, map
, res
: String;
915 win
:= g_GUI_GetWindow('SelectMapMenu');
916 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
918 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
919 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
921 if (wad
= '') or (map
= '') then
922 begin // Ýòî íå êàðòà
923 TGUILabel(GetControl('lbMapName')).Text := '';
924 TGUILabel(GetControl('lbMapAuthor')).Text := '';
925 TGUILabel(GetControl('lbMapSize')).Text := '';
926 TGUIMemo(GetControl('meMapDescription')).SetText('');
927 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
928 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
934 a
:= g_Map_GetMapInfo(res
);
936 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
937 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
938 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
939 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
940 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
941 TGUILabel(win
.GetControl('lbMapScale')).Text :=
942 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
947 procedure ProcSelectWAD(Sender
: TGUIControl
);
952 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
954 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
956 with TGUIListBox(GetControl('lsMapRes')) do
962 list
:= g_Map_GetMapsList(wad
);
976 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
982 win
:= g_GUI_GetWindow('CampaignMenu');
983 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
985 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
989 TGUILabel(GetControl('lbWADName')).Text := '';
990 TGUILabel(GetControl('lbWADAuthor')).Text := '';
991 TGUIMemo(GetControl('meWADDescription')).SetText('');
994 a
:= g_Game_GetMegaWADInfo(wad
);
996 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
997 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
998 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1000 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1004 fn
:= g_ExtractWadName(a
.pic
);
1006 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1008 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1013 procedure ProcChangeColor(Sender
: TGUIControl
);
1017 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1018 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1019 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1020 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1021 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1022 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1024 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1025 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1026 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1027 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1028 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1029 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1032 procedure ProcSelectModel(Sender
: TGUIControl
);
1037 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1038 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1039 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1041 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1042 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1043 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1045 ProcChangeColor(nil);
1048 procedure MenuLoadData();
1050 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1052 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1053 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1054 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1055 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1056 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1057 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1058 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1059 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1060 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1061 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1062 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1063 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1064 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1065 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1066 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1067 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1068 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1069 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1070 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1071 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1072 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1073 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1074 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1075 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1076 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1078 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1079 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1080 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1081 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1082 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1083 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1084 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1087 procedure MenuFreeData();
1089 e_CharFont_Remove(gMenuFont
);
1090 e_CharFont_Remove(gMenuSmallFont
);
1092 g_Texture_Delete('MAINMENU_LOGO');
1093 g_Texture_Delete('MAINMENU_MARKER1');
1094 g_Texture_Delete('MAINMENU_MARKER2');
1095 g_Texture_Delete('SCROLL_LEFT');
1096 g_Texture_Delete('SCROLL_RIGHT');
1097 g_Texture_Delete('SCROLL_MIDDLE');
1098 g_Texture_Delete('SCROLL_MARKER');
1099 g_Texture_Delete('EDIT_LEFT');
1100 g_Texture_Delete('EDIT_RIGHT');
1101 g_Texture_Delete('EDIT_MIDDLE');
1102 g_Texture_Delete('BOX1');
1103 g_Texture_Delete('BOX2');
1104 g_Texture_Delete('BOX3');
1105 g_Texture_Delete('BOX4');
1106 g_Texture_Delete('BOX5');
1107 g_Texture_Delete('BOX6');
1108 g_Texture_Delete('BOX7');
1109 g_Texture_Delete('BOX8');
1110 g_Texture_Delete('BOX9');
1111 g_Texture_Delete('BSCROLL_UP_A');
1112 g_Texture_Delete('BSCROLL_UP_U');
1113 g_Texture_Delete('BSCROLL_DOWN_A');
1114 g_Texture_Delete('BSCROLL_DOWN_U');
1115 g_Texture_Delete('BSCROLL_MIDDLE');
1116 g_Texture_Delete('NOPIC');
1118 g_Sound_Delete('MENU_SELECT');
1119 g_Sound_Delete('MENU_OPEN');
1120 g_Sound_Delete('MENU_CLOSE');
1121 g_Sound_Delete('MENU_CHANGE');
1122 g_Sound_Delete('SCROLL_ADD');
1123 g_Sound_Delete('SCROLL_SUB');
1124 g_Sound_Delete('SOUND_PLAYER_FALL');
1127 procedure ProcAuthorsMenu();
1129 gMusic
.SetByName('MUSIC_INTERMUS');
1133 procedure ProcExitMenuKeyDown (yes
: Boolean);
1136 snd
: TPlayableSound
;
1141 g_Game_StopAllSounds(True);
1142 case (Random(18)) of
1143 0: s
:= 'SOUND_MONSTER_PAIN';
1144 1: s
:= 'SOUND_MONSTER_DIE_3';
1145 2: s
:= 'SOUND_MONSTER_SLOP';
1146 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1147 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1148 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1149 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1150 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1151 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1152 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1153 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1154 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1155 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1156 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1157 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1158 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1159 else s
:= 'SOUND_PLAYER_FALL';
1161 snd
:= TPlayableSound
.Create();
1162 res
:= snd
.SetByName(s
);
1163 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1167 while snd
.IsPlaying() do begin end;
1175 procedure ProcLoadMenu();
1182 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1183 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1184 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1188 procedure ProcSaveMenu();
1196 name
:= g_GetSaveName(a
, valid
);
1197 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1198 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1202 procedure ProcSaveGame(Sender
: TGUIControl
);
1206 if g_Game_IsNet
then Exit
;
1207 if g_Game_IsTestMap
then Exit
;
1208 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1209 g_Game_PauseAllSounds(True);
1210 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1212 g_ActiveWindow
:= nil;
1213 g_Game_Pause(False);
1216 procedure ProcLoadGame(Sender
: TGUIControl
);
1220 if g_Game_IsNet
then Exit
;
1221 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1222 if g_LoadGame(a
) then
1224 g_Game_PauseAllSounds(False)
1226 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1228 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1229 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1230 //g_ActiveWindow := nil;
1234 procedure ProcSinglePlayer (n
: Integer);
1235 var wad
, map
: AnsiString;
1238 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1239 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1240 if e_FindResource(AllMapDirs
, wad
) then
1242 wad
:= ExpandFileName(wad
);
1243 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1247 procedure ProcSingle1Player
;
1252 procedure ProcSingle2Players
;
1257 procedure ProcSelectMapMenu();
1260 wad_lb
: TGUIFileListBox
;
1261 map_lb
: TGUIListBox
;
1264 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1265 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1266 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1268 if wad_lb
.SelectedItem() <> '' then
1269 map
:= map_lb
.SelectedItem()
1273 wad_lb
.UpdateFileList();
1276 if wad_lb
.SelectedItem() <> '' then
1279 map_lb
.SelectItem(map
);
1281 if map_lb
.SelectedItem() <> '' then
1285 g_GUI_ShowWindow('SelectMapMenu');
1288 procedure ProcSelectCampaignMenu();
1291 wad_lb
: TGUIFileListBox
;
1293 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1294 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1296 wad_lb
.UpdateFileList();
1298 if wad_lb
.SelectedItem() <> '' then
1299 ProcSelectCampaignWAD(nil);
1302 procedure ProcSetMap();
1304 wad
, map
, res
: String;
1306 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1308 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1309 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1312 if (wad
= '') or (map
= '') then
1315 wad
:= e_FindWadRel(MapDirs
, WAD
);
1317 res
:= wad
+':\'+map
;
1319 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1320 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1323 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1327 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1329 g_Sound_SetupAllVolumes(
1330 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1331 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1335 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1340 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1342 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1343 g_dbg_scale
:= TempScale
+ 1;
1347 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1351 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1352 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1353 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1354 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1357 procedure ProcOptionsPlayersMIMenu();
1362 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1364 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1366 if a
= '' then Exit
;
1368 i
:= g_PlayerModel_GetIndex(a
);
1369 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1371 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1372 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1373 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1375 if PlayerModelsArray
[i
].HaveWeapon
then
1376 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1378 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1381 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1384 procedure ProcOptionsPlayerP1WeaponMenu();
1388 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1389 if a
= '' then Exit
;
1390 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1393 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1395 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1398 procedure ProcOptionsPlayerP2WeaponMenu();
1402 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1403 if a
= '' then Exit
;
1404 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1407 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1409 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1412 procedure ProcOptionsPlayersAnim();
1416 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1421 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1424 Model
.AnimState
.Loop
:= True;
1428 procedure ProcOptionsPlayersWeap();
1432 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1437 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1441 procedure ProcOptionsPlayersRot();
1445 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1446 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1448 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1452 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1456 g_Options_SetDefault();
1462 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1464 if yes
then ReadOptions();
1468 procedure ProcAuthorsClose();
1470 gMusic
.SetByName('MUSIC_MENU');
1472 gState
:= STATE_MENU
;
1475 procedure ProcGMClose();
1477 g_Game_InGameMenu(False);
1480 procedure ProcGMShow();
1485 if (gGameSettings
.GameType
= GT_SINGLE
) and
1486 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1487 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1488 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1490 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1491 if g_Game_IsTestMap
then
1492 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1493 TGUIMainMenu(g_ActiveWindow
.GetControl(
1494 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1497 procedure ProcChangePlayers();
1499 TeamGame
, Spectator
, AddTwo
: Boolean;
1500 P1Team
{, P2Team}: Byte;
1501 bP2
: TGUITextButton
;
1503 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1504 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1505 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1506 P1Team
:= TEAM_NONE
;
1507 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1509 //P2Team := TEAM_NONE;
1510 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1512 TGUIMainMenu(g_ActiveWindow
.GetControl(
1513 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1514 TGUIMainMenu(g_ActiveWindow
.GetControl(
1515 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1516 TGUIMainMenu(g_ActiveWindow
.GetControl(
1517 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1519 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1520 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1521 bP2
.Enabled
:= AddTwo
and not Spectator
;
1523 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1525 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1526 if gPlayer2
= nil then
1527 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1529 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1531 TGUIMainMenu(g_ActiveWindow
.GetControl(
1532 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1535 procedure ProcJoinRed();
1537 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1539 if g_Game_IsServer
then
1541 if gPlayer1
= nil then
1542 g_Game_AddPlayer(TEAM_RED
)
1545 if gPlayer1
.Team
<> TEAM_RED
then
1547 gPlayer1
.SwitchTeam
;
1548 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1551 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1556 gPlayer1Settings
.Team
:= TEAM_RED
;
1557 MC_SEND_PlayerSettings
;
1558 if gPlayer1
= nil then
1559 g_Game_AddPlayer(TEAM_RED
);
1561 g_ActiveWindow
:= nil;
1562 g_Game_Pause(False);
1565 procedure ProcJoinBlue();
1567 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1569 if g_Game_IsServer
then
1571 if gPlayer1
= nil then
1572 g_Game_AddPlayer(TEAM_BLUE
)
1575 if gPlayer1
.Team
<> TEAM_BLUE
then
1577 gPlayer1
.SwitchTeam
;
1578 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1581 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1586 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1587 MC_SEND_PlayerSettings
;
1588 if gPlayer1
= nil then
1589 g_Game_AddPlayer(TEAM_BLUE
);
1591 g_ActiveWindow
:= nil;
1592 g_Game_Pause(False);
1595 procedure ProcJoinGame();
1597 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1599 if gPlayer1
= nil then
1601 g_ActiveWindow
:= nil;
1602 g_Game_Pause(False);
1605 procedure ProcSwitchP2();
1607 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1609 if gPlayer1
= nil then
1611 if gPlayer2
= nil then
1614 g_Game_RemovePlayer();
1615 g_ActiveWindow
:= nil;
1616 g_Game_Pause(False);
1619 procedure ProcSpectate();
1621 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1624 g_ActiveWindow
:= nil;
1625 g_Game_Pause(False);
1628 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1630 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1633 procedure ProcEndMenuKeyDown (yes
: Boolean);
1635 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1638 procedure ProcSetRussianLanguage
;
1640 if gLanguage
<> LANGUAGE_RUSSIAN
then
1642 gLanguage
:= LANGUAGE_RUSSIAN
;
1643 gLanguageChange
:= True;
1644 gAskLanguage
:= False;
1649 procedure ProcSetEnglishLanguage
;
1651 if gLanguage
<> LANGUAGE_ENGLISH
then
1653 gLanguage
:= LANGUAGE_ENGLISH
;
1654 gLanguageChange
:= True;
1655 gAskLanguage
:= False;
1660 procedure ReadGameSettings();
1664 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1666 with gGameSettings
do
1668 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1669 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1673 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1674 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1676 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1678 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1682 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1683 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1687 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1688 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1690 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1695 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1696 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1697 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1699 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1700 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1701 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1704 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1709 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1711 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1712 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1713 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1715 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1716 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1720 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1721 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1723 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1724 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1725 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1726 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1727 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1728 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1729 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1730 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1734 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1735 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1736 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1737 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1738 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1743 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1744 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1749 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1750 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1755 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1756 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1757 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1762 procedure ProcApplyGameSet();
1766 stat
: TPlayerStatArray
;
1768 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1770 if not g_Game_IsServer
then Exit
;
1772 with gGameSettings
do
1774 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1776 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1777 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1779 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1782 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1784 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1785 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1786 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1787 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1788 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1792 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1794 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1795 Options
:= Options
or GAME_OPTION_DMKEYS
1797 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1800 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1802 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1808 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1810 TimeLimit
:= Max(n
, b
);
1814 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1816 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1823 if GameMode
= GM_DM
then
1825 stat
:= g_Player_GetStats();
1827 for a
:= 0 to High(stat
) do
1828 if stat
[a
].Frags
> b
then
1832 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1834 ScoreLimit
:= Max(n
, b
);
1838 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1840 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1841 if n
< 0 then n
:= 0;
1842 if n
> 255 then n
:= 255;
1848 stat
:= g_Player_GetStats();
1850 for a
:= 0 to High(stat
) do
1851 if stat
[a
].Lives
> b
then
1854 MaxLives
:= Max(n
, b
);
1858 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1860 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1863 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1864 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1868 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1869 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1873 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1874 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1879 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1881 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1882 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1883 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1884 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1888 // don't forget to latch this shit
1889 gsGameFlags
:= Options
;
1890 gsMaxLives
:= MaxLives
;
1891 gsScoreLimit
:= ScoreLimit
;
1892 gsTimeLimit
:= TimeLimit
;
1895 if g_Game_IsNet
then MH_SEND_GameSettings
;
1898 procedure ProcVideoOptionsRes();
1903 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1905 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1906 IntToStr(gWinSizeX
) +
1907 ' x ' + IntToStr(gWinSizeY
) +
1908 ', ' + IntToStr(gBPP
) + ' bpp';
1910 with TGUIListBox(menu
.GetControl('lsResolution')) do
1912 list
:= sys_GetDisplayModes(gBPP
);
1916 ItemIndex
:= Length(list
)
1924 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1930 TempResScale
:= Round(r_pixel_scale
- 1);
1931 with TGUISwitch(menu
.GetControl('swResFactor')) do
1932 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1935 procedure ProcApplyVideoOptions();
1938 Fullscreen
: Boolean;
1939 SWidth
, SHeight
: Integer;
1940 ScaleChanged
: Boolean;
1943 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1945 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1947 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1950 SWidth
:= gWinSizeX
;
1951 SHeight
:= gWinSizeY
;
1952 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1955 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1957 ScaleChanged
:= False;
1958 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1960 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1961 r_pixel_scale
:= TempResScale
+ 1;
1962 ScaleChanged
:= True;
1965 if (SWidth
<> gWinSizeX
) or
1966 (SHeight
<> gWinSizeY
) or
1967 (Fullscreen
<> gFullscreen
) or
1970 gResolutionChange
:= True;
1971 gRC_Width
:= SWidth
;
1972 gRC_Height
:= SHeight
;
1973 gRC_FullScreen
:= Fullscreen
;
1974 gRC_Maximized
:= gWinMaximized
;
1977 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1981 procedure ProcSetFirstRussianLanguage
;
1983 gLanguage
:= LANGUAGE_RUSSIAN
;
1984 gLanguageChange
:= True;
1985 gAskLanguage
:= False;
1988 procedure ProcSetFirstEnglishLanguage
;
1990 gLanguage
:= LANGUAGE_ENGLISH
;
1991 gLanguageChange
:= True;
1992 gAskLanguage
:= False;
1995 procedure ProcRecallAddress();
1997 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1999 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2000 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2004 procedure CreateFirstLanguageMenu();
2008 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2010 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2012 Name
:= 'mmFirstLanguageMenu';
2013 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2014 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2017 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2018 Menu
.MainWindow
:= True;
2019 g_GUI_AddWindow(Menu
);
2022 procedure g_Menu_AskLanguage();
2024 CreateFirstLanguageMenu();
2025 g_GUI_ShowWindow('FirstLanguageMenu');
2028 procedure CreatePlayerOptionsMenu(s
: String);
2033 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2035 a
:= _lc
[I_MENU_PLAYER_1
]
2037 a
:= _lc
[I_MENU_PLAYER_2
];
2038 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2040 Name
:= 'mOptionsPlayers'+s
+'Menu';
2041 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2043 Name
:= 'ed'+s
+'Name';
2047 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2049 Name
:= 'sw'+s
+'Team';
2050 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2051 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2053 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2055 Name
:= 'ls'+s
+'Model';
2057 Items
:= g_PlayerModel_GetNames();
2058 OnChange
:= ProcSelectModel
;
2060 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2062 Name
:= 'sc'+s
+'Red';
2064 OnChange
:= ProcChangeColor
;
2066 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2068 Name
:= 'sc'+s
+'Green';
2070 OnChange
:= ProcChangeColor
;
2072 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2074 Name
:= 'sc'+s
+'Blue';
2076 OnChange
:= ProcChangeColor
;
2079 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2080 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2081 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2082 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2083 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2084 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2085 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2087 Name
:= 'mv'+s
+'Model';
2088 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2089 Y
:= GetControl('ls'+s
+'Model').Y
;
2092 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2093 g_GUI_AddWindow(Menu
);
2096 procedure CreateAllMenus();
2100 a
, cx
, _y
, i
: Integer;
2103 Menu
:= TGUIWindow
.Create('MainMenu');
2104 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2106 Name
:= 'mmMainMenu';
2107 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2108 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2109 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2110 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2111 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2112 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2114 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2116 Color
:= _RGB(255, 255, 255);
2117 X
:= gScreenWidth
-GetWidth
-8;
2118 Y
:= gScreenHeight
-GetHeight
-8;
2120 Menu
.DefControl
:= 'mmMainMenu';
2121 Menu
.MainWindow
:= True;
2122 g_GUI_AddWindow(Menu
);
2124 Menu
:= TGUIWindow
.Create('NewGameMenu');
2125 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2127 Name
:= 'mmNewGameMenu';
2128 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2129 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2130 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2131 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2133 Menu
.DefControl
:= 'mmNewGameMenu';
2134 g_GUI_AddWindow(Menu
);
2136 Menu
:= TGUIWindow
.Create('NetGameMenu');
2137 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2139 Name
:= 'mmNetGameMenu';
2140 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2141 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2143 Menu
.DefControl
:= 'mmNetGameMenu';
2144 g_GUI_AddWindow(Menu
);
2146 Menu
:= TGUIWindow
.Create('NetServerMenu');
2147 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2149 Name
:= 'mNetServerMenu';
2150 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2152 Name
:= 'edSrvName';
2153 OnlyDigits
:= False;
2156 Text := NetServerName
;
2158 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2160 Name
:= 'edSrvPassword';
2161 OnlyDigits
:= False;
2164 Text := NetPassword
;
2166 with AddEdit(_lc
[I_NET_PORT
]) do
2172 Text := IntToStr(NetPort
);
2174 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2176 Name
:= 'edMaxPlayers';
2180 Text := IntToStr(NetMaxClients
);
2182 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2184 Name
:= 'swUseMaster';
2185 AddItem(_lc
[I_MENU_YES
]);
2186 AddItem(_lc
[I_MENU_NO
]);
2187 if NetUseMaster
then
2193 with AddLabel(_lc
[I_MENU_MAP
]) do
2198 OnClick
:= @ProcSelectMapMenu
;
2200 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2202 Name
:= 'swGameMode';
2203 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2204 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2205 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2206 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2207 case g_Game_TextToMode(gsGameMode
) of
2209 GM_DM
: ItemIndex
:= 0;
2210 GM_TDM
: ItemIndex
:= 1;
2211 GM_CTF
: ItemIndex
:= 2;
2213 GM_COOP
: ItemIndex
:= 3;
2215 OnChange
:= ProcSwitchMonstersCustom
;
2217 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2219 Name
:= 'edTimeLimit';
2223 if gsTimeLimit
> 0 then
2224 Text := IntToStr(gsTimeLimit
);
2226 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2228 Name
:= 'edScoreLimit';
2232 if gsScoreLimit
> 0 then
2233 Text := IntToStr(gsScoreLimit
);
2235 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2237 Name
:= 'edMaxLives';
2241 if gsMaxLives
> 0 then
2242 Text := IntToStr(gsMaxLives
);
2244 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2246 Name
:= 'edItemRespawnTime';
2250 if gsItemRespawnTime
> 0 then
2251 Text := IntToStr(gsItemRespawnTime
);
2253 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2255 Name
:= 'swPlayers';
2256 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2257 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2258 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2259 ItemIndex
:= gsPlayers
;
2261 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2263 Name
:= 'swTeamDamage';
2264 AddItem(_lc
[I_MENU_YES
]);
2265 AddItem(_lc
[I_MENU_NO
]);
2266 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2271 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2273 Name
:= 'swTeamHit';
2274 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2275 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2276 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2277 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2278 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2280 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2282 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2287 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2289 Name
:= 'swDeathmatchKeys';
2290 AddItem(_lc
[I_MENU_YES
]);
2291 AddItem(_lc
[I_MENU_NO
]);
2292 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2297 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2299 Name
:= 'swEnableExits';
2300 AddItem(_lc
[I_MENU_YES
]);
2301 AddItem(_lc
[I_MENU_NO
]);
2302 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2307 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2309 Name
:= 'swWeaponStay';
2310 AddItem(_lc
[I_MENU_YES
]);
2311 AddItem(_lc
[I_MENU_NO
]);
2312 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2317 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2319 Name
:= 'swMonsters';
2320 AddItem(_lc
[I_MENU_YES
]);
2321 AddItem(_lc
[I_MENU_NO
]);
2322 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2327 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2330 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2331 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2332 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2334 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2336 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2339 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2341 Name
:= 'swFlagDrop';
2342 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2343 AddItem(_lc
[I_MENU_YES
]);
2344 AddItem(_lc
[I_MENU_NO
]);
2345 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2347 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2353 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2357 Menu
.DefControl
:= 'mNetServerMenu';
2358 g_GUI_AddWindow(Menu
);
2360 Menu
:= TGUIWindow
.Create('NetClientMenu');
2361 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2363 Name
:= 'mNetClientMenu';
2365 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2368 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2374 Text := 'localhost';
2376 with AddEdit(_lc
[I_NET_PORT
]) do
2384 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2387 OnlyDigits
:= False;
2394 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2398 Menu
.DefControl
:= 'mNetClientMenu';
2399 g_GUI_AddWindow(Menu
);
2401 Menu
:= TGUIWindow
.Create('LoadMenu');
2402 Menu
.OnShow
:= ProcLoadMenu
;
2403 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2405 Name
:= 'mmLoadMenu';
2410 Name
:= 'edSlot'+IntToStr(a
);
2413 OnEnter
:= ProcLoadGame
;
2416 Menu
.DefControl
:= 'mmLoadMenu';
2417 g_GUI_AddWindow(Menu
);
2419 Menu
:= TGUIWindow
.Create('SaveMenu');
2420 Menu
.OnShow
:= ProcSaveMenu
;
2421 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2423 Name
:= 'mmSaveMenu';
2428 Name
:= 'edSlot'+IntToStr(a
);
2431 OnChange
:= ProcSaveGame
;
2434 Menu
.DefControl
:= 'mmSaveMenu';
2435 g_GUI_AddWindow(Menu
);
2437 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2438 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2440 Name
:= 'mCustomGameMenu';
2441 with AddLabel(_lc
[I_MENU_MAP
]) do
2446 OnClick
:= @ProcSelectMapMenu
;
2448 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2450 Name
:= 'swGameMode';
2451 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2452 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2453 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2454 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2455 case g_Game_TextToMode(gsGameMode
) of
2457 GM_DM
: ItemIndex
:= 0;
2458 GM_TDM
: ItemIndex
:= 1;
2459 GM_CTF
: ItemIndex
:= 2;
2461 GM_COOP
: ItemIndex
:= 3;
2463 OnChange
:= ProcSwitchMonstersCustom
;
2465 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2467 Name
:= 'edTimeLimit';
2471 if gsTimeLimit
> 0 then
2472 Text := IntToStr(gsTimeLimit
);
2474 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2476 Name
:= 'edScoreLimit';
2480 if gsScoreLimit
> 0 then
2481 Text := IntToStr(gsScoreLimit
);
2483 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2485 Name
:= 'edMaxLives';
2489 if gsMaxLives
> 0 then
2490 Text := IntToStr(gsMaxLives
);
2492 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2494 Name
:= 'edItemRespawnTime';
2498 if gsItemRespawnTime
> 0 then
2499 Text := IntToStr(gsItemRespawnTime
);
2501 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2503 Name
:= 'swPlayers';
2504 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2505 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2506 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2507 ItemIndex
:= gsPlayers
;
2509 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2511 Name
:= 'swTeamDamage';
2512 AddItem(_lc
[I_MENU_YES
]);
2513 AddItem(_lc
[I_MENU_NO
]);
2514 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2519 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2521 Name
:= 'swTeamHit';
2522 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2523 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2524 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2525 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2526 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2528 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2530 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2535 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2537 Name
:= 'swDeathmatchKeys';
2538 AddItem(_lc
[I_MENU_YES
]);
2539 AddItem(_lc
[I_MENU_NO
]);
2540 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2545 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2547 Name
:= 'swEnableExits';
2548 AddItem(_lc
[I_MENU_YES
]);
2549 AddItem(_lc
[I_MENU_NO
]);
2550 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2555 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2557 Name
:= 'swWeaponStay';
2558 AddItem(_lc
[I_MENU_YES
]);
2559 AddItem(_lc
[I_MENU_NO
]);
2560 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2565 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2567 Name
:= 'swMonsters';
2568 AddItem(_lc
[I_MENU_YES
]);
2569 AddItem(_lc
[I_MENU_NO
]);
2570 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2575 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2578 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2579 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2580 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2582 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2584 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2587 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2589 Name
:= 'swFlagDrop';
2590 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2591 AddItem(_lc
[I_MENU_YES
]);
2592 AddItem(_lc
[I_MENU_NO
]);
2593 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2595 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2601 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2605 Menu
.DefControl
:= 'mCustomGameMenu';
2606 g_GUI_AddWindow(Menu
);
2608 Menu
:= TGUIWindow
.Create('CampaignMenu');
2609 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2611 Name
:= 'mCampaignMenu';
2620 with AddFileList('', 15, 4) do
2623 OnChange
:= ProcSelectCampaignWAD
;
2627 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2628 SetBase(MegawadDirs
);
2631 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2633 Name
:= 'lbWADName';
2637 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2639 Name
:= 'lbWADAuthor';
2643 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2644 with AddMemo('', 15, 3) do
2646 Name
:= 'meWADDescription';
2647 Color
:= MENU_ITEMSCTRL_COLOR
;
2649 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2651 Name
:= 'swPlayers';
2652 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2653 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2656 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2660 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2662 Name
:= 'mpWADImage';
2663 DefaultRes
:= 'NOPIC';
2664 X
:= GetControl('lsWAD').X
+4;
2665 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2668 Menu
.DefControl
:= 'mCampaignMenu';
2669 g_GUI_AddWindow(Menu
);
2671 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2672 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2674 Name
:= 'mSelectMapMenu';
2675 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2678 OnChange
:= ProcSelectWAD
;
2682 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2685 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2689 OnChange
:= ProcSelectMap
;
2692 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2694 Name
:= 'lbMapName';
2698 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2700 Name
:= 'lbMapAuthor';
2704 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2706 Name
:= 'lbMapSize';
2710 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2712 Name
:= 'meMapDescription';
2717 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2719 Name
:= 'mpMapPreview';
2720 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2721 Y
:= GetControl('lsMapWAD').Y
;
2723 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2725 Name
:= 'lbMapScale';
2728 Color
:= MENU_ITEMSCTRL_COLOR
;
2729 X
:= GetControl('lsMapWAD').X
+
2730 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2731 2 + MAPPREVIEW_WIDTH
*4;
2732 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2735 Menu
.OnClose
:= ProcSetMap
;
2736 Menu
.DefControl
:= 'mSelectMapMenu';
2737 g_GUI_AddWindow(Menu
);
2739 Menu
:= TGUIWindow
.Create('OptionsMenu');
2740 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2742 Name
:= 'mmOptionsMenu';
2743 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2744 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2745 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2746 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2747 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2748 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2750 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2751 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2753 Menu
.OnClose
:= ProcApplyOptions
;
2754 Menu
.DefControl
:= 'mmOptionsMenu';
2755 g_GUI_AddWindow(Menu
);
2757 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2758 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2759 g_GUI_AddWindow(Menu
);
2761 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2762 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2764 Name
:= 'mOptionsVideoMenu';
2765 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2766 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2772 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2775 AddItem(_lc
[I_MENU_YES
]);
2776 AddItem(_lc
[I_MENU_NO
]);
2778 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2780 Name
:= 'swTextureFilter';
2781 AddItem(_lc
[I_MENU_YES
]);
2782 AddItem(_lc
[I_MENU_NO
]);
2784 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2787 AddItem(_lc
[I_MENU_YES
]);
2788 AddItem(_lc
[I_MENU_NO
]);
2790 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2792 Name
:= 'swLegacyNPOT';
2793 AddItem(_lc
[I_MENU_NO
]);
2794 AddItem(_lc
[I_MENU_YES
]);
2797 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2800 Menu
.DefControl
:= 'mOptionsVideoMenu';
2801 g_GUI_AddWindow(Menu
);
2803 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2804 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2806 Name
:= 'mOptionsVideoResMenu';
2807 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2809 Name
:= 'lbCurrentRes';
2813 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2815 Name
:= 'lsResolution';
2818 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2820 Name
:= 'swFullScreen';
2821 AddItem(_lc
[I_MENU_YES
]);
2822 AddItem(_lc
[I_MENU_NO
]);
2824 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2826 Name
:= 'swResFactor';
2828 for i
:= 2 to gRC_Width
div 640 do
2829 AddItem(IntToStr(i
) + 'x');
2832 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2835 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2836 g_GUI_AddWindow(Menu
);
2838 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2839 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2841 Name
:= 'mOptionsSoundMenu';
2842 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2844 Name
:= 'scMusicLevel';
2846 OnChange
:= ProcChangeSoundSettings
;
2848 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2850 Name
:= 'scSoundLevel';
2852 OnChange
:= ProcChangeSoundSettings
;
2854 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2856 Name
:= 'scMaxSimSounds';
2859 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2861 Name
:= 'swAnnouncer';
2862 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2863 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2864 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2865 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2867 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2868 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2870 Name
:= 'swSoundEffects';
2871 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2872 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2874 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2875 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2877 Name
:= 'swChatSpeech';
2878 AddItem(_lc
[I_MENU_YES
]);
2879 AddItem(_lc
[I_MENU_NO
]);
2881 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2883 Name
:= 'swInactiveSounds';
2884 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2885 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2889 Menu
.DefControl
:= 'mOptionsSoundMenu';
2890 g_GUI_AddWindow(Menu
);
2892 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2893 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2895 Name
:= 'mOptionsGameMenu';
2896 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2898 Name
:= 'scParticlesCount';
2901 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2903 Name
:= 'swBloodCount';
2904 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2905 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2906 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2907 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2908 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2910 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2912 Name
:= 'scShellsMax';
2915 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2917 Name
:= 'scGibsMax';
2920 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2922 Name
:= 'scCorpsesMax';
2925 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2927 Name
:= 'swGibsCount';
2928 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2929 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2930 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2931 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2932 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2934 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2936 Name
:= 'swCorpseType';
2937 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2938 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2940 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2942 Name
:= 'swGibsType';
2943 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2944 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2946 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2948 Name
:= 'swBloodType';
2949 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2950 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2952 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2954 Name
:= 'swScreenFlash';
2955 AddItem(_lc
[I_MENU_NO
]);
2956 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2957 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2959 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2961 Name
:= 'swBackground';
2962 AddItem(_lc
[I_MENU_YES
]);
2963 AddItem(_lc
[I_MENU_NO
]);
2965 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2967 Name
:= 'swMessages';
2968 AddItem(_lc
[I_MENU_YES
]);
2969 AddItem(_lc
[I_MENU_NO
]);
2971 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2973 Name
:= 'swRevertPlayers';
2974 AddItem(_lc
[I_MENU_YES
]);
2975 AddItem(_lc
[I_MENU_NO
]);
2977 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2979 Name
:= 'swChatBubble';
2980 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2981 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2982 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2983 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2984 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2986 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2988 Name
:= 'swPlayerIndicator';
2989 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2990 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2991 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2993 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2995 Name
:= 'swPlayerIndicatorStyle';
2996 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2997 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2999 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3001 Name
:= 'scScaleFactor';
3003 OnChange
:= ProcChangeGameSettings
;
3007 Menu
.DefControl
:= 'mOptionsGameMenu';
3008 g_GUI_AddWindow(Menu
);
3010 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3011 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3013 Name
:= 'mOptionsControlsMenu';
3014 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3015 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3016 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3017 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3018 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3020 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3021 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3022 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3023 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3024 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3025 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3026 if e_HasJoysticks
then
3029 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3031 if g_touch_enabled
then
3034 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3037 Menu
.DefControl
:= 'mOptionsControlsMenu';
3038 g_GUI_AddWindow(Menu
);
3040 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3041 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3043 Name
:= 'mOptionsControlsP1Menu';
3044 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3045 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3046 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3047 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3048 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3049 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3050 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3051 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3052 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3053 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3054 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3056 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3057 g_GUI_AddWindow(Menu
);
3059 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3060 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3062 Name
:= 'mOptionsControlsP1MenuWeapons';
3063 for i
:= WP_FIRST
to WP_LAST
do
3064 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3065 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3067 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3068 g_GUI_AddWindow(Menu
);
3070 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3071 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3073 Name
:= 'mOptionsControlsP2Menu';
3074 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3075 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3076 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3077 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3078 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3079 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3080 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3081 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3082 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3083 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3084 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3086 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3087 g_GUI_AddWindow(Menu
);
3089 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3090 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3092 Name
:= 'mOptionsControlsP2MenuWeapons';
3093 for i
:= WP_FIRST
to WP_LAST
do
3094 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3095 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3097 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3098 g_GUI_AddWindow(Menu
);
3100 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3101 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3103 Name
:= 'mOptionsControlsJoystickMenu';
3104 for i
:= 0 to e_MaxJoys
- 1 do
3105 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3107 Name
:= 'scDeadzone' + IntToStr(i
);
3111 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3112 g_GUI_AddWindow(Menu
);
3114 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3117 Name
:= 'mOptionsControlsTouchMenu';
3118 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3120 Name
:= 'swTouchAlt';
3121 AddItem(_lc
[I_MENU_NO
]);
3122 AddItem(_lc
[I_MENU_YES
]);
3123 OnChange
:= ProcChangeTouchSettings
;
3125 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3127 Name
:= 'scTouchSize';
3129 OnChange
:= ProcChangeTouchSettings
;
3131 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3133 Name
:= 'swTouchFire';
3134 AddItem(_lc
[I_MENU_NO
]);
3135 AddItem(_lc
[I_MENU_YES
]);
3137 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3139 Name
:= 'scTouchOffset';
3141 OnChange
:= ProcChangeTouchSettings
;
3144 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3145 g_GUI_AddWindow(Menu
);
3147 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3148 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3150 Name
:= 'mOptionsPlayersMenu';
3151 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3152 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3154 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3155 g_GUI_AddWindow(Menu
);
3157 CreatePlayerOptionsMenu('P1');
3158 CreatePlayerOptionsMenu('P2');
3160 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3161 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3163 Name
:= 'mOptionsPlayersMIMenu';
3164 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3169 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3174 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3176 Name
:= 'meComment';
3179 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3180 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3183 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3187 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3188 g_GUI_AddWindow(Menu
);
3190 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3191 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3193 Name
:= 'mOptionsPlayersP1WeaponMenu';
3194 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3196 Name
:= 'swWeaponAutoswitch';
3197 AddItem(_lc
[I_MENU_NO
]);
3198 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3199 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3201 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3203 Name
:= 'swWeaponAllowEmpty';
3204 AddItem(_lc
[I_MENU_YES
]);
3205 AddItem(_lc
[I_MENU_NO
]);
3207 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3209 Name
:= 'swWeaponAllowFist';
3210 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3211 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3213 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3216 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3217 g_GUI_AddWindow(Menu
);
3219 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3220 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3222 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3223 for i
:= WP_FIRST
to WP_LAST
do
3225 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3227 Name
:= IntToStr(i
);
3228 for a
:= WP_FIRST
to WP_LAST
+1 do
3230 AddItem(IntToStr(a
));
3235 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3237 Name
:= IntToStr(WP_LAST
+1);
3238 for a
:= WP_FIRST
to WP_LAST
+1 do
3240 AddItem(IntToStr(a
));
3242 ItemIndex
:= WP_LAST
+ 1;
3245 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3246 g_GUI_AddWindow(Menu
);
3249 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3250 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3252 Name
:= 'mOptionsPlayersP2WeaponMenu';
3253 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3255 Name
:= 'swWeaponAutoswitch';
3256 AddItem(_lc
[I_MENU_NO
]);
3257 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3258 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3260 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3262 Name
:= 'swWeaponAllowEmpty';
3263 AddItem(_lc
[I_MENU_YES
]);
3264 AddItem(_lc
[I_MENU_NO
]);
3266 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3268 Name
:= 'swWeaponAllowFist';
3269 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3270 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3272 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3275 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3276 g_GUI_AddWindow(Menu
);
3278 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3279 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3281 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3282 for i
:= WP_FIRST
to WP_LAST
do
3284 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3286 Name
:= IntToStr(i
);
3287 for a
:= WP_FIRST
to WP_LAST
+1 do
3289 AddItem(IntToStr(a
));
3294 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3296 Name
:= IntToStr(WP_LAST
+1);
3297 for a
:= WP_FIRST
to WP_LAST
+1 do
3299 AddItem(IntToStr(a
));
3301 ItemIndex
:= WP_LAST
+ 1;
3304 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3305 g_GUI_AddWindow(Menu
);
3307 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3308 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3310 Name
:= 'mOptionsLanguageMenu';
3311 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3312 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3315 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3316 g_GUI_AddWindow(Menu
);
3318 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3319 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3320 g_GUI_AddWindow(Menu
);
3322 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3323 Menu
.BackTexture
:= 'INTER';
3324 Menu
.OnClose
:= ProcAuthorsClose
;
3328 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3330 Color
:= _RGB(255, 0, 0);
3331 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3333 _y
:= _y
+GetHeight();
3335 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3337 Color
:= _RGB(255, 0, 0);
3338 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3340 _y
:= _y
+GetHeight()+32;
3342 // ×òî äåëàë: Êòî äåëàë
3343 cx
:= gScreenWidth
div 2 - 320 + 64;
3344 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3346 Color
:= _RGB(255, 0, 0);
3351 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3353 Color
:= _RGB(255, 255, 255);
3358 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3360 Color
:= _RGB(255, 0, 0);
3365 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3367 Color
:= _RGB(255, 255, 255);
3372 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3374 Color
:= _RGB(255, 255, 255);
3379 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3381 Color
:= _RGB(255, 0, 0);
3386 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3388 Color
:= _RGB(255, 255, 255);
3393 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3395 Color
:= _RGB(255, 0, 0);
3400 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3402 Color
:= _RGB(255, 255, 255);
3405 _y
:= gScreenHeight
- 128;
3408 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3410 Color
:= _RGB(255, 0, 0);
3415 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3417 Color
:= _RGB(255, 255, 255);
3420 _y
:= _y
+GetHeight();
3422 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3424 Color
:= _RGB(255, 255, 255);
3427 _y
:= _y
+GetHeight();
3429 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3431 Color
:= _RGB(255, 255, 255);
3434 _y
:= gScreenHeight
- 32;
3436 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3438 Color
:= _RGB(255, 0, 0);
3439 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3442 g_GUI_AddWindow(Menu
);
3444 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3445 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3446 g_GUI_AddWindow(Menu
);
3448 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3449 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3451 Name
:= 'mmGameSingleMenu';
3452 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3453 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3454 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3455 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3456 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3457 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3459 Menu
.DefControl
:= 'mmGameSingleMenu';
3460 Menu
.MainWindow
:= True;
3461 Menu
.OnClose
:= ProcGMClose
;
3462 Menu
.OnShow
:= ProcGMShow
;
3463 g_GUI_AddWindow(Menu
);
3465 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3466 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3467 g_GUI_AddWindow(Menu
);
3469 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3470 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3471 g_GUI_AddWindow(Menu
);
3473 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3474 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3476 Name
:= 'mmGameCustomMenu';
3477 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3478 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3479 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3480 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3481 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3482 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3483 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3485 Menu
.DefControl
:= 'mmGameCustomMenu';
3486 Menu
.MainWindow
:= True;
3487 Menu
.OnClose
:= ProcGMClose
;
3488 Menu
.OnShow
:= ProcGMShow
;
3489 g_GUI_AddWindow(Menu
);
3491 Menu
:= TGUIWindow
.Create('GameServerMenu');
3492 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3494 Name
:= 'mmGameServerMenu';
3495 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3496 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3497 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3498 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3499 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3501 Menu
.DefControl
:= 'mmGameServerMenu';
3502 Menu
.MainWindow
:= True;
3503 Menu
.OnClose
:= ProcGMClose
;
3504 Menu
.OnShow
:= ProcGMShow
;
3505 g_GUI_AddWindow(Menu
);
3507 Menu
:= TGUIWindow
.Create('GameClientMenu');
3508 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3510 Name
:= 'mmGameClientMenu';
3511 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3512 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3513 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3515 Menu
.DefControl
:= 'mmGameClientMenu';
3516 Menu
.MainWindow
:= True;
3517 Menu
.OnClose
:= ProcGMClose
;
3518 Menu
.OnShow
:= ProcGMShow
;
3519 g_GUI_AddWindow(Menu
);
3521 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3522 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3524 Name
:= 'mClientPasswordMenu';
3525 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3533 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3536 Menu
.DefControl
:= 'mClientPasswordMenu';
3537 g_GUI_AddWindow(Menu
);
3539 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3540 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3542 Name
:= 'mGameSetGameMenu';
3543 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3545 Name
:= 'swTeamDamage';
3546 AddItem(_lc
[I_MENU_YES
]);
3547 AddItem(_lc
[I_MENU_NO
]);
3550 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3552 Name
:= 'swTeamHit';
3553 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3554 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3555 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3556 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3559 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3561 Name
:= 'swDeathmatchKeys';
3562 AddItem(_lc
[I_MENU_YES
]);
3563 AddItem(_lc
[I_MENU_NO
]);
3566 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3568 Name
:= 'edTimeLimit';
3573 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3575 Name
:= 'edScoreLimit';
3580 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3582 Name
:= 'edMaxLives';
3587 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3590 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3591 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3592 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3595 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3597 Name
:= 'swFlagDrop';
3598 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3599 AddItem(_lc
[I_MENU_YES
]);
3600 AddItem(_lc
[I_MENU_NO
]);
3606 Menu
.DefControl
:= 'mGameSetGameMenu';
3607 Menu
.OnClose
:= ProcApplyGameSet
;
3608 g_GUI_AddWindow(Menu
);
3610 Menu
:= TGUIWindow
.Create('TeamMenu');
3611 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3613 Name
:= 'mmTeamMenu';
3614 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3615 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3616 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3617 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3618 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3620 Menu
.DefControl
:= 'mmTeamMenu';
3621 Menu
.OnShow
:= ProcChangePlayers
;
3622 g_GUI_AddWindow(Menu
);
3625 procedure g_Menu_Show_SaveMenu();
3627 if g_Game_IsTestMap
then
3629 if gGameSettings
.GameType
= GT_SINGLE
then
3630 g_GUI_ShowWindow('GameSingleMenu')
3633 if g_Game_IsClient
then
3636 if g_Game_IsNet
then
3639 g_GUI_ShowWindow('GameCustomMenu');
3641 g_GUI_ShowWindow('SaveMenu');
3642 g_Sound_PlayEx('MENU_OPEN');
3645 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3647 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3648 if gGameSettings
.GameType
= GT_SINGLE
then
3650 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3654 if g_Game_IsClient
then exit
;
3655 if g_Game_IsNet
then exit
;
3656 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3658 g_GUI_ShowWindow('LoadMenu');
3659 g_Sound_PlayEx('MENU_OPEN');
3662 procedure g_Menu_Show_GameSetGame();
3664 if gGameSettings
.GameType
= GT_SINGLE
then
3665 g_GUI_ShowWindow('GameSingleMenu')
3668 if g_Game_IsClient
then
3671 if g_Game_IsNet
then
3672 g_GUI_ShowWindow('GameServerMenu')
3674 g_GUI_ShowWindow('GameCustomMenu');
3677 g_GUI_ShowWindow('GameSetGameMenu');
3678 g_Sound_PlayEx('MENU_OPEN');
3681 procedure g_Menu_Show_OptionsVideo();
3683 if gGameSettings
.GameType
= GT_SINGLE
then
3684 g_GUI_ShowWindow('GameSingleMenu')
3687 if g_Game_IsClient
then
3688 g_GUI_ShowWindow('GameClientMenu')
3690 if g_Game_IsNet
then
3691 g_GUI_ShowWindow('GameServerMenu')
3693 g_GUI_ShowWindow('GameCustomMenu');
3696 g_GUI_ShowWindow('OptionsMenu');
3697 g_GUI_ShowWindow('OptionsVideoMenu');
3698 g_Sound_PlayEx('MENU_OPEN');
3701 procedure g_Menu_Show_OptionsSound();
3703 if gGameSettings
.GameType
= GT_SINGLE
then
3704 g_GUI_ShowWindow('GameSingleMenu')
3707 if g_Game_IsClient
then
3708 g_GUI_ShowWindow('GameClientMenu')
3710 if g_Game_IsNet
then
3711 g_GUI_ShowWindow('GameServerMenu')
3713 g_GUI_ShowWindow('GameCustomMenu');
3716 g_GUI_ShowWindow('OptionsMenu');
3717 g_GUI_ShowWindow('OptionsSoundMenu');
3718 g_Sound_PlayEx('MENU_OPEN');
3721 procedure g_Menu_Show_EndGameMenu();
3723 g_GUI_ShowWindow('EndGameMenu');
3724 g_Sound_PlayEx('MENU_OPEN');
3727 procedure g_Menu_Show_QuitGameMenu();
3729 g_GUI_ShowWindow('ExitMenu');
3730 g_Sound_PlayEx('MENU_OPEN');
3733 procedure g_Menu_Init();
3739 procedure g_Menu_Free();
3744 procedure g_Menu_Reset();
3748 g_GUI_SaveMenuPos();
3749 ex
:= g_GUI_Destroy();
3753 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3758 g_Game_SetDebugMode();
3760 g_GUI_LoadMenuPos();