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'));
168 with menu
, gGameControls
.P1Control
do
170 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
171 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
172 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
173 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
174 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
175 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
176 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
177 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
178 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
181 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
183 with menu
, gGameControls
.P2Control
do
185 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
186 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
187 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
188 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
189 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
190 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
191 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
192 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
193 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
196 if e_JoysticksAvailable
> 0 then
198 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
201 for i
:= 0 to e_JoysticksAvailable
-1 do
202 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
206 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
208 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
209 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
210 TEAM_RED
, TEAM_BLUE
);
212 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
214 gPlayer1Settings
.Model
:= Model
.Name
;
215 gPlayer1Settings
.Color
:= Model
.Color
;
218 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
220 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
221 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
222 TEAM_RED
, TEAM_BLUE
);
223 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
225 gPlayer2Settings
.Model
:= Model
.Name
;
226 gPlayer2Settings
.Color
:= Model
.Color
;
229 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
230 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
232 if g_Game_IsServer
then
234 if gPlayer1
<> nil then
236 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
237 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
238 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
239 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
241 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
244 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
247 if gPlayer2
<> nil then
249 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
250 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
251 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
252 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
254 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
259 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
261 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
264 procedure ReadOptions();
269 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
271 with TGUISwitch(menu
.GetControl('swBPP')) do
277 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
278 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
280 with TGUISwitch(menu
.GetControl('swVSync')) do
281 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
283 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
284 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
286 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
288 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
289 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
290 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
292 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
293 if gMuteWhenInactive
then
298 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
300 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
301 if gSoundEffectsDF
then
306 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
308 with menu
, gGameControls
.P1Control
do
310 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
311 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
312 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
313 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
314 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
315 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
316 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
317 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
318 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
321 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
323 with menu
, gGameControls
.P2Control
do
325 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
326 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
327 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
328 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
329 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
330 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
331 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
332 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
333 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
336 if e_JoysticksAvailable
> 0 then
338 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
341 for i
:= 0 to e_JoysticksAvailable
-1 do
342 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
347 with menu
, gGameControls
.GameControls
do
349 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
350 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
351 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
352 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
355 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
357 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
358 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
359 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
360 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
361 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
363 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
366 with TGUISwitch(menu
.GetControl('swBloodType')) do
367 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
369 with TGUISwitch(menu
.GetControl('swCorpseType')) do
370 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
372 with TGUISwitch(menu
.GetControl('swGibsType')) do
373 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
375 with TGUISwitch(menu
.GetControl('swGibsCount')) do
384 with TGUISwitch(menu
.GetControl('swBackGround')) do
385 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
387 with TGUISwitch(menu
.GetControl('swMessages')) do
388 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
390 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
391 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
393 with TGUISwitch(menu
.GetControl('swChatBubble')) do
394 ItemIndex
:= gChatBubble
;
396 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
398 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
399 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
401 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
402 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
404 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
405 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
406 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
408 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
410 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
411 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
413 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
414 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
416 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
417 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
418 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
420 ProcSelectModel(nil);
423 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
425 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
426 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
427 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
429 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
432 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
434 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
435 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
436 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
438 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
441 procedure ProcStartCustomGame();
447 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
449 Map
:= TGUILabel(GetControl('lbMap')).Text;
452 if Pos(':\', Map
) = 0 then
455 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
456 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
457 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
458 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
459 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
461 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
462 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
463 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
464 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
467 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
469 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
471 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
473 Options
:= Options
or GAME_OPTION_MONSTERS
;
474 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
476 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
478 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
479 gcBotsVS
:= 'Monsters';
482 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
483 gcBotsVS
:= 'Everybody';
486 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
487 gcBotsVS
:= 'Players';
494 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
496 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
497 gcMaxLives
, Options
, gcPlayers
);
501 procedure ProcStartNetGame();
507 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
509 Map
:= TGUILabel(GetControl('lbMap')).Text;
512 if Pos(':\', Map
) = 0 then
515 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
516 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
517 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
518 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
519 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
520 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
522 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
523 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
524 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
525 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
528 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
530 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
532 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
534 Options
:= Options
or GAME_OPTION_MONSTERS
;
535 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
537 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
539 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
540 gnBotsVS
:= 'Monsters';
543 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
544 gnBotsVS
:= 'Everybody';
547 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
548 gnBotsVS
:= 'Players';
553 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
554 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
555 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
556 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
557 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
560 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
561 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
563 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
564 Options
, gnPlayers
, 0, NetPort
);
567 procedure ProcConnectNetGame();
571 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
573 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
574 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
575 PW
:= TGUIEdit(GetControl('edPW')).Text;
578 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
579 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
582 procedure ProcEnterPassword();
586 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
588 NetClientIP
:= PromptIP
;
589 NetClientPort
:= PromptPort
;
590 PW
:= TGUIEdit(GetControl('edPW')).Text;
593 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
594 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
597 procedure ProcServerlist();
599 if not NetInitDone
then
601 if (not g_Net_Init()) then
603 g_Console_Add('NET: ERROR: Failed to init ENet!');
610 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
612 gState
:= STATE_SLIST
;
613 g_ActiveWindow
:= nil;
615 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
620 slReturnPressed
:= True;
621 if g_Net_Slist_Fetch(slCurrent
) then
623 if slCurrent
= nil then
624 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
627 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
630 procedure ProcStartCampaign();
636 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
638 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
639 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
646 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
649 procedure ProcSelectMap(Sender
: TGUIControl
);
653 wad
, map
, res
: String;
655 win
:= g_GUI_GetWindow('SelectMapMenu');
656 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
658 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
659 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
661 if (wad
= '') or (map
= '') then
662 begin // Ýòî íå êàðòà
663 TGUILabel(GetControl('lbMapName')).Text := '';
664 TGUILabel(GetControl('lbMapAuthor')).Text := '';
665 TGUILabel(GetControl('lbMapSize')).Text := '';
666 TGUIMemo(GetControl('meMapDescription')).SetText('');
667 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
668 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
674 a
:= g_Map_GetMapInfo(res
);
676 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
677 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
678 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
679 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
680 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
681 TGUILabel(win
.GetControl('lbMapScale')).Text :=
682 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
687 procedure ProcSelectWAD(Sender
: TGUIControl
);
692 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
694 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
696 with TGUIListBox(GetControl('lsMapRes')) do
702 list
:= g_Map_GetMapsList(wad
);
716 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
722 win
:= g_GUI_GetWindow('CampaignMenu');
723 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
725 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
729 TGUILabel(GetControl('lbWADName')).Text := '';
730 TGUILabel(GetControl('lbWADAuthor')).Text := '';
731 TGUIMemo(GetControl('meWADDescription')).SetText('');
734 a
:= g_Game_GetMegaWADInfo(wad
);
736 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
737 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
738 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
740 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
744 fn
:= g_ExtractWadName(a
.pic
);
746 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
748 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
753 procedure ProcChangeColor(Sender
: TGUIControl
);
757 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
758 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
759 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
760 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
761 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
762 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
764 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
765 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
766 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
767 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
768 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
769 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
772 procedure ProcSelectModel(Sender
: TGUIControl
);
777 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
778 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
779 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
781 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
782 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
783 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
785 ProcChangeColor(nil);
788 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
800 wad
:= TWADFile
.Create
;
801 if wad
.ReadFile(GameWAD
) then
802 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
807 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
809 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
810 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
811 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
812 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
814 if g_Texture_Get('FONT_STD', ID
) then
815 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
820 if cfglen
<> 0 then FreeMem(cfgdata
);
823 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
829 cfgdata
, fntdata
: Pointer;
830 cfglen
, fntlen
: Integer;
838 wad
:= TWADFile
.Create
;
839 if wad
.ReadFile(GameWAD
) then
841 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
842 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
848 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
849 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
850 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
852 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
853 FontID
:= e_CharFont_Create(spc
);
857 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
858 if chrwidth
= 0 then Continue
;
860 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
862 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
868 if cfglen
<> 0 then FreeMem(cfgdata
);
869 if fntlen
<> 0 then FreeMem(fntdata
);
872 procedure MenuLoadData();
874 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
876 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
877 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
878 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
879 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
880 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
881 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
882 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
883 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
884 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
885 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
886 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
887 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
888 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
889 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
890 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
891 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
892 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
893 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
894 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
895 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
896 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
897 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
898 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
899 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
901 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
902 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
903 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
904 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
905 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
906 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
907 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
910 procedure MenuFreeData();
912 e_CharFont_Remove(gMenuFont
);
913 e_CharFont_Remove(gMenuSmallFont
);
915 g_Texture_Delete('MAINMENU_MARKER1');
916 g_Texture_Delete('MAINMENU_MARKER2');
917 g_Texture_Delete('SCROLL_LEFT');
918 g_Texture_Delete('SCROLL_RIGHT');
919 g_Texture_Delete('SCROLL_MIDDLE');
920 g_Texture_Delete('SCROLL_MARKER');
921 g_Texture_Delete('EDIT_LEFT');
922 g_Texture_Delete('EDIT_RIGHT');
923 g_Texture_Delete('EDIT_MIDDLE');
924 g_Texture_Delete('BOX1');
925 g_Texture_Delete('BOX2');
926 g_Texture_Delete('BOX3');
927 g_Texture_Delete('BOX4');
928 g_Texture_Delete('BOX5');
929 g_Texture_Delete('BOX6');
930 g_Texture_Delete('BOX7');
931 g_Texture_Delete('BOX8');
932 g_Texture_Delete('BOX9');
933 g_Texture_Delete('BSCROLL_UP_A');
934 g_Texture_Delete('BSCROLL_UP_U');
935 g_Texture_Delete('BSCROLL_DOWN_A');
936 g_Texture_Delete('BSCROLL_DOWN_U');
937 g_Texture_Delete('BSCROLL_MIDDLE');
938 g_Texture_Delete('NOPIC');
940 g_Sound_Delete('MENU_SELECT');
941 g_Sound_Delete('MENU_OPEN');
942 g_Sound_Delete('MENU_CLOSE');
943 g_Sound_Delete('MENU_CHANGE');
944 g_Sound_Delete('SCROLL_ADD');
945 g_Sound_Delete('SCROLL_SUB');
946 g_Sound_Delete('SOUND_PLAYER_FALL');
949 procedure ProcAuthorsMenu();
951 gMusic
.SetByName('MUSIC_INTERMUS');
955 procedure ProcExitMenuKeyDown (yes
: Boolean);
963 g_Game_StopAllSounds(True);
965 0: s
:= 'SOUND_MONSTER_PAIN';
966 1: s
:= 'SOUND_MONSTER_DIE_3';
967 2: s
:= 'SOUND_MONSTER_SLOP';
968 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
969 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
970 5: s
:= 'SOUND_MONSTER_MAN_DIE';
971 6: s
:= 'SOUND_MONSTER_BSP_DIE';
972 7: s
:= 'SOUND_MONSTER_VILE_DIE';
973 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
974 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
975 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
976 11: s
:= 'SOUND_MONSTER_BARON_DIE';
977 12: s
:= 'SOUND_MONSTER_CACO_DIE';
978 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
979 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
980 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
981 else s
:= 'SOUND_PLAYER_FALL';
983 snd
:= TPlayableSound
.Create();
984 res
:= snd
.SetByName(s
);
985 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
989 while snd
.IsPlaying() do begin end;
997 procedure ProcLoadMenu();
1002 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1006 procedure ProcSaveMenu();
1011 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1015 procedure ProcSaveGame(Sender
: TGUIControl
);
1019 if g_Game_IsNet
then Exit
;
1020 if g_Game_IsTestMap
then Exit
;
1021 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1022 g_Game_PauseAllSounds(True);
1023 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1025 g_ActiveWindow
:= nil;
1026 g_Game_Pause(False);
1029 procedure ProcLoadGame(Sender
: TGUIControl
);
1033 if g_Game_IsNet
then Exit
;
1034 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1035 if g_LoadGame(a
) then
1036 g_Game_PauseAllSounds(False)
1037 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1038 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1041 procedure ProcSingle1Player();
1043 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1046 procedure ProcSingle2Players();
1048 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1051 procedure ProcSelectMapMenu();
1054 wad_lb
: TGUIFileListBox
;
1055 map_lb
: TGUIListBox
;
1058 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1059 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1060 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1062 if wad_lb
.SelectedItem() <> '' then
1063 map
:= map_lb
.SelectedItem()
1067 wad_lb
.UpdateFileList();
1070 if wad_lb
.SelectedItem() <> '' then
1073 map_lb
.SelectItem(map
);
1075 if map_lb
.SelectedItem() <> '' then
1079 g_GUI_ShowWindow('SelectMapMenu');
1082 procedure ProcSelectCampaignMenu();
1085 wad_lb
: TGUIFileListBox
;
1087 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1088 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1090 wad_lb
.UpdateFileList();
1092 if wad_lb
.SelectedItem() <> '' then
1093 ProcSelectCampaignWAD(nil);
1096 procedure ProcSetMap();
1098 wad
, map
, res
: String;
1100 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1102 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1103 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1106 if (wad
= '') or (map
= '') then
1109 res
:= wad
+':\'+map
;
1111 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1112 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1115 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1121 g_Sound_SetupAllVolumes(
1122 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1123 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1127 procedure ProcOptionsPlayersMIMenu();
1132 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1134 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1136 if a
= '' then Exit
;
1138 b
:= g_PlayerModel_GetInfo(a
);
1140 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1142 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1143 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1144 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1146 if b
.HaveWeapon
then
1147 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1149 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1152 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1155 procedure ProcOptionsPlayersAnim();
1159 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1164 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1167 Model
.GetCurrentAnimation
.Loop
:= True;
1168 Model
.GetCurrentAnimationMask
.Loop
:= True;
1172 procedure ProcOptionsPlayersWeap();
1176 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1181 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1185 procedure ProcOptionsPlayersRot();
1189 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1190 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1191 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1194 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1198 g_Options_SetDefault();
1204 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1206 if yes
then ReadOptions();
1210 procedure ProcAuthorsClose();
1212 gMusic
.SetByName('MUSIC_MENU');
1214 gState
:= STATE_MENU
;
1217 procedure ProcGMClose();
1219 g_Game_InGameMenu(False);
1222 procedure ProcGMShow();
1227 if (gGameSettings
.GameType
= GT_SINGLE
) and
1228 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1229 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1230 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1232 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1233 if g_Game_IsTestMap
then
1234 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1235 TGUIMainMenu(g_ActiveWindow
.GetControl(
1236 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1239 procedure ProcChangePlayers();
1241 TeamGame
, Spectator
, AddTwo
: Boolean;
1242 P1Team
{, P2Team}: Byte;
1243 bP2
: TGUITextButton
;
1245 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1246 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1247 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1248 P1Team
:= TEAM_NONE
;
1249 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1251 //P2Team := TEAM_NONE;
1252 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1254 TGUIMainMenu(g_ActiveWindow
.GetControl(
1255 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1256 TGUIMainMenu(g_ActiveWindow
.GetControl(
1257 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1258 TGUIMainMenu(g_ActiveWindow
.GetControl(
1259 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1261 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1262 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1263 bP2
.Enabled
:= AddTwo
and not Spectator
;
1265 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1267 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1268 if gPlayer2
= nil then
1269 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1271 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1273 TGUIMainMenu(g_ActiveWindow
.GetControl(
1274 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1277 procedure ProcJoinRed();
1279 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1281 if g_Game_IsServer
then
1283 if gPlayer1
= nil then
1284 g_Game_AddPlayer(TEAM_RED
)
1287 if gPlayer1
.Team
<> TEAM_RED
then
1289 gPlayer1
.SwitchTeam
;
1290 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1293 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1298 gPlayer1Settings
.Team
:= TEAM_RED
;
1299 MC_SEND_PlayerSettings
;
1300 if gPlayer1
= nil then
1301 g_Game_AddPlayer(TEAM_RED
);
1303 g_ActiveWindow
:= nil;
1304 g_Game_Pause(False);
1307 procedure ProcJoinBlue();
1309 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1311 if g_Game_IsServer
then
1313 if gPlayer1
= nil then
1314 g_Game_AddPlayer(TEAM_BLUE
)
1317 if gPlayer1
.Team
<> TEAM_BLUE
then
1319 gPlayer1
.SwitchTeam
;
1320 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1323 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1328 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1329 MC_SEND_PlayerSettings
;
1330 if gPlayer1
= nil then
1331 g_Game_AddPlayer(TEAM_BLUE
);
1333 g_ActiveWindow
:= nil;
1334 g_Game_Pause(False);
1337 procedure ProcJoinGame();
1339 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1341 if gPlayer1
= nil then
1343 g_ActiveWindow
:= nil;
1344 g_Game_Pause(False);
1347 procedure ProcSwitchP2();
1349 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1351 if gPlayer1
= nil then
1353 if gPlayer2
= nil then
1356 g_Game_RemovePlayer();
1357 g_ActiveWindow
:= nil;
1358 g_Game_Pause(False);
1361 procedure ProcSpectate();
1363 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1366 g_ActiveWindow
:= nil;
1367 g_Game_Pause(False);
1370 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1372 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1375 procedure ProcEndMenuKeyDown (yes
: Boolean);
1377 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1380 procedure ProcSetRussianLanguage();
1382 if gLanguage
<> LANGUAGE_RUSSIAN
then
1384 gLanguage
:= LANGUAGE_RUSSIAN
;
1385 gLanguageChange
:= True;
1386 gAskLanguage
:= False;
1388 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1390 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1395 procedure ProcSetEnglishLanguage();
1397 if gLanguage
<> LANGUAGE_ENGLISH
then
1399 gLanguage
:= LANGUAGE_ENGLISH
;
1400 gLanguageChange
:= True;
1401 gAskLanguage
:= False;
1403 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1405 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1410 procedure ReadGameSettings();
1414 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1416 with gGameSettings
do
1418 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1419 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1424 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1425 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1426 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1428 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1429 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1430 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1433 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1438 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1440 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1441 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1442 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1443 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1444 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1445 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1446 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1447 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1451 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1452 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1457 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1458 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1463 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1464 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1469 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1470 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1475 procedure ProcApplyGameSet();
1479 stat
: TPlayerStatArray
;
1481 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1483 if not g_Game_IsServer
then Exit
;
1485 with gGameSettings
do
1487 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1489 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1490 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1492 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1495 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1497 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1503 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1505 TimeLimit
:= Max(n
, b
);
1509 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1511 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1518 if GameMode
= GM_DM
then
1520 stat
:= g_Player_GetStats();
1522 for a
:= 0 to High(stat
) do
1523 if stat
[a
].Frags
> b
then
1527 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1529 GoalLimit
:= Max(n
, b
);
1533 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1535 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1536 if n
< 0 then n
:= 0;
1537 if n
> 255 then n
:= 255;
1543 stat
:= g_Player_GetStats();
1545 for a
:= 0 to High(stat
) do
1546 if stat
[a
].Lives
> b
then
1549 MaxLives
:= Max(n
, b
);
1553 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1555 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1558 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1559 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1563 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1564 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1568 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1569 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1575 if g_Game_IsNet
then MH_SEND_GameSettings
;
1578 procedure ProcVideoOptionsRes();
1584 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1586 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1587 IntToStr(gScreenWidth
) +
1588 ' x ' + IntToStr(gScreenHeight
) +
1589 ', ' + IntToStr(gBPP
) + ' bpp';
1591 with TGUIListBox(menu
.GetControl('lsResolution')) do
1593 list
:= GetDisplayModes(gBPP
, SR
);
1604 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1611 procedure ProcApplyVideoOptions();
1614 Fullscreen
: Boolean;
1615 SWidth
, SHeight
: Integer;
1618 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1620 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1621 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1623 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1625 if (SWidth
<> gScreenWidth
) or
1626 (SHeight
<> gScreenHeight
) or
1627 (Fullscreen
<> gFullscreen
) then
1629 gResolutionChange
:= True;
1630 gRC_Width
:= SWidth
;
1631 gRC_Height
:= SHeight
;
1632 gRC_FullScreen
:= Fullscreen
;
1633 gRC_Maximized
:= gWinMaximized
;
1636 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1640 procedure ProcSetFirstRussianLanguage();
1642 gLanguage
:= LANGUAGE_RUSSIAN
;
1643 gLanguageChange
:= True;
1644 gAskLanguage
:= False;
1646 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1649 procedure ProcSetFirstEnglishLanguage();
1651 gLanguage
:= LANGUAGE_ENGLISH
;
1652 gLanguageChange
:= True;
1653 gAskLanguage
:= False;
1655 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1658 procedure ProcRecallAddress();
1660 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1662 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1663 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1667 procedure CreateFirstLanguageMenu();
1671 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1673 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1675 Name
:= 'mmFirstLanguageMenu';
1676 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1677 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1680 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1681 Menu
.MainWindow
:= True;
1682 g_GUI_AddWindow(Menu
);
1685 procedure g_Menu_AskLanguage();
1687 CreateFirstLanguageMenu();
1688 g_GUI_ShowWindow('FirstLanguageMenu');
1691 procedure CreatePlayerOptionsMenu(s
: String);
1696 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1698 a
:= _lc
[I_MENU_PLAYER_1
]
1700 a
:= _lc
[I_MENU_PLAYER_2
];
1701 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1703 Name
:= 'mOptionsPlayers'+s
+'Menu';
1704 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1706 Name
:= 'ed'+s
+'Name';
1710 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1712 Name
:= 'sw'+s
+'Team';
1713 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1714 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1716 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1718 Name
:= 'ls'+s
+'Model';
1720 Items
:= g_PlayerModel_GetNames();
1721 OnChange
:= ProcSelectModel
;
1723 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1725 Name
:= 'sc'+s
+'Red';
1727 OnChange
:= ProcChangeColor
;
1729 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1731 Name
:= 'sc'+s
+'Green';
1733 OnChange
:= ProcChangeColor
;
1735 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1737 Name
:= 'sc'+s
+'Blue';
1739 OnChange
:= ProcChangeColor
;
1742 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1743 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1744 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1745 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1747 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1749 Name
:= 'mv'+s
+'Model';
1750 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1751 Y
:= GetControl('ls'+s
+'Model').Y
;
1754 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1755 g_GUI_AddWindow(Menu
);
1758 procedure CreateAllMenus();
1762 a
, cx
, _y
, i
: Integer;
1765 Menu
:= TGUIWindow
.Create('MainMenu');
1766 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1768 Name
:= 'mmMainMenu';
1769 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1770 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1771 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1772 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1773 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1774 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1776 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1778 Color
:= _RGB(255, 255, 255);
1779 X
:= gScreenWidth
-GetWidth
-8;
1780 Y
:= gScreenHeight
-GetHeight
-8;
1782 Menu
.DefControl
:= 'mmMainMenu';
1783 Menu
.MainWindow
:= True;
1784 g_GUI_AddWindow(Menu
);
1786 Menu
:= TGUIWindow
.Create('NewGameMenu');
1787 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1789 Name
:= 'mmNewGameMenu';
1790 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1791 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1792 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1793 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1795 Menu
.DefControl
:= 'mmNewGameMenu';
1796 g_GUI_AddWindow(Menu
);
1798 Menu
:= TGUIWindow
.Create('NetGameMenu');
1799 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1801 Name
:= 'mmNetGameMenu';
1802 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1803 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1805 Menu
.DefControl
:= 'mmNetGameMenu';
1806 g_GUI_AddWindow(Menu
);
1808 Menu
:= TGUIWindow
.Create('NetServerMenu');
1809 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1811 Name
:= 'mNetServerMenu';
1812 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1814 Name
:= 'edSrvName';
1815 OnlyDigits
:= False;
1818 Text := NetServerName
;
1820 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1822 Name
:= 'edSrvPassword';
1823 OnlyDigits
:= False;
1826 Text := NetPassword
;
1828 with AddEdit(_lc
[I_NET_PORT
]) do
1834 Text := IntToStr(NetPort
);
1836 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1838 Name
:= 'edMaxPlayers';
1842 Text := IntToStr(NetMaxClients
);
1844 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1846 Name
:= 'swUseMaster';
1847 AddItem(_lc
[I_MENU_YES
]);
1848 AddItem(_lc
[I_MENU_NO
]);
1849 if NetUseMaster
then
1855 with AddLabel(_lc
[I_MENU_MAP
]) do
1860 OnClick
:= @ProcSelectMapMenu
;
1862 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1864 Name
:= 'swGameMode';
1865 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1866 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1867 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1868 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1869 case g_Game_TextToMode(gnGameMode
) of
1871 GM_DM
: ItemIndex
:= 0;
1872 GM_TDM
: ItemIndex
:= 1;
1873 GM_CTF
: ItemIndex
:= 2;
1875 GM_COOP
: ItemIndex
:= 3;
1877 OnChange
:= ProcSwitchMonstersNet
;
1879 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1881 Name
:= 'edTimeLimit';
1885 if gnTimeLimit
> 0 then
1886 Text := IntToStr(gnTimeLimit
);
1888 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1890 Name
:= 'edGoalLimit';
1894 if gnGoalLimit
> 0 then
1895 Text := IntToStr(gnGoalLimit
);
1897 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1899 Name
:= 'edMaxLives';
1903 if gnMaxLives
> 0 then
1904 Text := IntToStr(gnMaxLives
);
1906 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1908 Name
:= 'swPlayers';
1909 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1910 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1911 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1912 ItemIndex
:= gnPlayers
;
1914 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1916 Name
:= 'swTeamDamage';
1917 AddItem(_lc
[I_MENU_YES
]);
1918 AddItem(_lc
[I_MENU_NO
]);
1919 if gnTeamDamage
then
1924 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1926 Name
:= 'swEnableExits';
1927 AddItem(_lc
[I_MENU_YES
]);
1928 AddItem(_lc
[I_MENU_NO
]);
1934 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
1936 Name
:= 'swWeaponStay';
1937 AddItem(_lc
[I_MENU_YES
]);
1938 AddItem(_lc
[I_MENU_NO
]);
1939 if gnWeaponStay
then
1944 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
1946 Name
:= 'swMonsters';
1947 AddItem(_lc
[I_MENU_YES
]);
1948 AddItem(_lc
[I_MENU_NO
]);
1954 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
1957 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
1958 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
1959 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
1961 if gnBotsVS
= 'Players' then
1963 if gnBotsVS
= 'Monsters' then
1967 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
1971 Menu
.DefControl
:= 'mNetServerMenu';
1972 g_GUI_AddWindow(Menu
);
1974 Menu
:= TGUIWindow
.Create('NetClientMenu');
1975 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
1977 Name
:= 'mNetClientMenu';
1979 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
1982 with AddEdit(_lc
[I_NET_ADDRESS
]) do
1988 Text := 'localhost';
1990 with AddEdit(_lc
[I_NET_PORT
]) do
1998 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2001 OnlyDigits
:= False;
2008 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2012 Menu
.DefControl
:= 'mNetClientMenu';
2013 g_GUI_AddWindow(Menu
);
2015 Menu
:= TGUIWindow
.Create('LoadMenu');
2016 Menu
.OnShow
:= ProcLoadMenu
;
2017 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2019 Name
:= 'mmLoadMenu';
2024 Name
:= 'edSlot'+IntToStr(a
);
2027 OnEnter
:= ProcLoadGame
;
2030 Menu
.DefControl
:= 'mmLoadMenu';
2031 g_GUI_AddWindow(Menu
);
2033 Menu
:= TGUIWindow
.Create('SaveMenu');
2034 Menu
.OnShow
:= ProcSaveMenu
;
2035 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2037 Name
:= 'mmSaveMenu';
2042 Name
:= 'edSlot'+IntToStr(a
);
2045 OnChange
:= ProcSaveGame
;
2048 Menu
.DefControl
:= 'mmSaveMenu';
2049 g_GUI_AddWindow(Menu
);
2051 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2052 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2054 Name
:= 'mCustomGameMenu';
2055 with AddLabel(_lc
[I_MENU_MAP
]) do
2060 OnClick
:= @ProcSelectMapMenu
;
2062 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2064 Name
:= 'swGameMode';
2065 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2066 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2067 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2068 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2069 case g_Game_TextToMode(gcGameMode
) of
2071 GM_DM
: ItemIndex
:= 0;
2072 GM_TDM
: ItemIndex
:= 1;
2073 GM_CTF
: ItemIndex
:= 2;
2075 GM_COOP
: ItemIndex
:= 3;
2077 OnChange
:= ProcSwitchMonstersCustom
;
2079 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2081 Name
:= 'edTimeLimit';
2085 if gcTimeLimit
> 0 then
2086 Text := IntToStr(gcTimeLimit
);
2088 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2090 Name
:= 'edGoalLimit';
2094 if gcGoalLimit
> 0 then
2095 Text := IntToStr(gcGoalLimit
);
2097 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2099 Name
:= 'edMaxLives';
2103 if gcMaxLives
> 0 then
2104 Text := IntToStr(gcMaxLives
);
2106 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2108 Name
:= 'swPlayers';
2109 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2110 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2111 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2112 ItemIndex
:= gcPlayers
;
2114 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2116 Name
:= 'swTeamDamage';
2117 AddItem(_lc
[I_MENU_YES
]);
2118 AddItem(_lc
[I_MENU_NO
]);
2119 if gcTeamDamage
then
2124 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2126 Name
:= 'swEnableExits';
2127 AddItem(_lc
[I_MENU_YES
]);
2128 AddItem(_lc
[I_MENU_NO
]);
2134 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2136 Name
:= 'swWeaponStay';
2137 AddItem(_lc
[I_MENU_YES
]);
2138 AddItem(_lc
[I_MENU_NO
]);
2139 if gcWeaponStay
then
2144 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2146 Name
:= 'swMonsters';
2147 AddItem(_lc
[I_MENU_YES
]);
2148 AddItem(_lc
[I_MENU_NO
]);
2154 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2157 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2158 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2159 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2161 if gcBotsVS
= 'Players' then
2163 if gcBotsVS
= 'Monsters' then
2167 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2171 Menu
.DefControl
:= 'mCustomGameMenu';
2172 g_GUI_AddWindow(Menu
);
2174 Menu
:= TGUIWindow
.Create('CampaignMenu');
2175 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2177 Name
:= 'mCampaignMenu';
2186 with AddFileList('', 15, 4) do
2189 OnChange
:= ProcSelectCampaignWAD
;
2193 FileMask
:= '*.wad|*.pk3|*.zip';
2194 SetBase(MapsDir
+'megawads/');
2197 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2199 Name
:= 'lbWADName';
2203 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2205 Name
:= 'lbWADAuthor';
2209 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2210 with AddMemo('', 15, 3) do
2212 Name
:= 'meWADDescription';
2213 Color
:= MENU_ITEMSCTRL_COLOR
;
2215 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2217 Name
:= 'swPlayers';
2218 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2219 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2222 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2226 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2228 Name
:= 'mpWADImage';
2229 DefaultRes
:= 'NOPIC';
2230 X
:= GetControl('lsWAD').X
+4;
2231 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2234 Menu
.DefControl
:= 'mCampaignMenu';
2235 g_GUI_AddWindow(Menu
);
2237 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2238 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2240 Name
:= 'mSelectMapMenu';
2241 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2244 OnChange
:= ProcSelectWAD
;
2248 FileMask
:= '*.wad|*.pk3|*.zip';
2251 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2255 OnChange
:= ProcSelectMap
;
2258 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2260 Name
:= 'lbMapName';
2264 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2266 Name
:= 'lbMapAuthor';
2270 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2272 Name
:= 'lbMapSize';
2276 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2278 Name
:= 'meMapDescription';
2283 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2285 Name
:= 'mpMapPreview';
2286 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2287 Y
:= GetControl('lsMapWAD').Y
;
2289 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2291 Name
:= 'lbMapScale';
2294 Color
:= MENU_ITEMSCTRL_COLOR
;
2295 X
:= GetControl('lsMapWAD').X
+
2296 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2297 2 + MAPPREVIEW_WIDTH
*4;
2298 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2301 Menu
.OnClose
:= ProcSetMap
;
2302 Menu
.DefControl
:= 'mSelectMapMenu';
2303 g_GUI_AddWindow(Menu
);
2305 Menu
:= TGUIWindow
.Create('OptionsMenu');
2306 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2308 Name
:= 'mmOptionsMenu';
2309 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2310 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2311 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2312 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2313 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2314 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2316 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2317 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2319 Menu
.OnClose
:= ProcApplyOptions
;
2320 Menu
.DefControl
:= 'mmOptionsMenu';
2321 g_GUI_AddWindow(Menu
);
2323 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2324 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2325 g_GUI_AddWindow(Menu
);
2327 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2328 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2330 Name
:= 'mOptionsVideoMenu';
2331 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2332 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2338 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2341 AddItem(_lc
[I_MENU_YES
]);
2342 AddItem(_lc
[I_MENU_NO
]);
2344 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2346 Name
:= 'swTextureFilter';
2347 AddItem(_lc
[I_MENU_YES
]);
2348 AddItem(_lc
[I_MENU_NO
]);
2350 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2352 Name
:= 'swLegacyNPOT';
2353 AddItem(_lc
[I_MENU_NO
]);
2354 AddItem(_lc
[I_MENU_YES
]);
2357 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2360 Menu
.DefControl
:= 'mOptionsVideoMenu';
2361 g_GUI_AddWindow(Menu
);
2363 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2364 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2366 Name
:= 'mOptionsVideoResMenu';
2367 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2369 Name
:= 'lbCurrentRes';
2373 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2375 Name
:= 'lsResolution';
2378 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2380 Name
:= 'swFullScreen';
2381 AddItem(_lc
[I_MENU_YES
]);
2382 AddItem(_lc
[I_MENU_NO
]);
2385 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2388 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2389 g_GUI_AddWindow(Menu
);
2391 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2392 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2394 Name
:= 'mOptionsSoundMenu';
2395 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2397 Name
:= 'scMusicLevel';
2399 OnChange
:= ProcChangeSoundSettings
;
2401 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2403 Name
:= 'scSoundLevel';
2405 OnChange
:= ProcChangeSoundSettings
;
2407 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2409 Name
:= 'scMaxSimSounds';
2412 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2414 Name
:= 'swAnnouncer';
2415 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2416 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2417 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2418 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2420 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2421 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2423 Name
:= 'swSoundEffects';
2424 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2425 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2427 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2429 Name
:= 'swInactiveSounds';
2430 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2431 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2435 Menu
.DefControl
:= 'mOptionsSoundMenu';
2436 g_GUI_AddWindow(Menu
);
2438 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2439 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2441 Name
:= 'mOptionsGameMenu';
2442 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2444 Name
:= 'scParticlesCount';
2447 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2449 Name
:= 'swBloodCount';
2450 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2451 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2452 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2453 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2454 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2456 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2458 Name
:= 'scShellsMax';
2461 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2463 Name
:= 'scGibsMax';
2466 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2468 Name
:= 'scCorpsesMax';
2471 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2473 Name
:= 'swGibsCount';
2474 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2475 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2476 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2477 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2478 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2480 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2482 Name
:= 'swCorpseType';
2483 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2484 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2486 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2488 Name
:= 'swGibsType';
2489 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2490 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2492 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2494 Name
:= 'swBloodType';
2495 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2496 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2498 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2500 Name
:= 'swScreenFlash';
2501 AddItem(_lc
[I_MENU_NO
]);
2502 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2503 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2505 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2507 Name
:= 'swBackground';
2508 AddItem(_lc
[I_MENU_YES
]);
2509 AddItem(_lc
[I_MENU_NO
]);
2511 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2513 Name
:= 'swMessages';
2514 AddItem(_lc
[I_MENU_YES
]);
2515 AddItem(_lc
[I_MENU_NO
]);
2517 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2519 Name
:= 'swRevertPlayers';
2520 AddItem(_lc
[I_MENU_YES
]);
2521 AddItem(_lc
[I_MENU_NO
]);
2523 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2525 Name
:= 'swChatBubble';
2526 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2527 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2528 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2529 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2530 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2534 Menu
.DefControl
:= 'mOptionsGameMenu';
2535 g_GUI_AddWindow(Menu
);
2537 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2538 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2540 Name
:= 'mOptionsControlsMenu';
2541 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2542 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2543 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2544 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2545 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2547 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsControlsP1Menu');
2548 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsControlsP2Menu');
2550 if e_JoysticksAvailable
<> 0 then
2551 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2553 Menu
.DefControl
:= 'mOptionsControlsMenu';
2554 g_GUI_AddWindow(Menu
);
2556 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2557 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2559 Name
:= 'mOptionsControlsP1Menu';
2560 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2561 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2562 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2563 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2564 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2565 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2566 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2567 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2568 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2570 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2571 g_GUI_AddWindow(Menu
);
2573 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2574 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2576 Name
:= 'mOptionsControlsP2Menu';
2577 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2578 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2579 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2580 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2581 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2582 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2583 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2584 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2585 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2587 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2588 g_GUI_AddWindow(Menu
);
2590 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2591 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2593 Name
:= 'mOptionsControlsJoystickMenu';
2594 for i
:= 0 to e_JoysticksAvailable
-1 do
2595 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2597 Name
:= 'scDeadzone' + IntToStr(i
);
2601 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2602 g_GUI_AddWindow(Menu
);
2604 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2605 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2607 Name
:= 'mOptionsPlayersMenu';
2608 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2609 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2611 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2612 g_GUI_AddWindow(Menu
);
2614 CreatePlayerOptionsMenu('P1');
2615 CreatePlayerOptionsMenu('P2');
2617 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2618 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2620 Name
:= 'mOptionsPlayersMIMenu';
2621 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2626 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2631 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2633 Name
:= 'meComment';
2636 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2637 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2640 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2644 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2645 g_GUI_AddWindow(Menu
);
2647 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2648 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2650 Name
:= 'mOptionsLanguageMenu';
2651 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2652 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2655 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2659 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2660 g_GUI_AddWindow(Menu
);
2662 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2663 Menu
.BackTexture
:= 'INTER';
2664 Menu
.OnClose
:= ProcAuthorsClose
;
2668 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2670 Color
:= _RGB(255, 0, 0);
2671 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2673 _y
:= _y
+GetHeight();
2675 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2677 Color
:= _RGB(255, 0, 0);
2678 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2680 _y
:= _y
+GetHeight()+32;
2682 // ×òî äåëàë: Êòî äåëàë
2683 cx
:= gScreenWidth
div 2 - 320 + 64;
2684 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2686 Color
:= _RGB(255, 0, 0);
2691 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2693 Color
:= _RGB(255, 255, 255);
2698 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2700 Color
:= _RGB(255, 0, 0);
2705 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2707 Color
:= _RGB(255, 255, 255);
2712 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2714 Color
:= _RGB(255, 255, 255);
2719 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2721 Color
:= _RGB(255, 0, 0);
2726 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2728 Color
:= _RGB(255, 255, 255);
2733 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2735 Color
:= _RGB(255, 0, 0);
2740 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2742 Color
:= _RGB(255, 255, 255);
2745 _y
:= gScreenHeight
- 128;
2748 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2750 Color
:= _RGB(255, 0, 0);
2755 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2757 Color
:= _RGB(255, 255, 255);
2760 _y
:= _y
+GetHeight();
2762 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2764 Color
:= _RGB(255, 255, 255);
2767 _y
:= _y
+GetHeight();
2769 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2771 Color
:= _RGB(255, 255, 255);
2774 _y
:= gScreenHeight
- 32;
2776 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2778 Color
:= _RGB(255, 0, 0);
2779 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2782 g_GUI_AddWindow(Menu
);
2784 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2785 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2786 g_GUI_AddWindow(Menu
);
2788 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2789 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2791 Name
:= 'mmGameSingleMenu';
2792 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2793 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2794 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2795 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2796 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2797 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2799 Menu
.DefControl
:= 'mmGameSingleMenu';
2800 Menu
.MainWindow
:= True;
2801 Menu
.OnClose
:= ProcGMClose
;
2802 Menu
.OnShow
:= ProcGMShow
;
2803 g_GUI_AddWindow(Menu
);
2805 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2806 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2807 g_GUI_AddWindow(Menu
);
2809 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2810 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2811 g_GUI_AddWindow(Menu
);
2813 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2814 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2816 Name
:= 'mmGameCustomMenu';
2817 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2818 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2819 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2820 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2821 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2822 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2823 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2825 Menu
.DefControl
:= 'mmGameCustomMenu';
2826 Menu
.MainWindow
:= True;
2827 Menu
.OnClose
:= ProcGMClose
;
2828 Menu
.OnShow
:= ProcGMShow
;
2829 g_GUI_AddWindow(Menu
);
2831 Menu
:= TGUIWindow
.Create('GameServerMenu');
2832 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2834 Name
:= 'mmGameServerMenu';
2835 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2836 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2837 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2838 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2839 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2841 Menu
.DefControl
:= 'mmGameServerMenu';
2842 Menu
.MainWindow
:= True;
2843 Menu
.OnClose
:= ProcGMClose
;
2844 Menu
.OnShow
:= ProcGMShow
;
2845 g_GUI_AddWindow(Menu
);
2847 Menu
:= TGUIWindow
.Create('GameClientMenu');
2848 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2850 Name
:= 'mmGameClientMenu';
2851 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2852 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2853 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2855 Menu
.DefControl
:= 'mmGameClientMenu';
2856 Menu
.MainWindow
:= True;
2857 Menu
.OnClose
:= ProcGMClose
;
2858 Menu
.OnShow
:= ProcGMShow
;
2859 g_GUI_AddWindow(Menu
);
2861 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2862 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2864 Name
:= 'mClientPasswordMenu';
2865 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2873 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2876 Menu
.DefControl
:= 'mClientPasswordMenu';
2877 g_GUI_AddWindow(Menu
);
2879 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2880 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2882 Name
:= 'mGameSetGameMenu';
2883 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2885 Name
:= 'swTeamDamage';
2886 AddItem(_lc
[I_MENU_YES
]);
2887 AddItem(_lc
[I_MENU_NO
]);
2890 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2892 Name
:= 'edTimeLimit';
2897 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2899 Name
:= 'edGoalLimit';
2904 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2906 Name
:= 'edMaxLives';
2911 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2914 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2915 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2916 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2922 Menu
.DefControl
:= 'mGameSetGameMenu';
2923 Menu
.OnClose
:= ProcApplyGameSet
;
2924 g_GUI_AddWindow(Menu
);
2926 Menu
:= TGUIWindow
.Create('TeamMenu');
2927 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
2929 Name
:= 'mmTeamMenu';
2930 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
2931 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
2932 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
2933 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
2934 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
2936 Menu
.DefControl
:= 'mmTeamMenu';
2937 Menu
.OnShow
:= ProcChangePlayers
;
2938 g_GUI_AddWindow(Menu
);
2941 procedure g_Menu_Show_SaveMenu();
2943 if g_Game_IsTestMap
then
2945 if gGameSettings
.GameType
= GT_SINGLE
then
2946 g_GUI_ShowWindow('GameSingleMenu')
2949 if g_Game_IsClient
then
2952 if g_Game_IsNet
then
2955 g_GUI_ShowWindow('GameCustomMenu');
2957 g_GUI_ShowWindow('SaveMenu');
2958 g_Sound_PlayEx('MENU_OPEN');
2961 procedure g_Menu_Show_LoadMenu();
2963 if gGameSettings
.GameType
= GT_SINGLE
then
2964 g_GUI_ShowWindow('GameSingleMenu')
2967 if g_Game_IsClient
then
2970 if g_Game_IsNet
then
2973 g_GUI_ShowWindow('GameCustomMenu');
2975 g_GUI_ShowWindow('LoadMenu');
2976 g_Sound_PlayEx('MENU_OPEN');
2979 procedure g_Menu_Show_GameSetGame();
2981 if gGameSettings
.GameType
= GT_SINGLE
then
2982 g_GUI_ShowWindow('GameSingleMenu')
2985 if g_Game_IsClient
then
2988 if g_Game_IsNet
then
2989 g_GUI_ShowWindow('GameServerMenu')
2991 g_GUI_ShowWindow('GameCustomMenu');
2994 g_GUI_ShowWindow('GameSetGameMenu');
2995 g_Sound_PlayEx('MENU_OPEN');
2998 procedure g_Menu_Show_OptionsVideo();
3000 if gGameSettings
.GameType
= GT_SINGLE
then
3001 g_GUI_ShowWindow('GameSingleMenu')
3004 if g_Game_IsClient
then
3005 g_GUI_ShowWindow('GameClientMenu')
3007 if g_Game_IsNet
then
3008 g_GUI_ShowWindow('GameServerMenu')
3010 g_GUI_ShowWindow('GameCustomMenu');
3013 g_GUI_ShowWindow('OptionsMenu');
3014 g_GUI_ShowWindow('OptionsVideoMenu');
3015 g_Sound_PlayEx('MENU_OPEN');
3018 procedure g_Menu_Show_OptionsSound();
3020 if gGameSettings
.GameType
= GT_SINGLE
then
3021 g_GUI_ShowWindow('GameSingleMenu')
3024 if g_Game_IsClient
then
3025 g_GUI_ShowWindow('GameClientMenu')
3027 if g_Game_IsNet
then
3028 g_GUI_ShowWindow('GameServerMenu')
3030 g_GUI_ShowWindow('GameCustomMenu');
3033 g_GUI_ShowWindow('OptionsMenu');
3034 g_GUI_ShowWindow('OptionsSoundMenu');
3035 g_Sound_PlayEx('MENU_OPEN');
3038 procedure g_Menu_Show_EndGameMenu();
3040 g_GUI_ShowWindow('EndGameMenu');
3041 g_Sound_PlayEx('MENU_OPEN');
3044 procedure g_Menu_Show_QuitGameMenu();
3046 g_GUI_ShowWindow('ExitMenu');
3047 g_Sound_PlayEx('MENU_OPEN');
3050 procedure g_Menu_Init();
3057 procedure g_Menu_Free();
3061 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3066 procedure g_Menu_Reset();
3070 g_GUI_SaveMenuPos();
3071 ex
:= g_GUI_Destroy();
3075 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3080 g_Game_SetDebugMode();
3082 g_GUI_LoadMenuPos();