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, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu();
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
45 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
46 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPSTRUCT
, wadreader
, Math
, g_saveload
,
49 e_textures
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
;
53 type TYNCallback
= procedure (yes
:Boolean);
55 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
57 if win
.UserData
= nil then exit
;
59 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
60 IK_N
: TYNCallback(win
.UserData
)(false);
64 procedure YesButtonCB (ctl
: TGUITextButton
);
66 if ctl
.UserData
= nil then exit
;
67 TYNCallback(ctl
.UserData
)(true);
70 procedure NoButtonCB (ctl
: TGUITextButton
);
72 if ctl
.UserData
= nil then exit
;
73 TYNCallback(ctl
.UserData
)(false);
76 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
80 //if length(Text) = 0 then exit;
81 Result
:= TGUIWindow
.Create(WinName
);
84 //OnKeyDownEx := @YNKeyDownProc;
85 //UserData := @ActionProc;
86 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
89 Name
:= '__temp_yes_no_menu:'+WinName
;
91 AddText(Text, MaxLen
);
92 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
93 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
95 DefControl
:= '__temp_yes_no_menu:'+WinName
;
101 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
102 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
104 procedure ProcApplyOptions();
109 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
111 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
115 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
116 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
117 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
121 g_Sound_SetupAllVolumes(
122 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
123 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
126 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
127 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
128 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
129 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
133 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
134 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
135 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
136 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
138 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
143 else gGibsCount
:= 48;
146 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
147 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
148 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
149 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
150 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
151 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
152 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
153 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
154 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
156 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
158 with menu
, gGameControls
.GameControls
do
160 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
161 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
162 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
163 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
167 with menu
, gGameControls
.P1Control
do
169 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
170 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
171 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
172 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
173 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
174 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
175 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
176 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
177 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
180 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt'));
181 with menu
, gGameControls
.P1Control
do
183 KeyRight2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
184 KeyLeft2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
185 KeyUp2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
186 KeyDown2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
187 KeyFire2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
188 KeyJump2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
189 KeyNextWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
190 KeyPrevWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
191 KeyOpen2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
194 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
195 with menu
, gGameControls
.P2Control
do
197 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
198 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
199 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
200 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
201 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
202 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
203 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
204 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
205 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
208 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
209 with menu
, gGameControls
.P2Control
do
211 KeyRight2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
212 KeyLeft2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
213 KeyUp2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
214 KeyDown2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
215 KeyFire2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
216 KeyJump2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
217 KeyNextWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
218 KeyPrevWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
219 KeyOpen2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
222 if e_JoysticksAvailable
> 0 then
224 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
227 for i
:= 0 to e_JoysticksAvailable
-1 do
228 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
232 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
234 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
235 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
236 TEAM_RED
, TEAM_BLUE
);
238 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
240 gPlayer1Settings
.Model
:= Model
.Name
;
241 gPlayer1Settings
.Color
:= Model
.Color
;
244 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
246 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
247 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
248 TEAM_RED
, TEAM_BLUE
);
249 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
251 gPlayer2Settings
.Model
:= Model
.Name
;
252 gPlayer2Settings
.Color
:= Model
.Color
;
255 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
256 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
258 if g_Game_IsServer
then
260 if gPlayer1
<> nil then
262 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
263 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
264 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
265 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
267 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
270 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
273 if gPlayer2
<> nil then
275 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
276 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
277 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
278 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
280 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
285 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
287 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
290 procedure ReadOptions();
295 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
297 with TGUISwitch(menu
.GetControl('swBPP')) do
303 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
304 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
306 with TGUISwitch(menu
.GetControl('swVSync')) do
307 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
309 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
310 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
312 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
314 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
315 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
316 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
318 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
319 if gMuteWhenInactive
then
324 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
326 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
327 if gSoundEffectsDF
then
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
333 with menu
, gGameControls
.P1Control
do
335 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
336 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
337 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
338 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
339 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
340 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
341 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
342 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
343 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt'));
347 with menu
, gGameControls
.P1Control
do
349 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
350 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
351 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
352 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
353 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
354 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
355 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
356 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
357 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
360 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
361 with menu
, gGameControls
.P2Control
do
363 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
364 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
365 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
366 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
367 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
368 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
369 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
370 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
371 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
374 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
375 with menu
, gGameControls
.P2Control
do
377 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
378 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
379 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
380 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
381 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
382 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
383 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
384 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
385 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
388 if e_JoysticksAvailable
> 0 then
390 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
393 for i
:= 0 to e_JoysticksAvailable
-1 do
394 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
398 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
399 with menu
, gGameControls
.GameControls
do
401 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
402 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
403 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
404 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
407 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
409 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
410 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
411 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
412 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
413 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
415 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
418 with TGUISwitch(menu
.GetControl('swBloodType')) do
419 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
421 with TGUISwitch(menu
.GetControl('swCorpseType')) do
422 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
424 with TGUISwitch(menu
.GetControl('swGibsType')) do
425 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
427 with TGUISwitch(menu
.GetControl('swGibsCount')) do
436 with TGUISwitch(menu
.GetControl('swBackGround')) do
437 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
439 with TGUISwitch(menu
.GetControl('swMessages')) do
440 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
442 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
443 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
445 with TGUISwitch(menu
.GetControl('swChatBubble')) do
446 ItemIndex
:= gChatBubble
;
448 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
450 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
451 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
453 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
454 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
456 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
457 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
458 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
460 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
462 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
463 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
465 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
466 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
468 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
469 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
470 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
472 ProcSelectModel(nil);
475 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
477 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
478 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
479 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
481 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
484 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
486 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
487 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
488 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
490 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
493 procedure ProcStartCustomGame();
499 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
501 Map
:= TGUILabel(GetControl('lbMap')).Text;
504 if Pos(':\', Map
) = 0 then
507 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
508 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
509 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
510 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
511 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
513 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
514 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
515 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
516 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
519 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
521 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
523 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
525 Options
:= Options
or GAME_OPTION_MONSTERS
;
526 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
528 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
530 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
531 gcBotsVS
:= 'Monsters';
534 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
535 gcBotsVS
:= 'Everybody';
538 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
539 gcBotsVS
:= 'Players';
546 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
548 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
549 gcMaxLives
, Options
, gcPlayers
);
553 procedure ProcStartNetGame();
559 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
561 Map
:= TGUILabel(GetControl('lbMap')).Text;
564 if Pos(':\', Map
) = 0 then
567 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
568 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
569 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
570 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
571 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
572 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
574 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
575 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
576 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
577 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
580 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
582 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
584 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
586 Options
:= Options
or GAME_OPTION_MONSTERS
;
587 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
589 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
591 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
592 gnBotsVS
:= 'Monsters';
595 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
596 gnBotsVS
:= 'Everybody';
599 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
600 gnBotsVS
:= 'Players';
605 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
606 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
607 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
608 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
609 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
612 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
613 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
615 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
616 Options
, gnPlayers
, 0, NetPort
);
619 procedure ProcConnectNetGame();
623 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
625 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
626 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
627 PW
:= TGUIEdit(GetControl('edPW')).Text;
630 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
631 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
634 procedure ProcEnterPassword();
638 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
640 NetClientIP
:= PromptIP
;
641 NetClientPort
:= PromptPort
;
642 PW
:= TGUIEdit(GetControl('edPW')).Text;
645 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
646 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
649 procedure ProcServerlist();
651 if not NetInitDone
then
653 if (not g_Net_Init()) then
655 g_Console_Add('NET: ERROR: Failed to init ENet!');
662 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
664 gState
:= STATE_SLIST
;
665 g_ActiveWindow
:= nil;
667 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
672 slReturnPressed
:= True;
673 if g_Net_Slist_Fetch(slCurrent
) then
675 if slCurrent
= nil then
676 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
679 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
682 procedure ProcStartCampaign();
688 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
690 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
691 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
698 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
701 procedure ProcSelectMap(Sender
: TGUIControl
);
705 wad
, map
, res
: String;
707 win
:= g_GUI_GetWindow('SelectMapMenu');
708 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
710 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
711 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
713 if (wad
= '') or (map
= '') then
714 begin // Ýòî íå êàðòà
715 TGUILabel(GetControl('lbMapName')).Text := '';
716 TGUILabel(GetControl('lbMapAuthor')).Text := '';
717 TGUILabel(GetControl('lbMapSize')).Text := '';
718 TGUIMemo(GetControl('meMapDescription')).SetText('');
719 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
720 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
726 a
:= g_Map_GetMapInfo(res
);
728 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
729 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
730 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
731 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
732 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
733 TGUILabel(win
.GetControl('lbMapScale')).Text :=
734 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
739 procedure ProcSelectWAD(Sender
: TGUIControl
);
744 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
746 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
748 with TGUIListBox(GetControl('lsMapRes')) do
754 list
:= g_Map_GetMapsList(wad
);
768 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
774 win
:= g_GUI_GetWindow('CampaignMenu');
775 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
777 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
781 TGUILabel(GetControl('lbWADName')).Text := '';
782 TGUILabel(GetControl('lbWADAuthor')).Text := '';
783 TGUIMemo(GetControl('meWADDescription')).SetText('');
786 a
:= g_Game_GetMegaWADInfo(wad
);
788 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
789 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
790 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
792 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
796 fn
:= g_ExtractWadName(a
.pic
);
798 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
800 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
805 procedure ProcChangeColor(Sender
: TGUIControl
);
809 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
810 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
811 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
812 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
813 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
814 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
816 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
817 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
818 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
819 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
820 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
821 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
824 procedure ProcSelectModel(Sender
: TGUIControl
);
829 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
830 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
831 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
833 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
834 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
835 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
837 ProcChangeColor(nil);
840 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
852 wad
:= TWADFile
.Create
;
853 if wad
.ReadFile(GameWAD
) then
854 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
859 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
861 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
862 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
863 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
864 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
866 if g_Texture_Get('FONT_STD', ID
) then
867 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
872 if cfglen
<> 0 then FreeMem(cfgdata
);
875 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
881 cfgdata
, fntdata
: Pointer;
882 cfglen
, fntlen
: Integer;
890 wad
:= TWADFile
.Create
;
891 if wad
.ReadFile(GameWAD
) then
893 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
894 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
900 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
901 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
902 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
904 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
905 FontID
:= e_CharFont_Create(spc
);
909 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
910 if chrwidth
= 0 then Continue
;
912 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
914 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
920 if cfglen
<> 0 then FreeMem(cfgdata
);
921 if fntlen
<> 0 then FreeMem(fntdata
);
924 procedure MenuLoadData();
926 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
928 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
929 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
930 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
931 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
932 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
933 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
934 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
935 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
936 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
937 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
938 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
939 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
940 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
941 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
942 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
943 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
944 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
945 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
946 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
947 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
948 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
949 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
950 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
951 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
953 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
954 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
955 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
956 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
957 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
958 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
959 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
962 procedure MenuFreeData();
964 e_CharFont_Remove(gMenuFont
);
965 e_CharFont_Remove(gMenuSmallFont
);
967 g_Texture_Delete('MAINMENU_MARKER1');
968 g_Texture_Delete('MAINMENU_MARKER2');
969 g_Texture_Delete('SCROLL_LEFT');
970 g_Texture_Delete('SCROLL_RIGHT');
971 g_Texture_Delete('SCROLL_MIDDLE');
972 g_Texture_Delete('SCROLL_MARKER');
973 g_Texture_Delete('EDIT_LEFT');
974 g_Texture_Delete('EDIT_RIGHT');
975 g_Texture_Delete('EDIT_MIDDLE');
976 g_Texture_Delete('BOX1');
977 g_Texture_Delete('BOX2');
978 g_Texture_Delete('BOX3');
979 g_Texture_Delete('BOX4');
980 g_Texture_Delete('BOX5');
981 g_Texture_Delete('BOX6');
982 g_Texture_Delete('BOX7');
983 g_Texture_Delete('BOX8');
984 g_Texture_Delete('BOX9');
985 g_Texture_Delete('BSCROLL_UP_A');
986 g_Texture_Delete('BSCROLL_UP_U');
987 g_Texture_Delete('BSCROLL_DOWN_A');
988 g_Texture_Delete('BSCROLL_DOWN_U');
989 g_Texture_Delete('BSCROLL_MIDDLE');
990 g_Texture_Delete('NOPIC');
992 g_Sound_Delete('MENU_SELECT');
993 g_Sound_Delete('MENU_OPEN');
994 g_Sound_Delete('MENU_CLOSE');
995 g_Sound_Delete('MENU_CHANGE');
996 g_Sound_Delete('SCROLL_ADD');
997 g_Sound_Delete('SCROLL_SUB');
998 g_Sound_Delete('SOUND_PLAYER_FALL');
1001 procedure ProcAuthorsMenu();
1003 gMusic
.SetByName('MUSIC_INTERMUS');
1007 procedure ProcExitMenuKeyDown (yes
: Boolean);
1010 snd
: TPlayableSound
;
1015 g_Game_StopAllSounds(True);
1016 case (Random(18)) of
1017 0: s
:= 'SOUND_MONSTER_PAIN';
1018 1: s
:= 'SOUND_MONSTER_DIE_3';
1019 2: s
:= 'SOUND_MONSTER_SLOP';
1020 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1021 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1022 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1023 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1024 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1025 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1026 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1027 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1028 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1029 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1030 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1031 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1032 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1033 else s
:= 'SOUND_PLAYER_FALL';
1035 snd
:= TPlayableSound
.Create();
1036 res
:= snd
.SetByName(s
);
1037 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1041 while snd
.IsPlaying() do begin end;
1049 procedure ProcLoadMenu();
1054 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1058 procedure ProcSaveMenu();
1063 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1067 procedure ProcSaveGame(Sender
: TGUIControl
);
1071 if g_Game_IsNet
then Exit
;
1072 if g_Game_IsTestMap
then Exit
;
1073 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1074 g_Game_PauseAllSounds(True);
1075 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1077 g_ActiveWindow
:= nil;
1078 g_Game_Pause(False);
1081 procedure ProcLoadGame(Sender
: TGUIControl
);
1085 if g_Game_IsNet
then Exit
;
1086 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1087 if g_LoadGame(a
) then
1088 g_Game_PauseAllSounds(False)
1089 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1090 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1093 procedure ProcSingle1Player();
1095 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1098 procedure ProcSingle2Players();
1100 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1103 procedure ProcSelectMapMenu();
1106 wad_lb
: TGUIFileListBox
;
1107 map_lb
: TGUIListBox
;
1110 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1111 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1112 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1114 if wad_lb
.SelectedItem() <> '' then
1115 map
:= map_lb
.SelectedItem()
1119 wad_lb
.UpdateFileList();
1122 if wad_lb
.SelectedItem() <> '' then
1125 map_lb
.SelectItem(map
);
1127 if map_lb
.SelectedItem() <> '' then
1131 g_GUI_ShowWindow('SelectMapMenu');
1134 procedure ProcSelectCampaignMenu();
1137 wad_lb
: TGUIFileListBox
;
1139 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1140 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1142 wad_lb
.UpdateFileList();
1144 if wad_lb
.SelectedItem() <> '' then
1145 ProcSelectCampaignWAD(nil);
1148 procedure ProcSetMap();
1150 wad
, map
, res
: String;
1152 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1154 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1155 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1158 if (wad
= '') or (map
= '') then
1161 res
:= wad
+':\'+map
;
1163 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1164 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1167 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1171 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1173 g_Sound_SetupAllVolumes(
1174 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1175 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1179 procedure ProcOptionsPlayersMIMenu();
1184 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1186 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1188 if a
= '' then Exit
;
1190 b
:= g_PlayerModel_GetInfo(a
);
1192 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1194 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1195 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1196 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1198 if b
.HaveWeapon
then
1199 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1201 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1204 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1207 procedure ProcOptionsPlayersAnim();
1211 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1216 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1219 Model
.GetCurrentAnimation
.Loop
:= True;
1220 Model
.GetCurrentAnimationMask
.Loop
:= True;
1224 procedure ProcOptionsPlayersWeap();
1228 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1233 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1237 procedure ProcOptionsPlayersRot();
1241 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1242 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1243 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1246 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1250 g_Options_SetDefault();
1256 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1258 if yes
then ReadOptions();
1262 procedure ProcAuthorsClose();
1264 gMusic
.SetByName('MUSIC_MENU');
1266 gState
:= STATE_MENU
;
1269 procedure ProcGMClose();
1271 g_Game_InGameMenu(False);
1274 procedure ProcGMShow();
1279 if (gGameSettings
.GameType
= GT_SINGLE
) and
1280 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1281 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1282 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1284 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1285 if g_Game_IsTestMap
then
1286 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1287 TGUIMainMenu(g_ActiveWindow
.GetControl(
1288 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1291 procedure ProcChangePlayers();
1293 TeamGame
, Spectator
, AddTwo
: Boolean;
1294 P1Team
{, P2Team}: Byte;
1295 bP2
: TGUITextButton
;
1297 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1298 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1299 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1300 P1Team
:= TEAM_NONE
;
1301 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1303 //P2Team := TEAM_NONE;
1304 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1306 TGUIMainMenu(g_ActiveWindow
.GetControl(
1307 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1308 TGUIMainMenu(g_ActiveWindow
.GetControl(
1309 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1310 TGUIMainMenu(g_ActiveWindow
.GetControl(
1311 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1313 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1314 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1315 bP2
.Enabled
:= AddTwo
and not Spectator
;
1317 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1319 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1320 if gPlayer2
= nil then
1321 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1323 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1325 TGUIMainMenu(g_ActiveWindow
.GetControl(
1326 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1329 procedure ProcJoinRed();
1331 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1333 if g_Game_IsServer
then
1335 if gPlayer1
= nil then
1336 g_Game_AddPlayer(TEAM_RED
)
1339 if gPlayer1
.Team
<> TEAM_RED
then
1341 gPlayer1
.SwitchTeam
;
1342 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1345 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1350 gPlayer1Settings
.Team
:= TEAM_RED
;
1351 MC_SEND_PlayerSettings
;
1352 if gPlayer1
= nil then
1353 g_Game_AddPlayer(TEAM_RED
);
1355 g_ActiveWindow
:= nil;
1356 g_Game_Pause(False);
1359 procedure ProcJoinBlue();
1361 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1363 if g_Game_IsServer
then
1365 if gPlayer1
= nil then
1366 g_Game_AddPlayer(TEAM_BLUE
)
1369 if gPlayer1
.Team
<> TEAM_BLUE
then
1371 gPlayer1
.SwitchTeam
;
1372 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1375 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1380 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1381 MC_SEND_PlayerSettings
;
1382 if gPlayer1
= nil then
1383 g_Game_AddPlayer(TEAM_BLUE
);
1385 g_ActiveWindow
:= nil;
1386 g_Game_Pause(False);
1389 procedure ProcJoinGame();
1391 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1393 if gPlayer1
= nil then
1395 g_ActiveWindow
:= nil;
1396 g_Game_Pause(False);
1399 procedure ProcSwitchP2();
1401 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1403 if gPlayer1
= nil then
1405 if gPlayer2
= nil then
1408 g_Game_RemovePlayer();
1409 g_ActiveWindow
:= nil;
1410 g_Game_Pause(False);
1413 procedure ProcSpectate();
1415 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1418 g_ActiveWindow
:= nil;
1419 g_Game_Pause(False);
1422 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1424 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1427 procedure ProcEndMenuKeyDown (yes
: Boolean);
1429 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1432 procedure ProcSetRussianLanguage();
1434 if gLanguage
<> LANGUAGE_RUSSIAN
then
1436 gLanguage
:= LANGUAGE_RUSSIAN
;
1437 gLanguageChange
:= True;
1438 gAskLanguage
:= False;
1440 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1442 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1447 procedure ProcSetEnglishLanguage();
1449 if gLanguage
<> LANGUAGE_ENGLISH
then
1451 gLanguage
:= LANGUAGE_ENGLISH
;
1452 gLanguageChange
:= True;
1453 gAskLanguage
:= False;
1455 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1457 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1462 procedure ReadGameSettings();
1466 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1468 with gGameSettings
do
1470 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1471 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1476 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1477 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1478 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1480 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1481 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1482 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1485 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1490 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1492 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1493 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1494 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1495 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1496 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1497 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1498 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1499 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1503 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1504 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1509 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1510 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1515 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1516 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1521 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1522 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1527 procedure ProcApplyGameSet();
1531 stat
: TPlayerStatArray
;
1533 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1535 if not g_Game_IsServer
then Exit
;
1537 with gGameSettings
do
1539 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1541 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1542 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1544 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1547 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1549 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1555 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1557 TimeLimit
:= Max(n
, b
);
1561 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1563 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1570 if GameMode
= GM_DM
then
1572 stat
:= g_Player_GetStats();
1574 for a
:= 0 to High(stat
) do
1575 if stat
[a
].Frags
> b
then
1579 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1581 GoalLimit
:= Max(n
, b
);
1585 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1587 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1588 if n
< 0 then n
:= 0;
1589 if n
> 255 then n
:= 255;
1595 stat
:= g_Player_GetStats();
1597 for a
:= 0 to High(stat
) do
1598 if stat
[a
].Lives
> b
then
1601 MaxLives
:= Max(n
, b
);
1605 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1607 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1610 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1611 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1615 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1616 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1620 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1621 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1627 if g_Game_IsNet
then MH_SEND_GameSettings
;
1630 procedure ProcVideoOptionsRes();
1636 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1638 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1639 IntToStr(gScreenWidth
) +
1640 ' x ' + IntToStr(gScreenHeight
) +
1641 ', ' + IntToStr(gBPP
) + ' bpp';
1643 with TGUIListBox(menu
.GetControl('lsResolution')) do
1645 list
:= GetDisplayModes(gBPP
, SR
);
1656 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1663 procedure ProcApplyVideoOptions();
1666 Fullscreen
: Boolean;
1667 SWidth
, SHeight
: Integer;
1670 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1672 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1673 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1675 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1677 if (SWidth
<> gScreenWidth
) or
1678 (SHeight
<> gScreenHeight
) or
1679 (Fullscreen
<> gFullscreen
) then
1681 gResolutionChange
:= True;
1682 gRC_Width
:= SWidth
;
1683 gRC_Height
:= SHeight
;
1684 gRC_FullScreen
:= Fullscreen
;
1685 gRC_Maximized
:= gWinMaximized
;
1688 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1692 procedure ProcSetFirstRussianLanguage();
1694 gLanguage
:= LANGUAGE_RUSSIAN
;
1695 gLanguageChange
:= True;
1696 gAskLanguage
:= False;
1698 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1701 procedure ProcSetFirstEnglishLanguage();
1703 gLanguage
:= LANGUAGE_ENGLISH
;
1704 gLanguageChange
:= True;
1705 gAskLanguage
:= False;
1707 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1710 procedure ProcRecallAddress();
1712 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1714 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1715 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1719 procedure CreateFirstLanguageMenu();
1723 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1725 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1727 Name
:= 'mmFirstLanguageMenu';
1728 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1729 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1732 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1733 Menu
.MainWindow
:= True;
1734 g_GUI_AddWindow(Menu
);
1737 procedure g_Menu_AskLanguage();
1739 CreateFirstLanguageMenu();
1740 g_GUI_ShowWindow('FirstLanguageMenu');
1743 procedure CreatePlayerOptionsMenu(s
: String);
1748 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1750 a
:= _lc
[I_MENU_PLAYER_1
]
1752 a
:= _lc
[I_MENU_PLAYER_2
];
1753 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1755 Name
:= 'mOptionsPlayers'+s
+'Menu';
1756 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1758 Name
:= 'ed'+s
+'Name';
1762 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1764 Name
:= 'sw'+s
+'Team';
1765 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1766 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1768 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1770 Name
:= 'ls'+s
+'Model';
1772 Items
:= g_PlayerModel_GetNames();
1773 OnChange
:= ProcSelectModel
;
1775 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1777 Name
:= 'sc'+s
+'Red';
1779 OnChange
:= ProcChangeColor
;
1781 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1783 Name
:= 'sc'+s
+'Green';
1785 OnChange
:= ProcChangeColor
;
1787 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1789 Name
:= 'sc'+s
+'Blue';
1791 OnChange
:= ProcChangeColor
;
1794 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1795 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1796 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1797 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1799 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1801 Name
:= 'mv'+s
+'Model';
1802 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1803 Y
:= GetControl('ls'+s
+'Model').Y
;
1806 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1807 g_GUI_AddWindow(Menu
);
1810 procedure CreateAllMenus();
1814 a
, cx
, _y
, i
: Integer;
1817 Menu
:= TGUIWindow
.Create('MainMenu');
1818 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1820 Name
:= 'mmMainMenu';
1821 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1822 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1823 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1824 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1825 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1826 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1828 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1830 Color
:= _RGB(255, 255, 255);
1831 X
:= gScreenWidth
-GetWidth
-8;
1832 Y
:= gScreenHeight
-GetHeight
-8;
1834 Menu
.DefControl
:= 'mmMainMenu';
1835 Menu
.MainWindow
:= True;
1836 g_GUI_AddWindow(Menu
);
1838 Menu
:= TGUIWindow
.Create('NewGameMenu');
1839 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1841 Name
:= 'mmNewGameMenu';
1842 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1843 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1844 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1845 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1847 Menu
.DefControl
:= 'mmNewGameMenu';
1848 g_GUI_AddWindow(Menu
);
1850 Menu
:= TGUIWindow
.Create('NetGameMenu');
1851 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1853 Name
:= 'mmNetGameMenu';
1854 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1855 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1857 Menu
.DefControl
:= 'mmNetGameMenu';
1858 g_GUI_AddWindow(Menu
);
1860 Menu
:= TGUIWindow
.Create('NetServerMenu');
1861 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1863 Name
:= 'mNetServerMenu';
1864 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1866 Name
:= 'edSrvName';
1867 OnlyDigits
:= False;
1870 Text := NetServerName
;
1872 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1874 Name
:= 'edSrvPassword';
1875 OnlyDigits
:= False;
1878 Text := NetPassword
;
1880 with AddEdit(_lc
[I_NET_PORT
]) do
1886 Text := IntToStr(NetPort
);
1888 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1890 Name
:= 'edMaxPlayers';
1894 Text := IntToStr(NetMaxClients
);
1896 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1898 Name
:= 'swUseMaster';
1899 AddItem(_lc
[I_MENU_YES
]);
1900 AddItem(_lc
[I_MENU_NO
]);
1901 if NetUseMaster
then
1907 with AddLabel(_lc
[I_MENU_MAP
]) do
1912 OnClick
:= @ProcSelectMapMenu
;
1914 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1916 Name
:= 'swGameMode';
1917 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1918 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1919 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1920 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1921 case g_Game_TextToMode(gnGameMode
) of
1923 GM_DM
: ItemIndex
:= 0;
1924 GM_TDM
: ItemIndex
:= 1;
1925 GM_CTF
: ItemIndex
:= 2;
1927 GM_COOP
: ItemIndex
:= 3;
1929 OnChange
:= ProcSwitchMonstersNet
;
1931 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1933 Name
:= 'edTimeLimit';
1937 if gnTimeLimit
> 0 then
1938 Text := IntToStr(gnTimeLimit
);
1940 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1942 Name
:= 'edGoalLimit';
1946 if gnGoalLimit
> 0 then
1947 Text := IntToStr(gnGoalLimit
);
1949 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1951 Name
:= 'edMaxLives';
1955 if gnMaxLives
> 0 then
1956 Text := IntToStr(gnMaxLives
);
1958 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1960 Name
:= 'swPlayers';
1961 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1962 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1963 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1964 ItemIndex
:= gnPlayers
;
1966 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1968 Name
:= 'swTeamDamage';
1969 AddItem(_lc
[I_MENU_YES
]);
1970 AddItem(_lc
[I_MENU_NO
]);
1971 if gnTeamDamage
then
1976 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1978 Name
:= 'swEnableExits';
1979 AddItem(_lc
[I_MENU_YES
]);
1980 AddItem(_lc
[I_MENU_NO
]);
1986 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
1988 Name
:= 'swWeaponStay';
1989 AddItem(_lc
[I_MENU_YES
]);
1990 AddItem(_lc
[I_MENU_NO
]);
1991 if gnWeaponStay
then
1996 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
1998 Name
:= 'swMonsters';
1999 AddItem(_lc
[I_MENU_YES
]);
2000 AddItem(_lc
[I_MENU_NO
]);
2006 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2009 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2010 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2011 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2013 if gnBotsVS
= 'Players' then
2015 if gnBotsVS
= 'Monsters' then
2019 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2023 Menu
.DefControl
:= 'mNetServerMenu';
2024 g_GUI_AddWindow(Menu
);
2026 Menu
:= TGUIWindow
.Create('NetClientMenu');
2027 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2029 Name
:= 'mNetClientMenu';
2031 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2034 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2040 Text := 'localhost';
2042 with AddEdit(_lc
[I_NET_PORT
]) do
2050 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2053 OnlyDigits
:= False;
2060 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2064 Menu
.DefControl
:= 'mNetClientMenu';
2065 g_GUI_AddWindow(Menu
);
2067 Menu
:= TGUIWindow
.Create('LoadMenu');
2068 Menu
.OnShow
:= ProcLoadMenu
;
2069 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2071 Name
:= 'mmLoadMenu';
2076 Name
:= 'edSlot'+IntToStr(a
);
2079 OnEnter
:= ProcLoadGame
;
2082 Menu
.DefControl
:= 'mmLoadMenu';
2083 g_GUI_AddWindow(Menu
);
2085 Menu
:= TGUIWindow
.Create('SaveMenu');
2086 Menu
.OnShow
:= ProcSaveMenu
;
2087 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2089 Name
:= 'mmSaveMenu';
2094 Name
:= 'edSlot'+IntToStr(a
);
2097 OnChange
:= ProcSaveGame
;
2100 Menu
.DefControl
:= 'mmSaveMenu';
2101 g_GUI_AddWindow(Menu
);
2103 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2104 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2106 Name
:= 'mCustomGameMenu';
2107 with AddLabel(_lc
[I_MENU_MAP
]) do
2112 OnClick
:= @ProcSelectMapMenu
;
2114 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2116 Name
:= 'swGameMode';
2117 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2118 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2119 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2120 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2121 case g_Game_TextToMode(gcGameMode
) of
2123 GM_DM
: ItemIndex
:= 0;
2124 GM_TDM
: ItemIndex
:= 1;
2125 GM_CTF
: ItemIndex
:= 2;
2127 GM_COOP
: ItemIndex
:= 3;
2129 OnChange
:= ProcSwitchMonstersCustom
;
2131 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2133 Name
:= 'edTimeLimit';
2137 if gcTimeLimit
> 0 then
2138 Text := IntToStr(gcTimeLimit
);
2140 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2142 Name
:= 'edGoalLimit';
2146 if gcGoalLimit
> 0 then
2147 Text := IntToStr(gcGoalLimit
);
2149 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2151 Name
:= 'edMaxLives';
2155 if gcMaxLives
> 0 then
2156 Text := IntToStr(gcMaxLives
);
2158 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2160 Name
:= 'swPlayers';
2161 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2162 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2163 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2164 ItemIndex
:= gcPlayers
;
2166 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2168 Name
:= 'swTeamDamage';
2169 AddItem(_lc
[I_MENU_YES
]);
2170 AddItem(_lc
[I_MENU_NO
]);
2171 if gcTeamDamage
then
2176 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2178 Name
:= 'swEnableExits';
2179 AddItem(_lc
[I_MENU_YES
]);
2180 AddItem(_lc
[I_MENU_NO
]);
2186 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2188 Name
:= 'swWeaponStay';
2189 AddItem(_lc
[I_MENU_YES
]);
2190 AddItem(_lc
[I_MENU_NO
]);
2191 if gcWeaponStay
then
2196 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2198 Name
:= 'swMonsters';
2199 AddItem(_lc
[I_MENU_YES
]);
2200 AddItem(_lc
[I_MENU_NO
]);
2206 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2209 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2210 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2211 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2213 if gcBotsVS
= 'Players' then
2215 if gcBotsVS
= 'Monsters' then
2219 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2223 Menu
.DefControl
:= 'mCustomGameMenu';
2224 g_GUI_AddWindow(Menu
);
2226 Menu
:= TGUIWindow
.Create('CampaignMenu');
2227 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2229 Name
:= 'mCampaignMenu';
2238 with AddFileList('', 15, 4) do
2241 OnChange
:= ProcSelectCampaignWAD
;
2245 FileMask
:= '*.wad|*.pk3|*.zip';
2246 SetBase(MapsDir
+'megawads/');
2249 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2251 Name
:= 'lbWADName';
2255 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2257 Name
:= 'lbWADAuthor';
2261 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2262 with AddMemo('', 15, 3) do
2264 Name
:= 'meWADDescription';
2265 Color
:= MENU_ITEMSCTRL_COLOR
;
2267 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2269 Name
:= 'swPlayers';
2270 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2271 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2274 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2278 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2280 Name
:= 'mpWADImage';
2281 DefaultRes
:= 'NOPIC';
2282 X
:= GetControl('lsWAD').X
+4;
2283 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2286 Menu
.DefControl
:= 'mCampaignMenu';
2287 g_GUI_AddWindow(Menu
);
2289 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2290 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2292 Name
:= 'mSelectMapMenu';
2293 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2296 OnChange
:= ProcSelectWAD
;
2300 FileMask
:= '*.wad|*.pk3|*.zip';
2303 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2307 OnChange
:= ProcSelectMap
;
2310 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2312 Name
:= 'lbMapName';
2316 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2318 Name
:= 'lbMapAuthor';
2322 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2324 Name
:= 'lbMapSize';
2328 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2330 Name
:= 'meMapDescription';
2335 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2337 Name
:= 'mpMapPreview';
2338 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2339 Y
:= GetControl('lsMapWAD').Y
;
2341 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2343 Name
:= 'lbMapScale';
2346 Color
:= MENU_ITEMSCTRL_COLOR
;
2347 X
:= GetControl('lsMapWAD').X
+
2348 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2349 2 + MAPPREVIEW_WIDTH
*4;
2350 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2353 Menu
.OnClose
:= ProcSetMap
;
2354 Menu
.DefControl
:= 'mSelectMapMenu';
2355 g_GUI_AddWindow(Menu
);
2357 Menu
:= TGUIWindow
.Create('OptionsMenu');
2358 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2360 Name
:= 'mmOptionsMenu';
2361 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2362 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2363 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2364 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2365 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2366 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2368 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2369 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2371 Menu
.OnClose
:= ProcApplyOptions
;
2372 Menu
.DefControl
:= 'mmOptionsMenu';
2373 g_GUI_AddWindow(Menu
);
2375 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2376 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2377 g_GUI_AddWindow(Menu
);
2379 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2380 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2382 Name
:= 'mOptionsVideoMenu';
2383 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2384 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2390 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2393 AddItem(_lc
[I_MENU_YES
]);
2394 AddItem(_lc
[I_MENU_NO
]);
2396 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2398 Name
:= 'swTextureFilter';
2399 AddItem(_lc
[I_MENU_YES
]);
2400 AddItem(_lc
[I_MENU_NO
]);
2402 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2404 Name
:= 'swLegacyNPOT';
2405 AddItem(_lc
[I_MENU_NO
]);
2406 AddItem(_lc
[I_MENU_YES
]);
2409 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2412 Menu
.DefControl
:= 'mOptionsVideoMenu';
2413 g_GUI_AddWindow(Menu
);
2415 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2416 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2418 Name
:= 'mOptionsVideoResMenu';
2419 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2421 Name
:= 'lbCurrentRes';
2425 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2427 Name
:= 'lsResolution';
2430 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2432 Name
:= 'swFullScreen';
2433 AddItem(_lc
[I_MENU_YES
]);
2434 AddItem(_lc
[I_MENU_NO
]);
2437 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2440 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2441 g_GUI_AddWindow(Menu
);
2443 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2444 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2446 Name
:= 'mOptionsSoundMenu';
2447 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2449 Name
:= 'scMusicLevel';
2451 OnChange
:= ProcChangeSoundSettings
;
2453 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2455 Name
:= 'scSoundLevel';
2457 OnChange
:= ProcChangeSoundSettings
;
2459 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2461 Name
:= 'scMaxSimSounds';
2464 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2466 Name
:= 'swAnnouncer';
2467 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2468 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2469 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2470 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2472 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2473 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2475 Name
:= 'swSoundEffects';
2476 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2477 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2479 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2481 Name
:= 'swInactiveSounds';
2482 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2483 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2487 Menu
.DefControl
:= 'mOptionsSoundMenu';
2488 g_GUI_AddWindow(Menu
);
2490 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2491 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2493 Name
:= 'mOptionsGameMenu';
2494 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2496 Name
:= 'scParticlesCount';
2499 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2501 Name
:= 'swBloodCount';
2502 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2503 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2504 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2505 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2506 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2508 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2510 Name
:= 'scShellsMax';
2513 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2515 Name
:= 'scGibsMax';
2518 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2520 Name
:= 'scCorpsesMax';
2523 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2525 Name
:= 'swGibsCount';
2526 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2527 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2528 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2529 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2530 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2532 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2534 Name
:= 'swCorpseType';
2535 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2536 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2538 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2540 Name
:= 'swGibsType';
2541 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2542 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2544 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2546 Name
:= 'swBloodType';
2547 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2548 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2550 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2552 Name
:= 'swScreenFlash';
2553 AddItem(_lc
[I_MENU_NO
]);
2554 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2555 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2557 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2559 Name
:= 'swBackground';
2560 AddItem(_lc
[I_MENU_YES
]);
2561 AddItem(_lc
[I_MENU_NO
]);
2563 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2565 Name
:= 'swMessages';
2566 AddItem(_lc
[I_MENU_YES
]);
2567 AddItem(_lc
[I_MENU_NO
]);
2569 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2571 Name
:= 'swRevertPlayers';
2572 AddItem(_lc
[I_MENU_YES
]);
2573 AddItem(_lc
[I_MENU_NO
]);
2575 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2577 Name
:= 'swChatBubble';
2578 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2579 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2580 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2581 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2582 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2586 Menu
.DefControl
:= 'mOptionsGameMenu';
2587 g_GUI_AddWindow(Menu
);
2589 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2590 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2592 Name
:= 'mOptionsControlsMenu';
2593 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2594 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2595 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2596 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2597 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2599 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsControlsP1Menu');
2600 AddButton(nil, _lc
[I_MENU_PLAYER_1_ALT
], 'OptionsControlsP1MenuAlt');
2601 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsControlsP2Menu');
2602 AddButton(nil, _lc
[I_MENU_PLAYER_2_ALT
], 'OptionsControlsP2MenuAlt');
2604 if e_JoysticksAvailable
<> 0 then
2605 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2607 Menu
.DefControl
:= 'mOptionsControlsMenu';
2608 g_GUI_AddWindow(Menu
);
2610 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2611 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2613 Name
:= 'mOptionsControlsP1Menu';
2614 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2615 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2616 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2617 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2618 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2619 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2620 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2621 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2622 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2624 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2625 g_GUI_AddWindow(Menu
);
2627 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuAlt');
2628 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2630 Name
:= 'mOptionsControlsP1MenuAlt';
2631 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2632 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2633 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2634 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2635 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2636 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2637 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2638 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2639 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2641 Menu
.DefControl
:= 'mOptionsControlsP1MenuAlt';
2642 g_GUI_AddWindow(Menu
);
2644 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2645 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2647 Name
:= 'mOptionsControlsP2Menu';
2648 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2649 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2650 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2651 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2652 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2653 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2654 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2655 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2656 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2658 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2659 g_GUI_AddWindow(Menu
);
2661 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuAlt');
2662 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2664 Name
:= 'mOptionsControlsP2MenuAlt';
2665 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2666 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2667 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2668 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2669 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2670 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2671 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2672 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2673 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2675 Menu
.DefControl
:= 'mOptionsControlsP2MenuAlt';
2676 g_GUI_AddWindow(Menu
);
2678 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2679 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2681 Name
:= 'mOptionsControlsJoystickMenu';
2682 for i
:= 0 to e_JoysticksAvailable
-1 do
2683 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2685 Name
:= 'scDeadzone' + IntToStr(i
);
2689 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2690 g_GUI_AddWindow(Menu
);
2692 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2693 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2695 Name
:= 'mOptionsPlayersMenu';
2696 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2697 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2699 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2700 g_GUI_AddWindow(Menu
);
2702 CreatePlayerOptionsMenu('P1');
2703 CreatePlayerOptionsMenu('P2');
2705 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2706 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2708 Name
:= 'mOptionsPlayersMIMenu';
2709 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2714 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2719 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2721 Name
:= 'meComment';
2724 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2725 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2728 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2732 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2733 g_GUI_AddWindow(Menu
);
2735 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2736 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2738 Name
:= 'mOptionsLanguageMenu';
2739 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2740 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2743 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2744 g_GUI_AddWindow(Menu
);
2746 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2747 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2748 g_GUI_AddWindow(Menu
);
2750 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2751 Menu
.BackTexture
:= 'INTER';
2752 Menu
.OnClose
:= ProcAuthorsClose
;
2756 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2758 Color
:= _RGB(255, 0, 0);
2759 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2761 _y
:= _y
+GetHeight();
2763 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2765 Color
:= _RGB(255, 0, 0);
2766 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2768 _y
:= _y
+GetHeight()+32;
2770 // ×òî äåëàë: Êòî äåëàë
2771 cx
:= gScreenWidth
div 2 - 320 + 64;
2772 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2774 Color
:= _RGB(255, 0, 0);
2779 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2781 Color
:= _RGB(255, 255, 255);
2786 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2788 Color
:= _RGB(255, 0, 0);
2793 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2795 Color
:= _RGB(255, 255, 255);
2800 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2802 Color
:= _RGB(255, 255, 255);
2807 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2809 Color
:= _RGB(255, 0, 0);
2814 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2816 Color
:= _RGB(255, 255, 255);
2821 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2823 Color
:= _RGB(255, 0, 0);
2828 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2830 Color
:= _RGB(255, 255, 255);
2833 _y
:= gScreenHeight
- 128;
2836 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2838 Color
:= _RGB(255, 0, 0);
2843 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2845 Color
:= _RGB(255, 255, 255);
2848 _y
:= _y
+GetHeight();
2850 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2852 Color
:= _RGB(255, 255, 255);
2855 _y
:= _y
+GetHeight();
2857 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2859 Color
:= _RGB(255, 255, 255);
2862 _y
:= gScreenHeight
- 32;
2864 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2866 Color
:= _RGB(255, 0, 0);
2867 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2870 g_GUI_AddWindow(Menu
);
2872 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2873 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2874 g_GUI_AddWindow(Menu
);
2876 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2877 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2879 Name
:= 'mmGameSingleMenu';
2880 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2881 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2882 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2883 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2884 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2885 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2887 Menu
.DefControl
:= 'mmGameSingleMenu';
2888 Menu
.MainWindow
:= True;
2889 Menu
.OnClose
:= ProcGMClose
;
2890 Menu
.OnShow
:= ProcGMShow
;
2891 g_GUI_AddWindow(Menu
);
2893 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2894 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2895 g_GUI_AddWindow(Menu
);
2897 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2898 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2899 g_GUI_AddWindow(Menu
);
2901 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2902 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2904 Name
:= 'mmGameCustomMenu';
2905 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2906 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2907 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2908 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2909 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2910 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2911 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2913 Menu
.DefControl
:= 'mmGameCustomMenu';
2914 Menu
.MainWindow
:= True;
2915 Menu
.OnClose
:= ProcGMClose
;
2916 Menu
.OnShow
:= ProcGMShow
;
2917 g_GUI_AddWindow(Menu
);
2919 Menu
:= TGUIWindow
.Create('GameServerMenu');
2920 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2922 Name
:= 'mmGameServerMenu';
2923 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2924 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2925 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2926 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2927 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2929 Menu
.DefControl
:= 'mmGameServerMenu';
2930 Menu
.MainWindow
:= True;
2931 Menu
.OnClose
:= ProcGMClose
;
2932 Menu
.OnShow
:= ProcGMShow
;
2933 g_GUI_AddWindow(Menu
);
2935 Menu
:= TGUIWindow
.Create('GameClientMenu');
2936 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2938 Name
:= 'mmGameClientMenu';
2939 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2940 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2941 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2943 Menu
.DefControl
:= 'mmGameClientMenu';
2944 Menu
.MainWindow
:= True;
2945 Menu
.OnClose
:= ProcGMClose
;
2946 Menu
.OnShow
:= ProcGMShow
;
2947 g_GUI_AddWindow(Menu
);
2949 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2950 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2952 Name
:= 'mClientPasswordMenu';
2953 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2961 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2964 Menu
.DefControl
:= 'mClientPasswordMenu';
2965 g_GUI_AddWindow(Menu
);
2967 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2968 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2970 Name
:= 'mGameSetGameMenu';
2971 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2973 Name
:= 'swTeamDamage';
2974 AddItem(_lc
[I_MENU_YES
]);
2975 AddItem(_lc
[I_MENU_NO
]);
2978 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2980 Name
:= 'edTimeLimit';
2985 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2987 Name
:= 'edGoalLimit';
2992 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2994 Name
:= 'edMaxLives';
2999 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3002 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3003 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3004 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3010 Menu
.DefControl
:= 'mGameSetGameMenu';
3011 Menu
.OnClose
:= ProcApplyGameSet
;
3012 g_GUI_AddWindow(Menu
);
3014 Menu
:= TGUIWindow
.Create('TeamMenu');
3015 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3017 Name
:= 'mmTeamMenu';
3018 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3019 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3020 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3021 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3022 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3024 Menu
.DefControl
:= 'mmTeamMenu';
3025 Menu
.OnShow
:= ProcChangePlayers
;
3026 g_GUI_AddWindow(Menu
);
3029 procedure g_Menu_Show_SaveMenu();
3031 if g_Game_IsTestMap
then
3033 if gGameSettings
.GameType
= GT_SINGLE
then
3034 g_GUI_ShowWindow('GameSingleMenu')
3037 if g_Game_IsClient
then
3040 if g_Game_IsNet
then
3043 g_GUI_ShowWindow('GameCustomMenu');
3045 g_GUI_ShowWindow('SaveMenu');
3046 g_Sound_PlayEx('MENU_OPEN');
3049 procedure g_Menu_Show_LoadMenu();
3051 if gGameSettings
.GameType
= GT_SINGLE
then
3052 g_GUI_ShowWindow('GameSingleMenu')
3055 if g_Game_IsClient
then
3058 if g_Game_IsNet
then
3061 g_GUI_ShowWindow('GameCustomMenu');
3063 g_GUI_ShowWindow('LoadMenu');
3064 g_Sound_PlayEx('MENU_OPEN');
3067 procedure g_Menu_Show_GameSetGame();
3069 if gGameSettings
.GameType
= GT_SINGLE
then
3070 g_GUI_ShowWindow('GameSingleMenu')
3073 if g_Game_IsClient
then
3076 if g_Game_IsNet
then
3077 g_GUI_ShowWindow('GameServerMenu')
3079 g_GUI_ShowWindow('GameCustomMenu');
3082 g_GUI_ShowWindow('GameSetGameMenu');
3083 g_Sound_PlayEx('MENU_OPEN');
3086 procedure g_Menu_Show_OptionsVideo();
3088 if gGameSettings
.GameType
= GT_SINGLE
then
3089 g_GUI_ShowWindow('GameSingleMenu')
3092 if g_Game_IsClient
then
3093 g_GUI_ShowWindow('GameClientMenu')
3095 if g_Game_IsNet
then
3096 g_GUI_ShowWindow('GameServerMenu')
3098 g_GUI_ShowWindow('GameCustomMenu');
3101 g_GUI_ShowWindow('OptionsMenu');
3102 g_GUI_ShowWindow('OptionsVideoMenu');
3103 g_Sound_PlayEx('MENU_OPEN');
3106 procedure g_Menu_Show_OptionsSound();
3108 if gGameSettings
.GameType
= GT_SINGLE
then
3109 g_GUI_ShowWindow('GameSingleMenu')
3112 if g_Game_IsClient
then
3113 g_GUI_ShowWindow('GameClientMenu')
3115 if g_Game_IsNet
then
3116 g_GUI_ShowWindow('GameServerMenu')
3118 g_GUI_ShowWindow('GameCustomMenu');
3121 g_GUI_ShowWindow('OptionsMenu');
3122 g_GUI_ShowWindow('OptionsSoundMenu');
3123 g_Sound_PlayEx('MENU_OPEN');
3126 procedure g_Menu_Show_EndGameMenu();
3128 g_GUI_ShowWindow('EndGameMenu');
3129 g_Sound_PlayEx('MENU_OPEN');
3132 procedure g_Menu_Show_QuitGameMenu();
3134 g_GUI_ShowWindow('ExitMenu');
3135 g_Sound_PlayEx('MENU_OPEN');
3138 procedure g_Menu_Init();
3145 procedure g_Menu_Free();
3149 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3154 procedure g_Menu_Reset();
3158 g_GUI_SaveMenuPos();
3159 ex
:= g_GUI_Destroy();
3163 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3168 g_Game_SetDebugMode();
3170 g_GUI_LoadMenuPos();