5 procedure g_Menu_Init();
6 procedure g_Menu_Free();
7 procedure g_Menu_Reset();
8 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
9 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
10 procedure g_Menu_AskLanguage();
12 procedure g_Menu_Show_SaveMenu();
13 procedure g_Menu_Show_LoadMenu();
14 procedure g_Menu_Show_GameSetGame();
15 procedure g_Menu_Show_OptionsVideo();
16 procedure g_Menu_Show_OptionsSound();
17 procedure g_Menu_Show_EndGameMenu();
18 procedure g_Menu_Show_QuitGameMenu();
22 gMenuSmallFont
: DWORD
;
29 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
30 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
,
31 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
32 MAPSTRUCT
, wadreader
, Math
, g_saveload
,
33 e_textures
, GL
, GLExt
, g_language
,
34 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
;
37 type TYNCallback
= procedure (yes
:Boolean);
39 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
41 if win
.UserData
= nil then exit
;
43 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
44 IK_N
: TYNCallback(win
.UserData
)(false);
48 procedure YesButtonCB (ctl
: TGUITextButton
);
50 if ctl
.UserData
= nil then exit
;
51 TYNCallback(ctl
.UserData
)(true);
54 procedure NoButtonCB (ctl
: TGUITextButton
);
56 if ctl
.UserData
= nil then exit
;
57 TYNCallback(ctl
.UserData
)(false);
60 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
64 //if length(Text) = 0 then exit;
65 Result
:= TGUIWindow
.Create(WinName
);
68 //OnKeyDownEx := @YNKeyDownProc;
69 //UserData := @ActionProc;
70 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
73 Name
:= '__temp_yes_no_menu:'+WinName
;
75 AddText(Text, MaxLen
);
76 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
77 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
79 DefControl
:= '__temp_yes_no_menu:'+WinName
;
85 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
86 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
88 procedure ProcApplyOptions();
93 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
95 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
99 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
100 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
101 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
103 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
105 g_Sound_SetupAllVolumes(
106 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
107 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
110 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
111 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
112 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
113 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
115 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
117 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
118 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
119 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
120 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
122 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
127 else gGibsCount
:= 48;
130 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
131 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
132 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
133 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
134 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
135 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
136 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
137 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
138 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
140 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
142 with menu
, gGameControls
.GameControls
do
144 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
145 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
146 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
147 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
150 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
152 with menu
, gGameControls
.P1Control
do
154 KeyRight
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
;
155 KeyLeft
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
;
156 KeyUp
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
;
157 KeyDown
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
;
158 KeyFire
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
;
159 KeyJump
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
;
160 KeyNextWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
;
161 KeyPrevWeapon
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
;
162 KeyOpen
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
;
165 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
167 with menu
, gGameControls
.P2Control
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 if e_JoysticksAvailable
> 0 then
182 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
185 for i
:= 0 to e_JoysticksAvailable
-1 do
186 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
190 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
192 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
193 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
194 TEAM_RED
, TEAM_BLUE
);
196 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
198 gPlayer1Settings
.Model
:= Model
.Name
;
199 gPlayer1Settings
.Color
:= Model
.Color
;
202 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
204 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
205 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
206 TEAM_RED
, TEAM_BLUE
);
207 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
209 gPlayer2Settings
.Model
:= Model
.Name
;
210 gPlayer2Settings
.Color
:= Model
.Color
;
213 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
214 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
216 if g_Game_IsServer
then
218 if gPlayer1
<> nil then
220 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
221 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
222 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
223 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
225 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
228 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
231 if gPlayer2
<> nil then
233 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
234 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
235 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
236 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
238 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
243 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
245 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
248 procedure ReadOptions();
253 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
255 with TGUISwitch(menu
.GetControl('swBPP')) do
261 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
262 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
264 with TGUISwitch(menu
.GetControl('swVSync')) do
265 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
267 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
268 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
270 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
272 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
273 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
274 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
276 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
277 if gMuteWhenInactive
then
282 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
284 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
285 if gSoundEffectsDF
then
290 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
292 with menu
, gGameControls
.P1Control
do
294 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
295 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
296 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
297 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
298 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
299 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
300 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
301 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
302 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
307 with menu
, gGameControls
.P2Control
do
309 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key
:= KeyRight
;
310 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key
:= KeyLeft
;
311 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key
:= KeyUp
;
312 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key
:= KeyDown
;
313 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key
:= KeyFire
;
314 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key
:= KeyJump
;
315 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key
:= KeyNextWeapon
;
316 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key
:= KeyPrevWeapon
;
317 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key
:= KeyOpen
;
320 if e_JoysticksAvailable
> 0 then
322 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
325 for i
:= 0 to e_JoysticksAvailable
-1 do
326 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
330 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
331 with menu
, gGameControls
.GameControls
do
333 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
334 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
335 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
336 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
341 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
342 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
343 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
344 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
345 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
347 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
350 with TGUISwitch(menu
.GetControl('swBloodType')) do
351 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
353 with TGUISwitch(menu
.GetControl('swCorpseType')) do
354 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
356 with TGUISwitch(menu
.GetControl('swGibsType')) do
357 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
359 with TGUISwitch(menu
.GetControl('swGibsCount')) do
368 with TGUISwitch(menu
.GetControl('swBackGround')) do
369 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
371 with TGUISwitch(menu
.GetControl('swMessages')) do
372 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
374 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
375 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
377 with TGUISwitch(menu
.GetControl('swChatBubble')) do
378 ItemIndex
:= gChatBubble
;
380 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
382 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
383 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
385 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
386 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
388 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
389 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
390 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
392 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
394 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
395 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
397 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
398 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
400 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
401 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
402 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
404 ProcSelectModel(nil);
407 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
409 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
410 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
411 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
413 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
416 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
418 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
419 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
420 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
422 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
425 procedure ProcStartCustomGame();
431 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
433 Map
:= TGUILabel(GetControl('lbMap')).Text;
436 if Pos(':\', Map
) = 0 then
439 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
440 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
441 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
442 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
443 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
445 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
446 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
447 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
448 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
451 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
453 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
455 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
457 Options
:= Options
or GAME_OPTION_MONSTERS
;
458 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
460 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
462 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
463 gcBotsVS
:= 'Monsters';
466 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
467 gcBotsVS
:= 'Everybody';
470 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
471 gcBotsVS
:= 'Players';
478 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
480 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
481 gcMaxLives
, Options
, gcPlayers
);
485 procedure ProcStartNetGame();
491 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
493 Map
:= TGUILabel(GetControl('lbMap')).Text;
496 if Pos(':\', Map
) = 0 then
499 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
500 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
501 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
502 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
503 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
504 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
506 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
507 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
508 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
509 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
512 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
514 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
516 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
518 Options
:= Options
or GAME_OPTION_MONSTERS
;
519 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
521 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
523 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
524 gnBotsVS
:= 'Monsters';
527 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
528 gnBotsVS
:= 'Everybody';
531 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
532 gnBotsVS
:= 'Players';
537 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
538 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
539 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
540 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
541 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
544 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
545 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
547 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
548 Options
, gnPlayers
, 0, NetPort
);
551 procedure ProcConnectNetGame();
555 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
557 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
558 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
559 PW
:= TGUIEdit(GetControl('edPW')).Text;
562 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
563 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
566 procedure ProcEnterPassword();
570 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
572 NetClientIP
:= PromptIP
;
573 NetClientPort
:= PromptPort
;
574 PW
:= TGUIEdit(GetControl('edPW')).Text;
577 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
578 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
581 procedure ProcServerlist();
583 if not NetInitDone
then
585 if (not g_Net_Init()) then
587 g_Console_Add('NET: ERROR: Failed to init ENet!');
594 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
596 gState
:= STATE_SLIST
;
597 g_ActiveWindow
:= nil;
599 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
604 slReturnPressed
:= True;
605 if g_Net_Slist_Fetch(slCurrent
) then
607 if slCurrent
= nil then
608 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
611 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
614 procedure ProcStartCampaign();
620 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
622 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
623 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
630 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
633 procedure ProcSelectMap(Sender
: TGUIControl
);
637 wad
, map
, res
: String;
639 win
:= g_GUI_GetWindow('SelectMapMenu');
640 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
642 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
643 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
645 if (wad
= '') or (map
= '') then
646 begin // Ýòî íå êàðòà
647 TGUILabel(GetControl('lbMapName')).Text := '';
648 TGUILabel(GetControl('lbMapAuthor')).Text := '';
649 TGUILabel(GetControl('lbMapSize')).Text := '';
650 TGUIMemo(GetControl('meMapDescription')).SetText('');
651 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
652 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
658 a
:= g_Map_GetMapInfo(res
);
660 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
661 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
662 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
663 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
664 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
665 TGUILabel(win
.GetControl('lbMapScale')).Text :=
666 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
671 procedure ProcSelectWAD(Sender
: TGUIControl
);
676 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
678 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
680 with TGUIListBox(GetControl('lsMapRes')) do
686 list
:= g_Map_GetMapsList(wad
);
700 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
706 win
:= g_GUI_GetWindow('CampaignMenu');
707 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
709 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
713 TGUILabel(GetControl('lbWADName')).Text := '';
714 TGUILabel(GetControl('lbWADAuthor')).Text := '';
715 TGUIMemo(GetControl('meWADDescription')).SetText('');
718 a
:= g_Game_GetMegaWADInfo(wad
);
720 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
721 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
722 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
724 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
728 g_ProcessResourceStr(a
.pic
, @fn
, nil, nil);
730 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
732 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
737 procedure ProcChangeColor(Sender
: TGUIControl
);
741 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
742 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
743 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
744 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
745 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
746 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
748 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
749 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
750 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
751 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
752 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
753 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
756 procedure ProcSelectModel(Sender
: TGUIControl
);
761 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
762 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
763 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
765 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
766 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
767 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
769 ProcChangeColor(nil);
772 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
784 wad
:= TWADFile
.Create
;
785 if wad
.ReadFile(GameWAD
) then
786 wad
.GetResource('FONTS', cfgres
, cfgdata
, cfglen
);
791 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
793 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
794 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
795 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
796 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
798 if g_Texture_Get('FONT_STD', ID
) then
799 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
804 if cfglen
<> 0 then FreeMem(cfgdata
);
807 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
813 cfgdata
, fntdata
: Pointer;
814 cfglen
, fntlen
: Integer;
822 wad
:= TWADFile
.Create
;
823 if wad
.ReadFile(GameWAD
) then
825 wad
.GetResource('FONTS', txtres
, cfgdata
, cfglen
);
826 wad
.GetResource('FONTS', fntres
, fntdata
, fntlen
);
832 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
833 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
834 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
836 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
837 FontID
:= e_CharFont_Create(spc
);
841 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
842 if chrwidth
= 0 then Continue
;
844 if e_CreateTextureMemEx(fntdata
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
846 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
852 if cfglen
<> 0 then FreeMem(cfgdata
);
853 if fntlen
<> 0 then FreeMem(fntdata
);
856 procedure MenuLoadData();
858 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
860 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
861 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
862 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
863 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
864 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
865 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
866 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
867 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
868 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
869 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
870 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
871 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
872 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
873 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
874 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
875 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
876 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
877 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
878 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
879 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
880 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
881 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
882 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
883 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
885 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
886 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
887 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
888 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
889 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
890 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
891 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
894 procedure MenuFreeData();
896 e_CharFont_Remove(gMenuFont
);
897 e_CharFont_Remove(gMenuSmallFont
);
899 g_Texture_Delete('MAINMENU_MARKER1');
900 g_Texture_Delete('MAINMENU_MARKER2');
901 g_Texture_Delete('SCROLL_LEFT');
902 g_Texture_Delete('SCROLL_RIGHT');
903 g_Texture_Delete('SCROLL_MIDDLE');
904 g_Texture_Delete('SCROLL_MARKER');
905 g_Texture_Delete('EDIT_LEFT');
906 g_Texture_Delete('EDIT_RIGHT');
907 g_Texture_Delete('EDIT_MIDDLE');
908 g_Texture_Delete('BOX1');
909 g_Texture_Delete('BOX2');
910 g_Texture_Delete('BOX3');
911 g_Texture_Delete('BOX4');
912 g_Texture_Delete('BOX5');
913 g_Texture_Delete('BOX6');
914 g_Texture_Delete('BOX7');
915 g_Texture_Delete('BOX8');
916 g_Texture_Delete('BOX9');
917 g_Texture_Delete('BSCROLL_UP_A');
918 g_Texture_Delete('BSCROLL_UP_U');
919 g_Texture_Delete('BSCROLL_DOWN_A');
920 g_Texture_Delete('BSCROLL_DOWN_U');
921 g_Texture_Delete('BSCROLL_MIDDLE');
922 g_Texture_Delete('NOPIC');
924 g_Sound_Delete('MENU_SELECT');
925 g_Sound_Delete('MENU_OPEN');
926 g_Sound_Delete('MENU_CLOSE');
927 g_Sound_Delete('MENU_CHANGE');
928 g_Sound_Delete('SCROLL_ADD');
929 g_Sound_Delete('SCROLL_SUB');
930 g_Sound_Delete('SOUND_PLAYER_FALL');
933 procedure ProcAuthorsMenu();
935 gMusic
.SetByName('MUSIC_INTERMUS');
939 procedure ProcExitMenuKeyDown (yes
: Boolean);
947 g_Game_StopAllSounds(True);
949 0: s
:= 'SOUND_MONSTER_PAIN';
950 1: s
:= 'SOUND_MONSTER_DIE_3';
951 2: s
:= 'SOUND_MONSTER_SLOP';
952 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
953 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
954 5: s
:= 'SOUND_MONSTER_MAN_DIE';
955 6: s
:= 'SOUND_MONSTER_BSP_DIE';
956 7: s
:= 'SOUND_MONSTER_VILE_DIE';
957 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
958 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
959 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
960 11: s
:= 'SOUND_MONSTER_BARON_DIE';
961 12: s
:= 'SOUND_MONSTER_CACO_DIE';
962 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
963 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
964 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
965 else s
:= 'SOUND_PLAYER_FALL';
967 snd
:= TPlayableSound
.Create();
968 res
:= snd
.SetByName(s
);
969 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
973 while snd
.IsPlaying() do begin end;
981 procedure ProcLoadMenu();
986 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
990 procedure ProcSaveMenu();
995 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
999 procedure ProcSaveGame(Sender
: TGUIControl
);
1003 if g_Game_IsNet
then Exit
;
1004 if g_Game_IsTestMap
then Exit
;
1005 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1006 g_Game_PauseAllSounds(True);
1007 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1009 g_ActiveWindow
:= nil;
1010 g_Game_Pause(False);
1013 procedure ProcLoadGame(Sender
: TGUIControl
);
1017 if g_Game_IsNet
then Exit
;
1018 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1019 if g_LoadGame(a
) then
1020 g_Game_PauseAllSounds(False)
1021 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1022 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1025 procedure ProcSingle1Player();
1027 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1030 procedure ProcSingle2Players();
1032 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1035 procedure ProcSelectMapMenu();
1038 wad_lb
: TGUIFileListBox
;
1039 map_lb
: TGUIListBox
;
1042 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1043 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1044 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1046 if wad_lb
.SelectedItem() <> '' then
1047 map
:= map_lb
.SelectedItem()
1051 wad_lb
.UpdateFileList();
1054 if wad_lb
.SelectedItem() <> '' then
1057 map_lb
.SelectItem(map
);
1059 if map_lb
.SelectedItem() <> '' then
1063 g_GUI_ShowWindow('SelectMapMenu');
1066 procedure ProcSelectCampaignMenu();
1069 wad_lb
: TGUIFileListBox
;
1071 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1072 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1074 wad_lb
.UpdateFileList();
1076 if wad_lb
.SelectedItem() <> '' then
1077 ProcSelectCampaignWAD(nil);
1080 procedure ProcSetMap();
1082 wad
, map
, res
: String;
1084 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1086 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1087 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1090 if (wad
= '') or (map
= '') then
1093 res
:= wad
+':\'+map
;
1095 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1096 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1099 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1103 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1105 g_Sound_SetupAllVolumes(
1106 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1107 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1111 procedure ProcOptionsPlayersMIMenu();
1116 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1118 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1120 if a
= '' then Exit
;
1122 b
:= g_PlayerModel_GetInfo(a
);
1124 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1126 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1127 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1128 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1130 if b
.HaveWeapon
then
1131 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1133 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1136 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1139 procedure ProcOptionsPlayersAnim();
1143 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1148 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1151 Model
.GetCurrentAnimation
.Loop
:= True;
1152 Model
.GetCurrentAnimationMask
.Loop
:= True;
1156 procedure ProcOptionsPlayersWeap();
1160 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1165 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1169 procedure ProcOptionsPlayersRot();
1173 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1174 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1175 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1178 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1182 g_Options_SetDefault();
1188 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1190 if yes
then ReadOptions();
1194 procedure ProcAuthorsClose();
1196 gMusic
.SetByName('MUSIC_MENU');
1198 gState
:= STATE_MENU
;
1201 procedure ProcGMClose();
1203 g_Game_InGameMenu(False);
1206 procedure ProcGMShow();
1211 if (gGameSettings
.GameType
= GT_SINGLE
) and
1212 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1213 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1214 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1216 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1217 if g_Game_IsTestMap
then
1218 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1219 TGUIMainMenu(g_ActiveWindow
.GetControl(
1220 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1223 procedure ProcChangePlayers();
1225 TeamGame
, Spectator
, AddTwo
: Boolean;
1226 P1Team
{, P2Team}: Byte;
1227 bP2
: TGUITextButton
;
1229 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1230 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1231 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1232 P1Team
:= TEAM_NONE
;
1233 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1235 //P2Team := TEAM_NONE;
1236 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1238 TGUIMainMenu(g_ActiveWindow
.GetControl(
1239 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1240 TGUIMainMenu(g_ActiveWindow
.GetControl(
1241 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1242 TGUIMainMenu(g_ActiveWindow
.GetControl(
1243 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1245 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1246 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1247 bP2
.Enabled
:= AddTwo
and not Spectator
;
1249 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1251 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1252 if gPlayer2
= nil then
1253 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1255 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1257 TGUIMainMenu(g_ActiveWindow
.GetControl(
1258 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1261 procedure ProcJoinRed();
1263 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1265 if g_Game_IsServer
then
1267 if gPlayer1
= nil then
1268 g_Game_AddPlayer(TEAM_RED
)
1271 if gPlayer1
.Team
<> TEAM_RED
then
1273 gPlayer1
.SwitchTeam
;
1274 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1277 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1282 gPlayer1Settings
.Team
:= TEAM_RED
;
1283 MC_SEND_PlayerSettings
;
1284 if gPlayer1
= nil then
1285 g_Game_AddPlayer(TEAM_RED
);
1287 g_ActiveWindow
:= nil;
1288 g_Game_Pause(False);
1291 procedure ProcJoinBlue();
1293 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1295 if g_Game_IsServer
then
1297 if gPlayer1
= nil then
1298 g_Game_AddPlayer(TEAM_BLUE
)
1301 if gPlayer1
.Team
<> TEAM_BLUE
then
1303 gPlayer1
.SwitchTeam
;
1304 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1307 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1312 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1313 MC_SEND_PlayerSettings
;
1314 if gPlayer1
= nil then
1315 g_Game_AddPlayer(TEAM_BLUE
);
1317 g_ActiveWindow
:= nil;
1318 g_Game_Pause(False);
1321 procedure ProcJoinGame();
1323 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1325 if gPlayer1
= nil then
1327 g_ActiveWindow
:= nil;
1328 g_Game_Pause(False);
1331 procedure ProcSwitchP2();
1333 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1335 if gPlayer1
= nil then
1337 if gPlayer2
= nil then
1340 g_Game_RemovePlayer();
1341 g_ActiveWindow
:= nil;
1342 g_Game_Pause(False);
1345 procedure ProcSpectate();
1347 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1350 g_ActiveWindow
:= nil;
1351 g_Game_Pause(False);
1354 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1356 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1359 procedure ProcEndMenuKeyDown (yes
: Boolean);
1361 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1364 procedure ProcSetRussianLanguage();
1366 if gLanguage
<> LANGUAGE_RUSSIAN
then
1368 gLanguage
:= LANGUAGE_RUSSIAN
;
1369 gLanguageChange
:= True;
1370 gAskLanguage
:= False;
1372 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1374 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1379 procedure ProcSetEnglishLanguage();
1381 if gLanguage
<> LANGUAGE_ENGLISH
then
1383 gLanguage
:= LANGUAGE_ENGLISH
;
1384 gLanguageChange
:= True;
1385 gAskLanguage
:= False;
1387 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1389 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1394 procedure ReadGameSettings();
1398 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1400 with gGameSettings
do
1402 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1403 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1408 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1409 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1410 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1412 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1413 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1414 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1417 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1422 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1424 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1425 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1426 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1427 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1428 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1429 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1430 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1431 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1435 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1436 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1441 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1442 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1447 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1448 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1453 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1454 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1459 procedure ProcApplyGameSet();
1463 stat
: TPlayerStatArray
;
1465 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1467 if not g_Game_IsServer
then Exit
;
1469 with gGameSettings
do
1471 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1473 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1474 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1476 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1479 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1481 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1487 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1489 TimeLimit
:= Max(n
, b
);
1493 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1495 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1502 if GameMode
= GM_DM
then
1504 stat
:= g_Player_GetStats();
1506 for a
:= 0 to High(stat
) do
1507 if stat
[a
].Frags
> b
then
1511 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1513 GoalLimit
:= Max(n
, b
);
1517 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1519 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1520 if n
< 0 then n
:= 0;
1521 if n
> 255 then n
:= 255;
1527 stat
:= g_Player_GetStats();
1529 for a
:= 0 to High(stat
) do
1530 if stat
[a
].Lives
> b
then
1533 MaxLives
:= Max(n
, b
);
1537 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1539 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1542 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1543 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1547 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1548 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1552 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1553 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1559 if g_Game_IsNet
then MH_SEND_GameSettings
;
1562 procedure ProcVideoOptionsRes();
1568 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1570 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1571 IntToStr(gScreenWidth
) +
1572 ' x ' + IntToStr(gScreenHeight
) +
1573 ', ' + IntToStr(gBPP
) + ' bpp';
1575 with TGUIListBox(menu
.GetControl('lsResolution')) do
1577 list
:= GetDisplayModes(gBPP
, SR
);
1588 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1595 procedure ProcApplyVideoOptions();
1598 Fullscreen
: Boolean;
1599 SWidth
, SHeight
: Integer;
1602 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1604 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1605 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1607 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1609 if (SWidth
<> gScreenWidth
) or
1610 (SHeight
<> gScreenHeight
) or
1611 (Fullscreen
<> gFullscreen
) then
1613 gResolutionChange
:= True;
1614 gRC_Width
:= SWidth
;
1615 gRC_Height
:= SHeight
;
1616 gRC_FullScreen
:= Fullscreen
;
1617 gRC_Maximized
:= gWinMaximized
;
1620 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1624 procedure ProcSetFirstRussianLanguage();
1626 gLanguage
:= LANGUAGE_RUSSIAN
;
1627 gLanguageChange
:= True;
1628 gAskLanguage
:= False;
1630 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1633 procedure ProcSetFirstEnglishLanguage();
1635 gLanguage
:= LANGUAGE_ENGLISH
;
1636 gLanguageChange
:= True;
1637 gAskLanguage
:= False;
1639 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1642 procedure ProcRecallAddress();
1644 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1646 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1647 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1651 procedure CreateFirstLanguageMenu();
1655 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1657 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1659 Name
:= 'mmFirstLanguageMenu';
1660 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1661 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1664 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1665 Menu
.MainWindow
:= True;
1666 g_GUI_AddWindow(Menu
);
1669 procedure g_Menu_AskLanguage();
1671 CreateFirstLanguageMenu();
1672 g_GUI_ShowWindow('FirstLanguageMenu');
1675 procedure CreatePlayerOptionsMenu(s
: String);
1680 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1682 a
:= _lc
[I_MENU_PLAYER_1
]
1684 a
:= _lc
[I_MENU_PLAYER_2
];
1685 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1687 Name
:= 'mOptionsPlayers'+s
+'Menu';
1688 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1690 Name
:= 'ed'+s
+'Name';
1694 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1696 Name
:= 'sw'+s
+'Team';
1697 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1698 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1700 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1702 Name
:= 'ls'+s
+'Model';
1704 Items
:= g_PlayerModel_GetNames();
1705 OnChange
:= ProcSelectModel
;
1707 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1709 Name
:= 'sc'+s
+'Red';
1711 OnChange
:= ProcChangeColor
;
1713 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1715 Name
:= 'sc'+s
+'Green';
1717 OnChange
:= ProcChangeColor
;
1719 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1721 Name
:= 'sc'+s
+'Blue';
1723 OnChange
:= ProcChangeColor
;
1726 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1727 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1728 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1729 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1731 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1733 Name
:= 'mv'+s
+'Model';
1734 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1735 Y
:= GetControl('ls'+s
+'Model').Y
;
1738 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1739 g_GUI_AddWindow(Menu
);
1742 procedure CreateAllMenus();
1746 a
, cx
, _y
, i
: Integer;
1749 Menu
:= TGUIWindow
.Create('MainMenu');
1750 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1752 Name
:= 'mmMainMenu';
1753 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1754 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1755 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1756 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1757 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1758 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1760 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1762 Color
:= _RGB(255, 255, 255);
1763 X
:= gScreenWidth
-GetWidth
-8;
1764 Y
:= gScreenHeight
-GetHeight
-8;
1766 Menu
.DefControl
:= 'mmMainMenu';
1767 Menu
.MainWindow
:= True;
1768 g_GUI_AddWindow(Menu
);
1770 Menu
:= TGUIWindow
.Create('NewGameMenu');
1771 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1773 Name
:= 'mmNewGameMenu';
1774 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1775 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1776 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1777 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1779 Menu
.DefControl
:= 'mmNewGameMenu';
1780 g_GUI_AddWindow(Menu
);
1782 Menu
:= TGUIWindow
.Create('NetGameMenu');
1783 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1785 Name
:= 'mmNetGameMenu';
1786 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1787 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1789 Menu
.DefControl
:= 'mmNetGameMenu';
1790 g_GUI_AddWindow(Menu
);
1792 Menu
:= TGUIWindow
.Create('NetServerMenu');
1793 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1795 Name
:= 'mNetServerMenu';
1796 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1798 Name
:= 'edSrvName';
1799 OnlyDigits
:= False;
1802 Text := NetServerName
;
1804 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1806 Name
:= 'edSrvPassword';
1807 OnlyDigits
:= False;
1810 Text := NetPassword
;
1812 with AddEdit(_lc
[I_NET_PORT
]) do
1818 Text := IntToStr(NetPort
);
1820 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1822 Name
:= 'edMaxPlayers';
1826 Text := IntToStr(NetMaxClients
);
1828 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1830 Name
:= 'swUseMaster';
1831 AddItem(_lc
[I_MENU_YES
]);
1832 AddItem(_lc
[I_MENU_NO
]);
1833 if NetUseMaster
then
1839 with AddLabel(_lc
[I_MENU_MAP
]) do
1844 OnClick
:= @ProcSelectMapMenu
;
1846 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1848 Name
:= 'swGameMode';
1849 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1850 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1851 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1852 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1853 case g_Game_TextToMode(gnGameMode
) of
1855 GM_DM
: ItemIndex
:= 0;
1856 GM_TDM
: ItemIndex
:= 1;
1857 GM_CTF
: ItemIndex
:= 2;
1859 GM_COOP
: ItemIndex
:= 3;
1861 OnChange
:= ProcSwitchMonstersNet
;
1863 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1865 Name
:= 'edTimeLimit';
1869 if gnTimeLimit
> 0 then
1870 Text := IntToStr(gnTimeLimit
);
1872 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1874 Name
:= 'edGoalLimit';
1878 if gnGoalLimit
> 0 then
1879 Text := IntToStr(gnGoalLimit
);
1881 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1883 Name
:= 'edMaxLives';
1887 if gnMaxLives
> 0 then
1888 Text := IntToStr(gnMaxLives
);
1890 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1892 Name
:= 'swPlayers';
1893 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1894 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1895 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1896 ItemIndex
:= gnPlayers
;
1898 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1900 Name
:= 'swTeamDamage';
1901 AddItem(_lc
[I_MENU_YES
]);
1902 AddItem(_lc
[I_MENU_NO
]);
1903 if gnTeamDamage
then
1908 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1910 Name
:= 'swEnableExits';
1911 AddItem(_lc
[I_MENU_YES
]);
1912 AddItem(_lc
[I_MENU_NO
]);
1918 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
1920 Name
:= 'swWeaponStay';
1921 AddItem(_lc
[I_MENU_YES
]);
1922 AddItem(_lc
[I_MENU_NO
]);
1923 if gnWeaponStay
then
1928 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
1930 Name
:= 'swMonsters';
1931 AddItem(_lc
[I_MENU_YES
]);
1932 AddItem(_lc
[I_MENU_NO
]);
1938 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
1941 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
1942 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
1943 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
1945 if gnBotsVS
= 'Players' then
1947 if gnBotsVS
= 'Monsters' then
1951 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
1955 Menu
.DefControl
:= 'mNetServerMenu';
1956 g_GUI_AddWindow(Menu
);
1958 Menu
:= TGUIWindow
.Create('NetClientMenu');
1959 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
1961 Name
:= 'mNetClientMenu';
1963 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
1966 with AddEdit(_lc
[I_NET_ADDRESS
]) do
1972 Text := 'localhost';
1974 with AddEdit(_lc
[I_NET_PORT
]) do
1982 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1985 OnlyDigits
:= False;
1992 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
1996 Menu
.DefControl
:= 'mNetClientMenu';
1997 g_GUI_AddWindow(Menu
);
1999 Menu
:= TGUIWindow
.Create('LoadMenu');
2000 Menu
.OnShow
:= ProcLoadMenu
;
2001 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2003 Name
:= 'mmLoadMenu';
2008 Name
:= 'edSlot'+IntToStr(a
);
2011 OnEnter
:= ProcLoadGame
;
2014 Menu
.DefControl
:= 'mmLoadMenu';
2015 g_GUI_AddWindow(Menu
);
2017 Menu
:= TGUIWindow
.Create('SaveMenu');
2018 Menu
.OnShow
:= ProcSaveMenu
;
2019 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2021 Name
:= 'mmSaveMenu';
2026 Name
:= 'edSlot'+IntToStr(a
);
2029 OnChange
:= ProcSaveGame
;
2032 Menu
.DefControl
:= 'mmSaveMenu';
2033 g_GUI_AddWindow(Menu
);
2035 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2036 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2038 Name
:= 'mCustomGameMenu';
2039 with AddLabel(_lc
[I_MENU_MAP
]) do
2044 OnClick
:= @ProcSelectMapMenu
;
2046 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2048 Name
:= 'swGameMode';
2049 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2050 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2051 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2052 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2053 case g_Game_TextToMode(gcGameMode
) of
2055 GM_DM
: ItemIndex
:= 0;
2056 GM_TDM
: ItemIndex
:= 1;
2057 GM_CTF
: ItemIndex
:= 2;
2059 GM_COOP
: ItemIndex
:= 3;
2061 OnChange
:= ProcSwitchMonstersCustom
;
2063 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2065 Name
:= 'edTimeLimit';
2069 if gcTimeLimit
> 0 then
2070 Text := IntToStr(gcTimeLimit
);
2072 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2074 Name
:= 'edGoalLimit';
2078 if gcGoalLimit
> 0 then
2079 Text := IntToStr(gcGoalLimit
);
2081 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2083 Name
:= 'edMaxLives';
2087 if gcMaxLives
> 0 then
2088 Text := IntToStr(gcMaxLives
);
2090 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2092 Name
:= 'swPlayers';
2093 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2094 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2095 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2096 ItemIndex
:= gcPlayers
;
2098 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2100 Name
:= 'swTeamDamage';
2101 AddItem(_lc
[I_MENU_YES
]);
2102 AddItem(_lc
[I_MENU_NO
]);
2103 if gcTeamDamage
then
2108 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2110 Name
:= 'swEnableExits';
2111 AddItem(_lc
[I_MENU_YES
]);
2112 AddItem(_lc
[I_MENU_NO
]);
2118 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2120 Name
:= 'swWeaponStay';
2121 AddItem(_lc
[I_MENU_YES
]);
2122 AddItem(_lc
[I_MENU_NO
]);
2123 if gcWeaponStay
then
2128 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2130 Name
:= 'swMonsters';
2131 AddItem(_lc
[I_MENU_YES
]);
2132 AddItem(_lc
[I_MENU_NO
]);
2138 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2141 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2142 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2143 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2145 if gcBotsVS
= 'Players' then
2147 if gcBotsVS
= 'Monsters' then
2151 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2155 Menu
.DefControl
:= 'mCustomGameMenu';
2156 g_GUI_AddWindow(Menu
);
2158 Menu
:= TGUIWindow
.Create('CampaignMenu');
2159 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2161 Name
:= 'mCampaignMenu';
2170 with AddFileList('', 15, 4) do
2173 OnChange
:= ProcSelectCampaignWAD
;
2177 FileMask
:= '*.wad|*.pk3|*.zip';
2178 SetBase(MapsDir
+'megawads/');
2181 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2183 Name
:= 'lbWADName';
2187 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2189 Name
:= 'lbWADAuthor';
2193 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2194 with AddMemo('', 15, 3) do
2196 Name
:= 'meWADDescription';
2197 Color
:= MENU_ITEMSCTRL_COLOR
;
2199 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2201 Name
:= 'swPlayers';
2202 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2203 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2206 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2210 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2212 Name
:= 'mpWADImage';
2213 DefaultRes
:= 'NOPIC';
2214 X
:= GetControl('lsWAD').X
+4;
2215 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2218 Menu
.DefControl
:= 'mCampaignMenu';
2219 g_GUI_AddWindow(Menu
);
2221 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2222 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2224 Name
:= 'mSelectMapMenu';
2225 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2228 OnChange
:= ProcSelectWAD
;
2232 FileMask
:= '*.wad|*.pk3|*.zip';
2235 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2239 OnChange
:= ProcSelectMap
;
2242 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2244 Name
:= 'lbMapName';
2248 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2250 Name
:= 'lbMapAuthor';
2254 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2256 Name
:= 'lbMapSize';
2260 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2262 Name
:= 'meMapDescription';
2267 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2269 Name
:= 'mpMapPreview';
2270 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2271 Y
:= GetControl('lsMapWAD').Y
;
2273 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2275 Name
:= 'lbMapScale';
2278 Color
:= MENU_ITEMSCTRL_COLOR
;
2279 X
:= GetControl('lsMapWAD').X
+
2280 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2281 2 + MAPPREVIEW_WIDTH
*4;
2282 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2285 Menu
.OnClose
:= ProcSetMap
;
2286 Menu
.DefControl
:= 'mSelectMapMenu';
2287 g_GUI_AddWindow(Menu
);
2289 Menu
:= TGUIWindow
.Create('OptionsMenu');
2290 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2292 Name
:= 'mmOptionsMenu';
2293 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2294 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2295 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2296 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2297 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2298 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2300 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2301 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2303 Menu
.OnClose
:= ProcApplyOptions
;
2304 Menu
.DefControl
:= 'mmOptionsMenu';
2305 g_GUI_AddWindow(Menu
);
2307 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2308 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2309 g_GUI_AddWindow(Menu
);
2311 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2312 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2314 Name
:= 'mOptionsVideoMenu';
2315 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2316 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2322 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2325 AddItem(_lc
[I_MENU_YES
]);
2326 AddItem(_lc
[I_MENU_NO
]);
2328 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2330 Name
:= 'swTextureFilter';
2331 AddItem(_lc
[I_MENU_YES
]);
2332 AddItem(_lc
[I_MENU_NO
]);
2334 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2336 Name
:= 'swLegacyNPOT';
2337 AddItem(_lc
[I_MENU_NO
]);
2338 AddItem(_lc
[I_MENU_YES
]);
2341 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2344 Menu
.DefControl
:= 'mOptionsVideoMenu';
2345 g_GUI_AddWindow(Menu
);
2347 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2348 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2350 Name
:= 'mOptionsVideoResMenu';
2351 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2353 Name
:= 'lbCurrentRes';
2357 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2359 Name
:= 'lsResolution';
2362 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2364 Name
:= 'swFullScreen';
2365 AddItem(_lc
[I_MENU_YES
]);
2366 AddItem(_lc
[I_MENU_NO
]);
2369 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2372 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2373 g_GUI_AddWindow(Menu
);
2375 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2376 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2378 Name
:= 'mOptionsSoundMenu';
2379 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2381 Name
:= 'scMusicLevel';
2383 OnChange
:= ProcChangeSoundSettings
;
2385 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2387 Name
:= 'scSoundLevel';
2389 OnChange
:= ProcChangeSoundSettings
;
2391 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2393 Name
:= 'scMaxSimSounds';
2396 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2398 Name
:= 'swAnnouncer';
2399 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2400 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2401 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2402 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2404 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2405 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2407 Name
:= 'swSoundEffects';
2408 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2409 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2411 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2413 Name
:= 'swInactiveSounds';
2414 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2415 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2419 Menu
.DefControl
:= 'mOptionsSoundMenu';
2420 g_GUI_AddWindow(Menu
);
2422 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2423 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2425 Name
:= 'mOptionsGameMenu';
2426 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2428 Name
:= 'scParticlesCount';
2431 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2433 Name
:= 'swBloodCount';
2434 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2435 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2436 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2437 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2438 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2440 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2442 Name
:= 'scShellsMax';
2445 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2447 Name
:= 'scGibsMax';
2450 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2452 Name
:= 'scCorpsesMax';
2455 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2457 Name
:= 'swGibsCount';
2458 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2459 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2460 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2461 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2462 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2464 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2466 Name
:= 'swCorpseType';
2467 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2468 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2470 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2472 Name
:= 'swGibsType';
2473 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2474 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2476 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2478 Name
:= 'swBloodType';
2479 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2480 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2482 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2484 Name
:= 'swScreenFlash';
2485 AddItem(_lc
[I_MENU_NO
]);
2486 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2487 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2489 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2491 Name
:= 'swBackground';
2492 AddItem(_lc
[I_MENU_YES
]);
2493 AddItem(_lc
[I_MENU_NO
]);
2495 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2497 Name
:= 'swMessages';
2498 AddItem(_lc
[I_MENU_YES
]);
2499 AddItem(_lc
[I_MENU_NO
]);
2501 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2503 Name
:= 'swRevertPlayers';
2504 AddItem(_lc
[I_MENU_YES
]);
2505 AddItem(_lc
[I_MENU_NO
]);
2507 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2509 Name
:= 'swChatBubble';
2510 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2511 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2512 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2513 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2514 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2518 Menu
.DefControl
:= 'mOptionsGameMenu';
2519 g_GUI_AddWindow(Menu
);
2521 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2522 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2524 Name
:= 'mOptionsControlsMenu';
2525 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2526 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2527 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2528 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2529 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2531 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsControlsP1Menu');
2532 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsControlsP2Menu');
2534 if e_JoysticksAvailable
<> 0 then
2535 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2537 Menu
.DefControl
:= 'mOptionsControlsMenu';
2538 g_GUI_AddWindow(Menu
);
2540 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2541 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1
]))) do
2543 Name
:= 'mOptionsControlsP1Menu';
2544 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2545 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2546 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2547 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2548 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2549 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2550 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2551 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2552 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2554 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2555 g_GUI_AddWindow(Menu
);
2557 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2558 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2
]))) do
2560 Name
:= 'mOptionsControlsP2Menu';
2561 AddKeyRead(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2562 AddKeyRead(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2563 AddKeyRead(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2564 AddKeyRead(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2565 AddKeyRead(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2566 AddKeyRead(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2567 AddKeyRead(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2568 AddKeyRead(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2569 AddKeyRead(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2571 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2572 g_GUI_AddWindow(Menu
);
2574 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2575 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2577 Name
:= 'mOptionsControlsJoystickMenu';
2578 for i
:= 0 to e_JoysticksAvailable
-1 do
2579 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2581 Name
:= 'scDeadzone' + IntToStr(i
);
2585 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2586 g_GUI_AddWindow(Menu
);
2588 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2589 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2591 Name
:= 'mOptionsPlayersMenu';
2592 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2593 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2595 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2596 g_GUI_AddWindow(Menu
);
2598 CreatePlayerOptionsMenu('P1');
2599 CreatePlayerOptionsMenu('P2');
2601 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2602 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2604 Name
:= 'mOptionsPlayersMIMenu';
2605 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2610 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2615 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2617 Name
:= 'meComment';
2620 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2621 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2624 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2628 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2629 g_GUI_AddWindow(Menu
);
2631 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2632 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2634 Name
:= 'mOptionsLanguageMenu';
2635 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2636 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2639 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2640 g_GUI_AddWindow(Menu
);
2642 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2643 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2644 g_GUI_AddWindow(Menu
);
2646 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2647 Menu
.BackTexture
:= 'INTER';
2648 Menu
.OnClose
:= ProcAuthorsClose
;
2652 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2654 Color
:= _RGB(255, 0, 0);
2655 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2657 _y
:= _y
+GetHeight();
2659 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2661 Color
:= _RGB(255, 0, 0);
2662 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2664 _y
:= _y
+GetHeight()+32;
2666 // ×òî äåëàë: Êòî äåëàë
2667 cx
:= gScreenWidth
div 2 - 320 + 64;
2668 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2670 Color
:= _RGB(255, 0, 0);
2675 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2677 Color
:= _RGB(255, 255, 255);
2682 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2684 Color
:= _RGB(255, 0, 0);
2689 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2691 Color
:= _RGB(255, 255, 255);
2696 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2698 Color
:= _RGB(255, 255, 255);
2703 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2705 Color
:= _RGB(255, 0, 0);
2710 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2712 Color
:= _RGB(255, 255, 255);
2717 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2719 Color
:= _RGB(255, 0, 0);
2724 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2726 Color
:= _RGB(255, 255, 255);
2729 _y
:= gScreenHeight
- 128;
2732 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2734 Color
:= _RGB(255, 0, 0);
2739 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2741 Color
:= _RGB(255, 255, 255);
2744 _y
:= _y
+GetHeight();
2746 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2748 Color
:= _RGB(255, 255, 255);
2751 _y
:= _y
+GetHeight();
2753 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2755 Color
:= _RGB(255, 255, 255);
2758 _y
:= gScreenHeight
- 32;
2760 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2762 Color
:= _RGB(255, 0, 0);
2763 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2766 g_GUI_AddWindow(Menu
);
2768 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2769 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2770 g_GUI_AddWindow(Menu
);
2772 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2773 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2775 Name
:= 'mmGameSingleMenu';
2776 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2777 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2778 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2779 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2780 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2781 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2783 Menu
.DefControl
:= 'mmGameSingleMenu';
2784 Menu
.MainWindow
:= True;
2785 Menu
.OnClose
:= ProcGMClose
;
2786 Menu
.OnShow
:= ProcGMShow
;
2787 g_GUI_AddWindow(Menu
);
2789 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2790 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2791 g_GUI_AddWindow(Menu
);
2793 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2794 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2795 g_GUI_AddWindow(Menu
);
2797 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2798 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2800 Name
:= 'mmGameCustomMenu';
2801 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2802 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2803 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2804 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2805 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2806 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2807 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2809 Menu
.DefControl
:= 'mmGameCustomMenu';
2810 Menu
.MainWindow
:= True;
2811 Menu
.OnClose
:= ProcGMClose
;
2812 Menu
.OnShow
:= ProcGMShow
;
2813 g_GUI_AddWindow(Menu
);
2815 Menu
:= TGUIWindow
.Create('GameServerMenu');
2816 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2818 Name
:= 'mmGameServerMenu';
2819 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
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
:= 'mmGameServerMenu';
2826 Menu
.MainWindow
:= True;
2827 Menu
.OnClose
:= ProcGMClose
;
2828 Menu
.OnShow
:= ProcGMShow
;
2829 g_GUI_AddWindow(Menu
);
2831 Menu
:= TGUIWindow
.Create('GameClientMenu');
2832 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2834 Name
:= 'mmGameClientMenu';
2835 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2836 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2837 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2839 Menu
.DefControl
:= 'mmGameClientMenu';
2840 Menu
.MainWindow
:= True;
2841 Menu
.OnClose
:= ProcGMClose
;
2842 Menu
.OnShow
:= ProcGMShow
;
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2846 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2848 Name
:= 'mClientPasswordMenu';
2849 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2857 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2860 Menu
.DefControl
:= 'mClientPasswordMenu';
2861 g_GUI_AddWindow(Menu
);
2863 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2864 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2866 Name
:= 'mGameSetGameMenu';
2867 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2869 Name
:= 'swTeamDamage';
2870 AddItem(_lc
[I_MENU_YES
]);
2871 AddItem(_lc
[I_MENU_NO
]);
2874 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2876 Name
:= 'edTimeLimit';
2881 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2883 Name
:= 'edGoalLimit';
2888 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2890 Name
:= 'edMaxLives';
2895 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2898 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2899 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2900 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2906 Menu
.DefControl
:= 'mGameSetGameMenu';
2907 Menu
.OnClose
:= ProcApplyGameSet
;
2908 g_GUI_AddWindow(Menu
);
2910 Menu
:= TGUIWindow
.Create('TeamMenu');
2911 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
2913 Name
:= 'mmTeamMenu';
2914 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
2915 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
2916 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
2917 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
2918 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
2920 Menu
.DefControl
:= 'mmTeamMenu';
2921 Menu
.OnShow
:= ProcChangePlayers
;
2922 g_GUI_AddWindow(Menu
);
2925 procedure g_Menu_Show_SaveMenu();
2927 if g_Game_IsTestMap
then
2929 if gGameSettings
.GameType
= GT_SINGLE
then
2930 g_GUI_ShowWindow('GameSingleMenu')
2933 if g_Game_IsClient
then
2936 if g_Game_IsNet
then
2939 g_GUI_ShowWindow('GameCustomMenu');
2941 g_GUI_ShowWindow('SaveMenu');
2942 g_Sound_PlayEx('MENU_OPEN');
2945 procedure g_Menu_Show_LoadMenu();
2947 if gGameSettings
.GameType
= GT_SINGLE
then
2948 g_GUI_ShowWindow('GameSingleMenu')
2951 if g_Game_IsClient
then
2954 if g_Game_IsNet
then
2957 g_GUI_ShowWindow('GameCustomMenu');
2959 g_GUI_ShowWindow('LoadMenu');
2960 g_Sound_PlayEx('MENU_OPEN');
2963 procedure g_Menu_Show_GameSetGame();
2965 if gGameSettings
.GameType
= GT_SINGLE
then
2966 g_GUI_ShowWindow('GameSingleMenu')
2969 if g_Game_IsClient
then
2972 if g_Game_IsNet
then
2973 g_GUI_ShowWindow('GameServerMenu')
2975 g_GUI_ShowWindow('GameCustomMenu');
2978 g_GUI_ShowWindow('GameSetGameMenu');
2979 g_Sound_PlayEx('MENU_OPEN');
2982 procedure g_Menu_Show_OptionsVideo();
2984 if gGameSettings
.GameType
= GT_SINGLE
then
2985 g_GUI_ShowWindow('GameSingleMenu')
2988 if g_Game_IsClient
then
2989 g_GUI_ShowWindow('GameClientMenu')
2991 if g_Game_IsNet
then
2992 g_GUI_ShowWindow('GameServerMenu')
2994 g_GUI_ShowWindow('GameCustomMenu');
2997 g_GUI_ShowWindow('OptionsMenu');
2998 g_GUI_ShowWindow('OptionsVideoMenu');
2999 g_Sound_PlayEx('MENU_OPEN');
3002 procedure g_Menu_Show_OptionsSound();
3004 if gGameSettings
.GameType
= GT_SINGLE
then
3005 g_GUI_ShowWindow('GameSingleMenu')
3008 if g_Game_IsClient
then
3009 g_GUI_ShowWindow('GameClientMenu')
3011 if g_Game_IsNet
then
3012 g_GUI_ShowWindow('GameServerMenu')
3014 g_GUI_ShowWindow('GameCustomMenu');
3017 g_GUI_ShowWindow('OptionsMenu');
3018 g_GUI_ShowWindow('OptionsSoundMenu');
3019 g_Sound_PlayEx('MENU_OPEN');
3022 procedure g_Menu_Show_EndGameMenu();
3024 g_GUI_ShowWindow('EndGameMenu');
3025 g_Sound_PlayEx('MENU_OPEN');
3028 procedure g_Menu_Show_QuitGameMenu();
3030 g_GUI_ShowWindow('ExitMenu');
3031 g_Sound_PlayEx('MENU_OPEN');
3034 procedure g_Menu_Init();
3041 procedure g_Menu_Free();
3045 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3050 procedure g_Menu_Reset();
3054 g_GUI_SaveMenuPos();
3055 ex
:= g_GUI_Destroy();
3059 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3064 g_Game_SetDebugMode();
3066 g_GUI_LoadMenuPos();