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('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
196 with menu
, gGameControls
.P1Control
do
199 KeyWeapon
[i
] := TGUIKeyRead(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key
;
202 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
203 with menu
, gGameControls
.P2Control
do
205 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
206 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
207 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
208 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
209 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
210 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
211 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
212 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
213 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
216 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
217 with menu
, gGameControls
.P2Control
do
219 KeyRight2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
220 KeyLeft2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
221 KeyUp2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
222 KeyDown2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
223 KeyFire2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
224 KeyJump2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
225 KeyNextWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
226 KeyPrevWeapon2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
227 KeyOpen2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
228 KeyStrafe2
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
;
231 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
232 with menu
, gGameControls
.P2Control
do
235 KeyWeapon
[i
] := TGUIKeyRead(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key
;
238 if e_JoysticksAvailable
> 0 then
240 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
243 for i
:= 0 to e_JoysticksAvailable
-1 do
244 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
248 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
250 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
251 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
252 TEAM_RED
, TEAM_BLUE
);
254 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
256 gPlayer1Settings
.Model
:= Model
.Name
;
257 gPlayer1Settings
.Color
:= Model
.Color
;
260 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
262 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
263 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
264 TEAM_RED
, TEAM_BLUE
);
265 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
267 gPlayer2Settings
.Model
:= Model
.Name
;
268 gPlayer2Settings
.Color
:= Model
.Color
;
271 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
272 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
274 if g_Game_IsServer
then
276 if gPlayer1
<> nil then
278 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
279 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
280 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
281 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
283 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
286 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
289 if gPlayer2
<> nil then
291 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
292 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
293 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
294 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
296 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
301 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
303 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
306 procedure ReadOptions();
311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
313 with TGUISwitch(menu
.GetControl('swBPP')) do
319 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
320 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
322 with TGUISwitch(menu
.GetControl('swVSync')) do
323 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
325 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
326 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
328 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
330 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
331 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
332 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
334 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
335 if gMuteWhenInactive
then
340 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
342 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
343 if gSoundEffectsDF
then
348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
349 with menu
, gGameControls
.P1Control
do
351 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
352 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
353 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
354 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
355 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
356 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
357 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
358 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
359 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
362 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt'));
363 with menu
, gGameControls
.P1Control
do
365 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
366 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
367 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
368 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
369 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
370 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
371 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
372 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
373 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
374 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
:= KeyStrafe2
;
377 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
378 with menu
, gGameControls
.P2Control
do
380 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
381 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
382 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
383 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
384 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
385 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
386 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
387 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
388 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
391 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt'));
392 with menu
, gGameControls
.P2Control
do
394 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight2
;
395 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft2
;
396 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp2
;
397 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown2
;
398 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire2
;
399 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump2
;
400 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon2
;
401 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon2
;
402 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen2
;
403 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key
:= KeyStrafe2
;
406 if e_JoysticksAvailable
> 0 then
408 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
411 for i
:= 0 to e_JoysticksAvailable
-1 do
412 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
416 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
417 with menu
, gGameControls
.GameControls
do
419 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
420 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
421 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
422 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
425 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
427 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
428 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
429 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
430 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
431 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
433 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
436 with TGUISwitch(menu
.GetControl('swBloodType')) do
437 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
439 with TGUISwitch(menu
.GetControl('swCorpseType')) do
440 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
442 with TGUISwitch(menu
.GetControl('swGibsType')) do
443 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
445 with TGUISwitch(menu
.GetControl('swGibsCount')) do
454 with TGUISwitch(menu
.GetControl('swBackGround')) do
455 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
457 with TGUISwitch(menu
.GetControl('swMessages')) do
458 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
460 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
461 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
463 with TGUISwitch(menu
.GetControl('swChatBubble')) do
464 ItemIndex
:= gChatBubble
;
466 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
468 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
469 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
471 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
472 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
474 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
475 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
476 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
478 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
480 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
481 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
483 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
484 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
486 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
487 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
488 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
490 ProcSelectModel(nil);
493 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
495 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
496 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
497 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
499 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
502 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
504 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
505 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
506 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
508 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
511 procedure ProcStartCustomGame();
517 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
519 Map
:= TGUILabel(GetControl('lbMap')).Text;
522 if Pos(':\', Map
) = 0 then
525 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
526 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
527 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
528 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
529 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
531 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
532 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
533 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
534 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
537 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
539 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
541 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
543 Options
:= Options
or GAME_OPTION_MONSTERS
;
544 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
546 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
548 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
549 gcBotsVS
:= 'Monsters';
552 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
553 gcBotsVS
:= 'Everybody';
556 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
557 gcBotsVS
:= 'Players';
564 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
566 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
567 gcMaxLives
, Options
, gcPlayers
);
571 procedure ProcStartNetGame();
577 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
579 Map
:= TGUILabel(GetControl('lbMap')).Text;
582 if Pos(':\', Map
) = 0 then
585 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
586 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
587 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
588 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
589 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
590 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
592 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
593 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
594 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
595 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
598 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
600 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
602 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
604 Options
:= Options
or GAME_OPTION_MONSTERS
;
605 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
607 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
609 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
610 gnBotsVS
:= 'Monsters';
613 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
614 gnBotsVS
:= 'Everybody';
617 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
618 gnBotsVS
:= 'Players';
623 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
624 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
625 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
626 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
627 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
630 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
631 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
633 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
634 Options
, gnPlayers
, 0, NetPort
);
637 procedure ProcConnectNetGame();
641 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
643 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
644 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
645 PW
:= TGUIEdit(GetControl('edPW')).Text;
648 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
649 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
652 procedure ProcEnterPassword();
656 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
658 NetClientIP
:= PromptIP
;
659 NetClientPort
:= PromptPort
;
660 PW
:= TGUIEdit(GetControl('edPW')).Text;
663 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
664 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
667 procedure ProcServerlist();
669 if not NetInitDone
then
671 if (not g_Net_Init()) then
673 g_Console_Add('NET: ERROR: Failed to init ENet!');
680 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
682 gState
:= STATE_SLIST
;
683 g_ActiveWindow
:= nil;
685 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
690 slReturnPressed
:= True;
691 if g_Net_Slist_Fetch(slCurrent
) then
693 if slCurrent
= nil then
694 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
697 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
700 procedure ProcStartCampaign();
706 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
708 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
709 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
716 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
719 procedure ProcSelectMap(Sender
: TGUIControl
);
723 wad
, map
, res
: String;
725 win
:= g_GUI_GetWindow('SelectMapMenu');
726 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
728 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
729 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
731 if (wad
= '') or (map
= '') then
732 begin // Ýòî íå êàðòà
733 TGUILabel(GetControl('lbMapName')).Text := '';
734 TGUILabel(GetControl('lbMapAuthor')).Text := '';
735 TGUILabel(GetControl('lbMapSize')).Text := '';
736 TGUIMemo(GetControl('meMapDescription')).SetText('');
737 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
738 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
744 a
:= g_Map_GetMapInfo(res
);
746 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
747 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
748 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
749 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
750 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
751 TGUILabel(win
.GetControl('lbMapScale')).Text :=
752 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
757 procedure ProcSelectWAD(Sender
: TGUIControl
);
762 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
764 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
766 with TGUIListBox(GetControl('lsMapRes')) do
772 list
:= g_Map_GetMapsList(wad
);
786 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
792 win
:= g_GUI_GetWindow('CampaignMenu');
793 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
795 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
799 TGUILabel(GetControl('lbWADName')).Text := '';
800 TGUILabel(GetControl('lbWADAuthor')).Text := '';
801 TGUIMemo(GetControl('meWADDescription')).SetText('');
804 a
:= g_Game_GetMegaWADInfo(wad
);
806 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
807 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
808 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
810 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
814 fn
:= g_ExtractWadName(a
.pic
);
816 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
818 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
823 procedure ProcChangeColor(Sender
: TGUIControl
);
827 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
828 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
829 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
830 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
831 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
832 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
834 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
835 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
836 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
837 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
838 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
839 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
842 procedure ProcSelectModel(Sender
: TGUIControl
);
847 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
848 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
849 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
851 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
852 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
853 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
855 ProcChangeColor(nil);
858 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
870 wad
:= TWADFile
.Create
;
871 if wad
.ReadFile(GameWAD
) then
872 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
877 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
879 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
880 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
881 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
882 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
884 if g_Texture_Get('FONT_STD', ID
) then
885 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
890 if cfglen
<> 0 then FreeMem(cfgdata
);
893 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
899 cfgdata
, fntdata
: Pointer;
900 cfglen
, fntlen
: Integer;
908 wad
:= TWADFile
.Create
;
909 if wad
.ReadFile(GameWAD
) then
911 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
912 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
918 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
919 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
920 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
922 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
923 FontID
:= e_CharFont_Create(spc
);
927 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
928 if chrwidth
= 0 then Continue
;
930 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
932 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
938 if cfglen
<> 0 then FreeMem(cfgdata
);
939 if fntlen
<> 0 then FreeMem(fntdata
);
942 procedure MenuLoadData();
944 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
946 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
947 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
948 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
949 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
950 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
951 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
952 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
953 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
954 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
955 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
956 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
957 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
958 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
959 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
960 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
961 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
962 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
963 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
964 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
965 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
966 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
967 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
968 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
969 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
971 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
972 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
973 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
974 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
975 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
976 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
977 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
980 procedure MenuFreeData();
982 e_CharFont_Remove(gMenuFont
);
983 e_CharFont_Remove(gMenuSmallFont
);
985 g_Texture_Delete('MAINMENU_MARKER1');
986 g_Texture_Delete('MAINMENU_MARKER2');
987 g_Texture_Delete('SCROLL_LEFT');
988 g_Texture_Delete('SCROLL_RIGHT');
989 g_Texture_Delete('SCROLL_MIDDLE');
990 g_Texture_Delete('SCROLL_MARKER');
991 g_Texture_Delete('EDIT_LEFT');
992 g_Texture_Delete('EDIT_RIGHT');
993 g_Texture_Delete('EDIT_MIDDLE');
994 g_Texture_Delete('BOX1');
995 g_Texture_Delete('BOX2');
996 g_Texture_Delete('BOX3');
997 g_Texture_Delete('BOX4');
998 g_Texture_Delete('BOX5');
999 g_Texture_Delete('BOX6');
1000 g_Texture_Delete('BOX7');
1001 g_Texture_Delete('BOX8');
1002 g_Texture_Delete('BOX9');
1003 g_Texture_Delete('BSCROLL_UP_A');
1004 g_Texture_Delete('BSCROLL_UP_U');
1005 g_Texture_Delete('BSCROLL_DOWN_A');
1006 g_Texture_Delete('BSCROLL_DOWN_U');
1007 g_Texture_Delete('BSCROLL_MIDDLE');
1008 g_Texture_Delete('NOPIC');
1010 g_Sound_Delete('MENU_SELECT');
1011 g_Sound_Delete('MENU_OPEN');
1012 g_Sound_Delete('MENU_CLOSE');
1013 g_Sound_Delete('MENU_CHANGE');
1014 g_Sound_Delete('SCROLL_ADD');
1015 g_Sound_Delete('SCROLL_SUB');
1016 g_Sound_Delete('SOUND_PLAYER_FALL');
1019 procedure ProcAuthorsMenu();
1021 gMusic
.SetByName('MUSIC_INTERMUS');
1025 procedure ProcExitMenuKeyDown (yes
: Boolean);
1028 snd
: TPlayableSound
;
1033 g_Game_StopAllSounds(True);
1034 case (Random(18)) of
1035 0: s
:= 'SOUND_MONSTER_PAIN';
1036 1: s
:= 'SOUND_MONSTER_DIE_3';
1037 2: s
:= 'SOUND_MONSTER_SLOP';
1038 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1039 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1040 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1041 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1042 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1043 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1044 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1045 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1046 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1047 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1048 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1049 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1050 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1051 else s
:= 'SOUND_PLAYER_FALL';
1053 snd
:= TPlayableSound
.Create();
1054 res
:= snd
.SetByName(s
);
1055 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1059 while snd
.IsPlaying() do begin end;
1067 procedure ProcLoadMenu();
1072 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1076 procedure ProcSaveMenu();
1081 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1085 procedure ProcSaveGame(Sender
: TGUIControl
);
1089 if g_Game_IsNet
then Exit
;
1090 if g_Game_IsTestMap
then Exit
;
1091 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1092 g_Game_PauseAllSounds(True);
1093 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1095 g_ActiveWindow
:= nil;
1096 g_Game_Pause(False);
1099 procedure ProcLoadGame(Sender
: TGUIControl
);
1103 if g_Game_IsNet
then Exit
;
1104 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1105 if g_LoadGame(a
) then
1106 g_Game_PauseAllSounds(False)
1107 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1108 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1111 procedure ProcSingle1Player();
1113 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1116 procedure ProcSingle2Players();
1118 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1121 procedure ProcSelectMapMenu();
1124 wad_lb
: TGUIFileListBox
;
1125 map_lb
: TGUIListBox
;
1128 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1129 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1130 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1132 if wad_lb
.SelectedItem() <> '' then
1133 map
:= map_lb
.SelectedItem()
1137 wad_lb
.UpdateFileList();
1140 if wad_lb
.SelectedItem() <> '' then
1143 map_lb
.SelectItem(map
);
1145 if map_lb
.SelectedItem() <> '' then
1149 g_GUI_ShowWindow('SelectMapMenu');
1152 procedure ProcSelectCampaignMenu();
1155 wad_lb
: TGUIFileListBox
;
1157 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1158 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1160 wad_lb
.UpdateFileList();
1162 if wad_lb
.SelectedItem() <> '' then
1163 ProcSelectCampaignWAD(nil);
1166 procedure ProcSetMap();
1168 wad
, map
, res
: String;
1170 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1172 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1173 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1176 if (wad
= '') or (map
= '') then
1179 res
:= wad
+':\'+map
;
1181 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1182 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1185 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1189 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1191 g_Sound_SetupAllVolumes(
1192 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1193 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1197 procedure ProcOptionsPlayersMIMenu();
1202 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1204 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1206 if a
= '' then Exit
;
1208 b
:= g_PlayerModel_GetInfo(a
);
1210 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1212 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1213 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1214 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1216 if b
.HaveWeapon
then
1217 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1219 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1222 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1225 procedure ProcOptionsPlayersAnim();
1229 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1234 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1237 Model
.GetCurrentAnimation
.Loop
:= True;
1238 Model
.GetCurrentAnimationMask
.Loop
:= True;
1242 procedure ProcOptionsPlayersWeap();
1246 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1251 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1255 procedure ProcOptionsPlayersRot();
1259 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1260 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1261 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1264 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1268 g_Options_SetDefault();
1274 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1276 if yes
then ReadOptions();
1280 procedure ProcAuthorsClose();
1282 gMusic
.SetByName('MUSIC_MENU');
1284 gState
:= STATE_MENU
;
1287 procedure ProcGMClose();
1289 g_Game_InGameMenu(False);
1292 procedure ProcGMShow();
1297 if (gGameSettings
.GameType
= GT_SINGLE
) and
1298 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1299 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1300 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1302 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1303 if g_Game_IsTestMap
then
1304 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1305 TGUIMainMenu(g_ActiveWindow
.GetControl(
1306 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1309 procedure ProcChangePlayers();
1311 TeamGame
, Spectator
, AddTwo
: Boolean;
1312 P1Team
{, P2Team}: Byte;
1313 bP2
: TGUITextButton
;
1315 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1316 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1317 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1318 P1Team
:= TEAM_NONE
;
1319 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1321 //P2Team := TEAM_NONE;
1322 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1324 TGUIMainMenu(g_ActiveWindow
.GetControl(
1325 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1326 TGUIMainMenu(g_ActiveWindow
.GetControl(
1327 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1328 TGUIMainMenu(g_ActiveWindow
.GetControl(
1329 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1331 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1332 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1333 bP2
.Enabled
:= AddTwo
and not Spectator
;
1335 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1337 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1338 if gPlayer2
= nil then
1339 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1341 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1343 TGUIMainMenu(g_ActiveWindow
.GetControl(
1344 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1347 procedure ProcJoinRed();
1349 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1351 if g_Game_IsServer
then
1353 if gPlayer1
= nil then
1354 g_Game_AddPlayer(TEAM_RED
)
1357 if gPlayer1
.Team
<> TEAM_RED
then
1359 gPlayer1
.SwitchTeam
;
1360 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1363 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1368 gPlayer1Settings
.Team
:= TEAM_RED
;
1369 MC_SEND_PlayerSettings
;
1370 if gPlayer1
= nil then
1371 g_Game_AddPlayer(TEAM_RED
);
1373 g_ActiveWindow
:= nil;
1374 g_Game_Pause(False);
1377 procedure ProcJoinBlue();
1379 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1381 if g_Game_IsServer
then
1383 if gPlayer1
= nil then
1384 g_Game_AddPlayer(TEAM_BLUE
)
1387 if gPlayer1
.Team
<> TEAM_BLUE
then
1389 gPlayer1
.SwitchTeam
;
1390 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1393 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1398 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1399 MC_SEND_PlayerSettings
;
1400 if gPlayer1
= nil then
1401 g_Game_AddPlayer(TEAM_BLUE
);
1403 g_ActiveWindow
:= nil;
1404 g_Game_Pause(False);
1407 procedure ProcJoinGame();
1409 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1411 if gPlayer1
= nil then
1413 g_ActiveWindow
:= nil;
1414 g_Game_Pause(False);
1417 procedure ProcSwitchP2();
1419 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1421 if gPlayer1
= nil then
1423 if gPlayer2
= nil then
1426 g_Game_RemovePlayer();
1427 g_ActiveWindow
:= nil;
1428 g_Game_Pause(False);
1431 procedure ProcSpectate();
1433 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1436 g_ActiveWindow
:= nil;
1437 g_Game_Pause(False);
1440 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1442 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1445 procedure ProcEndMenuKeyDown (yes
: Boolean);
1447 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1450 procedure ProcSetRussianLanguage();
1452 if gLanguage
<> LANGUAGE_RUSSIAN
then
1454 gLanguage
:= LANGUAGE_RUSSIAN
;
1455 gLanguageChange
:= True;
1456 gAskLanguage
:= False;
1458 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1460 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1465 procedure ProcSetEnglishLanguage();
1467 if gLanguage
<> LANGUAGE_ENGLISH
then
1469 gLanguage
:= LANGUAGE_ENGLISH
;
1470 gLanguageChange
:= True;
1471 gAskLanguage
:= False;
1473 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1475 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1480 procedure ReadGameSettings();
1484 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1486 with gGameSettings
do
1488 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1489 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1494 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1495 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1496 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1498 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1499 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1500 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1503 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1508 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1510 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1511 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1512 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1513 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1514 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1515 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1516 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1517 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1521 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1522 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1527 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1528 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1533 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1534 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1539 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1540 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1545 procedure ProcApplyGameSet();
1549 stat
: TPlayerStatArray
;
1551 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1553 if not g_Game_IsServer
then Exit
;
1555 with gGameSettings
do
1557 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1559 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1560 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1562 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1565 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1567 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1573 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1575 TimeLimit
:= Max(n
, b
);
1579 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1581 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1588 if GameMode
= GM_DM
then
1590 stat
:= g_Player_GetStats();
1592 for a
:= 0 to High(stat
) do
1593 if stat
[a
].Frags
> b
then
1597 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1599 GoalLimit
:= Max(n
, b
);
1603 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1605 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1606 if n
< 0 then n
:= 0;
1607 if n
> 255 then n
:= 255;
1613 stat
:= g_Player_GetStats();
1615 for a
:= 0 to High(stat
) do
1616 if stat
[a
].Lives
> b
then
1619 MaxLives
:= Max(n
, b
);
1623 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1625 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1628 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1629 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1633 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1634 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1638 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1639 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1645 if g_Game_IsNet
then MH_SEND_GameSettings
;
1648 procedure ProcVideoOptionsRes();
1654 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1656 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1657 IntToStr(gScreenWidth
) +
1658 ' x ' + IntToStr(gScreenHeight
) +
1659 ', ' + IntToStr(gBPP
) + ' bpp';
1661 with TGUIListBox(menu
.GetControl('lsResolution')) do
1663 list
:= GetDisplayModes(gBPP
, SR
);
1674 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1681 procedure ProcApplyVideoOptions();
1684 Fullscreen
: Boolean;
1685 SWidth
, SHeight
: Integer;
1688 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1690 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1691 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1693 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1695 if (SWidth
<> gScreenWidth
) or
1696 (SHeight
<> gScreenHeight
) or
1697 (Fullscreen
<> gFullscreen
) then
1699 gResolutionChange
:= True;
1700 gRC_Width
:= SWidth
;
1701 gRC_Height
:= SHeight
;
1702 gRC_FullScreen
:= Fullscreen
;
1703 gRC_Maximized
:= gWinMaximized
;
1706 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1710 procedure ProcSetFirstRussianLanguage();
1712 gLanguage
:= LANGUAGE_RUSSIAN
;
1713 gLanguageChange
:= True;
1714 gAskLanguage
:= False;
1716 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1719 procedure ProcSetFirstEnglishLanguage();
1721 gLanguage
:= LANGUAGE_ENGLISH
;
1722 gLanguageChange
:= True;
1723 gAskLanguage
:= False;
1725 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1728 procedure ProcRecallAddress();
1730 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1732 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1733 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1737 procedure CreateFirstLanguageMenu();
1741 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1743 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1745 Name
:= 'mmFirstLanguageMenu';
1746 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1747 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1750 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1751 Menu
.MainWindow
:= True;
1752 g_GUI_AddWindow(Menu
);
1755 procedure g_Menu_AskLanguage();
1757 CreateFirstLanguageMenu();
1758 g_GUI_ShowWindow('FirstLanguageMenu');
1761 procedure CreatePlayerOptionsMenu(s
: String);
1766 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1768 a
:= _lc
[I_MENU_PLAYER_1
]
1770 a
:= _lc
[I_MENU_PLAYER_2
];
1771 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1773 Name
:= 'mOptionsPlayers'+s
+'Menu';
1774 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1776 Name
:= 'ed'+s
+'Name';
1780 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1782 Name
:= 'sw'+s
+'Team';
1783 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1784 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1786 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1788 Name
:= 'ls'+s
+'Model';
1790 Items
:= g_PlayerModel_GetNames();
1791 OnChange
:= ProcSelectModel
;
1793 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1795 Name
:= 'sc'+s
+'Red';
1797 OnChange
:= ProcChangeColor
;
1799 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1801 Name
:= 'sc'+s
+'Green';
1803 OnChange
:= ProcChangeColor
;
1805 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1807 Name
:= 'sc'+s
+'Blue';
1809 OnChange
:= ProcChangeColor
;
1812 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1813 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1814 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1815 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1817 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1819 Name
:= 'mv'+s
+'Model';
1820 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1821 Y
:= GetControl('ls'+s
+'Model').Y
;
1824 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1825 g_GUI_AddWindow(Menu
);
1828 procedure CreateAllMenus();
1832 a
, cx
, _y
, i
: Integer;
1835 Menu
:= TGUIWindow
.Create('MainMenu');
1836 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1838 Name
:= 'mmMainMenu';
1839 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1840 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1841 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1842 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1843 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1844 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1846 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1848 Color
:= _RGB(255, 255, 255);
1849 X
:= gScreenWidth
-GetWidth
-8;
1850 Y
:= gScreenHeight
-GetHeight
-8;
1852 Menu
.DefControl
:= 'mmMainMenu';
1853 Menu
.MainWindow
:= True;
1854 g_GUI_AddWindow(Menu
);
1856 Menu
:= TGUIWindow
.Create('NewGameMenu');
1857 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1859 Name
:= 'mmNewGameMenu';
1860 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1861 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1862 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1863 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1865 Menu
.DefControl
:= 'mmNewGameMenu';
1866 g_GUI_AddWindow(Menu
);
1868 Menu
:= TGUIWindow
.Create('NetGameMenu');
1869 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1871 Name
:= 'mmNetGameMenu';
1872 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1873 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1875 Menu
.DefControl
:= 'mmNetGameMenu';
1876 g_GUI_AddWindow(Menu
);
1878 Menu
:= TGUIWindow
.Create('NetServerMenu');
1879 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1881 Name
:= 'mNetServerMenu';
1882 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1884 Name
:= 'edSrvName';
1885 OnlyDigits
:= False;
1888 Text := NetServerName
;
1890 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1892 Name
:= 'edSrvPassword';
1893 OnlyDigits
:= False;
1896 Text := NetPassword
;
1898 with AddEdit(_lc
[I_NET_PORT
]) do
1904 Text := IntToStr(NetPort
);
1906 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1908 Name
:= 'edMaxPlayers';
1912 Text := IntToStr(NetMaxClients
);
1914 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1916 Name
:= 'swUseMaster';
1917 AddItem(_lc
[I_MENU_YES
]);
1918 AddItem(_lc
[I_MENU_NO
]);
1919 if NetUseMaster
then
1925 with AddLabel(_lc
[I_MENU_MAP
]) do
1930 OnClick
:= @ProcSelectMapMenu
;
1932 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1934 Name
:= 'swGameMode';
1935 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1936 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1937 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1938 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1939 case g_Game_TextToMode(gnGameMode
) of
1941 GM_DM
: ItemIndex
:= 0;
1942 GM_TDM
: ItemIndex
:= 1;
1943 GM_CTF
: ItemIndex
:= 2;
1945 GM_COOP
: ItemIndex
:= 3;
1947 OnChange
:= ProcSwitchMonstersNet
;
1949 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1951 Name
:= 'edTimeLimit';
1955 if gnTimeLimit
> 0 then
1956 Text := IntToStr(gnTimeLimit
);
1958 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1960 Name
:= 'edGoalLimit';
1964 if gnGoalLimit
> 0 then
1965 Text := IntToStr(gnGoalLimit
);
1967 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1969 Name
:= 'edMaxLives';
1973 if gnMaxLives
> 0 then
1974 Text := IntToStr(gnMaxLives
);
1976 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1978 Name
:= 'swPlayers';
1979 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1980 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1981 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1982 ItemIndex
:= gnPlayers
;
1984 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1986 Name
:= 'swTeamDamage';
1987 AddItem(_lc
[I_MENU_YES
]);
1988 AddItem(_lc
[I_MENU_NO
]);
1989 if gnTeamDamage
then
1994 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1996 Name
:= 'swEnableExits';
1997 AddItem(_lc
[I_MENU_YES
]);
1998 AddItem(_lc
[I_MENU_NO
]);
2004 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2006 Name
:= 'swWeaponStay';
2007 AddItem(_lc
[I_MENU_YES
]);
2008 AddItem(_lc
[I_MENU_NO
]);
2009 if gnWeaponStay
then
2014 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2016 Name
:= 'swMonsters';
2017 AddItem(_lc
[I_MENU_YES
]);
2018 AddItem(_lc
[I_MENU_NO
]);
2024 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2027 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2028 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2029 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2031 if gnBotsVS
= 'Players' then
2033 if gnBotsVS
= 'Monsters' then
2037 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2041 Menu
.DefControl
:= 'mNetServerMenu';
2042 g_GUI_AddWindow(Menu
);
2044 Menu
:= TGUIWindow
.Create('NetClientMenu');
2045 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2047 Name
:= 'mNetClientMenu';
2049 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2052 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2058 Text := 'localhost';
2060 with AddEdit(_lc
[I_NET_PORT
]) do
2068 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2071 OnlyDigits
:= False;
2078 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2082 Menu
.DefControl
:= 'mNetClientMenu';
2083 g_GUI_AddWindow(Menu
);
2085 Menu
:= TGUIWindow
.Create('LoadMenu');
2086 Menu
.OnShow
:= ProcLoadMenu
;
2087 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2089 Name
:= 'mmLoadMenu';
2094 Name
:= 'edSlot'+IntToStr(a
);
2097 OnEnter
:= ProcLoadGame
;
2100 Menu
.DefControl
:= 'mmLoadMenu';
2101 g_GUI_AddWindow(Menu
);
2103 Menu
:= TGUIWindow
.Create('SaveMenu');
2104 Menu
.OnShow
:= ProcSaveMenu
;
2105 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2107 Name
:= 'mmSaveMenu';
2112 Name
:= 'edSlot'+IntToStr(a
);
2115 OnChange
:= ProcSaveGame
;
2118 Menu
.DefControl
:= 'mmSaveMenu';
2119 g_GUI_AddWindow(Menu
);
2121 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2122 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2124 Name
:= 'mCustomGameMenu';
2125 with AddLabel(_lc
[I_MENU_MAP
]) do
2130 OnClick
:= @ProcSelectMapMenu
;
2132 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2134 Name
:= 'swGameMode';
2135 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2136 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2137 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2138 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2139 case g_Game_TextToMode(gcGameMode
) of
2141 GM_DM
: ItemIndex
:= 0;
2142 GM_TDM
: ItemIndex
:= 1;
2143 GM_CTF
: ItemIndex
:= 2;
2145 GM_COOP
: ItemIndex
:= 3;
2147 OnChange
:= ProcSwitchMonstersCustom
;
2149 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2151 Name
:= 'edTimeLimit';
2155 if gcTimeLimit
> 0 then
2156 Text := IntToStr(gcTimeLimit
);
2158 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2160 Name
:= 'edGoalLimit';
2164 if gcGoalLimit
> 0 then
2165 Text := IntToStr(gcGoalLimit
);
2167 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2169 Name
:= 'edMaxLives';
2173 if gcMaxLives
> 0 then
2174 Text := IntToStr(gcMaxLives
);
2176 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2178 Name
:= 'swPlayers';
2179 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2180 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2181 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2182 ItemIndex
:= gcPlayers
;
2184 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2186 Name
:= 'swTeamDamage';
2187 AddItem(_lc
[I_MENU_YES
]);
2188 AddItem(_lc
[I_MENU_NO
]);
2189 if gcTeamDamage
then
2194 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2196 Name
:= 'swEnableExits';
2197 AddItem(_lc
[I_MENU_YES
]);
2198 AddItem(_lc
[I_MENU_NO
]);
2204 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2206 Name
:= 'swWeaponStay';
2207 AddItem(_lc
[I_MENU_YES
]);
2208 AddItem(_lc
[I_MENU_NO
]);
2209 if gcWeaponStay
then
2214 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2216 Name
:= 'swMonsters';
2217 AddItem(_lc
[I_MENU_YES
]);
2218 AddItem(_lc
[I_MENU_NO
]);
2224 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2227 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2228 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2229 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2231 if gcBotsVS
= 'Players' then
2233 if gcBotsVS
= 'Monsters' then
2237 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2241 Menu
.DefControl
:= 'mCustomGameMenu';
2242 g_GUI_AddWindow(Menu
);
2244 Menu
:= TGUIWindow
.Create('CampaignMenu');
2245 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2247 Name
:= 'mCampaignMenu';
2256 with AddFileList('', 15, 4) do
2259 OnChange
:= ProcSelectCampaignWAD
;
2263 FileMask
:= '*.wad|*.pk3|*.zip';
2264 SetBase(MapsDir
+'megawads/');
2267 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2269 Name
:= 'lbWADName';
2273 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2275 Name
:= 'lbWADAuthor';
2279 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2280 with AddMemo('', 15, 3) do
2282 Name
:= 'meWADDescription';
2283 Color
:= MENU_ITEMSCTRL_COLOR
;
2285 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2287 Name
:= 'swPlayers';
2288 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2289 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2292 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2296 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2298 Name
:= 'mpWADImage';
2299 DefaultRes
:= 'NOPIC';
2300 X
:= GetControl('lsWAD').X
+4;
2301 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2304 Menu
.DefControl
:= 'mCampaignMenu';
2305 g_GUI_AddWindow(Menu
);
2307 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2308 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2310 Name
:= 'mSelectMapMenu';
2311 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2314 OnChange
:= ProcSelectWAD
;
2318 FileMask
:= '*.wad|*.pk3|*.zip';
2321 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2325 OnChange
:= ProcSelectMap
;
2328 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2330 Name
:= 'lbMapName';
2334 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2336 Name
:= 'lbMapAuthor';
2340 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2342 Name
:= 'lbMapSize';
2346 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2348 Name
:= 'meMapDescription';
2353 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2355 Name
:= 'mpMapPreview';
2356 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2357 Y
:= GetControl('lsMapWAD').Y
;
2359 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2361 Name
:= 'lbMapScale';
2364 Color
:= MENU_ITEMSCTRL_COLOR
;
2365 X
:= GetControl('lsMapWAD').X
+
2366 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2367 2 + MAPPREVIEW_WIDTH
*4;
2368 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2371 Menu
.OnClose
:= ProcSetMap
;
2372 Menu
.DefControl
:= 'mSelectMapMenu';
2373 g_GUI_AddWindow(Menu
);
2375 Menu
:= TGUIWindow
.Create('OptionsMenu');
2376 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2378 Name
:= 'mmOptionsMenu';
2379 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2380 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2381 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2382 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2383 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2384 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2386 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2387 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2389 Menu
.OnClose
:= ProcApplyOptions
;
2390 Menu
.DefControl
:= 'mmOptionsMenu';
2391 g_GUI_AddWindow(Menu
);
2393 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2394 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2395 g_GUI_AddWindow(Menu
);
2397 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2398 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2400 Name
:= 'mOptionsVideoMenu';
2401 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2402 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2408 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2411 AddItem(_lc
[I_MENU_YES
]);
2412 AddItem(_lc
[I_MENU_NO
]);
2414 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2416 Name
:= 'swTextureFilter';
2417 AddItem(_lc
[I_MENU_YES
]);
2418 AddItem(_lc
[I_MENU_NO
]);
2420 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2422 Name
:= 'swLegacyNPOT';
2423 AddItem(_lc
[I_MENU_NO
]);
2424 AddItem(_lc
[I_MENU_YES
]);
2427 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2430 Menu
.DefControl
:= 'mOptionsVideoMenu';
2431 g_GUI_AddWindow(Menu
);
2433 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2434 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2436 Name
:= 'mOptionsVideoResMenu';
2437 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2439 Name
:= 'lbCurrentRes';
2443 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2445 Name
:= 'lsResolution';
2448 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2450 Name
:= 'swFullScreen';
2451 AddItem(_lc
[I_MENU_YES
]);
2452 AddItem(_lc
[I_MENU_NO
]);
2455 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2458 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2459 g_GUI_AddWindow(Menu
);
2461 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2462 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2464 Name
:= 'mOptionsSoundMenu';
2465 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2467 Name
:= 'scMusicLevel';
2469 OnChange
:= ProcChangeSoundSettings
;
2471 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2473 Name
:= 'scSoundLevel';
2475 OnChange
:= ProcChangeSoundSettings
;
2477 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2479 Name
:= 'scMaxSimSounds';
2482 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2484 Name
:= 'swAnnouncer';
2485 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2486 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2487 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2488 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2490 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2491 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2493 Name
:= 'swSoundEffects';
2494 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2495 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2497 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2499 Name
:= 'swInactiveSounds';
2500 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2501 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2505 Menu
.DefControl
:= 'mOptionsSoundMenu';
2506 g_GUI_AddWindow(Menu
);
2508 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2509 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2511 Name
:= 'mOptionsGameMenu';
2512 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2514 Name
:= 'scParticlesCount';
2517 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2519 Name
:= 'swBloodCount';
2520 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2521 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2522 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2523 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2524 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2526 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2528 Name
:= 'scShellsMax';
2531 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2533 Name
:= 'scGibsMax';
2536 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2538 Name
:= 'scCorpsesMax';
2541 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2543 Name
:= 'swGibsCount';
2544 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2545 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2546 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2547 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2548 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2550 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2552 Name
:= 'swCorpseType';
2553 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2554 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2556 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2558 Name
:= 'swGibsType';
2559 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2560 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2562 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2564 Name
:= 'swBloodType';
2565 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2566 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2568 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2570 Name
:= 'swScreenFlash';
2571 AddItem(_lc
[I_MENU_NO
]);
2572 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2573 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2575 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2577 Name
:= 'swBackground';
2578 AddItem(_lc
[I_MENU_YES
]);
2579 AddItem(_lc
[I_MENU_NO
]);
2581 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2583 Name
:= 'swMessages';
2584 AddItem(_lc
[I_MENU_YES
]);
2585 AddItem(_lc
[I_MENU_NO
]);
2587 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2589 Name
:= 'swRevertPlayers';
2590 AddItem(_lc
[I_MENU_YES
]);
2591 AddItem(_lc
[I_MENU_NO
]);
2593 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2595 Name
:= 'swChatBubble';
2596 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2597 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2598 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2599 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2600 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2604 Menu
.DefControl
:= 'mOptionsGameMenu';
2605 g_GUI_AddWindow(Menu
);
2607 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2608 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2610 Name
:= 'mOptionsControlsMenu';
2611 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2612 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2613 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2614 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2615 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2617 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2618 AddButton(nil, _lc
[I_MENU_PLAYER_1_ALT
], 'OptionsControlsP1MenuAlt');
2619 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2620 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2621 AddButton(nil, _lc
[I_MENU_PLAYER_2_ALT
], 'OptionsControlsP2MenuAlt');
2622 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2624 if e_JoysticksAvailable
<> 0 then
2625 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2627 Menu
.DefControl
:= 'mOptionsControlsMenu';
2628 g_GUI_AddWindow(Menu
);
2630 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2631 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2633 Name
:= 'mOptionsControlsP1Menu';
2634 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2635 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2636 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2637 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2638 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2639 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2640 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2641 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2642 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2644 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2645 g_GUI_AddWindow(Menu
);
2647 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuAlt');
2648 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_ALT
]))) do
2650 Name
:= 'mOptionsControlsP1MenuAlt';
2651 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2652 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2653 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2654 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2655 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2656 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2657 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2658 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2659 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2660 AddKeyRead(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2662 Menu
.DefControl
:= 'mOptionsControlsP1MenuAlt';
2663 g_GUI_AddWindow(Menu
);
2665 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2666 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2668 Name
:= 'mOptionsControlsP1MenuWeapons';
2670 AddKeyRead(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2671 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2673 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2677 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2679 Name
:= 'mOptionsControlsP2Menu';
2680 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2681 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2682 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2683 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2684 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2685 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2686 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2687 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2688 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2690 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2691 g_GUI_AddWindow(Menu
);
2693 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuAlt');
2694 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_ALT
]))) do
2696 Name
:= 'mOptionsControlsP2MenuAlt';
2697 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2698 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2699 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2700 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2701 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2702 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2703 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2704 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2705 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2706 AddKeyRead(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2708 Menu
.DefControl
:= 'mOptionsControlsP2MenuAlt';
2709 g_GUI_AddWindow(Menu
);
2712 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2713 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2715 Name
:= 'mOptionsControlsP2MenuWeapons';
2717 AddKeyRead(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2718 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2720 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2721 g_GUI_AddWindow(Menu
);
2723 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2724 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2726 Name
:= 'mOptionsControlsJoystickMenu';
2727 for i
:= 0 to e_JoysticksAvailable
-1 do
2728 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2730 Name
:= 'scDeadzone' + IntToStr(i
);
2734 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2735 g_GUI_AddWindow(Menu
);
2737 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2738 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2740 Name
:= 'mOptionsPlayersMenu';
2741 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2742 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2744 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2745 g_GUI_AddWindow(Menu
);
2747 CreatePlayerOptionsMenu('P1');
2748 CreatePlayerOptionsMenu('P2');
2750 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2751 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2753 Name
:= 'mOptionsPlayersMIMenu';
2754 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2759 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2764 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2766 Name
:= 'meComment';
2769 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2770 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2773 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2777 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2778 g_GUI_AddWindow(Menu
);
2780 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2781 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2783 Name
:= 'mOptionsLanguageMenu';
2784 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2785 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2788 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2789 g_GUI_AddWindow(Menu
);
2791 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2792 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2793 g_GUI_AddWindow(Menu
);
2795 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2796 Menu
.BackTexture
:= 'INTER';
2797 Menu
.OnClose
:= ProcAuthorsClose
;
2801 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2803 Color
:= _RGB(255, 0, 0);
2804 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2806 _y
:= _y
+GetHeight();
2808 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2810 Color
:= _RGB(255, 0, 0);
2811 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2813 _y
:= _y
+GetHeight()+32;
2815 // ×òî äåëàë: Êòî äåëàë
2816 cx
:= gScreenWidth
div 2 - 320 + 64;
2817 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2819 Color
:= _RGB(255, 0, 0);
2824 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2826 Color
:= _RGB(255, 255, 255);
2831 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2833 Color
:= _RGB(255, 0, 0);
2838 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2840 Color
:= _RGB(255, 255, 255);
2845 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2847 Color
:= _RGB(255, 255, 255);
2852 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2854 Color
:= _RGB(255, 0, 0);
2859 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2861 Color
:= _RGB(255, 255, 255);
2866 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2868 Color
:= _RGB(255, 0, 0);
2873 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2875 Color
:= _RGB(255, 255, 255);
2878 _y
:= gScreenHeight
- 128;
2881 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2883 Color
:= _RGB(255, 0, 0);
2888 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2890 Color
:= _RGB(255, 255, 255);
2893 _y
:= _y
+GetHeight();
2895 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2897 Color
:= _RGB(255, 255, 255);
2900 _y
:= _y
+GetHeight();
2902 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2904 Color
:= _RGB(255, 255, 255);
2907 _y
:= gScreenHeight
- 32;
2909 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2911 Color
:= _RGB(255, 0, 0);
2912 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2918 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2919 g_GUI_AddWindow(Menu
);
2921 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2922 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2924 Name
:= 'mmGameSingleMenu';
2925 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2926 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2927 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2928 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2929 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2930 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2932 Menu
.DefControl
:= 'mmGameSingleMenu';
2933 Menu
.MainWindow
:= True;
2934 Menu
.OnClose
:= ProcGMClose
;
2935 Menu
.OnShow
:= ProcGMShow
;
2936 g_GUI_AddWindow(Menu
);
2938 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2939 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2940 g_GUI_AddWindow(Menu
);
2942 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2943 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2944 g_GUI_AddWindow(Menu
);
2946 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2947 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2949 Name
:= 'mmGameCustomMenu';
2950 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2951 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2952 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2953 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2954 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2955 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2956 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2958 Menu
.DefControl
:= 'mmGameCustomMenu';
2959 Menu
.MainWindow
:= True;
2960 Menu
.OnClose
:= ProcGMClose
;
2961 Menu
.OnShow
:= ProcGMShow
;
2962 g_GUI_AddWindow(Menu
);
2964 Menu
:= TGUIWindow
.Create('GameServerMenu');
2965 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2967 Name
:= 'mmGameServerMenu';
2968 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2969 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2970 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2971 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2972 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2974 Menu
.DefControl
:= 'mmGameServerMenu';
2975 Menu
.MainWindow
:= True;
2976 Menu
.OnClose
:= ProcGMClose
;
2977 Menu
.OnShow
:= ProcGMShow
;
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= TGUIWindow
.Create('GameClientMenu');
2981 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2983 Name
:= 'mmGameClientMenu';
2984 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2985 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2986 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2988 Menu
.DefControl
:= 'mmGameClientMenu';
2989 Menu
.MainWindow
:= True;
2990 Menu
.OnClose
:= ProcGMClose
;
2991 Menu
.OnShow
:= ProcGMShow
;
2992 g_GUI_AddWindow(Menu
);
2994 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2995 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2997 Name
:= 'mClientPasswordMenu';
2998 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3006 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3009 Menu
.DefControl
:= 'mClientPasswordMenu';
3010 g_GUI_AddWindow(Menu
);
3012 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3013 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3015 Name
:= 'mGameSetGameMenu';
3016 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3018 Name
:= 'swTeamDamage';
3019 AddItem(_lc
[I_MENU_YES
]);
3020 AddItem(_lc
[I_MENU_NO
]);
3023 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3025 Name
:= 'edTimeLimit';
3030 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3032 Name
:= 'edGoalLimit';
3037 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3039 Name
:= 'edMaxLives';
3044 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3047 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3048 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3049 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3055 Menu
.DefControl
:= 'mGameSetGameMenu';
3056 Menu
.OnClose
:= ProcApplyGameSet
;
3057 g_GUI_AddWindow(Menu
);
3059 Menu
:= TGUIWindow
.Create('TeamMenu');
3060 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3062 Name
:= 'mmTeamMenu';
3063 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3064 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3065 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3066 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3067 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3069 Menu
.DefControl
:= 'mmTeamMenu';
3070 Menu
.OnShow
:= ProcChangePlayers
;
3071 g_GUI_AddWindow(Menu
);
3074 procedure g_Menu_Show_SaveMenu();
3076 if g_Game_IsTestMap
then
3078 if gGameSettings
.GameType
= GT_SINGLE
then
3079 g_GUI_ShowWindow('GameSingleMenu')
3082 if g_Game_IsClient
then
3085 if g_Game_IsNet
then
3088 g_GUI_ShowWindow('GameCustomMenu');
3090 g_GUI_ShowWindow('SaveMenu');
3091 g_Sound_PlayEx('MENU_OPEN');
3094 procedure g_Menu_Show_LoadMenu();
3096 if gGameSettings
.GameType
= GT_SINGLE
then
3097 g_GUI_ShowWindow('GameSingleMenu')
3100 if g_Game_IsClient
then
3103 if g_Game_IsNet
then
3106 g_GUI_ShowWindow('GameCustomMenu');
3108 g_GUI_ShowWindow('LoadMenu');
3109 g_Sound_PlayEx('MENU_OPEN');
3112 procedure g_Menu_Show_GameSetGame();
3114 if gGameSettings
.GameType
= GT_SINGLE
then
3115 g_GUI_ShowWindow('GameSingleMenu')
3118 if g_Game_IsClient
then
3121 if g_Game_IsNet
then
3122 g_GUI_ShowWindow('GameServerMenu')
3124 g_GUI_ShowWindow('GameCustomMenu');
3127 g_GUI_ShowWindow('GameSetGameMenu');
3128 g_Sound_PlayEx('MENU_OPEN');
3131 procedure g_Menu_Show_OptionsVideo();
3133 if gGameSettings
.GameType
= GT_SINGLE
then
3134 g_GUI_ShowWindow('GameSingleMenu')
3137 if g_Game_IsClient
then
3138 g_GUI_ShowWindow('GameClientMenu')
3140 if g_Game_IsNet
then
3141 g_GUI_ShowWindow('GameServerMenu')
3143 g_GUI_ShowWindow('GameCustomMenu');
3146 g_GUI_ShowWindow('OptionsMenu');
3147 g_GUI_ShowWindow('OptionsVideoMenu');
3148 g_Sound_PlayEx('MENU_OPEN');
3151 procedure g_Menu_Show_OptionsSound();
3153 if gGameSettings
.GameType
= GT_SINGLE
then
3154 g_GUI_ShowWindow('GameSingleMenu')
3157 if g_Game_IsClient
then
3158 g_GUI_ShowWindow('GameClientMenu')
3160 if g_Game_IsNet
then
3161 g_GUI_ShowWindow('GameServerMenu')
3163 g_GUI_ShowWindow('GameCustomMenu');
3166 g_GUI_ShowWindow('OptionsMenu');
3167 g_GUI_ShowWindow('OptionsSoundMenu');
3168 g_Sound_PlayEx('MENU_OPEN');
3171 procedure g_Menu_Show_EndGameMenu();
3173 g_GUI_ShowWindow('EndGameMenu');
3174 g_Sound_PlayEx('MENU_OPEN');
3177 procedure g_Menu_Show_QuitGameMenu();
3179 g_GUI_ShowWindow('ExitMenu');
3180 g_Sound_PlayEx('MENU_OPEN');
3183 procedure g_Menu_Init();
3190 procedure g_Menu_Free();
3194 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3199 procedure g_Menu_Reset();
3203 g_GUI_SaveMenuPos();
3204 ex
:= g_GUI_Destroy();
3208 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3213 g_Game_SetDebugMode();
3215 g_GUI_LoadMenuPos();