1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
48 {$IFDEF ENABLE_SHELLS}
51 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
52 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
53 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
54 MAPDEF
, Math
, g_saveload
,
56 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
57 utils
, wadreader
, g_system
, r_render
, r_game
;
60 type TYNCallback
= procedure (yes
:Boolean);
62 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
64 if win
.UserData
= nil then exit
;
66 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
67 IK_N
: TYNCallback(win
.UserData
)(false);
71 procedure YesButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(true);
77 procedure NoButtonCB (ctl
: TGUITextButton
);
79 if ctl
.UserData
= nil then exit
;
80 TYNCallback(ctl
.UserData
)(false);
83 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
87 //if length(Text) = 0 then exit;
88 Result
:= TGUIWindow
.Create(WinName
);
91 //OnKeyDownEx := @YNKeyDownProc;
92 //UserData := @ActionProc;
93 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
96 Name
:= '__temp_yes_no_menu:'+WinName
;
98 AddText(Text, MaxLen
);
99 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
100 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
102 DefControl
:= '__temp_yes_no_menu:'+WinName
;
108 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
109 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
111 procedure ProcApplyOptions();
116 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
118 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
123 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
145 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
147 {$IFDEF ENABLE_SHELLS}
148 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
151 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
153 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
156 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
161 else gGibsCount
:= 48;
165 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
166 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
167 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
168 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
169 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
170 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
171 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
172 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
173 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
174 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
175 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
176 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
178 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
179 g_dbg_scale
:= TempScale
+ 1;
183 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
187 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
189 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
190 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
191 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
192 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
193 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
194 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
197 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
201 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
202 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
203 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
204 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
205 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
206 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
207 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
208 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
209 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
210 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
223 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
224 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
225 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
226 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
227 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
228 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
229 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
230 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
231 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
232 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
233 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
247 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
250 for i
:= WP_FIRST
to WP_LAST
do
252 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
254 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
259 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
262 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
269 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
270 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
271 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
272 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
285 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
286 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
287 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
288 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
289 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
290 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
291 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
292 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
293 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
294 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
295 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
302 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
304 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
305 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
309 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
312 for i
:= WP_FIRST
to WP_LAST
do
314 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
315 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
316 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
317 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
321 if e_HasJoysticks
then
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
326 for i
:= 0 to e_MaxJoys
- 1 do
327 if e_JoystickAvailable
[i
] then
328 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
332 if g_touch_enabled
then
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
335 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
336 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
337 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
338 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
341 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
342 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
343 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
344 TEAM_RED
, TEAM_BLUE
);
345 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
347 gPlayer1Settings
.Model
:= Model
.GetName();
348 gPlayer1Settings
.Color
:= Model
.Color
;
351 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
352 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
353 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
354 TEAM_RED
, TEAM_BLUE
);
355 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
357 gPlayer2Settings
.Model
:= Model
.GetName();
358 gPlayer2Settings
.Color
:= Model
.Color
;
361 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
362 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
363 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
364 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
365 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
368 for i
:= WP_FIRST
to WP_LAST
+1 do
370 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
374 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
375 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
376 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
377 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
378 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
381 for i
:= WP_FIRST
to WP_LAST
+1 do
383 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
387 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
388 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
390 if g_Game_IsServer
then
392 if gPlayer1
<> nil then
394 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
395 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
396 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
397 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
399 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
401 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
402 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
403 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
404 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
405 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
408 if gPlayer2
<> nil then
410 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
411 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
412 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
413 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
415 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
417 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
418 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
419 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
420 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
421 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
425 if g_Game_IsClient
then
427 MC_SEND_PlayerSettings
;
428 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
431 g_Console_WriteGameConfig
;
434 procedure ReadOptions();
439 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
441 with TGUISwitch(menu
.GetControl('swBPP')) do
447 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
448 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
450 with TGUISwitch(menu
.GetControl('swVSync')) do
451 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
453 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
454 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
456 with TGUISwitch(menu
.GetControl('swInterp')) do
457 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
461 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
462 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
463 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
465 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
466 if gMuteWhenInactive
then
471 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
473 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
474 if gSoundEffectsDF
then
479 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
480 if gUseChatSounds
then
485 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
516 for i
:= WP_FIRST
to WP_LAST
do
518 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
519 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
523 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
548 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
551 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
554 for i
:= WP_FIRST
to WP_LAST
do
556 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
557 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
561 if e_HasJoysticks
then
563 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
566 for i
:= 0 to e_MaxJoys
- 1 do
567 if e_JoystickAvailable
[i
] then
568 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
572 if g_touch_enabled
then
574 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
575 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
576 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
577 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
578 with TGUISwitch(menu
.GetControl('swTouchFire')) do
579 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
580 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
583 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
586 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
587 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
588 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
589 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
592 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
595 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
597 {$IFDEF ENABLE_SHELLS}
598 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
601 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
603 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
604 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
606 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
609 with TGUISwitch(menu
.GetControl('swBloodType')) do
610 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
612 with TGUISwitch(menu
.GetControl('swCorpseType')) do
613 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
615 with TGUISwitch(menu
.GetControl('swGibsType')) do
616 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
619 with TGUISwitch(menu
.GetControl('swGibsCount')) do
631 with TGUISwitch(menu
.GetControl('swBackGround')) do
632 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
634 with TGUISwitch(menu
.GetControl('swMessages')) do
635 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
637 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
638 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
640 with TGUISwitch(menu
.GetControl('swChatBubble')) do
641 ItemIndex
:= gChatBubble
;
643 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
644 ItemIndex
:= gPlayerIndicator
;
646 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
647 ItemIndex
:= gPlayerIndicatorStyle
;
649 TempScale
:= Round(g_dbg_scale
- 1);
650 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
652 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
654 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
655 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
657 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
658 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
660 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
661 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
662 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
664 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
665 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
666 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
667 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
668 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
669 for i
:= WP_FIRST
to WP_LAST
+1 do
671 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
672 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
675 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
676 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
677 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
678 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
679 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
680 for i
:= WP_FIRST
to WP_LAST
+1 do
682 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
683 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
686 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
688 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
689 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
691 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
692 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
694 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
695 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
696 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
698 ProcSelectModel(nil);
701 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
703 // don't turn off monsters in DM
705 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
706 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
707 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
709 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
712 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
713 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
714 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
715 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
719 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
721 // don't turn off monsters in DM
723 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
724 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
725 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
727 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
730 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
731 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
732 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
733 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
737 function LatchGameOptions(const MenuName
: string): Byte;
743 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
745 Map
:= TGUILabel(GetControl('lbMap')).Text;
748 if not isWadPath(Map
) then
751 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
752 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
753 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
754 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
755 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
756 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
757 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
761 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
762 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
763 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
764 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
765 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
766 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
767 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
768 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
769 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
770 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
772 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
773 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
774 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
775 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
778 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
779 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
780 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
781 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
784 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
785 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
786 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
787 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
790 // TODO: get this crap out of here
791 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
792 gGameSettings
.WarmupTime
:= gsWarmupTime
;
793 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
797 procedure ProcStartCustomGame();
801 GameMode
:= LatchGameOptions('mCustomGameMenu');
802 if GameMode
= GM_NONE
then Exit
;
804 g_Console_WriteGameConfig
;
805 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
806 gsMaxLives
, gsGameFlags
, gsPlayers
);
810 procedure ProcStartNetGame();
814 GameMode
:= LatchGameOptions('mNetServerMenu');
815 if GameMode
= GM_NONE
then Exit
;
817 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
819 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
820 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
821 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
822 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
823 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
824 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
827 g_Console_WriteGameConfig
;
828 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
829 gsGameFlags
, gsPlayers
, 0, NetPort
);
832 procedure ProcConnectNetGame();
836 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
838 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
839 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
840 PW
:= TGUIEdit(GetControl('edPW')).Text;
843 g_Console_WriteGameConfig
;
844 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
847 procedure ProcEnterPassword();
851 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
853 NetClientIP
:= PromptIP
;
854 NetClientPort
:= PromptPort
;
855 PW
:= TGUIEdit(GetControl('edPW')).Text;
858 g_Console_WriteGameConfig
;
859 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
862 procedure ProcServerlist();
864 if not NetInitDone
then
866 if (not g_Net_Init()) then
868 g_Console_Add('NET: ERROR: Failed to init ENet!');
875 g_Net_Slist_Set(NetMasterList
);
877 gState
:= STATE_SLIST
;
878 g_ActiveWindow
:= nil;
880 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
885 slReturnPressed
:= True;
886 if g_Net_Slist_Fetch(slCurrent
) then
888 if slCurrent
= nil then
889 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
892 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
893 g_Serverlist_GenerateTable(slCurrent
, slTable
);
896 procedure ProcStartCampaign();
902 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
904 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
905 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
907 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
913 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
916 procedure ProcSelectMap(Sender
: TGUIControl
);
920 wad
, map
, res
: String;
922 win
:= g_GUI_GetWindow('SelectMapMenu');
923 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
925 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
926 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
928 if (wad
= '') or (map
= '') then
929 begin // Ýòî íå êàðòà
930 TGUILabel(GetControl('lbMapName')).Text := '';
931 TGUILabel(GetControl('lbMapAuthor')).Text := '';
932 TGUILabel(GetControl('lbMapSize')).Text := '';
933 TGUIMemo(GetControl('meMapDescription')).SetText('');
934 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
935 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
941 a
:= g_Map_GetMapInfo(res
);
943 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
944 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
945 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
946 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
947 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
948 TGUILabel(win
.GetControl('lbMapScale')).Text :=
949 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
954 procedure ProcSelectWAD(Sender
: TGUIControl
);
959 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
961 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
963 with TGUIListBox(GetControl('lsMapRes')) do
969 list
:= g_Map_GetMapsList(wad
);
983 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
989 win
:= g_GUI_GetWindow('CampaignMenu');
990 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
992 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
996 TGUILabel(GetControl('lbWADName')).Text := '';
997 TGUILabel(GetControl('lbWADAuthor')).Text := '';
998 TGUIMemo(GetControl('meWADDescription')).SetText('');
1001 a
:= g_Game_GetMegaWADInfo(wad
);
1003 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1004 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1005 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1007 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1011 fn
:= g_ExtractWadName(a
.pic
);
1013 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1015 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1020 procedure ProcChangeColor(Sender
: TGUIControl
);
1024 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1025 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1026 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1027 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1028 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1029 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1031 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1032 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1033 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1034 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1035 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1036 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1039 procedure ProcSelectModel(Sender
: TGUIControl
);
1044 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1045 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1046 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1048 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1049 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1050 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1052 ProcChangeColor(nil);
1055 procedure MenuLoadData();
1057 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1059 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1060 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1061 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1062 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1063 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1064 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1065 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1066 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1067 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1068 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1069 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1070 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1071 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1072 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1073 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1074 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1075 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1076 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1077 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1078 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1079 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1080 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1081 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1082 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1083 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1085 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1086 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1087 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1088 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1089 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1090 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1091 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1094 procedure MenuFreeData();
1096 e_CharFont_Remove(gMenuFont
);
1097 e_CharFont_Remove(gMenuSmallFont
);
1099 g_Texture_Delete('MAINMENU_LOGO');
1100 g_Texture_Delete('MAINMENU_MARKER1');
1101 g_Texture_Delete('MAINMENU_MARKER2');
1102 g_Texture_Delete('SCROLL_LEFT');
1103 g_Texture_Delete('SCROLL_RIGHT');
1104 g_Texture_Delete('SCROLL_MIDDLE');
1105 g_Texture_Delete('SCROLL_MARKER');
1106 g_Texture_Delete('EDIT_LEFT');
1107 g_Texture_Delete('EDIT_RIGHT');
1108 g_Texture_Delete('EDIT_MIDDLE');
1109 g_Texture_Delete('BOX1');
1110 g_Texture_Delete('BOX2');
1111 g_Texture_Delete('BOX3');
1112 g_Texture_Delete('BOX4');
1113 g_Texture_Delete('BOX5');
1114 g_Texture_Delete('BOX6');
1115 g_Texture_Delete('BOX7');
1116 g_Texture_Delete('BOX8');
1117 g_Texture_Delete('BOX9');
1118 g_Texture_Delete('BSCROLL_UP_A');
1119 g_Texture_Delete('BSCROLL_UP_U');
1120 g_Texture_Delete('BSCROLL_DOWN_A');
1121 g_Texture_Delete('BSCROLL_DOWN_U');
1122 g_Texture_Delete('BSCROLL_MIDDLE');
1123 g_Texture_Delete('NOPIC');
1125 g_Sound_Delete('MENU_SELECT');
1126 g_Sound_Delete('MENU_OPEN');
1127 g_Sound_Delete('MENU_CLOSE');
1128 g_Sound_Delete('MENU_CHANGE');
1129 g_Sound_Delete('SCROLL_ADD');
1130 g_Sound_Delete('SCROLL_SUB');
1131 g_Sound_Delete('SOUND_PLAYER_FALL');
1134 procedure ProcAuthorsMenu();
1136 gMusic
.SetByName('MUSIC_INTERMUS');
1140 procedure ProcExitMenuKeyDown (yes
: Boolean);
1143 snd
: TPlayableSound
;
1148 g_Game_StopAllSounds(True);
1149 case (Random(18)) of
1150 0: s
:= 'SOUND_MONSTER_PAIN';
1151 1: s
:= 'SOUND_MONSTER_DIE_3';
1152 2: s
:= 'SOUND_MONSTER_SLOP';
1153 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1154 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1155 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1156 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1157 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1158 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1159 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1160 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1161 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1162 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1163 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1164 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1165 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1166 else s
:= 'SOUND_PLAYER_FALL';
1168 snd
:= TPlayableSound
.Create();
1169 res
:= snd
.SetByName(s
);
1170 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1174 while snd
.IsPlaying() do begin end;
1182 procedure ProcLoadMenu();
1189 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1190 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1191 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1195 procedure ProcSaveMenu();
1203 name
:= g_GetSaveName(a
, valid
);
1204 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1205 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1209 procedure ProcSaveGame(Sender
: TGUIControl
);
1213 if g_Game_IsNet
then Exit
;
1214 if g_Game_IsTestMap
then Exit
;
1215 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1216 g_Game_PauseAllSounds(True);
1217 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1219 g_ActiveWindow
:= nil;
1220 g_Game_Pause(False);
1223 procedure ProcLoadGame(Sender
: TGUIControl
);
1227 if g_Game_IsNet
then Exit
;
1228 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1229 if g_LoadGame(a
) then
1231 g_Game_PauseAllSounds(False)
1233 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1235 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1236 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1237 //g_ActiveWindow := nil;
1241 procedure ProcSinglePlayer (n
: Integer);
1242 var wad
, map
: AnsiString;
1245 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1246 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1247 if e_FindResource(AllMapDirs
, wad
) then
1249 wad
:= ExpandFileName(wad
);
1250 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1254 procedure ProcSingle1Player
;
1259 procedure ProcSingle2Players
;
1264 procedure ProcSelectMapMenu();
1267 wad_lb
: TGUIFileListBox
;
1268 map_lb
: TGUIListBox
;
1271 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1272 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1273 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1275 if wad_lb
.SelectedItem() <> '' then
1276 map
:= map_lb
.SelectedItem()
1280 wad_lb
.UpdateFileList();
1283 if wad_lb
.SelectedItem() <> '' then
1286 map_lb
.SelectItem(map
);
1288 if map_lb
.SelectedItem() <> '' then
1292 g_GUI_ShowWindow('SelectMapMenu');
1295 procedure ProcSelectCampaignMenu();
1298 wad_lb
: TGUIFileListBox
;
1300 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1301 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1303 wad_lb
.UpdateFileList();
1305 if wad_lb
.SelectedItem() <> '' then
1306 ProcSelectCampaignWAD(nil);
1309 procedure ProcSetMap();
1311 wad
, map
, res
: String;
1313 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1315 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1316 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1319 if (wad
= '') or (map
= '') then
1322 wad
:= e_FindWadRel(MapDirs
, WAD
);
1324 res
:= wad
+':\'+map
;
1326 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1327 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1330 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1336 g_Sound_SetupAllVolumes(
1337 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1338 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1342 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1347 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1349 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1350 g_dbg_scale
:= TempScale
+ 1;
1354 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1358 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1359 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1360 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1361 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1364 procedure ProcOptionsPlayersMIMenu();
1369 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1371 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1373 if a
= '' then Exit
;
1375 i
:= g_PlayerModel_GetIndex(a
);
1376 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1378 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1379 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1380 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1382 if PlayerModelsArray
[i
].HaveWeapon
then
1383 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1385 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1388 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1391 procedure ProcOptionsPlayerP1WeaponMenu();
1395 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1396 if a
= '' then Exit
;
1397 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1400 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1402 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1405 procedure ProcOptionsPlayerP2WeaponMenu();
1409 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1410 if a
= '' then Exit
;
1411 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1414 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1416 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1419 procedure ProcOptionsPlayersAnim();
1423 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1428 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1431 Model
.AnimState
.Loop
:= True;
1435 procedure ProcOptionsPlayersWeap();
1439 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1444 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1448 procedure ProcOptionsPlayersRot();
1452 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1453 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1455 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1459 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1463 g_Options_SetDefault();
1469 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1471 if yes
then ReadOptions();
1475 procedure ProcAuthorsClose();
1477 gMusic
.SetByName('MUSIC_MENU');
1479 gState
:= STATE_MENU
;
1482 procedure ProcGMClose();
1484 g_Game_InGameMenu(False);
1487 procedure ProcGMShow();
1492 if (gGameSettings
.GameType
= GT_SINGLE
) and
1493 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1494 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1495 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1497 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1498 if g_Game_IsTestMap
then
1499 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1500 TGUIMainMenu(g_ActiveWindow
.GetControl(
1501 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1504 procedure ProcChangePlayers();
1506 TeamGame
, Spectator
, AddTwo
: Boolean;
1507 P1Team
{, P2Team}: Byte;
1508 bP2
: TGUITextButton
;
1510 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1511 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1512 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1513 P1Team
:= TEAM_NONE
;
1514 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1516 //P2Team := TEAM_NONE;
1517 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1519 TGUIMainMenu(g_ActiveWindow
.GetControl(
1520 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1521 TGUIMainMenu(g_ActiveWindow
.GetControl(
1522 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1523 TGUIMainMenu(g_ActiveWindow
.GetControl(
1524 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1526 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1527 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1528 bP2
.Enabled
:= AddTwo
and not Spectator
;
1530 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1532 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1533 if gPlayer2
= nil then
1534 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1536 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1538 TGUIMainMenu(g_ActiveWindow
.GetControl(
1539 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1542 procedure ProcJoinRed();
1544 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1546 if g_Game_IsServer
then
1548 if gPlayer1
= nil then
1549 g_Game_AddPlayer(TEAM_RED
)
1552 if gPlayer1
.Team
<> TEAM_RED
then
1554 gPlayer1
.SwitchTeam
;
1555 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1558 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1563 gPlayer1Settings
.Team
:= TEAM_RED
;
1564 MC_SEND_PlayerSettings
;
1565 if gPlayer1
= nil then
1566 g_Game_AddPlayer(TEAM_RED
);
1568 g_ActiveWindow
:= nil;
1569 g_Game_Pause(False);
1572 procedure ProcJoinBlue();
1574 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1576 if g_Game_IsServer
then
1578 if gPlayer1
= nil then
1579 g_Game_AddPlayer(TEAM_BLUE
)
1582 if gPlayer1
.Team
<> TEAM_BLUE
then
1584 gPlayer1
.SwitchTeam
;
1585 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1588 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1593 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1594 MC_SEND_PlayerSettings
;
1595 if gPlayer1
= nil then
1596 g_Game_AddPlayer(TEAM_BLUE
);
1598 g_ActiveWindow
:= nil;
1599 g_Game_Pause(False);
1602 procedure ProcJoinGame();
1604 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1606 if gPlayer1
= nil then
1608 g_ActiveWindow
:= nil;
1609 g_Game_Pause(False);
1612 procedure ProcSwitchP2();
1614 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1616 if gPlayer1
= nil then
1618 if gPlayer2
= nil then
1621 g_Game_RemovePlayer();
1622 g_ActiveWindow
:= nil;
1623 g_Game_Pause(False);
1626 procedure ProcSpectate();
1628 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1631 g_ActiveWindow
:= nil;
1632 g_Game_Pause(False);
1635 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1637 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1640 procedure ProcEndMenuKeyDown (yes
: Boolean);
1642 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1645 procedure ProcSetRussianLanguage
;
1647 if gLanguage
<> LANGUAGE_RUSSIAN
then
1649 gLanguage
:= LANGUAGE_RUSSIAN
;
1650 gLanguageChange
:= True;
1651 gAskLanguage
:= False;
1656 procedure ProcSetEnglishLanguage
;
1658 if gLanguage
<> LANGUAGE_ENGLISH
then
1660 gLanguage
:= LANGUAGE_ENGLISH
;
1661 gLanguageChange
:= True;
1662 gAskLanguage
:= False;
1667 procedure ReadGameSettings();
1671 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1673 with gGameSettings
do
1675 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1676 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1680 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1681 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1683 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1685 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1689 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1690 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1694 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1695 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1697 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1702 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1703 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1704 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1706 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1707 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1708 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1711 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1716 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1718 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1719 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1720 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1722 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1723 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1727 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1728 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1730 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1731 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1732 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1733 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1734 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1735 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1736 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1737 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1741 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1742 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1743 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1744 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1745 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1750 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1751 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1756 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1757 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1762 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1763 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1764 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1769 procedure ProcApplyGameSet();
1773 stat
: TPlayerStatArray
;
1775 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1777 if not g_Game_IsServer
then Exit
;
1779 with gGameSettings
do
1781 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1783 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1784 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1786 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1789 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1791 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1792 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1793 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1794 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1795 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1799 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1801 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1802 Options
:= Options
or GAME_OPTION_DMKEYS
1804 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1807 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1809 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1815 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1817 TimeLimit
:= Max(n
, b
);
1821 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1823 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1830 if GameMode
= GM_DM
then
1832 stat
:= g_Player_GetStats();
1834 for a
:= 0 to High(stat
) do
1835 if stat
[a
].Frags
> b
then
1839 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1841 ScoreLimit
:= Max(n
, b
);
1845 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1847 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1848 if n
< 0 then n
:= 0;
1849 if n
> 255 then n
:= 255;
1855 stat
:= g_Player_GetStats();
1857 for a
:= 0 to High(stat
) do
1858 if stat
[a
].Lives
> b
then
1861 MaxLives
:= Max(n
, b
);
1865 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1867 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1870 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1871 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1875 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1876 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1880 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1881 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1886 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1888 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1889 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1890 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1891 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1895 // don't forget to latch this shit
1896 gsGameFlags
:= Options
;
1897 gsMaxLives
:= MaxLives
;
1898 gsScoreLimit
:= ScoreLimit
;
1899 gsTimeLimit
:= TimeLimit
;
1902 if g_Game_IsNet
then MH_SEND_GameSettings
;
1905 procedure ProcVideoOptionsRes();
1910 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1912 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1913 IntToStr(gWinSizeX
) +
1914 ' x ' + IntToStr(gWinSizeY
) +
1915 ', ' + IntToStr(gBPP
) + ' bpp';
1917 with TGUIListBox(menu
.GetControl('lsResolution')) do
1919 list
:= sys_GetDisplayModes(gBPP
);
1923 ItemIndex
:= Length(list
)
1931 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1937 TempResScale
:= Round(r_pixel_scale
- 1);
1938 with TGUISwitch(menu
.GetControl('swResFactor')) do
1939 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1942 procedure ProcApplyVideoOptions();
1945 Fullscreen
: Boolean;
1946 SWidth
, SHeight
: Integer;
1947 ScaleChanged
: Boolean;
1950 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1952 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1954 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1957 SWidth
:= gWinSizeX
;
1958 SHeight
:= gWinSizeY
;
1959 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1962 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1964 ScaleChanged
:= False;
1965 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1967 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1968 r_pixel_scale
:= TempResScale
+ 1;
1969 ScaleChanged
:= True;
1972 if (SWidth
<> gWinSizeX
) or
1973 (SHeight
<> gWinSizeY
) or
1974 (Fullscreen
<> gFullscreen
) or
1977 gResolutionChange
:= True;
1978 gRC_Width
:= SWidth
;
1979 gRC_Height
:= SHeight
;
1980 gRC_FullScreen
:= Fullscreen
;
1981 gRC_Maximized
:= gWinMaximized
;
1984 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1988 procedure ProcSetFirstRussianLanguage
;
1990 gLanguage
:= LANGUAGE_RUSSIAN
;
1991 gLanguageChange
:= True;
1992 gAskLanguage
:= False;
1995 procedure ProcSetFirstEnglishLanguage
;
1997 gLanguage
:= LANGUAGE_ENGLISH
;
1998 gLanguageChange
:= True;
1999 gAskLanguage
:= False;
2002 procedure ProcRecallAddress();
2004 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2006 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2007 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2011 procedure CreateFirstLanguageMenu();
2015 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2017 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2019 Name
:= 'mmFirstLanguageMenu';
2020 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2021 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2024 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2025 Menu
.MainWindow
:= True;
2026 g_GUI_AddWindow(Menu
);
2029 procedure g_Menu_AskLanguage();
2031 CreateFirstLanguageMenu();
2032 g_GUI_ShowWindow('FirstLanguageMenu');
2035 procedure CreatePlayerOptionsMenu(s
: String);
2040 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2042 a
:= _lc
[I_MENU_PLAYER_1
]
2044 a
:= _lc
[I_MENU_PLAYER_2
];
2045 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2047 Name
:= 'mOptionsPlayers'+s
+'Menu';
2048 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2050 Name
:= 'ed'+s
+'Name';
2054 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2056 Name
:= 'sw'+s
+'Team';
2057 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2058 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2060 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2062 Name
:= 'ls'+s
+'Model';
2064 Items
:= g_PlayerModel_GetNames();
2065 OnChange
:= ProcSelectModel
;
2067 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2069 Name
:= 'sc'+s
+'Red';
2071 OnChange
:= ProcChangeColor
;
2073 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2075 Name
:= 'sc'+s
+'Green';
2077 OnChange
:= ProcChangeColor
;
2079 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2081 Name
:= 'sc'+s
+'Blue';
2083 OnChange
:= ProcChangeColor
;
2086 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2087 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2088 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2089 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2090 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2091 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2092 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2094 Name
:= 'mv'+s
+'Model';
2095 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2096 Y
:= GetControl('ls'+s
+'Model').Y
;
2099 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2100 g_GUI_AddWindow(Menu
);
2103 procedure CreateAllMenus();
2107 a
, cx
, _y
, i
: Integer;
2110 Menu
:= TGUIWindow
.Create('MainMenu');
2111 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2113 Name
:= 'mmMainMenu';
2114 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2115 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2116 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2117 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2118 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2119 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2121 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2123 Color
:= _RGB(255, 255, 255);
2124 X
:= gScreenWidth
-GetWidth
-8;
2125 Y
:= gScreenHeight
-GetHeight
-8;
2127 Menu
.DefControl
:= 'mmMainMenu';
2128 Menu
.MainWindow
:= True;
2129 g_GUI_AddWindow(Menu
);
2131 Menu
:= TGUIWindow
.Create('NewGameMenu');
2132 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2134 Name
:= 'mmNewGameMenu';
2135 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2136 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2137 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2138 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2140 Menu
.DefControl
:= 'mmNewGameMenu';
2141 g_GUI_AddWindow(Menu
);
2143 Menu
:= TGUIWindow
.Create('NetGameMenu');
2144 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2146 Name
:= 'mmNetGameMenu';
2147 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2148 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2150 Menu
.DefControl
:= 'mmNetGameMenu';
2151 g_GUI_AddWindow(Menu
);
2153 Menu
:= TGUIWindow
.Create('NetServerMenu');
2154 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2156 Name
:= 'mNetServerMenu';
2157 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2159 Name
:= 'edSrvName';
2160 OnlyDigits
:= False;
2163 Text := NetServerName
;
2165 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2167 Name
:= 'edSrvPassword';
2168 OnlyDigits
:= False;
2171 Text := NetPassword
;
2173 with AddEdit(_lc
[I_NET_PORT
]) do
2179 Text := IntToStr(NetPort
);
2181 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2183 Name
:= 'edMaxPlayers';
2187 Text := IntToStr(NetMaxClients
);
2189 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2191 Name
:= 'swUseMaster';
2192 AddItem(_lc
[I_MENU_YES
]);
2193 AddItem(_lc
[I_MENU_NO
]);
2194 if NetUseMaster
then
2200 with AddLabel(_lc
[I_MENU_MAP
]) do
2205 OnClick
:= @ProcSelectMapMenu
;
2207 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2209 Name
:= 'swGameMode';
2210 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2211 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2212 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2213 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2214 case g_Game_TextToMode(gsGameMode
) of
2216 GM_DM
: ItemIndex
:= 0;
2217 GM_TDM
: ItemIndex
:= 1;
2218 GM_CTF
: ItemIndex
:= 2;
2220 GM_COOP
: ItemIndex
:= 3;
2222 OnChange
:= ProcSwitchMonstersCustom
;
2224 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2226 Name
:= 'edTimeLimit';
2230 if gsTimeLimit
> 0 then
2231 Text := IntToStr(gsTimeLimit
);
2233 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2235 Name
:= 'edScoreLimit';
2239 if gsScoreLimit
> 0 then
2240 Text := IntToStr(gsScoreLimit
);
2242 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2244 Name
:= 'edMaxLives';
2248 if gsMaxLives
> 0 then
2249 Text := IntToStr(gsMaxLives
);
2251 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2253 Name
:= 'edItemRespawnTime';
2257 if gsItemRespawnTime
> 0 then
2258 Text := IntToStr(gsItemRespawnTime
);
2260 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2262 Name
:= 'swPlayers';
2263 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2264 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2265 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2266 ItemIndex
:= gsPlayers
;
2268 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2270 Name
:= 'swTeamDamage';
2271 AddItem(_lc
[I_MENU_YES
]);
2272 AddItem(_lc
[I_MENU_NO
]);
2273 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2278 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2280 Name
:= 'swTeamHit';
2281 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2282 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2283 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2284 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2285 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2287 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2289 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2294 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2296 Name
:= 'swDeathmatchKeys';
2297 AddItem(_lc
[I_MENU_YES
]);
2298 AddItem(_lc
[I_MENU_NO
]);
2299 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2304 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2306 Name
:= 'swEnableExits';
2307 AddItem(_lc
[I_MENU_YES
]);
2308 AddItem(_lc
[I_MENU_NO
]);
2309 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2314 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2316 Name
:= 'swWeaponStay';
2317 AddItem(_lc
[I_MENU_YES
]);
2318 AddItem(_lc
[I_MENU_NO
]);
2319 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2324 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2326 Name
:= 'swMonsters';
2327 AddItem(_lc
[I_MENU_YES
]);
2328 AddItem(_lc
[I_MENU_NO
]);
2329 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2334 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2337 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2338 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2339 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2341 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2343 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2346 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2348 Name
:= 'swFlagDrop';
2349 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2350 AddItem(_lc
[I_MENU_YES
]);
2351 AddItem(_lc
[I_MENU_NO
]);
2352 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2354 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2360 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2364 Menu
.DefControl
:= 'mNetServerMenu';
2365 g_GUI_AddWindow(Menu
);
2367 Menu
:= TGUIWindow
.Create('NetClientMenu');
2368 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2370 Name
:= 'mNetClientMenu';
2372 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2375 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2381 Text := 'localhost';
2383 with AddEdit(_lc
[I_NET_PORT
]) do
2391 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2394 OnlyDigits
:= False;
2401 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2405 Menu
.DefControl
:= 'mNetClientMenu';
2406 g_GUI_AddWindow(Menu
);
2408 Menu
:= TGUIWindow
.Create('LoadMenu');
2409 Menu
.OnShow
:= ProcLoadMenu
;
2410 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2412 Name
:= 'mmLoadMenu';
2417 Name
:= 'edSlot'+IntToStr(a
);
2420 OnEnter
:= ProcLoadGame
;
2423 Menu
.DefControl
:= 'mmLoadMenu';
2424 g_GUI_AddWindow(Menu
);
2426 Menu
:= TGUIWindow
.Create('SaveMenu');
2427 Menu
.OnShow
:= ProcSaveMenu
;
2428 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2430 Name
:= 'mmSaveMenu';
2435 Name
:= 'edSlot'+IntToStr(a
);
2438 OnChange
:= ProcSaveGame
;
2441 Menu
.DefControl
:= 'mmSaveMenu';
2442 g_GUI_AddWindow(Menu
);
2444 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2445 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2447 Name
:= 'mCustomGameMenu';
2448 with AddLabel(_lc
[I_MENU_MAP
]) do
2453 OnClick
:= @ProcSelectMapMenu
;
2455 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2457 Name
:= 'swGameMode';
2458 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2459 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2460 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2461 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2462 case g_Game_TextToMode(gsGameMode
) of
2464 GM_DM
: ItemIndex
:= 0;
2465 GM_TDM
: ItemIndex
:= 1;
2466 GM_CTF
: ItemIndex
:= 2;
2468 GM_COOP
: ItemIndex
:= 3;
2470 OnChange
:= ProcSwitchMonstersCustom
;
2472 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2474 Name
:= 'edTimeLimit';
2478 if gsTimeLimit
> 0 then
2479 Text := IntToStr(gsTimeLimit
);
2481 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2483 Name
:= 'edScoreLimit';
2487 if gsScoreLimit
> 0 then
2488 Text := IntToStr(gsScoreLimit
);
2490 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2492 Name
:= 'edMaxLives';
2496 if gsMaxLives
> 0 then
2497 Text := IntToStr(gsMaxLives
);
2499 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2501 Name
:= 'edItemRespawnTime';
2505 if gsItemRespawnTime
> 0 then
2506 Text := IntToStr(gsItemRespawnTime
);
2508 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2510 Name
:= 'swPlayers';
2511 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2512 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2513 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2514 ItemIndex
:= gsPlayers
;
2516 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2518 Name
:= 'swTeamDamage';
2519 AddItem(_lc
[I_MENU_YES
]);
2520 AddItem(_lc
[I_MENU_NO
]);
2521 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2526 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2528 Name
:= 'swTeamHit';
2529 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2530 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2531 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2532 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2533 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2535 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2537 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2542 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2544 Name
:= 'swDeathmatchKeys';
2545 AddItem(_lc
[I_MENU_YES
]);
2546 AddItem(_lc
[I_MENU_NO
]);
2547 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2552 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2554 Name
:= 'swEnableExits';
2555 AddItem(_lc
[I_MENU_YES
]);
2556 AddItem(_lc
[I_MENU_NO
]);
2557 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2562 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2564 Name
:= 'swWeaponStay';
2565 AddItem(_lc
[I_MENU_YES
]);
2566 AddItem(_lc
[I_MENU_NO
]);
2567 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2572 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2574 Name
:= 'swMonsters';
2575 AddItem(_lc
[I_MENU_YES
]);
2576 AddItem(_lc
[I_MENU_NO
]);
2577 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2582 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2585 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2586 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2587 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2589 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2591 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2594 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2596 Name
:= 'swFlagDrop';
2597 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2598 AddItem(_lc
[I_MENU_YES
]);
2599 AddItem(_lc
[I_MENU_NO
]);
2600 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2602 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2608 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2612 Menu
.DefControl
:= 'mCustomGameMenu';
2613 g_GUI_AddWindow(Menu
);
2615 Menu
:= TGUIWindow
.Create('CampaignMenu');
2616 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2618 Name
:= 'mCampaignMenu';
2627 with AddFileList('', 15, 4) do
2630 OnChange
:= ProcSelectCampaignWAD
;
2634 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2635 SetBase(MegawadDirs
);
2638 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2640 Name
:= 'lbWADName';
2644 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2646 Name
:= 'lbWADAuthor';
2650 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2651 with AddMemo('', 15, 3) do
2653 Name
:= 'meWADDescription';
2654 Color
:= MENU_ITEMSCTRL_COLOR
;
2656 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2658 Name
:= 'swPlayers';
2659 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2660 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2663 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2667 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2669 Name
:= 'mpWADImage';
2670 DefaultRes
:= 'NOPIC';
2671 X
:= GetControl('lsWAD').X
+4;
2672 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2675 Menu
.DefControl
:= 'mCampaignMenu';
2676 g_GUI_AddWindow(Menu
);
2678 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2679 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2681 Name
:= 'mSelectMapMenu';
2682 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2685 OnChange
:= ProcSelectWAD
;
2689 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2692 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2696 OnChange
:= ProcSelectMap
;
2699 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2701 Name
:= 'lbMapName';
2705 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2707 Name
:= 'lbMapAuthor';
2711 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2713 Name
:= 'lbMapSize';
2717 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2719 Name
:= 'meMapDescription';
2724 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2726 Name
:= 'mpMapPreview';
2727 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2728 Y
:= GetControl('lsMapWAD').Y
;
2730 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2732 Name
:= 'lbMapScale';
2735 Color
:= MENU_ITEMSCTRL_COLOR
;
2736 X
:= GetControl('lsMapWAD').X
+
2737 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2738 2 + MAPPREVIEW_WIDTH
*4;
2739 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2742 Menu
.OnClose
:= ProcSetMap
;
2743 Menu
.DefControl
:= 'mSelectMapMenu';
2744 g_GUI_AddWindow(Menu
);
2746 Menu
:= TGUIWindow
.Create('OptionsMenu');
2747 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2749 Name
:= 'mmOptionsMenu';
2750 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2751 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2752 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2753 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2754 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2755 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2757 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2758 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2760 Menu
.OnClose
:= ProcApplyOptions
;
2761 Menu
.DefControl
:= 'mmOptionsMenu';
2762 g_GUI_AddWindow(Menu
);
2764 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2765 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2766 g_GUI_AddWindow(Menu
);
2768 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2769 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2771 Name
:= 'mOptionsVideoMenu';
2772 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2773 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2779 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2782 AddItem(_lc
[I_MENU_YES
]);
2783 AddItem(_lc
[I_MENU_NO
]);
2785 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2787 Name
:= 'swTextureFilter';
2788 AddItem(_lc
[I_MENU_YES
]);
2789 AddItem(_lc
[I_MENU_NO
]);
2791 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2794 AddItem(_lc
[I_MENU_YES
]);
2795 AddItem(_lc
[I_MENU_NO
]);
2797 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2799 Name
:= 'swLegacyNPOT';
2800 AddItem(_lc
[I_MENU_NO
]);
2801 AddItem(_lc
[I_MENU_YES
]);
2804 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2807 Menu
.DefControl
:= 'mOptionsVideoMenu';
2808 g_GUI_AddWindow(Menu
);
2810 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2811 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2813 Name
:= 'mOptionsVideoResMenu';
2814 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2816 Name
:= 'lbCurrentRes';
2820 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2822 Name
:= 'lsResolution';
2825 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2827 Name
:= 'swFullScreen';
2828 AddItem(_lc
[I_MENU_YES
]);
2829 AddItem(_lc
[I_MENU_NO
]);
2831 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2833 Name
:= 'swResFactor';
2835 for i
:= 2 to gRC_Width
div 640 do
2836 AddItem(IntToStr(i
) + 'x');
2839 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2842 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2846 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2848 Name
:= 'mOptionsSoundMenu';
2849 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2851 Name
:= 'scMusicLevel';
2853 OnChange
:= ProcChangeSoundSettings
;
2855 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2857 Name
:= 'scSoundLevel';
2859 OnChange
:= ProcChangeSoundSettings
;
2861 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2863 Name
:= 'scMaxSimSounds';
2866 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2868 Name
:= 'swAnnouncer';
2869 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2870 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2871 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2872 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2874 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2875 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2877 Name
:= 'swSoundEffects';
2878 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2879 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2881 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2882 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2884 Name
:= 'swChatSpeech';
2885 AddItem(_lc
[I_MENU_YES
]);
2886 AddItem(_lc
[I_MENU_NO
]);
2888 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2890 Name
:= 'swInactiveSounds';
2891 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2892 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2896 Menu
.DefControl
:= 'mOptionsSoundMenu';
2897 g_GUI_AddWindow(Menu
);
2899 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2900 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2902 Name
:= 'mOptionsGameMenu';
2903 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2905 Name
:= 'scParticlesCount';
2908 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2910 Name
:= 'swBloodCount';
2911 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2912 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2913 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2914 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2915 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2917 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2919 Name
:= 'scShellsMax';
2922 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2924 Name
:= 'scGibsMax';
2927 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2929 Name
:= 'scCorpsesMax';
2932 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2934 Name
:= 'swGibsCount';
2935 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2936 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2937 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2938 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2939 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2941 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2943 Name
:= 'swCorpseType';
2944 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2945 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2947 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2949 Name
:= 'swGibsType';
2950 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2951 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2953 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2955 Name
:= 'swBloodType';
2956 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2957 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2959 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2961 Name
:= 'swScreenFlash';
2962 AddItem(_lc
[I_MENU_NO
]);
2963 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2964 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2966 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2968 Name
:= 'swBackground';
2969 AddItem(_lc
[I_MENU_YES
]);
2970 AddItem(_lc
[I_MENU_NO
]);
2972 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2974 Name
:= 'swMessages';
2975 AddItem(_lc
[I_MENU_YES
]);
2976 AddItem(_lc
[I_MENU_NO
]);
2978 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2980 Name
:= 'swRevertPlayers';
2981 AddItem(_lc
[I_MENU_YES
]);
2982 AddItem(_lc
[I_MENU_NO
]);
2984 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2986 Name
:= 'swChatBubble';
2987 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2988 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2989 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2990 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2991 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2993 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2995 Name
:= 'swPlayerIndicator';
2996 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2997 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2998 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3000 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3002 Name
:= 'swPlayerIndicatorStyle';
3003 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3004 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3006 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3008 Name
:= 'scScaleFactor';
3010 OnChange
:= ProcChangeGameSettings
;
3014 Menu
.DefControl
:= 'mOptionsGameMenu';
3015 g_GUI_AddWindow(Menu
);
3017 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3018 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3020 Name
:= 'mOptionsControlsMenu';
3021 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3022 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3023 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3024 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3025 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3027 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3028 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3029 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3030 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3031 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3032 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3033 if e_HasJoysticks
then
3036 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3038 if g_touch_enabled
then
3041 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3044 Menu
.DefControl
:= 'mOptionsControlsMenu';
3045 g_GUI_AddWindow(Menu
);
3047 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3048 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3050 Name
:= 'mOptionsControlsP1Menu';
3051 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3052 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3053 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3054 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3055 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3056 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3057 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3058 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3059 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3060 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3061 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3063 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3064 g_GUI_AddWindow(Menu
);
3066 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3067 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3069 Name
:= 'mOptionsControlsP1MenuWeapons';
3070 for i
:= WP_FIRST
to WP_LAST
do
3071 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3072 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3074 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3075 g_GUI_AddWindow(Menu
);
3077 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3078 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3080 Name
:= 'mOptionsControlsP2Menu';
3081 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3082 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3083 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3084 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3085 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3086 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3087 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3088 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3089 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3090 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3091 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3093 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3094 g_GUI_AddWindow(Menu
);
3096 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3097 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3099 Name
:= 'mOptionsControlsP2MenuWeapons';
3100 for i
:= WP_FIRST
to WP_LAST
do
3101 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3102 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3104 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3105 g_GUI_AddWindow(Menu
);
3107 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3108 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3110 Name
:= 'mOptionsControlsJoystickMenu';
3111 for i
:= 0 to e_MaxJoys
- 1 do
3112 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3114 Name
:= 'scDeadzone' + IntToStr(i
);
3118 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3119 g_GUI_AddWindow(Menu
);
3121 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3122 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3124 Name
:= 'mOptionsControlsTouchMenu';
3125 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3127 Name
:= 'swTouchAlt';
3128 AddItem(_lc
[I_MENU_NO
]);
3129 AddItem(_lc
[I_MENU_YES
]);
3130 OnChange
:= ProcChangeTouchSettings
;
3132 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3134 Name
:= 'scTouchSize';
3136 OnChange
:= ProcChangeTouchSettings
;
3138 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3140 Name
:= 'swTouchFire';
3141 AddItem(_lc
[I_MENU_NO
]);
3142 AddItem(_lc
[I_MENU_YES
]);
3144 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3146 Name
:= 'scTouchOffset';
3148 OnChange
:= ProcChangeTouchSettings
;
3151 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3152 g_GUI_AddWindow(Menu
);
3154 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3155 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3157 Name
:= 'mOptionsPlayersMenu';
3158 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3159 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3161 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3162 g_GUI_AddWindow(Menu
);
3164 CreatePlayerOptionsMenu('P1');
3165 CreatePlayerOptionsMenu('P2');
3167 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3168 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3170 Name
:= 'mOptionsPlayersMIMenu';
3171 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3176 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3181 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3183 Name
:= 'meComment';
3186 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3187 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3190 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3194 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3195 g_GUI_AddWindow(Menu
);
3197 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3198 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3200 Name
:= 'mOptionsPlayersP1WeaponMenu';
3201 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3203 Name
:= 'swWeaponAutoswitch';
3204 AddItem(_lc
[I_MENU_NO
]);
3205 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3206 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3208 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3210 Name
:= 'swWeaponAllowEmpty';
3211 AddItem(_lc
[I_MENU_YES
]);
3212 AddItem(_lc
[I_MENU_NO
]);
3214 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3216 Name
:= 'swWeaponAllowFist';
3217 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3218 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3220 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3223 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3224 g_GUI_AddWindow(Menu
);
3226 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3227 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3229 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3230 for i
:= WP_FIRST
to WP_LAST
do
3232 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3234 Name
:= IntToStr(i
);
3235 for a
:= WP_FIRST
to WP_LAST
+1 do
3237 AddItem(IntToStr(a
));
3242 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3244 Name
:= IntToStr(WP_LAST
+1);
3245 for a
:= WP_FIRST
to WP_LAST
+1 do
3247 AddItem(IntToStr(a
));
3249 ItemIndex
:= WP_LAST
+ 1;
3252 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3253 g_GUI_AddWindow(Menu
);
3256 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3257 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3259 Name
:= 'mOptionsPlayersP2WeaponMenu';
3260 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3262 Name
:= 'swWeaponAutoswitch';
3263 AddItem(_lc
[I_MENU_NO
]);
3264 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3265 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3267 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3269 Name
:= 'swWeaponAllowEmpty';
3270 AddItem(_lc
[I_MENU_YES
]);
3271 AddItem(_lc
[I_MENU_NO
]);
3273 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3275 Name
:= 'swWeaponAllowFist';
3276 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3277 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3279 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3282 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3283 g_GUI_AddWindow(Menu
);
3285 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3286 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3288 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3289 for i
:= WP_FIRST
to WP_LAST
do
3291 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3293 Name
:= IntToStr(i
);
3294 for a
:= WP_FIRST
to WP_LAST
+1 do
3296 AddItem(IntToStr(a
));
3301 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3303 Name
:= IntToStr(WP_LAST
+1);
3304 for a
:= WP_FIRST
to WP_LAST
+1 do
3306 AddItem(IntToStr(a
));
3308 ItemIndex
:= WP_LAST
+ 1;
3311 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3312 g_GUI_AddWindow(Menu
);
3314 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3315 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3317 Name
:= 'mOptionsLanguageMenu';
3318 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3319 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3322 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3323 g_GUI_AddWindow(Menu
);
3325 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3326 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3327 g_GUI_AddWindow(Menu
);
3329 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3330 Menu
.BackTexture
:= 'INTER';
3331 Menu
.OnClose
:= ProcAuthorsClose
;
3335 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3337 Color
:= _RGB(255, 0, 0);
3338 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3340 _y
:= _y
+GetHeight();
3342 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3344 Color
:= _RGB(255, 0, 0);
3345 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3347 _y
:= _y
+GetHeight()+32;
3349 // ×òî äåëàë: Êòî äåëàë
3350 cx
:= gScreenWidth
div 2 - 320 + 64;
3351 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3353 Color
:= _RGB(255, 0, 0);
3358 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3360 Color
:= _RGB(255, 255, 255);
3365 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3367 Color
:= _RGB(255, 0, 0);
3372 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3374 Color
:= _RGB(255, 255, 255);
3379 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3381 Color
:= _RGB(255, 255, 255);
3386 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3388 Color
:= _RGB(255, 0, 0);
3393 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3395 Color
:= _RGB(255, 255, 255);
3400 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3402 Color
:= _RGB(255, 0, 0);
3407 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3409 Color
:= _RGB(255, 255, 255);
3412 _y
:= gScreenHeight
- 128;
3415 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3417 Color
:= _RGB(255, 0, 0);
3422 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3424 Color
:= _RGB(255, 255, 255);
3427 _y
:= _y
+GetHeight();
3429 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3431 Color
:= _RGB(255, 255, 255);
3434 _y
:= _y
+GetHeight();
3436 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3438 Color
:= _RGB(255, 255, 255);
3441 _y
:= gScreenHeight
- 32;
3443 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3445 Color
:= _RGB(255, 0, 0);
3446 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3449 g_GUI_AddWindow(Menu
);
3451 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3452 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3453 g_GUI_AddWindow(Menu
);
3455 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3456 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3458 Name
:= 'mmGameSingleMenu';
3459 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3460 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3461 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3462 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3463 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3464 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3466 Menu
.DefControl
:= 'mmGameSingleMenu';
3467 Menu
.MainWindow
:= True;
3468 Menu
.OnClose
:= ProcGMClose
;
3469 Menu
.OnShow
:= ProcGMShow
;
3470 g_GUI_AddWindow(Menu
);
3472 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3473 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3474 g_GUI_AddWindow(Menu
);
3476 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3477 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3478 g_GUI_AddWindow(Menu
);
3480 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3481 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3483 Name
:= 'mmGameCustomMenu';
3484 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3485 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3486 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3487 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3488 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3489 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3490 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3492 Menu
.DefControl
:= 'mmGameCustomMenu';
3493 Menu
.MainWindow
:= True;
3494 Menu
.OnClose
:= ProcGMClose
;
3495 Menu
.OnShow
:= ProcGMShow
;
3496 g_GUI_AddWindow(Menu
);
3498 Menu
:= TGUIWindow
.Create('GameServerMenu');
3499 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3501 Name
:= 'mmGameServerMenu';
3502 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3503 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3504 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3505 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3506 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3508 Menu
.DefControl
:= 'mmGameServerMenu';
3509 Menu
.MainWindow
:= True;
3510 Menu
.OnClose
:= ProcGMClose
;
3511 Menu
.OnShow
:= ProcGMShow
;
3512 g_GUI_AddWindow(Menu
);
3514 Menu
:= TGUIWindow
.Create('GameClientMenu');
3515 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3517 Name
:= 'mmGameClientMenu';
3518 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3519 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3520 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3522 Menu
.DefControl
:= 'mmGameClientMenu';
3523 Menu
.MainWindow
:= True;
3524 Menu
.OnClose
:= ProcGMClose
;
3525 Menu
.OnShow
:= ProcGMShow
;
3526 g_GUI_AddWindow(Menu
);
3528 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3529 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3531 Name
:= 'mClientPasswordMenu';
3532 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3540 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3543 Menu
.DefControl
:= 'mClientPasswordMenu';
3544 g_GUI_AddWindow(Menu
);
3546 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3547 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3549 Name
:= 'mGameSetGameMenu';
3550 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3552 Name
:= 'swTeamDamage';
3553 AddItem(_lc
[I_MENU_YES
]);
3554 AddItem(_lc
[I_MENU_NO
]);
3557 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3559 Name
:= 'swTeamHit';
3560 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3561 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3562 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3563 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3566 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3568 Name
:= 'swDeathmatchKeys';
3569 AddItem(_lc
[I_MENU_YES
]);
3570 AddItem(_lc
[I_MENU_NO
]);
3573 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3575 Name
:= 'edTimeLimit';
3580 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3582 Name
:= 'edScoreLimit';
3587 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3589 Name
:= 'edMaxLives';
3594 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3597 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3598 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3599 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3602 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3604 Name
:= 'swFlagDrop';
3605 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3606 AddItem(_lc
[I_MENU_YES
]);
3607 AddItem(_lc
[I_MENU_NO
]);
3613 Menu
.DefControl
:= 'mGameSetGameMenu';
3614 Menu
.OnClose
:= ProcApplyGameSet
;
3615 g_GUI_AddWindow(Menu
);
3617 Menu
:= TGUIWindow
.Create('TeamMenu');
3618 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3620 Name
:= 'mmTeamMenu';
3621 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3622 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3623 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3624 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3625 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3627 Menu
.DefControl
:= 'mmTeamMenu';
3628 Menu
.OnShow
:= ProcChangePlayers
;
3629 g_GUI_AddWindow(Menu
);
3632 procedure g_Menu_Show_SaveMenu();
3634 if g_Game_IsTestMap
then
3636 if gGameSettings
.GameType
= GT_SINGLE
then
3637 g_GUI_ShowWindow('GameSingleMenu')
3640 if g_Game_IsClient
then
3643 if g_Game_IsNet
then
3646 g_GUI_ShowWindow('GameCustomMenu');
3648 g_GUI_ShowWindow('SaveMenu');
3649 g_Sound_PlayEx('MENU_OPEN');
3652 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3654 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3655 if gGameSettings
.GameType
= GT_SINGLE
then
3657 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3661 if g_Game_IsClient
then exit
;
3662 if g_Game_IsNet
then exit
;
3663 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3665 g_GUI_ShowWindow('LoadMenu');
3666 g_Sound_PlayEx('MENU_OPEN');
3669 procedure g_Menu_Show_GameSetGame();
3671 if gGameSettings
.GameType
= GT_SINGLE
then
3672 g_GUI_ShowWindow('GameSingleMenu')
3675 if g_Game_IsClient
then
3678 if g_Game_IsNet
then
3679 g_GUI_ShowWindow('GameServerMenu')
3681 g_GUI_ShowWindow('GameCustomMenu');
3684 g_GUI_ShowWindow('GameSetGameMenu');
3685 g_Sound_PlayEx('MENU_OPEN');
3688 procedure g_Menu_Show_OptionsVideo();
3690 if gGameSettings
.GameType
= GT_SINGLE
then
3691 g_GUI_ShowWindow('GameSingleMenu')
3694 if g_Game_IsClient
then
3695 g_GUI_ShowWindow('GameClientMenu')
3697 if g_Game_IsNet
then
3698 g_GUI_ShowWindow('GameServerMenu')
3700 g_GUI_ShowWindow('GameCustomMenu');
3703 g_GUI_ShowWindow('OptionsMenu');
3704 g_GUI_ShowWindow('OptionsVideoMenu');
3705 g_Sound_PlayEx('MENU_OPEN');
3708 procedure g_Menu_Show_OptionsSound();
3710 if gGameSettings
.GameType
= GT_SINGLE
then
3711 g_GUI_ShowWindow('GameSingleMenu')
3714 if g_Game_IsClient
then
3715 g_GUI_ShowWindow('GameClientMenu')
3717 if g_Game_IsNet
then
3718 g_GUI_ShowWindow('GameServerMenu')
3720 g_GUI_ShowWindow('GameCustomMenu');
3723 g_GUI_ShowWindow('OptionsMenu');
3724 g_GUI_ShowWindow('OptionsSoundMenu');
3725 g_Sound_PlayEx('MENU_OPEN');
3728 procedure g_Menu_Show_EndGameMenu();
3730 g_GUI_ShowWindow('EndGameMenu');
3731 g_Sound_PlayEx('MENU_OPEN');
3734 procedure g_Menu_Show_QuitGameMenu();
3736 g_GUI_ShowWindow('ExitMenu');
3737 g_Sound_PlayEx('MENU_OPEN');
3740 procedure g_Menu_Init();
3746 procedure g_Menu_Free();
3751 procedure g_Menu_Reset();
3755 g_GUI_SaveMenuPos();
3756 ex
:= g_GUI_Destroy();
3760 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3765 g_Game_SetDebugMode();
3767 g_GUI_LoadMenuPos();