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/>.
16 {$INCLUDE ../shared/a_modes.inc}
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
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPSTRUCT
, wadreader
, Math
, g_saveload
,
49 e_textures
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
;
53 type TYNCallback
= procedure (yes
:Boolean);
55 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
57 if win
.UserData
= nil then exit
;
59 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
60 IK_N
: TYNCallback(win
.UserData
)(false);
64 procedure YesButtonCB (ctl
: TGUITextButton
);
66 if ctl
.UserData
= nil then exit
;
67 TYNCallback(ctl
.UserData
)(true);
70 procedure NoButtonCB (ctl
: TGUITextButton
);
72 if ctl
.UserData
= nil then exit
;
73 TYNCallback(ctl
.UserData
)(false);
76 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
80 //if length(Text) = 0 then exit;
81 Result
:= TGUIWindow
.Create(WinName
);
84 //OnKeyDownEx := @YNKeyDownProc;
85 //UserData := @ActionProc;
86 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
89 Name
:= '__temp_yes_no_menu:'+WinName
;
91 AddText(Text, MaxLen
);
92 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
93 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
95 DefControl
:= '__temp_yes_no_menu:'+WinName
;
101 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
102 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
104 procedure ProcApplyOptions();
109 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
111 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
115 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
116 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
117 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
121 g_Sound_SetupAllVolumes(
122 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
123 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
126 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
127 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
128 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
129 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
133 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
134 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
135 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
136 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
138 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
143 else gGibsCount
:= 48;
146 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
147 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
148 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
149 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
150 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
151 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
152 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
153 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
154 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
156 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
158 with menu
, gGameControls
.GameControls
do
160 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
161 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
162 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
163 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
167 with menu
, gGameControls
.P1Control
do
169 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
170 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
171 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
172 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
173 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
174 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
175 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
176 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
177 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
178 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
180 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
181 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
182 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
183 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
184 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
185 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
186 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
187 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
188 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
189 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
192 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
193 with menu
, gGameControls
.P1Control
do
195 for i
:= WP_FIRST
to WP_LAST
do
197 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
198 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
202 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
203 with menu
, gGameControls
.P2Control
do
205 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
206 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
207 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
208 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
209 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
210 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
211 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
212 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
213 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
214 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
216 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
217 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
218 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
219 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
220 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
221 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
222 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
223 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
224 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
225 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
228 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
229 with menu
, gGameControls
.P2Control
do
231 for i
:= WP_FIRST
to WP_LAST
do
233 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
234 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
238 if e_JoysticksAvailable
> 0 then
240 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
243 for i
:= 0 to e_JoysticksAvailable
-1 do
244 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
248 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
250 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
251 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
252 TEAM_RED
, TEAM_BLUE
);
254 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
256 gPlayer1Settings
.Model
:= Model
.Name
;
257 gPlayer1Settings
.Color
:= Model
.Color
;
260 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
262 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
263 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
264 TEAM_RED
, TEAM_BLUE
);
265 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
267 gPlayer2Settings
.Model
:= Model
.Name
;
268 gPlayer2Settings
.Color
:= Model
.Color
;
271 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
272 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
274 if g_Game_IsServer
then
276 if gPlayer1
<> nil then
278 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
279 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
280 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
281 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
283 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
286 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
289 if gPlayer2
<> nil then
291 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
292 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
293 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
294 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
296 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
301 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
303 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
306 procedure ReadOptions();
311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
313 with TGUISwitch(menu
.GetControl('swBPP')) do
319 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
320 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
322 with TGUISwitch(menu
.GetControl('swVSync')) do
323 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
325 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
326 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
328 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
330 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
331 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
332 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
334 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
335 if gMuteWhenInactive
then
340 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
342 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
343 if gSoundEffectsDF
then
348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
349 with menu
, gGameControls
.P1Control
do
351 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
352 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
353 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
354 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
355 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
356 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
357 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
358 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
362 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
374 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
375 with menu
, gGameControls
.P1Control
do
377 for i
:= WP_FIRST
to WP_LAST
do
379 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
380 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
384 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
385 with menu
, gGameControls
.P2Control
do
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
398 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
410 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
411 with menu
, gGameControls
.P2Control
do
413 for i
:= WP_FIRST
to WP_LAST
do
415 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
416 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
420 if e_JoysticksAvailable
> 0 then
422 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
425 for i
:= 0 to e_JoysticksAvailable
-1 do
426 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
430 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
431 with menu
, gGameControls
.GameControls
do
433 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
434 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
435 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
436 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
439 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
441 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
442 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
443 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
444 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
445 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
447 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
450 with TGUISwitch(menu
.GetControl('swBloodType')) do
451 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
453 with TGUISwitch(menu
.GetControl('swCorpseType')) do
454 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
456 with TGUISwitch(menu
.GetControl('swGibsType')) do
457 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
459 with TGUISwitch(menu
.GetControl('swGibsCount')) do
468 with TGUISwitch(menu
.GetControl('swBackGround')) do
469 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
471 with TGUISwitch(menu
.GetControl('swMessages')) do
472 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
474 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
475 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
477 with TGUISwitch(menu
.GetControl('swChatBubble')) do
478 ItemIndex
:= gChatBubble
;
480 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
482 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
483 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
485 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
486 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
488 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
489 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
490 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
492 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
494 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
495 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
497 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
498 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
500 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
501 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
502 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
504 ProcSelectModel(nil);
507 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
509 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
510 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
511 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
513 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
516 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
518 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
519 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
520 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
522 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
525 procedure ProcStartCustomGame();
531 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
533 Map
:= TGUILabel(GetControl('lbMap')).Text;
536 if Pos(':\', Map
) = 0 then
539 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
540 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
541 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
542 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
543 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
545 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
546 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
547 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
548 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
551 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
553 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
555 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
557 Options
:= Options
or GAME_OPTION_MONSTERS
;
558 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
560 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
562 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
563 gcBotsVS
:= 'Monsters';
566 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
567 gcBotsVS
:= 'Everybody';
570 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
571 gcBotsVS
:= 'Players';
578 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
580 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
581 gcMaxLives
, Options
, gcPlayers
);
585 procedure ProcStartNetGame();
591 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
593 Map
:= TGUILabel(GetControl('lbMap')).Text;
596 if Pos(':\', Map
) = 0 then
599 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
600 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
601 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
602 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
603 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
604 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
606 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
607 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
608 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
609 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
612 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
614 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
616 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
618 Options
:= Options
or GAME_OPTION_MONSTERS
;
619 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
621 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
623 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
624 gnBotsVS
:= 'Monsters';
627 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
628 gnBotsVS
:= 'Everybody';
631 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
632 gnBotsVS
:= 'Players';
637 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
638 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
639 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
640 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
641 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
644 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
645 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
647 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
648 Options
, gnPlayers
, 0, NetPort
);
651 procedure ProcConnectNetGame();
655 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
657 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
658 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
659 PW
:= TGUIEdit(GetControl('edPW')).Text;
662 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
663 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
666 procedure ProcEnterPassword();
670 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
672 NetClientIP
:= PromptIP
;
673 NetClientPort
:= PromptPort
;
674 PW
:= TGUIEdit(GetControl('edPW')).Text;
677 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
678 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
681 procedure ProcServerlist();
683 if not NetInitDone
then
685 if (not g_Net_Init()) then
687 g_Console_Add('NET: ERROR: Failed to init ENet!');
694 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
696 gState
:= STATE_SLIST
;
697 g_ActiveWindow
:= nil;
699 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
704 slReturnPressed
:= True;
705 if g_Net_Slist_Fetch(slCurrent
) then
707 if slCurrent
= nil then
708 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
711 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
714 procedure ProcStartCampaign();
720 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
722 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
723 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
730 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
733 procedure ProcSelectMap(Sender
: TGUIControl
);
737 wad
, map
, res
: String;
739 win
:= g_GUI_GetWindow('SelectMapMenu');
740 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
742 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
743 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
745 if (wad
= '') or (map
= '') then
746 begin // Ýòî íå êàðòà
747 TGUILabel(GetControl('lbMapName')).Text := '';
748 TGUILabel(GetControl('lbMapAuthor')).Text := '';
749 TGUILabel(GetControl('lbMapSize')).Text := '';
750 TGUIMemo(GetControl('meMapDescription')).SetText('');
751 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
752 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
758 a
:= g_Map_GetMapInfo(res
);
760 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
761 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
762 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
763 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
764 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
765 TGUILabel(win
.GetControl('lbMapScale')).Text :=
766 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
771 procedure ProcSelectWAD(Sender
: TGUIControl
);
776 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
778 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
780 with TGUIListBox(GetControl('lsMapRes')) do
786 list
:= g_Map_GetMapsList(wad
);
800 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
806 win
:= g_GUI_GetWindow('CampaignMenu');
807 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
809 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
813 TGUILabel(GetControl('lbWADName')).Text := '';
814 TGUILabel(GetControl('lbWADAuthor')).Text := '';
815 TGUIMemo(GetControl('meWADDescription')).SetText('');
818 a
:= g_Game_GetMegaWADInfo(wad
);
820 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
821 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
822 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
824 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
828 fn
:= g_ExtractWadName(a
.pic
);
830 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
832 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
837 procedure ProcChangeColor(Sender
: TGUIControl
);
841 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
842 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
843 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
844 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
845 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
846 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
848 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
849 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
850 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
851 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
852 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
853 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
856 procedure ProcSelectModel(Sender
: TGUIControl
);
861 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
862 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
863 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
865 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
866 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
867 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
869 ProcChangeColor(nil);
872 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
884 wad
:= TWADFile
.Create
;
885 if wad
.ReadFile(GameWAD
) then
886 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
891 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
893 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
894 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
895 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
896 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
898 if g_Texture_Get('FONT_STD', ID
) then
899 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
904 if cfglen
<> 0 then FreeMem(cfgdata
);
907 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
913 cfgdata
, fntdata
: Pointer;
914 cfglen
, fntlen
: Integer;
922 wad
:= TWADFile
.Create
;
923 if wad
.ReadFile(GameWAD
) then
925 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
926 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
932 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
933 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
934 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
936 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
937 FontID
:= e_CharFont_Create(spc
);
941 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
942 if chrwidth
= 0 then Continue
;
944 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
946 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
952 if cfglen
<> 0 then FreeMem(cfgdata
);
953 if fntlen
<> 0 then FreeMem(fntdata
);
956 procedure MenuLoadData();
958 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
960 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
961 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
962 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
963 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
964 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
965 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
966 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
967 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
968 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
969 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
970 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
971 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
972 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
973 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
974 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
975 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
976 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
977 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
978 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
979 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
980 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
981 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
982 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
983 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
985 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
986 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
987 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
988 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
989 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
990 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
991 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
994 procedure MenuFreeData();
996 e_CharFont_Remove(gMenuFont
);
997 e_CharFont_Remove(gMenuSmallFont
);
999 g_Texture_Delete('MAINMENU_MARKER1');
1000 g_Texture_Delete('MAINMENU_MARKER2');
1001 g_Texture_Delete('SCROLL_LEFT');
1002 g_Texture_Delete('SCROLL_RIGHT');
1003 g_Texture_Delete('SCROLL_MIDDLE');
1004 g_Texture_Delete('SCROLL_MARKER');
1005 g_Texture_Delete('EDIT_LEFT');
1006 g_Texture_Delete('EDIT_RIGHT');
1007 g_Texture_Delete('EDIT_MIDDLE');
1008 g_Texture_Delete('BOX1');
1009 g_Texture_Delete('BOX2');
1010 g_Texture_Delete('BOX3');
1011 g_Texture_Delete('BOX4');
1012 g_Texture_Delete('BOX5');
1013 g_Texture_Delete('BOX6');
1014 g_Texture_Delete('BOX7');
1015 g_Texture_Delete('BOX8');
1016 g_Texture_Delete('BOX9');
1017 g_Texture_Delete('BSCROLL_UP_A');
1018 g_Texture_Delete('BSCROLL_UP_U');
1019 g_Texture_Delete('BSCROLL_DOWN_A');
1020 g_Texture_Delete('BSCROLL_DOWN_U');
1021 g_Texture_Delete('BSCROLL_MIDDLE');
1022 g_Texture_Delete('NOPIC');
1024 g_Sound_Delete('MENU_SELECT');
1025 g_Sound_Delete('MENU_OPEN');
1026 g_Sound_Delete('MENU_CLOSE');
1027 g_Sound_Delete('MENU_CHANGE');
1028 g_Sound_Delete('SCROLL_ADD');
1029 g_Sound_Delete('SCROLL_SUB');
1030 g_Sound_Delete('SOUND_PLAYER_FALL');
1033 procedure ProcAuthorsMenu();
1035 gMusic
.SetByName('MUSIC_INTERMUS');
1039 procedure ProcExitMenuKeyDown (yes
: Boolean);
1042 snd
: TPlayableSound
;
1047 g_Game_StopAllSounds(True);
1048 case (Random(18)) of
1049 0: s
:= 'SOUND_MONSTER_PAIN';
1050 1: s
:= 'SOUND_MONSTER_DIE_3';
1051 2: s
:= 'SOUND_MONSTER_SLOP';
1052 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1053 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1054 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1055 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1056 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1057 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1058 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1059 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1060 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1061 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1062 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1063 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1064 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1065 else s
:= 'SOUND_PLAYER_FALL';
1067 snd
:= TPlayableSound
.Create();
1068 res
:= snd
.SetByName(s
);
1069 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1073 while snd
.IsPlaying() do begin end;
1081 procedure ProcLoadMenu();
1086 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1090 procedure ProcSaveMenu();
1095 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1099 procedure ProcSaveGame(Sender
: TGUIControl
);
1103 if g_Game_IsNet
then Exit
;
1104 if g_Game_IsTestMap
then Exit
;
1105 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1106 g_Game_PauseAllSounds(True);
1107 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1109 g_ActiveWindow
:= nil;
1110 g_Game_Pause(False);
1113 procedure ProcLoadGame(Sender
: TGUIControl
);
1117 if g_Game_IsNet
then Exit
;
1118 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1119 if g_LoadGame(a
) then
1120 g_Game_PauseAllSounds(False)
1121 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1122 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1125 procedure ProcSingle1Player();
1127 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1130 procedure ProcSingle2Players();
1132 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1135 procedure ProcSelectMapMenu();
1138 wad_lb
: TGUIFileListBox
;
1139 map_lb
: TGUIListBox
;
1142 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1143 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1144 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1146 if wad_lb
.SelectedItem() <> '' then
1147 map
:= map_lb
.SelectedItem()
1151 wad_lb
.UpdateFileList();
1154 if wad_lb
.SelectedItem() <> '' then
1157 map_lb
.SelectItem(map
);
1159 if map_lb
.SelectedItem() <> '' then
1163 g_GUI_ShowWindow('SelectMapMenu');
1166 procedure ProcSelectCampaignMenu();
1169 wad_lb
: TGUIFileListBox
;
1171 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1172 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1174 wad_lb
.UpdateFileList();
1176 if wad_lb
.SelectedItem() <> '' then
1177 ProcSelectCampaignWAD(nil);
1180 procedure ProcSetMap();
1182 wad
, map
, res
: String;
1184 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1186 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1187 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1190 if (wad
= '') or (map
= '') then
1193 res
:= wad
+':\'+map
;
1195 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1196 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1199 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1203 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1205 g_Sound_SetupAllVolumes(
1206 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1207 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1211 procedure ProcOptionsPlayersMIMenu();
1216 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1218 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1220 if a
= '' then Exit
;
1222 b
:= g_PlayerModel_GetInfo(a
);
1224 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1226 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1227 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1228 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1230 if b
.HaveWeapon
then
1231 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1233 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1236 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1239 procedure ProcOptionsPlayersAnim();
1243 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1248 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1251 Model
.GetCurrentAnimation
.Loop
:= True;
1252 Model
.GetCurrentAnimationMask
.Loop
:= True;
1256 procedure ProcOptionsPlayersWeap();
1260 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1265 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1269 procedure ProcOptionsPlayersRot();
1273 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1274 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1275 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1278 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1282 g_Options_SetDefault();
1288 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1290 if yes
then ReadOptions();
1294 procedure ProcAuthorsClose();
1296 gMusic
.SetByName('MUSIC_MENU');
1298 gState
:= STATE_MENU
;
1301 procedure ProcGMClose();
1303 g_Game_InGameMenu(False);
1306 procedure ProcGMShow();
1311 if (gGameSettings
.GameType
= GT_SINGLE
) and
1312 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1313 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1314 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1316 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1317 if g_Game_IsTestMap
then
1318 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1319 TGUIMainMenu(g_ActiveWindow
.GetControl(
1320 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1323 procedure ProcChangePlayers();
1325 TeamGame
, Spectator
, AddTwo
: Boolean;
1326 P1Team
{, P2Team}: Byte;
1327 bP2
: TGUITextButton
;
1329 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1330 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1331 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1332 P1Team
:= TEAM_NONE
;
1333 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1335 //P2Team := TEAM_NONE;
1336 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1338 TGUIMainMenu(g_ActiveWindow
.GetControl(
1339 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1340 TGUIMainMenu(g_ActiveWindow
.GetControl(
1341 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1342 TGUIMainMenu(g_ActiveWindow
.GetControl(
1343 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1345 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1346 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1347 bP2
.Enabled
:= AddTwo
and not Spectator
;
1349 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1351 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1352 if gPlayer2
= nil then
1353 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1355 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1357 TGUIMainMenu(g_ActiveWindow
.GetControl(
1358 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1361 procedure ProcJoinRed();
1363 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1365 if g_Game_IsServer
then
1367 if gPlayer1
= nil then
1368 g_Game_AddPlayer(TEAM_RED
)
1371 if gPlayer1
.Team
<> TEAM_RED
then
1373 gPlayer1
.SwitchTeam
;
1374 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1377 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1382 gPlayer1Settings
.Team
:= TEAM_RED
;
1383 MC_SEND_PlayerSettings
;
1384 if gPlayer1
= nil then
1385 g_Game_AddPlayer(TEAM_RED
);
1387 g_ActiveWindow
:= nil;
1388 g_Game_Pause(False);
1391 procedure ProcJoinBlue();
1393 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1395 if g_Game_IsServer
then
1397 if gPlayer1
= nil then
1398 g_Game_AddPlayer(TEAM_BLUE
)
1401 if gPlayer1
.Team
<> TEAM_BLUE
then
1403 gPlayer1
.SwitchTeam
;
1404 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1407 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1412 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1413 MC_SEND_PlayerSettings
;
1414 if gPlayer1
= nil then
1415 g_Game_AddPlayer(TEAM_BLUE
);
1417 g_ActiveWindow
:= nil;
1418 g_Game_Pause(False);
1421 procedure ProcJoinGame();
1423 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1425 if gPlayer1
= nil then
1427 g_ActiveWindow
:= nil;
1428 g_Game_Pause(False);
1431 procedure ProcSwitchP2();
1433 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1435 if gPlayer1
= nil then
1437 if gPlayer2
= nil then
1440 g_Game_RemovePlayer();
1441 g_ActiveWindow
:= nil;
1442 g_Game_Pause(False);
1445 procedure ProcSpectate();
1447 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1450 g_ActiveWindow
:= nil;
1451 g_Game_Pause(False);
1454 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1456 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1459 procedure ProcEndMenuKeyDown (yes
: Boolean);
1461 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1464 procedure ProcSetRussianLanguage();
1466 if gLanguage
<> LANGUAGE_RUSSIAN
then
1468 gLanguage
:= LANGUAGE_RUSSIAN
;
1469 gLanguageChange
:= True;
1470 gAskLanguage
:= False;
1472 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1474 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1479 procedure ProcSetEnglishLanguage();
1481 if gLanguage
<> LANGUAGE_ENGLISH
then
1483 gLanguage
:= LANGUAGE_ENGLISH
;
1484 gLanguageChange
:= True;
1485 gAskLanguage
:= False;
1487 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1489 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1494 procedure ReadGameSettings();
1498 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1500 with gGameSettings
do
1502 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1503 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1508 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1509 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1510 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1512 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1513 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1514 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1517 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1522 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1524 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1525 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1526 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1527 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1528 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1529 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1530 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1531 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1535 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1536 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1541 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1542 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1547 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1548 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1553 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1554 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1559 procedure ProcApplyGameSet();
1563 stat
: TPlayerStatArray
;
1565 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1567 if not g_Game_IsServer
then Exit
;
1569 with gGameSettings
do
1571 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1573 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1574 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1576 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1579 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1581 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1587 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1589 TimeLimit
:= Max(n
, b
);
1593 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1595 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1602 if GameMode
= GM_DM
then
1604 stat
:= g_Player_GetStats();
1606 for a
:= 0 to High(stat
) do
1607 if stat
[a
].Frags
> b
then
1611 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1613 GoalLimit
:= Max(n
, b
);
1617 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1619 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1620 if n
< 0 then n
:= 0;
1621 if n
> 255 then n
:= 255;
1627 stat
:= g_Player_GetStats();
1629 for a
:= 0 to High(stat
) do
1630 if stat
[a
].Lives
> b
then
1633 MaxLives
:= Max(n
, b
);
1637 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1639 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1642 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1643 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1647 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1648 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1652 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1653 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1659 if g_Game_IsNet
then MH_SEND_GameSettings
;
1662 procedure ProcVideoOptionsRes();
1668 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1670 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1671 IntToStr(gScreenWidth
) +
1672 ' x ' + IntToStr(gScreenHeight
) +
1673 ', ' + IntToStr(gBPP
) + ' bpp';
1675 with TGUIListBox(menu
.GetControl('lsResolution')) do
1677 list
:= GetDisplayModes(gBPP
, SR
);
1688 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1695 procedure ProcApplyVideoOptions();
1698 Fullscreen
: Boolean;
1699 SWidth
, SHeight
: Integer;
1702 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1704 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1705 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1707 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1709 if (SWidth
<> gScreenWidth
) or
1710 (SHeight
<> gScreenHeight
) or
1711 (Fullscreen
<> gFullscreen
) then
1713 gResolutionChange
:= True;
1714 gRC_Width
:= SWidth
;
1715 gRC_Height
:= SHeight
;
1716 gRC_FullScreen
:= Fullscreen
;
1717 gRC_Maximized
:= gWinMaximized
;
1720 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1724 procedure ProcSetFirstRussianLanguage();
1726 gLanguage
:= LANGUAGE_RUSSIAN
;
1727 gLanguageChange
:= True;
1728 gAskLanguage
:= False;
1730 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1733 procedure ProcSetFirstEnglishLanguage();
1735 gLanguage
:= LANGUAGE_ENGLISH
;
1736 gLanguageChange
:= True;
1737 gAskLanguage
:= False;
1739 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1742 procedure ProcRecallAddress();
1744 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1746 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1747 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1751 procedure CreateFirstLanguageMenu();
1755 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1757 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1759 Name
:= 'mmFirstLanguageMenu';
1760 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1761 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1764 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1765 Menu
.MainWindow
:= True;
1766 g_GUI_AddWindow(Menu
);
1769 procedure g_Menu_AskLanguage();
1771 CreateFirstLanguageMenu();
1772 g_GUI_ShowWindow('FirstLanguageMenu');
1775 procedure CreatePlayerOptionsMenu(s
: String);
1780 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1782 a
:= _lc
[I_MENU_PLAYER_1
]
1784 a
:= _lc
[I_MENU_PLAYER_2
];
1785 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1787 Name
:= 'mOptionsPlayers'+s
+'Menu';
1788 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1790 Name
:= 'ed'+s
+'Name';
1794 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1796 Name
:= 'sw'+s
+'Team';
1797 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1798 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1800 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1802 Name
:= 'ls'+s
+'Model';
1804 Items
:= g_PlayerModel_GetNames();
1805 OnChange
:= ProcSelectModel
;
1807 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1809 Name
:= 'sc'+s
+'Red';
1811 OnChange
:= ProcChangeColor
;
1813 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1815 Name
:= 'sc'+s
+'Green';
1817 OnChange
:= ProcChangeColor
;
1819 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1821 Name
:= 'sc'+s
+'Blue';
1823 OnChange
:= ProcChangeColor
;
1826 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1827 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1828 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1829 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1831 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1833 Name
:= 'mv'+s
+'Model';
1834 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1835 Y
:= GetControl('ls'+s
+'Model').Y
;
1838 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1839 g_GUI_AddWindow(Menu
);
1842 procedure CreateAllMenus();
1846 a
, cx
, _y
, i
: Integer;
1849 Menu
:= TGUIWindow
.Create('MainMenu');
1850 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1852 Name
:= 'mmMainMenu';
1853 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1854 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1855 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1856 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1857 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1858 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1860 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1862 Color
:= _RGB(255, 255, 255);
1863 X
:= gScreenWidth
-GetWidth
-8;
1864 Y
:= gScreenHeight
-GetHeight
-8;
1866 Menu
.DefControl
:= 'mmMainMenu';
1867 Menu
.MainWindow
:= True;
1868 g_GUI_AddWindow(Menu
);
1870 Menu
:= TGUIWindow
.Create('NewGameMenu');
1871 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1873 Name
:= 'mmNewGameMenu';
1874 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1875 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1876 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1877 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1879 Menu
.DefControl
:= 'mmNewGameMenu';
1880 g_GUI_AddWindow(Menu
);
1882 Menu
:= TGUIWindow
.Create('NetGameMenu');
1883 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1885 Name
:= 'mmNetGameMenu';
1886 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1887 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1889 Menu
.DefControl
:= 'mmNetGameMenu';
1890 g_GUI_AddWindow(Menu
);
1892 Menu
:= TGUIWindow
.Create('NetServerMenu');
1893 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1895 Name
:= 'mNetServerMenu';
1896 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1898 Name
:= 'edSrvName';
1899 OnlyDigits
:= False;
1902 Text := NetServerName
;
1904 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1906 Name
:= 'edSrvPassword';
1907 OnlyDigits
:= False;
1910 Text := NetPassword
;
1912 with AddEdit(_lc
[I_NET_PORT
]) do
1918 Text := IntToStr(NetPort
);
1920 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1922 Name
:= 'edMaxPlayers';
1926 Text := IntToStr(NetMaxClients
);
1928 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1930 Name
:= 'swUseMaster';
1931 AddItem(_lc
[I_MENU_YES
]);
1932 AddItem(_lc
[I_MENU_NO
]);
1933 if NetUseMaster
then
1939 with AddLabel(_lc
[I_MENU_MAP
]) do
1944 OnClick
:= @ProcSelectMapMenu
;
1946 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1948 Name
:= 'swGameMode';
1949 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1950 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1951 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1952 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1953 case g_Game_TextToMode(gnGameMode
) of
1955 GM_DM
: ItemIndex
:= 0;
1956 GM_TDM
: ItemIndex
:= 1;
1957 GM_CTF
: ItemIndex
:= 2;
1959 GM_COOP
: ItemIndex
:= 3;
1961 OnChange
:= ProcSwitchMonstersNet
;
1963 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1965 Name
:= 'edTimeLimit';
1969 if gnTimeLimit
> 0 then
1970 Text := IntToStr(gnTimeLimit
);
1972 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1974 Name
:= 'edGoalLimit';
1978 if gnGoalLimit
> 0 then
1979 Text := IntToStr(gnGoalLimit
);
1981 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1983 Name
:= 'edMaxLives';
1987 if gnMaxLives
> 0 then
1988 Text := IntToStr(gnMaxLives
);
1990 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1992 Name
:= 'swPlayers';
1993 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1994 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1995 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1996 ItemIndex
:= gnPlayers
;
1998 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2000 Name
:= 'swTeamDamage';
2001 AddItem(_lc
[I_MENU_YES
]);
2002 AddItem(_lc
[I_MENU_NO
]);
2003 if gnTeamDamage
then
2008 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2010 Name
:= 'swEnableExits';
2011 AddItem(_lc
[I_MENU_YES
]);
2012 AddItem(_lc
[I_MENU_NO
]);
2018 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2020 Name
:= 'swWeaponStay';
2021 AddItem(_lc
[I_MENU_YES
]);
2022 AddItem(_lc
[I_MENU_NO
]);
2023 if gnWeaponStay
then
2028 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2030 Name
:= 'swMonsters';
2031 AddItem(_lc
[I_MENU_YES
]);
2032 AddItem(_lc
[I_MENU_NO
]);
2038 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2041 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2042 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2043 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2045 if gnBotsVS
= 'Players' then
2047 if gnBotsVS
= 'Monsters' then
2051 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2055 Menu
.DefControl
:= 'mNetServerMenu';
2056 g_GUI_AddWindow(Menu
);
2058 Menu
:= TGUIWindow
.Create('NetClientMenu');
2059 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2061 Name
:= 'mNetClientMenu';
2063 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2066 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2072 Text := 'localhost';
2074 with AddEdit(_lc
[I_NET_PORT
]) do
2082 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2085 OnlyDigits
:= False;
2092 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2096 Menu
.DefControl
:= 'mNetClientMenu';
2097 g_GUI_AddWindow(Menu
);
2099 Menu
:= TGUIWindow
.Create('LoadMenu');
2100 Menu
.OnShow
:= ProcLoadMenu
;
2101 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2103 Name
:= 'mmLoadMenu';
2108 Name
:= 'edSlot'+IntToStr(a
);
2111 OnEnter
:= ProcLoadGame
;
2114 Menu
.DefControl
:= 'mmLoadMenu';
2115 g_GUI_AddWindow(Menu
);
2117 Menu
:= TGUIWindow
.Create('SaveMenu');
2118 Menu
.OnShow
:= ProcSaveMenu
;
2119 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2121 Name
:= 'mmSaveMenu';
2126 Name
:= 'edSlot'+IntToStr(a
);
2129 OnChange
:= ProcSaveGame
;
2132 Menu
.DefControl
:= 'mmSaveMenu';
2133 g_GUI_AddWindow(Menu
);
2135 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2136 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2138 Name
:= 'mCustomGameMenu';
2139 with AddLabel(_lc
[I_MENU_MAP
]) do
2144 OnClick
:= @ProcSelectMapMenu
;
2146 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2148 Name
:= 'swGameMode';
2149 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2150 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2151 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2152 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2153 case g_Game_TextToMode(gcGameMode
) of
2155 GM_DM
: ItemIndex
:= 0;
2156 GM_TDM
: ItemIndex
:= 1;
2157 GM_CTF
: ItemIndex
:= 2;
2159 GM_COOP
: ItemIndex
:= 3;
2161 OnChange
:= ProcSwitchMonstersCustom
;
2163 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2165 Name
:= 'edTimeLimit';
2169 if gcTimeLimit
> 0 then
2170 Text := IntToStr(gcTimeLimit
);
2172 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2174 Name
:= 'edGoalLimit';
2178 if gcGoalLimit
> 0 then
2179 Text := IntToStr(gcGoalLimit
);
2181 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2183 Name
:= 'edMaxLives';
2187 if gcMaxLives
> 0 then
2188 Text := IntToStr(gcMaxLives
);
2190 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2192 Name
:= 'swPlayers';
2193 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2194 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2195 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2196 ItemIndex
:= gcPlayers
;
2198 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2200 Name
:= 'swTeamDamage';
2201 AddItem(_lc
[I_MENU_YES
]);
2202 AddItem(_lc
[I_MENU_NO
]);
2203 if gcTeamDamage
then
2208 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2210 Name
:= 'swEnableExits';
2211 AddItem(_lc
[I_MENU_YES
]);
2212 AddItem(_lc
[I_MENU_NO
]);
2218 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2220 Name
:= 'swWeaponStay';
2221 AddItem(_lc
[I_MENU_YES
]);
2222 AddItem(_lc
[I_MENU_NO
]);
2223 if gcWeaponStay
then
2228 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2230 Name
:= 'swMonsters';
2231 AddItem(_lc
[I_MENU_YES
]);
2232 AddItem(_lc
[I_MENU_NO
]);
2238 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2241 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2242 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2243 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2245 if gcBotsVS
= 'Players' then
2247 if gcBotsVS
= 'Monsters' then
2251 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2255 Menu
.DefControl
:= 'mCustomGameMenu';
2256 g_GUI_AddWindow(Menu
);
2258 Menu
:= TGUIWindow
.Create('CampaignMenu');
2259 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2261 Name
:= 'mCampaignMenu';
2270 with AddFileList('', 15, 4) do
2273 OnChange
:= ProcSelectCampaignWAD
;
2277 FileMask
:= '*.wad|*.pk3|*.zip';
2278 SetBase(MapsDir
+'megawads/');
2281 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2283 Name
:= 'lbWADName';
2287 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2289 Name
:= 'lbWADAuthor';
2293 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2294 with AddMemo('', 15, 3) do
2296 Name
:= 'meWADDescription';
2297 Color
:= MENU_ITEMSCTRL_COLOR
;
2299 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2301 Name
:= 'swPlayers';
2302 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2303 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2306 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2310 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2312 Name
:= 'mpWADImage';
2313 DefaultRes
:= 'NOPIC';
2314 X
:= GetControl('lsWAD').X
+4;
2315 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2318 Menu
.DefControl
:= 'mCampaignMenu';
2319 g_GUI_AddWindow(Menu
);
2321 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2322 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2324 Name
:= 'mSelectMapMenu';
2325 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2328 OnChange
:= ProcSelectWAD
;
2332 FileMask
:= '*.wad|*.pk3|*.zip';
2335 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2339 OnChange
:= ProcSelectMap
;
2342 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2344 Name
:= 'lbMapName';
2348 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2350 Name
:= 'lbMapAuthor';
2354 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2356 Name
:= 'lbMapSize';
2360 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2362 Name
:= 'meMapDescription';
2367 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2369 Name
:= 'mpMapPreview';
2370 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2371 Y
:= GetControl('lsMapWAD').Y
;
2373 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2375 Name
:= 'lbMapScale';
2378 Color
:= MENU_ITEMSCTRL_COLOR
;
2379 X
:= GetControl('lsMapWAD').X
+
2380 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2381 2 + MAPPREVIEW_WIDTH
*4;
2382 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2385 Menu
.OnClose
:= ProcSetMap
;
2386 Menu
.DefControl
:= 'mSelectMapMenu';
2387 g_GUI_AddWindow(Menu
);
2389 Menu
:= TGUIWindow
.Create('OptionsMenu');
2390 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2392 Name
:= 'mmOptionsMenu';
2393 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2394 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2395 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2396 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2397 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2398 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2400 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2401 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2403 Menu
.OnClose
:= ProcApplyOptions
;
2404 Menu
.DefControl
:= 'mmOptionsMenu';
2405 g_GUI_AddWindow(Menu
);
2407 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2408 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2409 g_GUI_AddWindow(Menu
);
2411 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2412 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2414 Name
:= 'mOptionsVideoMenu';
2415 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2416 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2422 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2425 AddItem(_lc
[I_MENU_YES
]);
2426 AddItem(_lc
[I_MENU_NO
]);
2428 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2430 Name
:= 'swTextureFilter';
2431 AddItem(_lc
[I_MENU_YES
]);
2432 AddItem(_lc
[I_MENU_NO
]);
2434 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2436 Name
:= 'swLegacyNPOT';
2437 AddItem(_lc
[I_MENU_NO
]);
2438 AddItem(_lc
[I_MENU_YES
]);
2441 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2444 Menu
.DefControl
:= 'mOptionsVideoMenu';
2445 g_GUI_AddWindow(Menu
);
2447 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2448 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2450 Name
:= 'mOptionsVideoResMenu';
2451 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2453 Name
:= 'lbCurrentRes';
2457 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2459 Name
:= 'lsResolution';
2462 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2464 Name
:= 'swFullScreen';
2465 AddItem(_lc
[I_MENU_YES
]);
2466 AddItem(_lc
[I_MENU_NO
]);
2469 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2472 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2473 g_GUI_AddWindow(Menu
);
2475 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2476 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2478 Name
:= 'mOptionsSoundMenu';
2479 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2481 Name
:= 'scMusicLevel';
2483 OnChange
:= ProcChangeSoundSettings
;
2485 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2487 Name
:= 'scSoundLevel';
2489 OnChange
:= ProcChangeSoundSettings
;
2491 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2493 Name
:= 'scMaxSimSounds';
2496 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2498 Name
:= 'swAnnouncer';
2499 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2500 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2501 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2502 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2504 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2505 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2507 Name
:= 'swSoundEffects';
2508 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2509 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2511 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2513 Name
:= 'swInactiveSounds';
2514 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2515 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2519 Menu
.DefControl
:= 'mOptionsSoundMenu';
2520 g_GUI_AddWindow(Menu
);
2522 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2523 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2525 Name
:= 'mOptionsGameMenu';
2526 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2528 Name
:= 'scParticlesCount';
2531 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2533 Name
:= 'swBloodCount';
2534 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2535 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2536 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2537 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2538 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2540 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2542 Name
:= 'scShellsMax';
2545 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2547 Name
:= 'scGibsMax';
2550 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2552 Name
:= 'scCorpsesMax';
2555 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2557 Name
:= 'swGibsCount';
2558 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2559 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2560 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2561 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2562 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2564 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2566 Name
:= 'swCorpseType';
2567 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2568 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2570 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2572 Name
:= 'swGibsType';
2573 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2574 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2576 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2578 Name
:= 'swBloodType';
2579 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2580 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2582 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2584 Name
:= 'swScreenFlash';
2585 AddItem(_lc
[I_MENU_NO
]);
2586 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2587 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2589 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2591 Name
:= 'swBackground';
2592 AddItem(_lc
[I_MENU_YES
]);
2593 AddItem(_lc
[I_MENU_NO
]);
2595 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2597 Name
:= 'swMessages';
2598 AddItem(_lc
[I_MENU_YES
]);
2599 AddItem(_lc
[I_MENU_NO
]);
2601 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2603 Name
:= 'swRevertPlayers';
2604 AddItem(_lc
[I_MENU_YES
]);
2605 AddItem(_lc
[I_MENU_NO
]);
2607 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2609 Name
:= 'swChatBubble';
2610 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2611 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2612 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2613 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2614 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2618 Menu
.DefControl
:= 'mOptionsGameMenu';
2619 g_GUI_AddWindow(Menu
);
2621 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2622 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2624 Name
:= 'mOptionsControlsMenu';
2625 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2626 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2627 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2628 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2629 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2631 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2632 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2633 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2634 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2635 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2636 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2638 if e_JoysticksAvailable
<> 0 then
2639 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2641 Menu
.DefControl
:= 'mOptionsControlsMenu';
2642 g_GUI_AddWindow(Menu
);
2644 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2645 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2647 Name
:= 'mOptionsControlsP1Menu';
2648 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2649 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2650 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2651 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2652 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2653 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2654 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2655 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2656 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2657 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2659 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2660 g_GUI_AddWindow(Menu
);
2662 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2663 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2665 Name
:= 'mOptionsControlsP1MenuWeapons';
2666 for i
:= WP_FIRST
to WP_LAST
do
2667 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2668 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2670 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2671 g_GUI_AddWindow(Menu
);
2673 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2674 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2676 Name
:= 'mOptionsControlsP2Menu';
2677 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2678 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2679 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2680 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2681 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2682 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2683 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2684 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2685 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2686 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2688 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2689 g_GUI_AddWindow(Menu
);
2691 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2692 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2694 Name
:= 'mOptionsControlsP2MenuWeapons';
2695 for i
:= WP_FIRST
to WP_LAST
do
2696 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2697 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2699 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2700 g_GUI_AddWindow(Menu
);
2702 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2703 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2705 Name
:= 'mOptionsControlsJoystickMenu';
2706 for i
:= 0 to e_JoysticksAvailable
-1 do
2707 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2709 Name
:= 'scDeadzone' + IntToStr(i
);
2713 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2714 g_GUI_AddWindow(Menu
);
2716 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2717 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2719 Name
:= 'mOptionsPlayersMenu';
2720 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2721 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2723 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2724 g_GUI_AddWindow(Menu
);
2726 CreatePlayerOptionsMenu('P1');
2727 CreatePlayerOptionsMenu('P2');
2729 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2730 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2732 Name
:= 'mOptionsPlayersMIMenu';
2733 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2738 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2743 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2745 Name
:= 'meComment';
2748 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2749 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2752 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2756 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2757 g_GUI_AddWindow(Menu
);
2759 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2760 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2762 Name
:= 'mOptionsLanguageMenu';
2763 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2764 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2767 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2768 g_GUI_AddWindow(Menu
);
2770 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2771 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2772 g_GUI_AddWindow(Menu
);
2774 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2775 Menu
.BackTexture
:= 'INTER';
2776 Menu
.OnClose
:= ProcAuthorsClose
;
2780 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2782 Color
:= _RGB(255, 0, 0);
2783 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2785 _y
:= _y
+GetHeight();
2787 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2789 Color
:= _RGB(255, 0, 0);
2790 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2792 _y
:= _y
+GetHeight()+32;
2794 // ×òî äåëàë: Êòî äåëàë
2795 cx
:= gScreenWidth
div 2 - 320 + 64;
2796 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2798 Color
:= _RGB(255, 0, 0);
2803 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2805 Color
:= _RGB(255, 255, 255);
2810 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2812 Color
:= _RGB(255, 0, 0);
2817 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2819 Color
:= _RGB(255, 255, 255);
2824 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2826 Color
:= _RGB(255, 255, 255);
2831 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2833 Color
:= _RGB(255, 0, 0);
2838 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2840 Color
:= _RGB(255, 255, 255);
2845 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2847 Color
:= _RGB(255, 0, 0);
2852 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2854 Color
:= _RGB(255, 255, 255);
2857 _y
:= gScreenHeight
- 128;
2860 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2862 Color
:= _RGB(255, 0, 0);
2867 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2869 Color
:= _RGB(255, 255, 255);
2872 _y
:= _y
+GetHeight();
2874 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2876 Color
:= _RGB(255, 255, 255);
2879 _y
:= _y
+GetHeight();
2881 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2883 Color
:= _RGB(255, 255, 255);
2886 _y
:= gScreenHeight
- 32;
2888 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2890 Color
:= _RGB(255, 0, 0);
2891 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2894 g_GUI_AddWindow(Menu
);
2896 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2897 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2898 g_GUI_AddWindow(Menu
);
2900 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2901 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2903 Name
:= 'mmGameSingleMenu';
2904 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2905 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2906 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2907 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2908 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2909 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2911 Menu
.DefControl
:= 'mmGameSingleMenu';
2912 Menu
.MainWindow
:= True;
2913 Menu
.OnClose
:= ProcGMClose
;
2914 Menu
.OnShow
:= ProcGMShow
;
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2918 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2919 g_GUI_AddWindow(Menu
);
2921 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2922 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2923 g_GUI_AddWindow(Menu
);
2925 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2926 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2928 Name
:= 'mmGameCustomMenu';
2929 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2930 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2931 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2932 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2933 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2934 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2935 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2937 Menu
.DefControl
:= 'mmGameCustomMenu';
2938 Menu
.MainWindow
:= True;
2939 Menu
.OnClose
:= ProcGMClose
;
2940 Menu
.OnShow
:= ProcGMShow
;
2941 g_GUI_AddWindow(Menu
);
2943 Menu
:= TGUIWindow
.Create('GameServerMenu');
2944 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2946 Name
:= 'mmGameServerMenu';
2947 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2948 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2949 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2950 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2951 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2953 Menu
.DefControl
:= 'mmGameServerMenu';
2954 Menu
.MainWindow
:= True;
2955 Menu
.OnClose
:= ProcGMClose
;
2956 Menu
.OnShow
:= ProcGMShow
;
2957 g_GUI_AddWindow(Menu
);
2959 Menu
:= TGUIWindow
.Create('GameClientMenu');
2960 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2962 Name
:= 'mmGameClientMenu';
2963 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2964 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2965 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2967 Menu
.DefControl
:= 'mmGameClientMenu';
2968 Menu
.MainWindow
:= True;
2969 Menu
.OnClose
:= ProcGMClose
;
2970 Menu
.OnShow
:= ProcGMShow
;
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2974 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2976 Name
:= 'mClientPasswordMenu';
2977 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2985 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2988 Menu
.DefControl
:= 'mClientPasswordMenu';
2989 g_GUI_AddWindow(Menu
);
2991 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2992 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2994 Name
:= 'mGameSetGameMenu';
2995 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2997 Name
:= 'swTeamDamage';
2998 AddItem(_lc
[I_MENU_YES
]);
2999 AddItem(_lc
[I_MENU_NO
]);
3002 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3004 Name
:= 'edTimeLimit';
3009 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3011 Name
:= 'edGoalLimit';
3016 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3018 Name
:= 'edMaxLives';
3023 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3026 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3027 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3028 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3034 Menu
.DefControl
:= 'mGameSetGameMenu';
3035 Menu
.OnClose
:= ProcApplyGameSet
;
3036 g_GUI_AddWindow(Menu
);
3038 Menu
:= TGUIWindow
.Create('TeamMenu');
3039 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3041 Name
:= 'mmTeamMenu';
3042 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3043 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3044 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3045 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3046 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3048 Menu
.DefControl
:= 'mmTeamMenu';
3049 Menu
.OnShow
:= ProcChangePlayers
;
3050 g_GUI_AddWindow(Menu
);
3053 procedure g_Menu_Show_SaveMenu();
3055 if g_Game_IsTestMap
then
3057 if gGameSettings
.GameType
= GT_SINGLE
then
3058 g_GUI_ShowWindow('GameSingleMenu')
3061 if g_Game_IsClient
then
3064 if g_Game_IsNet
then
3067 g_GUI_ShowWindow('GameCustomMenu');
3069 g_GUI_ShowWindow('SaveMenu');
3070 g_Sound_PlayEx('MENU_OPEN');
3073 procedure g_Menu_Show_LoadMenu();
3075 if gGameSettings
.GameType
= GT_SINGLE
then
3076 g_GUI_ShowWindow('GameSingleMenu')
3079 if g_Game_IsClient
then
3082 if g_Game_IsNet
then
3085 g_GUI_ShowWindow('GameCustomMenu');
3087 g_GUI_ShowWindow('LoadMenu');
3088 g_Sound_PlayEx('MENU_OPEN');
3091 procedure g_Menu_Show_GameSetGame();
3093 if gGameSettings
.GameType
= GT_SINGLE
then
3094 g_GUI_ShowWindow('GameSingleMenu')
3097 if g_Game_IsClient
then
3100 if g_Game_IsNet
then
3101 g_GUI_ShowWindow('GameServerMenu')
3103 g_GUI_ShowWindow('GameCustomMenu');
3106 g_GUI_ShowWindow('GameSetGameMenu');
3107 g_Sound_PlayEx('MENU_OPEN');
3110 procedure g_Menu_Show_OptionsVideo();
3112 if gGameSettings
.GameType
= GT_SINGLE
then
3113 g_GUI_ShowWindow('GameSingleMenu')
3116 if g_Game_IsClient
then
3117 g_GUI_ShowWindow('GameClientMenu')
3119 if g_Game_IsNet
then
3120 g_GUI_ShowWindow('GameServerMenu')
3122 g_GUI_ShowWindow('GameCustomMenu');
3125 g_GUI_ShowWindow('OptionsMenu');
3126 g_GUI_ShowWindow('OptionsVideoMenu');
3127 g_Sound_PlayEx('MENU_OPEN');
3130 procedure g_Menu_Show_OptionsSound();
3132 if gGameSettings
.GameType
= GT_SINGLE
then
3133 g_GUI_ShowWindow('GameSingleMenu')
3136 if g_Game_IsClient
then
3137 g_GUI_ShowWindow('GameClientMenu')
3139 if g_Game_IsNet
then
3140 g_GUI_ShowWindow('GameServerMenu')
3142 g_GUI_ShowWindow('GameCustomMenu');
3145 g_GUI_ShowWindow('OptionsMenu');
3146 g_GUI_ShowWindow('OptionsSoundMenu');
3147 g_Sound_PlayEx('MENU_OPEN');
3150 procedure g_Menu_Show_EndGameMenu();
3152 g_GUI_ShowWindow('EndGameMenu');
3153 g_Sound_PlayEx('MENU_OPEN');
3156 procedure g_Menu_Show_QuitGameMenu();
3158 g_GUI_ShowWindow('ExitMenu');
3159 g_Sound_PlayEx('MENU_OPEN');
3162 procedure g_Menu_Init();
3169 procedure g_Menu_Free();
3173 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3178 procedure g_Menu_Reset();
3182 g_GUI_SaveMenuPos();
3183 ex
:= g_GUI_Destroy();
3187 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3192 g_Game_SetDebugMode();
3194 g_GUI_LoadMenuPos();