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
;
192 KeyStrafe2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
;
195 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
196 with menu
, gGameControls
.P2Control
do
198 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
199 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
200 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
201 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
202 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
203 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
204 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
205 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
206 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
209 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
210 with menu
, gGameControls
.P2Control
do
212 KeyRight2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
213 KeyLeft2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
214 KeyUp2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
215 KeyDown2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
216 KeyFire2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
217 KeyJump2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
218 KeyNextWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
219 KeyPrevWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
220 KeyOpen2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
221 KeyStrafe2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
;
224 if e_JoysticksAvailable
> 0 then
226 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
229 for i
:= 0 to e_JoysticksAvailable
-1 do
230 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
234 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
236 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
237 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
238 TEAM_RED
, TEAM_BLUE
);
240 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
242 gPlayer1Settings
.Model
:= Model
.Name
;
243 gPlayer1Settings
.Color
:= Model
.Color
;
246 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
248 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
249 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
250 TEAM_RED
, TEAM_BLUE
);
251 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
253 gPlayer2Settings
.Model
:= Model
.Name
;
254 gPlayer2Settings
.Color
:= Model
.Color
;
257 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
258 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
260 if g_Game_IsServer
then
262 if gPlayer1
<> nil then
264 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
265 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
266 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
267 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
269 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
272 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
275 if gPlayer2
<> nil then
277 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
278 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
279 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
280 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
282 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
287 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
289 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
292 procedure ReadOptions();
297 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
299 with TGUISwitch(menu
.GetControl('swBPP')) do
305 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
306 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
308 with TGUISwitch(menu
.GetControl('swVSync')) do
309 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
311 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
312 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
316 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
317 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
318 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
320 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
321 if gMuteWhenInactive
then
326 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
328 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
329 if gSoundEffectsDF
then
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
335 with menu
, gGameControls
.P1Control
do
337 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
338 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
339 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
340 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
341 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
342 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
343 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
344 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
345 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt'));
349 with menu
, gGameControls
.P1Control
do
351 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
352 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
353 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
354 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
355 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
356 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
357 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
358 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
359 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
360 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
:= KeyStrafe2
;
363 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
364 with menu
, gGameControls
.P2Control
do
366 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
367 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
368 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
369 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
370 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
371 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
372 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
373 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
374 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
377 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
378 with menu
, gGameControls
.P2Control
do
380 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
381 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
382 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
383 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
384 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
385 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
386 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
387 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
388 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
389 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
:= KeyStrafe2
;
392 if e_JoysticksAvailable
> 0 then
394 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
397 for i
:= 0 to e_JoysticksAvailable
-1 do
398 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
403 with menu
, gGameControls
.GameControls
do
405 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
406 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
407 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
408 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
413 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
414 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
415 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
416 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
417 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
419 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
422 with TGUISwitch(menu
.GetControl('swBloodType')) do
423 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
425 with TGUISwitch(menu
.GetControl('swCorpseType')) do
426 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
428 with TGUISwitch(menu
.GetControl('swGibsType')) do
429 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
431 with TGUISwitch(menu
.GetControl('swGibsCount')) do
440 with TGUISwitch(menu
.GetControl('swBackGround')) do
441 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
443 with TGUISwitch(menu
.GetControl('swMessages')) do
444 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
446 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
447 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
449 with TGUISwitch(menu
.GetControl('swChatBubble')) do
450 ItemIndex
:= gChatBubble
;
452 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
454 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
455 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
457 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
458 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
460 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
461 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
462 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
466 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
467 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
469 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
470 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
472 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
473 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
474 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
476 ProcSelectModel(nil);
479 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
481 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
482 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
483 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
485 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
488 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
490 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
491 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
492 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
494 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
497 procedure ProcStartCustomGame();
503 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
505 Map
:= TGUILabel(GetControl('lbMap')).Text;
508 if Pos(':\', Map
) = 0 then
511 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
512 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
513 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
514 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
515 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
517 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
518 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
519 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
520 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
523 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
525 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
527 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
529 Options
:= Options
or GAME_OPTION_MONSTERS
;
530 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
532 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
534 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
535 gcBotsVS
:= 'Monsters';
538 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
539 gcBotsVS
:= 'Everybody';
542 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
543 gcBotsVS
:= 'Players';
550 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
552 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
553 gcMaxLives
, Options
, gcPlayers
);
557 procedure ProcStartNetGame();
563 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
565 Map
:= TGUILabel(GetControl('lbMap')).Text;
568 if Pos(':\', Map
) = 0 then
571 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
572 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
573 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
574 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
575 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
576 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
578 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
579 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
580 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
581 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
584 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
586 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
588 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
590 Options
:= Options
or GAME_OPTION_MONSTERS
;
591 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
593 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
595 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
596 gnBotsVS
:= 'Monsters';
599 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
600 gnBotsVS
:= 'Everybody';
603 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
604 gnBotsVS
:= 'Players';
609 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
610 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
611 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
612 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
613 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
616 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
617 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
619 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
620 Options
, gnPlayers
, 0, NetPort
);
623 procedure ProcConnectNetGame();
627 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
629 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
630 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
631 PW
:= TGUIEdit(GetControl('edPW')).Text;
634 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
635 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
638 procedure ProcEnterPassword();
642 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
644 NetClientIP
:= PromptIP
;
645 NetClientPort
:= PromptPort
;
646 PW
:= TGUIEdit(GetControl('edPW')).Text;
649 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
650 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
653 procedure ProcServerlist();
655 if not NetInitDone
then
657 if (not g_Net_Init()) then
659 g_Console_Add('NET: ERROR: Failed to init ENet!');
666 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
668 gState
:= STATE_SLIST
;
669 g_ActiveWindow
:= nil;
671 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
676 slReturnPressed
:= True;
677 if g_Net_Slist_Fetch(slCurrent
) then
679 if slCurrent
= nil then
680 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
683 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
686 procedure ProcStartCampaign();
692 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
694 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
695 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
702 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
705 procedure ProcSelectMap(Sender
: TGUIControl
);
709 wad
, map
, res
: String;
711 win
:= g_GUI_GetWindow('SelectMapMenu');
712 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
714 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
715 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
717 if (wad
= '') or (map
= '') then
718 begin // Ýòî íå êàðòà
719 TGUILabel(GetControl('lbMapName')).Text := '';
720 TGUILabel(GetControl('lbMapAuthor')).Text := '';
721 TGUILabel(GetControl('lbMapSize')).Text := '';
722 TGUIMemo(GetControl('meMapDescription')).SetText('');
723 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
724 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
730 a
:= g_Map_GetMapInfo(res
);
732 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
733 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
734 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
735 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
736 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
737 TGUILabel(win
.GetControl('lbMapScale')).Text :=
738 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
743 procedure ProcSelectWAD(Sender
: TGUIControl
);
748 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
750 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
752 with TGUIListBox(GetControl('lsMapRes')) do
758 list
:= g_Map_GetMapsList(wad
);
772 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
778 win
:= g_GUI_GetWindow('CampaignMenu');
779 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
781 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
785 TGUILabel(GetControl('lbWADName')).Text := '';
786 TGUILabel(GetControl('lbWADAuthor')).Text := '';
787 TGUIMemo(GetControl('meWADDescription')).SetText('');
790 a
:= g_Game_GetMegaWADInfo(wad
);
792 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
793 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
794 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
796 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
800 fn
:= g_ExtractWadName(a
.pic
);
802 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
804 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
809 procedure ProcChangeColor(Sender
: TGUIControl
);
813 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
814 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
815 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
816 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
817 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
818 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
820 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
821 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
822 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
823 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
824 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
825 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
828 procedure ProcSelectModel(Sender
: TGUIControl
);
833 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
834 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
835 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
837 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
838 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
839 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
841 ProcChangeColor(nil);
844 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
856 wad
:= TWADFile
.Create
;
857 if wad
.ReadFile(GameWAD
) then
858 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
863 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
865 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
866 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
867 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
868 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
870 if g_Texture_Get('FONT_STD', ID
) then
871 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
876 if cfglen
<> 0 then FreeMem(cfgdata
);
879 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
885 cfgdata
, fntdata
: Pointer;
886 cfglen
, fntlen
: Integer;
894 wad
:= TWADFile
.Create
;
895 if wad
.ReadFile(GameWAD
) then
897 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
898 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
904 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
905 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
906 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
908 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
909 FontID
:= e_CharFont_Create(spc
);
913 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
914 if chrwidth
= 0 then Continue
;
916 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
918 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
924 if cfglen
<> 0 then FreeMem(cfgdata
);
925 if fntlen
<> 0 then FreeMem(fntdata
);
928 procedure MenuLoadData();
930 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
932 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
933 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
934 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
935 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
936 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
937 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
938 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
939 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
940 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
941 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
942 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
943 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
944 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
945 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
946 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
947 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
948 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
949 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
950 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
951 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
952 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
953 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
954 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
955 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
957 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
958 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
959 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
960 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
961 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
962 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
963 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
966 procedure MenuFreeData();
968 e_CharFont_Remove(gMenuFont
);
969 e_CharFont_Remove(gMenuSmallFont
);
971 g_Texture_Delete('MAINMENU_MARKER1');
972 g_Texture_Delete('MAINMENU_MARKER2');
973 g_Texture_Delete('SCROLL_LEFT');
974 g_Texture_Delete('SCROLL_RIGHT');
975 g_Texture_Delete('SCROLL_MIDDLE');
976 g_Texture_Delete('SCROLL_MARKER');
977 g_Texture_Delete('EDIT_LEFT');
978 g_Texture_Delete('EDIT_RIGHT');
979 g_Texture_Delete('EDIT_MIDDLE');
980 g_Texture_Delete('BOX1');
981 g_Texture_Delete('BOX2');
982 g_Texture_Delete('BOX3');
983 g_Texture_Delete('BOX4');
984 g_Texture_Delete('BOX5');
985 g_Texture_Delete('BOX6');
986 g_Texture_Delete('BOX7');
987 g_Texture_Delete('BOX8');
988 g_Texture_Delete('BOX9');
989 g_Texture_Delete('BSCROLL_UP_A');
990 g_Texture_Delete('BSCROLL_UP_U');
991 g_Texture_Delete('BSCROLL_DOWN_A');
992 g_Texture_Delete('BSCROLL_DOWN_U');
993 g_Texture_Delete('BSCROLL_MIDDLE');
994 g_Texture_Delete('NOPIC');
996 g_Sound_Delete('MENU_SELECT');
997 g_Sound_Delete('MENU_OPEN');
998 g_Sound_Delete('MENU_CLOSE');
999 g_Sound_Delete('MENU_CHANGE');
1000 g_Sound_Delete('SCROLL_ADD');
1001 g_Sound_Delete('SCROLL_SUB');
1002 g_Sound_Delete('SOUND_PLAYER_FALL');
1005 procedure ProcAuthorsMenu();
1007 gMusic
.SetByName('MUSIC_INTERMUS');
1011 procedure ProcExitMenuKeyDown (yes
: Boolean);
1014 snd
: TPlayableSound
;
1019 g_Game_StopAllSounds(True);
1020 case (Random(18)) of
1021 0: s
:= 'SOUND_MONSTER_PAIN';
1022 1: s
:= 'SOUND_MONSTER_DIE_3';
1023 2: s
:= 'SOUND_MONSTER_SLOP';
1024 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1025 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1026 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1027 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1028 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1029 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1030 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1031 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1032 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1033 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1034 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1035 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1036 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1037 else s
:= 'SOUND_PLAYER_FALL';
1039 snd
:= TPlayableSound
.Create();
1040 res
:= snd
.SetByName(s
);
1041 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1045 while snd
.IsPlaying() do begin end;
1053 procedure ProcLoadMenu();
1058 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1062 procedure ProcSaveMenu();
1067 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1071 procedure ProcSaveGame(Sender
: TGUIControl
);
1075 if g_Game_IsNet
then Exit
;
1076 if g_Game_IsTestMap
then Exit
;
1077 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1078 g_Game_PauseAllSounds(True);
1079 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1081 g_ActiveWindow
:= nil;
1082 g_Game_Pause(False);
1085 procedure ProcLoadGame(Sender
: TGUIControl
);
1089 if g_Game_IsNet
then Exit
;
1090 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1091 if g_LoadGame(a
) then
1092 g_Game_PauseAllSounds(False)
1093 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1094 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1097 procedure ProcSingle1Player();
1099 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1102 procedure ProcSingle2Players();
1104 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1107 procedure ProcSelectMapMenu();
1110 wad_lb
: TGUIFileListBox
;
1111 map_lb
: TGUIListBox
;
1114 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1115 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1116 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1118 if wad_lb
.SelectedItem() <> '' then
1119 map
:= map_lb
.SelectedItem()
1123 wad_lb
.UpdateFileList();
1126 if wad_lb
.SelectedItem() <> '' then
1129 map_lb
.SelectItem(map
);
1131 if map_lb
.SelectedItem() <> '' then
1135 g_GUI_ShowWindow('SelectMapMenu');
1138 procedure ProcSelectCampaignMenu();
1141 wad_lb
: TGUIFileListBox
;
1143 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1144 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1146 wad_lb
.UpdateFileList();
1148 if wad_lb
.SelectedItem() <> '' then
1149 ProcSelectCampaignWAD(nil);
1152 procedure ProcSetMap();
1154 wad
, map
, res
: String;
1156 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1158 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1159 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1162 if (wad
= '') or (map
= '') then
1165 res
:= wad
+':\'+map
;
1167 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1168 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1171 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1175 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1177 g_Sound_SetupAllVolumes(
1178 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1179 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1183 procedure ProcOptionsPlayersMIMenu();
1188 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1190 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1192 if a
= '' then Exit
;
1194 b
:= g_PlayerModel_GetInfo(a
);
1196 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1198 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1199 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1200 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1202 if b
.HaveWeapon
then
1203 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1205 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1208 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1211 procedure ProcOptionsPlayersAnim();
1215 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1220 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1223 Model
.GetCurrentAnimation
.Loop
:= True;
1224 Model
.GetCurrentAnimationMask
.Loop
:= True;
1228 procedure ProcOptionsPlayersWeap();
1232 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1237 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1241 procedure ProcOptionsPlayersRot();
1245 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1246 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1247 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1250 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1254 g_Options_SetDefault();
1260 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1262 if yes
then ReadOptions();
1266 procedure ProcAuthorsClose();
1268 gMusic
.SetByName('MUSIC_MENU');
1270 gState
:= STATE_MENU
;
1273 procedure ProcGMClose();
1275 g_Game_InGameMenu(False);
1278 procedure ProcGMShow();
1283 if (gGameSettings
.GameType
= GT_SINGLE
) and
1284 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1285 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1286 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1288 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1289 if g_Game_IsTestMap
then
1290 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1291 TGUIMainMenu(g_ActiveWindow
.GetControl(
1292 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1295 procedure ProcChangePlayers();
1297 TeamGame
, Spectator
, AddTwo
: Boolean;
1298 P1Team
{, P2Team}: Byte;
1299 bP2
: TGUITextButton
;
1301 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1302 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1303 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1304 P1Team
:= TEAM_NONE
;
1305 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1307 //P2Team := TEAM_NONE;
1308 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1310 TGUIMainMenu(g_ActiveWindow
.GetControl(
1311 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1312 TGUIMainMenu(g_ActiveWindow
.GetControl(
1313 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1314 TGUIMainMenu(g_ActiveWindow
.GetControl(
1315 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1317 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1318 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1319 bP2
.Enabled
:= AddTwo
and not Spectator
;
1321 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1323 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1324 if gPlayer2
= nil then
1325 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1327 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1329 TGUIMainMenu(g_ActiveWindow
.GetControl(
1330 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1333 procedure ProcJoinRed();
1335 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1337 if g_Game_IsServer
then
1339 if gPlayer1
= nil then
1340 g_Game_AddPlayer(TEAM_RED
)
1343 if gPlayer1
.Team
<> TEAM_RED
then
1345 gPlayer1
.SwitchTeam
;
1346 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1349 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1354 gPlayer1Settings
.Team
:= TEAM_RED
;
1355 MC_SEND_PlayerSettings
;
1356 if gPlayer1
= nil then
1357 g_Game_AddPlayer(TEAM_RED
);
1359 g_ActiveWindow
:= nil;
1360 g_Game_Pause(False);
1363 procedure ProcJoinBlue();
1365 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1367 if g_Game_IsServer
then
1369 if gPlayer1
= nil then
1370 g_Game_AddPlayer(TEAM_BLUE
)
1373 if gPlayer1
.Team
<> TEAM_BLUE
then
1375 gPlayer1
.SwitchTeam
;
1376 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1379 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1384 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1385 MC_SEND_PlayerSettings
;
1386 if gPlayer1
= nil then
1387 g_Game_AddPlayer(TEAM_BLUE
);
1389 g_ActiveWindow
:= nil;
1390 g_Game_Pause(False);
1393 procedure ProcJoinGame();
1395 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1397 if gPlayer1
= nil then
1399 g_ActiveWindow
:= nil;
1400 g_Game_Pause(False);
1403 procedure ProcSwitchP2();
1405 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1407 if gPlayer1
= nil then
1409 if gPlayer2
= nil then
1412 g_Game_RemovePlayer();
1413 g_ActiveWindow
:= nil;
1414 g_Game_Pause(False);
1417 procedure ProcSpectate();
1419 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1422 g_ActiveWindow
:= nil;
1423 g_Game_Pause(False);
1426 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1428 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1431 procedure ProcEndMenuKeyDown (yes
: Boolean);
1433 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1436 procedure ProcSetRussianLanguage();
1438 if gLanguage
<> LANGUAGE_RUSSIAN
then
1440 gLanguage
:= LANGUAGE_RUSSIAN
;
1441 gLanguageChange
:= True;
1442 gAskLanguage
:= False;
1444 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1446 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1451 procedure ProcSetEnglishLanguage();
1453 if gLanguage
<> LANGUAGE_ENGLISH
then
1455 gLanguage
:= LANGUAGE_ENGLISH
;
1456 gLanguageChange
:= True;
1457 gAskLanguage
:= False;
1459 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1461 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1466 procedure ReadGameSettings();
1470 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1472 with gGameSettings
do
1474 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1475 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1480 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1481 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1482 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1484 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1485 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1486 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1489 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1494 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1496 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1497 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1498 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1499 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1500 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1501 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1502 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1503 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1507 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1508 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1513 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1514 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1519 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1520 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1525 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1526 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1531 procedure ProcApplyGameSet();
1535 stat
: TPlayerStatArray
;
1537 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1539 if not g_Game_IsServer
then Exit
;
1541 with gGameSettings
do
1543 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1545 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1546 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1548 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1551 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1553 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1559 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1561 TimeLimit
:= Max(n
, b
);
1565 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1567 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1574 if GameMode
= GM_DM
then
1576 stat
:= g_Player_GetStats();
1578 for a
:= 0 to High(stat
) do
1579 if stat
[a
].Frags
> b
then
1583 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1585 GoalLimit
:= Max(n
, b
);
1589 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1591 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1592 if n
< 0 then n
:= 0;
1593 if n
> 255 then n
:= 255;
1599 stat
:= g_Player_GetStats();
1601 for a
:= 0 to High(stat
) do
1602 if stat
[a
].Lives
> b
then
1605 MaxLives
:= Max(n
, b
);
1609 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1611 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1614 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1615 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1619 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1620 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1624 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1625 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1631 if g_Game_IsNet
then MH_SEND_GameSettings
;
1634 procedure ProcVideoOptionsRes();
1640 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1642 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1643 IntToStr(gScreenWidth
) +
1644 ' x ' + IntToStr(gScreenHeight
) +
1645 ', ' + IntToStr(gBPP
) + ' bpp';
1647 with TGUIListBox(menu
.GetControl('lsResolution')) do
1649 list
:= GetDisplayModes(gBPP
, SR
);
1660 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1667 procedure ProcApplyVideoOptions();
1670 Fullscreen
: Boolean;
1671 SWidth
, SHeight
: Integer;
1674 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1676 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1677 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1679 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1681 if (SWidth
<> gScreenWidth
) or
1682 (SHeight
<> gScreenHeight
) or
1683 (Fullscreen
<> gFullscreen
) then
1685 gResolutionChange
:= True;
1686 gRC_Width
:= SWidth
;
1687 gRC_Height
:= SHeight
;
1688 gRC_FullScreen
:= Fullscreen
;
1689 gRC_Maximized
:= gWinMaximized
;
1692 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1696 procedure ProcSetFirstRussianLanguage();
1698 gLanguage
:= LANGUAGE_RUSSIAN
;
1699 gLanguageChange
:= True;
1700 gAskLanguage
:= False;
1702 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1705 procedure ProcSetFirstEnglishLanguage();
1707 gLanguage
:= LANGUAGE_ENGLISH
;
1708 gLanguageChange
:= True;
1709 gAskLanguage
:= False;
1711 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1714 procedure ProcRecallAddress();
1716 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1718 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1719 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1723 procedure CreateFirstLanguageMenu();
1727 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1729 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1731 Name
:= 'mmFirstLanguageMenu';
1732 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1733 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1736 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1737 Menu
.MainWindow
:= True;
1738 g_GUI_AddWindow(Menu
);
1741 procedure g_Menu_AskLanguage();
1743 CreateFirstLanguageMenu();
1744 g_GUI_ShowWindow('FirstLanguageMenu');
1747 procedure CreatePlayerOptionsMenu(s
: String);
1752 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1754 a
:= _lc
[I_MENU_PLAYER_1
]
1756 a
:= _lc
[I_MENU_PLAYER_2
];
1757 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1759 Name
:= 'mOptionsPlayers'+s
+'Menu';
1760 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1762 Name
:= 'ed'+s
+'Name';
1766 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1768 Name
:= 'sw'+s
+'Team';
1769 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1770 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1772 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1774 Name
:= 'ls'+s
+'Model';
1776 Items
:= g_PlayerModel_GetNames();
1777 OnChange
:= ProcSelectModel
;
1779 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1781 Name
:= 'sc'+s
+'Red';
1783 OnChange
:= ProcChangeColor
;
1785 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1787 Name
:= 'sc'+s
+'Green';
1789 OnChange
:= ProcChangeColor
;
1791 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1793 Name
:= 'sc'+s
+'Blue';
1795 OnChange
:= ProcChangeColor
;
1798 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1799 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1800 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1801 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1803 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1805 Name
:= 'mv'+s
+'Model';
1806 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1807 Y
:= GetControl('ls'+s
+'Model').Y
;
1810 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1811 g_GUI_AddWindow(Menu
);
1814 procedure CreateAllMenus();
1818 a
, cx
, _y
, i
: Integer;
1821 Menu
:= TGUIWindow
.Create('MainMenu');
1822 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1824 Name
:= 'mmMainMenu';
1825 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1826 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1827 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1828 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1829 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1830 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1832 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1834 Color
:= _RGB(255, 255, 255);
1835 X
:= gScreenWidth
-GetWidth
-8;
1836 Y
:= gScreenHeight
-GetHeight
-8;
1838 Menu
.DefControl
:= 'mmMainMenu';
1839 Menu
.MainWindow
:= True;
1840 g_GUI_AddWindow(Menu
);
1842 Menu
:= TGUIWindow
.Create('NewGameMenu');
1843 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1845 Name
:= 'mmNewGameMenu';
1846 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1847 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1848 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1849 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1851 Menu
.DefControl
:= 'mmNewGameMenu';
1852 g_GUI_AddWindow(Menu
);
1854 Menu
:= TGUIWindow
.Create('NetGameMenu');
1855 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1857 Name
:= 'mmNetGameMenu';
1858 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1859 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1861 Menu
.DefControl
:= 'mmNetGameMenu';
1862 g_GUI_AddWindow(Menu
);
1864 Menu
:= TGUIWindow
.Create('NetServerMenu');
1865 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1867 Name
:= 'mNetServerMenu';
1868 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1870 Name
:= 'edSrvName';
1871 OnlyDigits
:= False;
1874 Text := NetServerName
;
1876 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1878 Name
:= 'edSrvPassword';
1879 OnlyDigits
:= False;
1882 Text := NetPassword
;
1884 with AddEdit(_lc
[I_NET_PORT
]) do
1890 Text := IntToStr(NetPort
);
1892 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1894 Name
:= 'edMaxPlayers';
1898 Text := IntToStr(NetMaxClients
);
1900 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1902 Name
:= 'swUseMaster';
1903 AddItem(_lc
[I_MENU_YES
]);
1904 AddItem(_lc
[I_MENU_NO
]);
1905 if NetUseMaster
then
1911 with AddLabel(_lc
[I_MENU_MAP
]) do
1916 OnClick
:= @ProcSelectMapMenu
;
1918 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1920 Name
:= 'swGameMode';
1921 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1922 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1923 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1924 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1925 case g_Game_TextToMode(gnGameMode
) of
1927 GM_DM
: ItemIndex
:= 0;
1928 GM_TDM
: ItemIndex
:= 1;
1929 GM_CTF
: ItemIndex
:= 2;
1931 GM_COOP
: ItemIndex
:= 3;
1933 OnChange
:= ProcSwitchMonstersNet
;
1935 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1937 Name
:= 'edTimeLimit';
1941 if gnTimeLimit
> 0 then
1942 Text := IntToStr(gnTimeLimit
);
1944 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1946 Name
:= 'edGoalLimit';
1950 if gnGoalLimit
> 0 then
1951 Text := IntToStr(gnGoalLimit
);
1953 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1955 Name
:= 'edMaxLives';
1959 if gnMaxLives
> 0 then
1960 Text := IntToStr(gnMaxLives
);
1962 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1964 Name
:= 'swPlayers';
1965 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1966 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1967 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1968 ItemIndex
:= gnPlayers
;
1970 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1972 Name
:= 'swTeamDamage';
1973 AddItem(_lc
[I_MENU_YES
]);
1974 AddItem(_lc
[I_MENU_NO
]);
1975 if gnTeamDamage
then
1980 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1982 Name
:= 'swEnableExits';
1983 AddItem(_lc
[I_MENU_YES
]);
1984 AddItem(_lc
[I_MENU_NO
]);
1990 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
1992 Name
:= 'swWeaponStay';
1993 AddItem(_lc
[I_MENU_YES
]);
1994 AddItem(_lc
[I_MENU_NO
]);
1995 if gnWeaponStay
then
2000 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2002 Name
:= 'swMonsters';
2003 AddItem(_lc
[I_MENU_YES
]);
2004 AddItem(_lc
[I_MENU_NO
]);
2010 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2013 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2014 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2015 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2017 if gnBotsVS
= 'Players' then
2019 if gnBotsVS
= 'Monsters' then
2023 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2027 Menu
.DefControl
:= 'mNetServerMenu';
2028 g_GUI_AddWindow(Menu
);
2030 Menu
:= TGUIWindow
.Create('NetClientMenu');
2031 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2033 Name
:= 'mNetClientMenu';
2035 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2038 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2044 Text := 'localhost';
2046 with AddEdit(_lc
[I_NET_PORT
]) do
2054 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2057 OnlyDigits
:= False;
2064 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2068 Menu
.DefControl
:= 'mNetClientMenu';
2069 g_GUI_AddWindow(Menu
);
2071 Menu
:= TGUIWindow
.Create('LoadMenu');
2072 Menu
.OnShow
:= ProcLoadMenu
;
2073 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2075 Name
:= 'mmLoadMenu';
2080 Name
:= 'edSlot'+IntToStr(a
);
2083 OnEnter
:= ProcLoadGame
;
2086 Menu
.DefControl
:= 'mmLoadMenu';
2087 g_GUI_AddWindow(Menu
);
2089 Menu
:= TGUIWindow
.Create('SaveMenu');
2090 Menu
.OnShow
:= ProcSaveMenu
;
2091 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2093 Name
:= 'mmSaveMenu';
2098 Name
:= 'edSlot'+IntToStr(a
);
2101 OnChange
:= ProcSaveGame
;
2104 Menu
.DefControl
:= 'mmSaveMenu';
2105 g_GUI_AddWindow(Menu
);
2107 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2108 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2110 Name
:= 'mCustomGameMenu';
2111 with AddLabel(_lc
[I_MENU_MAP
]) do
2116 OnClick
:= @ProcSelectMapMenu
;
2118 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2120 Name
:= 'swGameMode';
2121 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2122 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2123 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2124 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2125 case g_Game_TextToMode(gcGameMode
) of
2127 GM_DM
: ItemIndex
:= 0;
2128 GM_TDM
: ItemIndex
:= 1;
2129 GM_CTF
: ItemIndex
:= 2;
2131 GM_COOP
: ItemIndex
:= 3;
2133 OnChange
:= ProcSwitchMonstersCustom
;
2135 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2137 Name
:= 'edTimeLimit';
2141 if gcTimeLimit
> 0 then
2142 Text := IntToStr(gcTimeLimit
);
2144 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2146 Name
:= 'edGoalLimit';
2150 if gcGoalLimit
> 0 then
2151 Text := IntToStr(gcGoalLimit
);
2153 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2155 Name
:= 'edMaxLives';
2159 if gcMaxLives
> 0 then
2160 Text := IntToStr(gcMaxLives
);
2162 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2164 Name
:= 'swPlayers';
2165 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2166 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2167 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2168 ItemIndex
:= gcPlayers
;
2170 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2172 Name
:= 'swTeamDamage';
2173 AddItem(_lc
[I_MENU_YES
]);
2174 AddItem(_lc
[I_MENU_NO
]);
2175 if gcTeamDamage
then
2180 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2182 Name
:= 'swEnableExits';
2183 AddItem(_lc
[I_MENU_YES
]);
2184 AddItem(_lc
[I_MENU_NO
]);
2190 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2192 Name
:= 'swWeaponStay';
2193 AddItem(_lc
[I_MENU_YES
]);
2194 AddItem(_lc
[I_MENU_NO
]);
2195 if gcWeaponStay
then
2200 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2202 Name
:= 'swMonsters';
2203 AddItem(_lc
[I_MENU_YES
]);
2204 AddItem(_lc
[I_MENU_NO
]);
2210 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2213 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2214 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2215 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2217 if gcBotsVS
= 'Players' then
2219 if gcBotsVS
= 'Monsters' then
2223 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2227 Menu
.DefControl
:= 'mCustomGameMenu';
2228 g_GUI_AddWindow(Menu
);
2230 Menu
:= TGUIWindow
.Create('CampaignMenu');
2231 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2233 Name
:= 'mCampaignMenu';
2242 with AddFileList('', 15, 4) do
2245 OnChange
:= ProcSelectCampaignWAD
;
2249 FileMask
:= '*.wad|*.pk3|*.zip';
2250 SetBase(MapsDir
+'megawads/');
2253 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2255 Name
:= 'lbWADName';
2259 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2261 Name
:= 'lbWADAuthor';
2265 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2266 with AddMemo('', 15, 3) do
2268 Name
:= 'meWADDescription';
2269 Color
:= MENU_ITEMSCTRL_COLOR
;
2271 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2273 Name
:= 'swPlayers';
2274 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2275 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2278 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2282 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2284 Name
:= 'mpWADImage';
2285 DefaultRes
:= 'NOPIC';
2286 X
:= GetControl('lsWAD').X
+4;
2287 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2290 Menu
.DefControl
:= 'mCampaignMenu';
2291 g_GUI_AddWindow(Menu
);
2293 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2294 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2296 Name
:= 'mSelectMapMenu';
2297 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2300 OnChange
:= ProcSelectWAD
;
2304 FileMask
:= '*.wad|*.pk3|*.zip';
2307 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2311 OnChange
:= ProcSelectMap
;
2314 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2316 Name
:= 'lbMapName';
2320 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2322 Name
:= 'lbMapAuthor';
2326 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2328 Name
:= 'lbMapSize';
2332 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2334 Name
:= 'meMapDescription';
2339 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2341 Name
:= 'mpMapPreview';
2342 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2343 Y
:= GetControl('lsMapWAD').Y
;
2345 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2347 Name
:= 'lbMapScale';
2350 Color
:= MENU_ITEMSCTRL_COLOR
;
2351 X
:= GetControl('lsMapWAD').X
+
2352 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2353 2 + MAPPREVIEW_WIDTH
*4;
2354 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2357 Menu
.OnClose
:= ProcSetMap
;
2358 Menu
.DefControl
:= 'mSelectMapMenu';
2359 g_GUI_AddWindow(Menu
);
2361 Menu
:= TGUIWindow
.Create('OptionsMenu');
2362 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2364 Name
:= 'mmOptionsMenu';
2365 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2366 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2367 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2368 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2369 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2370 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2372 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2373 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2375 Menu
.OnClose
:= ProcApplyOptions
;
2376 Menu
.DefControl
:= 'mmOptionsMenu';
2377 g_GUI_AddWindow(Menu
);
2379 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2380 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2381 g_GUI_AddWindow(Menu
);
2383 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2384 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2386 Name
:= 'mOptionsVideoMenu';
2387 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2388 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2394 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2397 AddItem(_lc
[I_MENU_YES
]);
2398 AddItem(_lc
[I_MENU_NO
]);
2400 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2402 Name
:= 'swTextureFilter';
2403 AddItem(_lc
[I_MENU_YES
]);
2404 AddItem(_lc
[I_MENU_NO
]);
2406 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2408 Name
:= 'swLegacyNPOT';
2409 AddItem(_lc
[I_MENU_NO
]);
2410 AddItem(_lc
[I_MENU_YES
]);
2413 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2416 Menu
.DefControl
:= 'mOptionsVideoMenu';
2417 g_GUI_AddWindow(Menu
);
2419 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2420 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2422 Name
:= 'mOptionsVideoResMenu';
2423 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2425 Name
:= 'lbCurrentRes';
2429 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2431 Name
:= 'lsResolution';
2434 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2436 Name
:= 'swFullScreen';
2437 AddItem(_lc
[I_MENU_YES
]);
2438 AddItem(_lc
[I_MENU_NO
]);
2441 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2444 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2445 g_GUI_AddWindow(Menu
);
2447 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2448 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2450 Name
:= 'mOptionsSoundMenu';
2451 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2453 Name
:= 'scMusicLevel';
2455 OnChange
:= ProcChangeSoundSettings
;
2457 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2459 Name
:= 'scSoundLevel';
2461 OnChange
:= ProcChangeSoundSettings
;
2463 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2465 Name
:= 'scMaxSimSounds';
2468 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2470 Name
:= 'swAnnouncer';
2471 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2472 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2473 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2474 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2476 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2477 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2479 Name
:= 'swSoundEffects';
2480 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2481 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2483 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2485 Name
:= 'swInactiveSounds';
2486 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2487 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2491 Menu
.DefControl
:= 'mOptionsSoundMenu';
2492 g_GUI_AddWindow(Menu
);
2494 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2495 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2497 Name
:= 'mOptionsGameMenu';
2498 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2500 Name
:= 'scParticlesCount';
2503 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2505 Name
:= 'swBloodCount';
2506 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2507 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2508 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2509 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2510 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2512 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2514 Name
:= 'scShellsMax';
2517 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2519 Name
:= 'scGibsMax';
2522 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2524 Name
:= 'scCorpsesMax';
2527 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2529 Name
:= 'swGibsCount';
2530 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2531 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2532 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2533 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2534 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2536 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2538 Name
:= 'swCorpseType';
2539 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2540 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2542 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2544 Name
:= 'swGibsType';
2545 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2546 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2548 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2550 Name
:= 'swBloodType';
2551 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2552 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2554 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2556 Name
:= 'swScreenFlash';
2557 AddItem(_lc
[I_MENU_NO
]);
2558 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2559 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2561 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2563 Name
:= 'swBackground';
2564 AddItem(_lc
[I_MENU_YES
]);
2565 AddItem(_lc
[I_MENU_NO
]);
2567 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2569 Name
:= 'swMessages';
2570 AddItem(_lc
[I_MENU_YES
]);
2571 AddItem(_lc
[I_MENU_NO
]);
2573 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2575 Name
:= 'swRevertPlayers';
2576 AddItem(_lc
[I_MENU_YES
]);
2577 AddItem(_lc
[I_MENU_NO
]);
2579 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2581 Name
:= 'swChatBubble';
2582 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2583 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2584 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2585 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2586 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2590 Menu
.DefControl
:= 'mOptionsGameMenu';
2591 g_GUI_AddWindow(Menu
);
2593 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2594 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2596 Name
:= 'mOptionsControlsMenu';
2597 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2598 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2599 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2600 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2601 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2603 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsControlsP1Menu');
2604 AddButton(nil, _lc
[I_MENU_PLAYER_1_ALT
], 'OptionsControlsP1MenuAlt');
2605 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsControlsP2Menu');
2606 AddButton(nil, _lc
[I_MENU_PLAYER_2_ALT
], 'OptionsControlsP2MenuAlt');
2608 if e_JoysticksAvailable
<> 0 then
2609 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2611 Menu
.DefControl
:= 'mOptionsControlsMenu';
2612 g_GUI_AddWindow(Menu
);
2614 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2615 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2617 Name
:= 'mOptionsControlsP1Menu';
2618 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2619 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2620 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2621 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2622 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2623 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2624 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2625 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2626 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2628 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2629 g_GUI_AddWindow(Menu
);
2631 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuAlt');
2632 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2634 Name
:= 'mOptionsControlsP1MenuAlt';
2635 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2636 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2637 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2638 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2639 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2640 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2641 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2642 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2643 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2644 AddKeyRead(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2646 Menu
.DefControl
:= 'mOptionsControlsP1MenuAlt';
2647 g_GUI_AddWindow(Menu
);
2649 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2650 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2652 Name
:= 'mOptionsControlsP2Menu';
2653 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2654 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2655 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2656 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2657 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2658 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2659 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2660 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2661 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2663 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2664 g_GUI_AddWindow(Menu
);
2666 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuAlt');
2667 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2669 Name
:= 'mOptionsControlsP2MenuAlt';
2670 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2671 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2672 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2673 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2674 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2675 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2676 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2677 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2678 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2679 AddKeyRead(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2681 Menu
.DefControl
:= 'mOptionsControlsP2MenuAlt';
2682 g_GUI_AddWindow(Menu
);
2684 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2685 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2687 Name
:= 'mOptionsControlsJoystickMenu';
2688 for i
:= 0 to e_JoysticksAvailable
-1 do
2689 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2691 Name
:= 'scDeadzone' + IntToStr(i
);
2695 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2696 g_GUI_AddWindow(Menu
);
2698 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2699 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2701 Name
:= 'mOptionsPlayersMenu';
2702 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2703 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2705 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2706 g_GUI_AddWindow(Menu
);
2708 CreatePlayerOptionsMenu('P1');
2709 CreatePlayerOptionsMenu('P2');
2711 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2712 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2714 Name
:= 'mOptionsPlayersMIMenu';
2715 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2720 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2725 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2727 Name
:= 'meComment';
2730 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2731 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2734 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2738 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2739 g_GUI_AddWindow(Menu
);
2741 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2742 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2744 Name
:= 'mOptionsLanguageMenu';
2745 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2746 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2749 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2750 g_GUI_AddWindow(Menu
);
2752 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2753 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2754 g_GUI_AddWindow(Menu
);
2756 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2757 Menu
.BackTexture
:= 'INTER';
2758 Menu
.OnClose
:= ProcAuthorsClose
;
2762 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2764 Color
:= _RGB(255, 0, 0);
2765 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2767 _y
:= _y
+GetHeight();
2769 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2771 Color
:= _RGB(255, 0, 0);
2772 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2774 _y
:= _y
+GetHeight()+32;
2776 // ×òî äåëàë: Êòî äåëàë
2777 cx
:= gScreenWidth
div 2 - 320 + 64;
2778 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2780 Color
:= _RGB(255, 0, 0);
2785 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2787 Color
:= _RGB(255, 255, 255);
2792 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2794 Color
:= _RGB(255, 0, 0);
2799 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2801 Color
:= _RGB(255, 255, 255);
2806 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2808 Color
:= _RGB(255, 255, 255);
2813 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2815 Color
:= _RGB(255, 0, 0);
2820 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2822 Color
:= _RGB(255, 255, 255);
2827 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2829 Color
:= _RGB(255, 0, 0);
2834 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2836 Color
:= _RGB(255, 255, 255);
2839 _y
:= gScreenHeight
- 128;
2842 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2844 Color
:= _RGB(255, 0, 0);
2849 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2851 Color
:= _RGB(255, 255, 255);
2854 _y
:= _y
+GetHeight();
2856 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2858 Color
:= _RGB(255, 255, 255);
2861 _y
:= _y
+GetHeight();
2863 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2865 Color
:= _RGB(255, 255, 255);
2868 _y
:= gScreenHeight
- 32;
2870 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2872 Color
:= _RGB(255, 0, 0);
2873 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2876 g_GUI_AddWindow(Menu
);
2878 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2879 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2880 g_GUI_AddWindow(Menu
);
2882 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2883 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2885 Name
:= 'mmGameSingleMenu';
2886 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2887 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2888 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2889 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2890 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2891 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2893 Menu
.DefControl
:= 'mmGameSingleMenu';
2894 Menu
.MainWindow
:= True;
2895 Menu
.OnClose
:= ProcGMClose
;
2896 Menu
.OnShow
:= ProcGMShow
;
2897 g_GUI_AddWindow(Menu
);
2899 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2900 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2901 g_GUI_AddWindow(Menu
);
2903 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2904 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2905 g_GUI_AddWindow(Menu
);
2907 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2908 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2910 Name
:= 'mmGameCustomMenu';
2911 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2912 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2913 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2914 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2915 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2916 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2917 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2919 Menu
.DefControl
:= 'mmGameCustomMenu';
2920 Menu
.MainWindow
:= True;
2921 Menu
.OnClose
:= ProcGMClose
;
2922 Menu
.OnShow
:= ProcGMShow
;
2923 g_GUI_AddWindow(Menu
);
2925 Menu
:= TGUIWindow
.Create('GameServerMenu');
2926 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2928 Name
:= 'mmGameServerMenu';
2929 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2930 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2931 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2932 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2933 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2935 Menu
.DefControl
:= 'mmGameServerMenu';
2936 Menu
.MainWindow
:= True;
2937 Menu
.OnClose
:= ProcGMClose
;
2938 Menu
.OnShow
:= ProcGMShow
;
2939 g_GUI_AddWindow(Menu
);
2941 Menu
:= TGUIWindow
.Create('GameClientMenu');
2942 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2944 Name
:= 'mmGameClientMenu';
2945 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2946 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2947 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2949 Menu
.DefControl
:= 'mmGameClientMenu';
2950 Menu
.MainWindow
:= True;
2951 Menu
.OnClose
:= ProcGMClose
;
2952 Menu
.OnShow
:= ProcGMShow
;
2953 g_GUI_AddWindow(Menu
);
2955 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2956 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2958 Name
:= 'mClientPasswordMenu';
2959 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2967 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2970 Menu
.DefControl
:= 'mClientPasswordMenu';
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2974 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2976 Name
:= 'mGameSetGameMenu';
2977 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2979 Name
:= 'swTeamDamage';
2980 AddItem(_lc
[I_MENU_YES
]);
2981 AddItem(_lc
[I_MENU_NO
]);
2984 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2986 Name
:= 'edTimeLimit';
2991 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2993 Name
:= 'edGoalLimit';
2998 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3000 Name
:= 'edMaxLives';
3005 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3008 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3009 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3010 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3016 Menu
.DefControl
:= 'mGameSetGameMenu';
3017 Menu
.OnClose
:= ProcApplyGameSet
;
3018 g_GUI_AddWindow(Menu
);
3020 Menu
:= TGUIWindow
.Create('TeamMenu');
3021 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3023 Name
:= 'mmTeamMenu';
3024 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3025 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3026 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3027 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3028 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3030 Menu
.DefControl
:= 'mmTeamMenu';
3031 Menu
.OnShow
:= ProcChangePlayers
;
3032 g_GUI_AddWindow(Menu
);
3035 procedure g_Menu_Show_SaveMenu();
3037 if g_Game_IsTestMap
then
3039 if gGameSettings
.GameType
= GT_SINGLE
then
3040 g_GUI_ShowWindow('GameSingleMenu')
3043 if g_Game_IsClient
then
3046 if g_Game_IsNet
then
3049 g_GUI_ShowWindow('GameCustomMenu');
3051 g_GUI_ShowWindow('SaveMenu');
3052 g_Sound_PlayEx('MENU_OPEN');
3055 procedure g_Menu_Show_LoadMenu();
3057 if gGameSettings
.GameType
= GT_SINGLE
then
3058 g_GUI_ShowWindow('GameSingleMenu')
3061 if g_Game_IsClient
then
3064 if g_Game_IsNet
then
3067 g_GUI_ShowWindow('GameCustomMenu');
3069 g_GUI_ShowWindow('LoadMenu');
3070 g_Sound_PlayEx('MENU_OPEN');
3073 procedure g_Menu_Show_GameSetGame();
3075 if gGameSettings
.GameType
= GT_SINGLE
then
3076 g_GUI_ShowWindow('GameSingleMenu')
3079 if g_Game_IsClient
then
3082 if g_Game_IsNet
then
3083 g_GUI_ShowWindow('GameServerMenu')
3085 g_GUI_ShowWindow('GameCustomMenu');
3088 g_GUI_ShowWindow('GameSetGameMenu');
3089 g_Sound_PlayEx('MENU_OPEN');
3092 procedure g_Menu_Show_OptionsVideo();
3094 if gGameSettings
.GameType
= GT_SINGLE
then
3095 g_GUI_ShowWindow('GameSingleMenu')
3098 if g_Game_IsClient
then
3099 g_GUI_ShowWindow('GameClientMenu')
3101 if g_Game_IsNet
then
3102 g_GUI_ShowWindow('GameServerMenu')
3104 g_GUI_ShowWindow('GameCustomMenu');
3107 g_GUI_ShowWindow('OptionsMenu');
3108 g_GUI_ShowWindow('OptionsVideoMenu');
3109 g_Sound_PlayEx('MENU_OPEN');
3112 procedure g_Menu_Show_OptionsSound();
3114 if gGameSettings
.GameType
= GT_SINGLE
then
3115 g_GUI_ShowWindow('GameSingleMenu')
3118 if g_Game_IsClient
then
3119 g_GUI_ShowWindow('GameClientMenu')
3121 if g_Game_IsNet
then
3122 g_GUI_ShowWindow('GameServerMenu')
3124 g_GUI_ShowWindow('GameCustomMenu');
3127 g_GUI_ShowWindow('OptionsMenu');
3128 g_GUI_ShowWindow('OptionsSoundMenu');
3129 g_Sound_PlayEx('MENU_OPEN');
3132 procedure g_Menu_Show_EndGameMenu();
3134 g_GUI_ShowWindow('EndGameMenu');
3135 g_Sound_PlayEx('MENU_OPEN');
3138 procedure g_Menu_Show_QuitGameMenu();
3140 g_GUI_ShowWindow('ExitMenu');
3141 g_Sound_PlayEx('MENU_OPEN');
3144 procedure g_Menu_Init();
3151 procedure g_Menu_Free();
3155 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3160 procedure g_Menu_Reset();
3164 g_GUI_SaveMenuPos();
3165 ex
:= g_GUI_Destroy();
3169 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3174 g_Game_SetDebugMode();
3176 g_GUI_LoadMenuPos();