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(standalone
: Boolean=false);
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
, sdl2
,
48 MAPDEF
, Math
, g_saveload
,
49 e_texture
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
54 type TYNCallback
= procedure (yes
:Boolean);
56 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
58 if win
.UserData
= nil then exit
;
60 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
61 IK_N
: TYNCallback(win
.UserData
)(false);
65 procedure YesButtonCB (ctl
: TGUITextButton
);
67 if ctl
.UserData
= nil then exit
;
68 TYNCallback(ctl
.UserData
)(true);
71 procedure NoButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(false);
77 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
81 //if length(Text) = 0 then exit;
82 Result
:= TGUIWindow
.Create(WinName
);
85 //OnKeyDownEx := @YNKeyDownProc;
86 //UserData := @ActionProc;
87 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
90 Name
:= '__temp_yes_no_menu:'+WinName
;
92 AddText(Text, MaxLen
);
93 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
94 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
96 DefControl
:= '__temp_yes_no_menu:'+WinName
;
102 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
103 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
105 procedure ProcApplyOptions();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 {$IF not DEFINED(HEADLESS)}
122 if (ovs
<> gVSync
) then
124 if (gVSync
) then v
:= 1 else v
:= 0;
125 if (SDL_GL_SetSwapInterval(v
) <> 0) then writeln('oops; can''t change vsync option, restart required')
126 else writeln('vsync changed');
130 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
131 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
133 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
135 g_Sound_SetupAllVolumes(
136 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
137 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
140 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
141 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
142 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
143 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
144 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
146 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
148 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
149 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
150 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
151 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
153 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
158 else gGibsCount
:= 48;
161 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
162 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
163 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
164 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
165 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
166 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
167 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
168 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
169 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
171 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
173 with menu
, gGameControls
.GameControls
do
175 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
176 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
177 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
178 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
181 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
182 with menu
, gGameControls
.P1Control
do
184 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
185 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
186 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
187 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
188 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
189 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
190 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
191 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
192 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
193 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
195 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
196 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
197 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
198 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
199 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
200 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
201 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
202 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
203 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
204 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
207 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
208 with menu
, gGameControls
.P1Control
do
210 for i
:= WP_FIRST
to WP_LAST
do
212 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
213 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
217 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
218 with menu
, gGameControls
.P2Control
do
220 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
221 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
222 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
223 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
224 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
225 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
226 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
227 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
228 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
229 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
231 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
232 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
233 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
234 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
235 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
236 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
237 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
238 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
239 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
240 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
243 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
244 with menu
, gGameControls
.P2Control
do
246 for i
:= WP_FIRST
to WP_LAST
do
248 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
249 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
253 if e_JoysticksAvailable
> 0 then
255 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
258 for i
:= 0 to e_JoysticksAvailable
-1 do
259 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
263 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
265 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
266 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
267 TEAM_RED
, TEAM_BLUE
);
269 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
271 gPlayer1Settings
.Model
:= Model
.Name
;
272 gPlayer1Settings
.Color
:= Model
.Color
;
275 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
277 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
278 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
279 TEAM_RED
, TEAM_BLUE
);
280 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
282 gPlayer2Settings
.Model
:= Model
.Name
;
283 gPlayer2Settings
.Color
:= Model
.Color
;
286 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
287 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
289 if g_Game_IsServer
then
291 if gPlayer1
<> nil then
293 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
294 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
295 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
296 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
298 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
301 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
304 if gPlayer2
<> nil then
306 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
307 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
308 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
309 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
311 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
316 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
318 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
321 procedure ReadOptions();
326 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
328 with TGUISwitch(menu
.GetControl('swBPP')) do
334 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
335 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
337 with TGUISwitch(menu
.GetControl('swVSync')) do
338 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
340 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
341 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
343 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
345 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
346 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
347 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
349 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
350 if gMuteWhenInactive
then
355 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
357 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
358 if gSoundEffectsDF
then
363 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
364 if gUseChatSounds
then
369 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
370 with menu
, gGameControls
.P1Control
do
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
374 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
395 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
396 with menu
, gGameControls
.P1Control
do
398 for i
:= WP_FIRST
to WP_LAST
do
400 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
401 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
405 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
406 with menu
, gGameControls
.P2Control
do
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
409 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
410 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
411 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
412 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
413 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
416 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
421 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
422 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
423 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
424 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
431 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
432 with menu
, gGameControls
.P2Control
do
434 for i
:= WP_FIRST
to WP_LAST
do
436 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
437 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
441 if e_JoysticksAvailable
> 0 then
443 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
446 for i
:= 0 to e_JoysticksAvailable
-1 do
447 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
451 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
452 with menu
, gGameControls
.GameControls
do
454 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
455 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
456 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
457 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
460 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
462 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
463 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
464 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
465 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
466 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
468 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
471 with TGUISwitch(menu
.GetControl('swBloodType')) do
472 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
474 with TGUISwitch(menu
.GetControl('swCorpseType')) do
475 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
477 with TGUISwitch(menu
.GetControl('swGibsType')) do
478 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
480 with TGUISwitch(menu
.GetControl('swGibsCount')) do
489 with TGUISwitch(menu
.GetControl('swBackGround')) do
490 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
492 with TGUISwitch(menu
.GetControl('swMessages')) do
493 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
495 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
496 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
498 with TGUISwitch(menu
.GetControl('swChatBubble')) do
499 ItemIndex
:= gChatBubble
;
501 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
503 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
504 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
506 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
507 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
509 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
510 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
511 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
515 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
516 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
518 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
519 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
521 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
522 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
523 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
525 ProcSelectModel(nil);
528 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
530 // don't turn off monsters in DM
532 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
533 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
534 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
536 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
539 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
540 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
541 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
542 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
546 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
548 // don't turn off monsters in DM
550 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
551 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
552 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
554 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
557 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
558 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
559 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
560 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
564 procedure ProcStartCustomGame();
570 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
572 Map
:= TGUILabel(GetControl('lbMap')).Text;
575 if not isWadPath(Map
) then
578 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
579 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
580 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
581 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
582 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
584 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
585 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
586 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
587 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
590 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
592 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
594 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
596 Options
:= Options
or GAME_OPTION_MONSTERS
;
597 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
599 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
601 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
602 gcBotsVS
:= 'Monsters';
605 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
606 gcBotsVS
:= 'Everybody';
609 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
610 gcBotsVS
:= 'Players';
617 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
619 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
620 gcMaxLives
, Options
, gcPlayers
);
624 procedure ProcStartNetGame();
630 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
632 Map
:= TGUILabel(GetControl('lbMap')).Text;
635 if not isWadPath(Map
) then
638 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
639 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
640 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
641 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
642 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
643 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
645 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
646 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
647 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
648 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
651 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
653 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
655 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
657 Options
:= Options
or GAME_OPTION_MONSTERS
;
658 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
660 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
662 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
663 gnBotsVS
:= 'Monsters';
666 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
667 gnBotsVS
:= 'Everybody';
670 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
671 gnBotsVS
:= 'Players';
676 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
677 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
678 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
679 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
680 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
683 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
684 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
686 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
687 Options
, gnPlayers
, 0, NetPort
);
690 procedure ProcConnectNetGame();
694 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
696 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
697 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
698 PW
:= TGUIEdit(GetControl('edPW')).Text;
701 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
702 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
705 procedure ProcEnterPassword();
709 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
711 NetClientIP
:= PromptIP
;
712 NetClientPort
:= PromptPort
;
713 PW
:= TGUIEdit(GetControl('edPW')).Text;
716 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
717 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
720 procedure ProcServerlist();
722 if not NetInitDone
then
724 if (not g_Net_Init()) then
726 g_Console_Add('NET: ERROR: Failed to init ENet!');
733 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
735 gState
:= STATE_SLIST
;
736 g_ActiveWindow
:= nil;
738 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
743 slReturnPressed
:= True;
744 if g_Net_Slist_Fetch(slCurrent
) then
746 if slCurrent
= nil then
747 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
750 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
753 procedure ProcStartCampaign();
759 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
761 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
762 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
769 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
772 procedure ProcSelectMap(Sender
: TGUIControl
);
776 wad
, map
, res
: String;
778 win
:= g_GUI_GetWindow('SelectMapMenu');
779 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
781 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
782 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
784 if (wad
= '') or (map
= '') then
785 begin // Ýòî íå êàðòà
786 TGUILabel(GetControl('lbMapName')).Text := '';
787 TGUILabel(GetControl('lbMapAuthor')).Text := '';
788 TGUILabel(GetControl('lbMapSize')).Text := '';
789 TGUIMemo(GetControl('meMapDescription')).SetText('');
790 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
791 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
797 a
:= g_Map_GetMapInfo(res
);
799 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
800 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
801 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
802 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
803 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
804 TGUILabel(win
.GetControl('lbMapScale')).Text :=
805 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
810 procedure ProcSelectWAD(Sender
: TGUIControl
);
815 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
817 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
819 with TGUIListBox(GetControl('lsMapRes')) do
825 list
:= g_Map_GetMapsList(wad
);
839 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
845 win
:= g_GUI_GetWindow('CampaignMenu');
846 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
848 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
852 TGUILabel(GetControl('lbWADName')).Text := '';
853 TGUILabel(GetControl('lbWADAuthor')).Text := '';
854 TGUIMemo(GetControl('meWADDescription')).SetText('');
857 a
:= g_Game_GetMegaWADInfo(wad
);
859 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
860 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
861 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
863 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
867 fn
:= g_ExtractWadName(a
.pic
);
869 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
871 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
876 procedure ProcChangeColor(Sender
: TGUIControl
);
880 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
881 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
882 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
883 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
884 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
885 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
887 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
888 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
889 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
890 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
891 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
892 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
895 procedure ProcSelectModel(Sender
: TGUIControl
);
900 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
901 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
902 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
904 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
905 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
906 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
908 ProcChangeColor(nil);
911 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
923 wad
:= TWADFile
.Create
;
924 if wad
.ReadFile(GameWAD
) then
925 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
930 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
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);
935 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
937 if g_Texture_Get('FONT_STD', ID
) then
938 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
943 if cfglen
<> 0 then FreeMem(cfgdata
);
946 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
952 cfgdata
, fntdata
: Pointer;
953 cfglen
, fntlen
: Integer;
961 wad
:= TWADFile
.Create
;
962 if wad
.ReadFile(GameWAD
) then
964 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
965 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
971 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
972 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
973 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
975 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
976 FontID
:= e_CharFont_Create(spc
);
980 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
981 if chrwidth
= 0 then Continue
;
983 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
985 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
991 if cfglen
<> 0 then FreeMem(cfgdata
);
992 if fntlen
<> 0 then FreeMem(fntdata
);
995 procedure MenuLoadData();
997 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
999 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1000 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1001 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1002 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1003 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1004 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1005 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1006 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1007 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1008 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1009 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1010 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1011 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1012 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1013 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1014 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1015 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1016 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1017 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1018 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1019 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1020 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1021 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1022 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1024 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1025 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1026 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1027 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1028 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1029 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1030 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1033 procedure MenuFreeData();
1035 e_CharFont_Remove(gMenuFont
);
1036 e_CharFont_Remove(gMenuSmallFont
);
1038 g_Texture_Delete('MAINMENU_MARKER1');
1039 g_Texture_Delete('MAINMENU_MARKER2');
1040 g_Texture_Delete('SCROLL_LEFT');
1041 g_Texture_Delete('SCROLL_RIGHT');
1042 g_Texture_Delete('SCROLL_MIDDLE');
1043 g_Texture_Delete('SCROLL_MARKER');
1044 g_Texture_Delete('EDIT_LEFT');
1045 g_Texture_Delete('EDIT_RIGHT');
1046 g_Texture_Delete('EDIT_MIDDLE');
1047 g_Texture_Delete('BOX1');
1048 g_Texture_Delete('BOX2');
1049 g_Texture_Delete('BOX3');
1050 g_Texture_Delete('BOX4');
1051 g_Texture_Delete('BOX5');
1052 g_Texture_Delete('BOX6');
1053 g_Texture_Delete('BOX7');
1054 g_Texture_Delete('BOX8');
1055 g_Texture_Delete('BOX9');
1056 g_Texture_Delete('BSCROLL_UP_A');
1057 g_Texture_Delete('BSCROLL_UP_U');
1058 g_Texture_Delete('BSCROLL_DOWN_A');
1059 g_Texture_Delete('BSCROLL_DOWN_U');
1060 g_Texture_Delete('BSCROLL_MIDDLE');
1061 g_Texture_Delete('NOPIC');
1063 g_Sound_Delete('MENU_SELECT');
1064 g_Sound_Delete('MENU_OPEN');
1065 g_Sound_Delete('MENU_CLOSE');
1066 g_Sound_Delete('MENU_CHANGE');
1067 g_Sound_Delete('SCROLL_ADD');
1068 g_Sound_Delete('SCROLL_SUB');
1069 g_Sound_Delete('SOUND_PLAYER_FALL');
1072 procedure ProcAuthorsMenu();
1074 gMusic
.SetByName('MUSIC_INTERMUS');
1078 procedure ProcExitMenuKeyDown (yes
: Boolean);
1081 snd
: TPlayableSound
;
1086 g_Game_StopAllSounds(True);
1087 case (Random(18)) of
1088 0: s
:= 'SOUND_MONSTER_PAIN';
1089 1: s
:= 'SOUND_MONSTER_DIE_3';
1090 2: s
:= 'SOUND_MONSTER_SLOP';
1091 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1092 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1093 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1094 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1095 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1096 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1097 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1098 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1099 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1100 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1101 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1102 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1103 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1104 else s
:= 'SOUND_PLAYER_FALL';
1106 snd
:= TPlayableSound
.Create();
1107 res
:= snd
.SetByName(s
);
1108 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1112 while snd
.IsPlaying() do begin end;
1120 procedure ProcLoadMenu();
1127 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1128 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1129 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1133 procedure ProcSaveMenu();
1141 name
:= g_GetSaveName(a
, valid
);
1142 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1143 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1147 procedure ProcSaveGame(Sender
: TGUIControl
);
1151 if g_Game_IsNet
then Exit
;
1152 if g_Game_IsTestMap
then Exit
;
1153 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1154 g_Game_PauseAllSounds(True);
1155 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1157 g_ActiveWindow
:= nil;
1158 g_Game_Pause(False);
1161 procedure ProcLoadGame(Sender
: TGUIControl
);
1165 if g_Game_IsNet
then Exit
;
1166 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1167 if g_LoadGame(a
) then
1169 g_Game_PauseAllSounds(False)
1171 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1173 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1174 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1175 //g_ActiveWindow := nil;
1179 procedure ProcSingle1Player();
1181 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1184 procedure ProcSingle2Players();
1186 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1189 procedure ProcSelectMapMenu();
1192 wad_lb
: TGUIFileListBox
;
1193 map_lb
: TGUIListBox
;
1196 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1197 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1198 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1200 if wad_lb
.SelectedItem() <> '' then
1201 map
:= map_lb
.SelectedItem()
1205 wad_lb
.UpdateFileList();
1208 if wad_lb
.SelectedItem() <> '' then
1211 map_lb
.SelectItem(map
);
1213 if map_lb
.SelectedItem() <> '' then
1217 g_GUI_ShowWindow('SelectMapMenu');
1220 procedure ProcSelectCampaignMenu();
1223 wad_lb
: TGUIFileListBox
;
1225 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1226 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1228 wad_lb
.UpdateFileList();
1230 if wad_lb
.SelectedItem() <> '' then
1231 ProcSelectCampaignWAD(nil);
1234 procedure ProcSetMap();
1236 wad
, map
, res
: String;
1238 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1240 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1241 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1244 if (wad
= '') or (map
= '') then
1247 res
:= wad
+':\'+map
;
1249 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1250 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1253 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1257 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1259 g_Sound_SetupAllVolumes(
1260 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1261 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1265 procedure ProcOptionsPlayersMIMenu();
1270 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1272 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1274 if a
= '' then Exit
;
1276 b
:= g_PlayerModel_GetInfo(a
);
1278 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1280 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1281 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1282 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1284 if b
.HaveWeapon
then
1285 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1287 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1290 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1293 procedure ProcOptionsPlayersAnim();
1297 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1302 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1305 Model
.GetCurrentAnimation
.Loop
:= True;
1306 Model
.GetCurrentAnimationMask
.Loop
:= True;
1310 procedure ProcOptionsPlayersWeap();
1314 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1319 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1323 procedure ProcOptionsPlayersRot();
1327 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1328 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1330 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1334 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1338 g_Options_SetDefault();
1344 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1346 if yes
then ReadOptions();
1350 procedure ProcAuthorsClose();
1352 gMusic
.SetByName('MUSIC_MENU');
1354 gState
:= STATE_MENU
;
1357 procedure ProcGMClose();
1359 g_Game_InGameMenu(False);
1362 procedure ProcGMShow();
1367 if (gGameSettings
.GameType
= GT_SINGLE
) and
1368 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1369 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1370 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1372 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1373 if g_Game_IsTestMap
then
1374 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1375 TGUIMainMenu(g_ActiveWindow
.GetControl(
1376 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1379 procedure ProcChangePlayers();
1381 TeamGame
, Spectator
, AddTwo
: Boolean;
1382 P1Team
{, P2Team}: Byte;
1383 bP2
: TGUITextButton
;
1385 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1386 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1387 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1388 P1Team
:= TEAM_NONE
;
1389 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1391 //P2Team := TEAM_NONE;
1392 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1394 TGUIMainMenu(g_ActiveWindow
.GetControl(
1395 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1396 TGUIMainMenu(g_ActiveWindow
.GetControl(
1397 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1398 TGUIMainMenu(g_ActiveWindow
.GetControl(
1399 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1401 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1402 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1403 bP2
.Enabled
:= AddTwo
and not Spectator
;
1405 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1407 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1408 if gPlayer2
= nil then
1409 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1411 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1413 TGUIMainMenu(g_ActiveWindow
.GetControl(
1414 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1417 procedure ProcJoinRed();
1419 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1421 if g_Game_IsServer
then
1423 if gPlayer1
= nil then
1424 g_Game_AddPlayer(TEAM_RED
)
1427 if gPlayer1
.Team
<> TEAM_RED
then
1429 gPlayer1
.SwitchTeam
;
1430 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1433 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1438 gPlayer1Settings
.Team
:= TEAM_RED
;
1439 MC_SEND_PlayerSettings
;
1440 if gPlayer1
= nil then
1441 g_Game_AddPlayer(TEAM_RED
);
1443 g_ActiveWindow
:= nil;
1444 g_Game_Pause(False);
1447 procedure ProcJoinBlue();
1449 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1451 if g_Game_IsServer
then
1453 if gPlayer1
= nil then
1454 g_Game_AddPlayer(TEAM_BLUE
)
1457 if gPlayer1
.Team
<> TEAM_BLUE
then
1459 gPlayer1
.SwitchTeam
;
1460 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1463 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1468 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1469 MC_SEND_PlayerSettings
;
1470 if gPlayer1
= nil then
1471 g_Game_AddPlayer(TEAM_BLUE
);
1473 g_ActiveWindow
:= nil;
1474 g_Game_Pause(False);
1477 procedure ProcJoinGame();
1479 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1481 if gPlayer1
= nil then
1483 g_ActiveWindow
:= nil;
1484 g_Game_Pause(False);
1487 procedure ProcSwitchP2();
1489 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1491 if gPlayer1
= nil then
1493 if gPlayer2
= nil then
1496 g_Game_RemovePlayer();
1497 g_ActiveWindow
:= nil;
1498 g_Game_Pause(False);
1501 procedure ProcSpectate();
1503 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1506 g_ActiveWindow
:= nil;
1507 g_Game_Pause(False);
1510 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1512 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1515 procedure ProcEndMenuKeyDown (yes
: Boolean);
1517 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1520 procedure ProcSetRussianLanguage();
1522 if gLanguage
<> LANGUAGE_RUSSIAN
then
1524 gLanguage
:= LANGUAGE_RUSSIAN
;
1525 gLanguageChange
:= True;
1526 gAskLanguage
:= False;
1528 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1530 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1535 procedure ProcSetEnglishLanguage();
1537 if gLanguage
<> LANGUAGE_ENGLISH
then
1539 gLanguage
:= LANGUAGE_ENGLISH
;
1540 gLanguageChange
:= True;
1541 gAskLanguage
:= False;
1543 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1545 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1550 procedure ReadGameSettings();
1554 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1556 with gGameSettings
do
1558 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1559 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1564 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1565 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1566 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1568 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1569 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1570 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1573 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1578 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1580 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1581 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1582 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1583 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1584 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1585 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1586 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1587 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1591 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1592 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1597 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1598 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1603 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1604 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1609 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1610 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1615 procedure ProcApplyGameSet();
1619 stat
: TPlayerStatArray
;
1621 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1623 if not g_Game_IsServer
then Exit
;
1625 with gGameSettings
do
1627 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1629 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1630 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1632 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1635 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1637 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1643 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1645 TimeLimit
:= Max(n
, b
);
1649 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1651 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1658 if GameMode
= GM_DM
then
1660 stat
:= g_Player_GetStats();
1662 for a
:= 0 to High(stat
) do
1663 if stat
[a
].Frags
> b
then
1667 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1669 GoalLimit
:= Max(n
, b
);
1673 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1675 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1676 if n
< 0 then n
:= 0;
1677 if n
> 255 then n
:= 255;
1683 stat
:= g_Player_GetStats();
1685 for a
:= 0 to High(stat
) do
1686 if stat
[a
].Lives
> b
then
1689 MaxLives
:= Max(n
, b
);
1693 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1695 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1698 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1699 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1703 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1704 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1708 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1709 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1715 if g_Game_IsNet
then MH_SEND_GameSettings
;
1718 procedure ProcVideoOptionsRes();
1724 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1726 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1727 IntToStr(gScreenWidth
) +
1728 ' x ' + IntToStr(gScreenHeight
) +
1729 ', ' + IntToStr(gBPP
) + ' bpp';
1731 with TGUIListBox(menu
.GetControl('lsResolution')) do
1733 list
:= GetDisplayModes(gBPP
, SR
);
1744 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1751 procedure ProcApplyVideoOptions();
1754 Fullscreen
: Boolean;
1755 SWidth
, SHeight
: Integer;
1758 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1760 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1761 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1763 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1765 if (SWidth
<> gScreenWidth
) or
1766 (SHeight
<> gScreenHeight
) or
1767 (Fullscreen
<> gFullscreen
) then
1769 gResolutionChange
:= True;
1770 gRC_Width
:= SWidth
;
1771 gRC_Height
:= SHeight
;
1772 gRC_FullScreen
:= Fullscreen
;
1773 gRC_Maximized
:= gWinMaximized
;
1776 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1780 procedure ProcSetFirstRussianLanguage();
1782 gLanguage
:= LANGUAGE_RUSSIAN
;
1783 gLanguageChange
:= True;
1784 gAskLanguage
:= False;
1786 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1789 procedure ProcSetFirstEnglishLanguage();
1791 gLanguage
:= LANGUAGE_ENGLISH
;
1792 gLanguageChange
:= True;
1793 gAskLanguage
:= False;
1795 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1798 procedure ProcRecallAddress();
1800 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1802 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1803 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1807 procedure CreateFirstLanguageMenu();
1811 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1813 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1815 Name
:= 'mmFirstLanguageMenu';
1816 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1817 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1820 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1821 Menu
.MainWindow
:= True;
1822 g_GUI_AddWindow(Menu
);
1825 procedure g_Menu_AskLanguage();
1827 CreateFirstLanguageMenu();
1828 g_GUI_ShowWindow('FirstLanguageMenu');
1831 procedure CreatePlayerOptionsMenu(s
: String);
1836 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1838 a
:= _lc
[I_MENU_PLAYER_1
]
1840 a
:= _lc
[I_MENU_PLAYER_2
];
1841 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1843 Name
:= 'mOptionsPlayers'+s
+'Menu';
1844 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1846 Name
:= 'ed'+s
+'Name';
1850 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1852 Name
:= 'sw'+s
+'Team';
1853 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1854 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1856 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1858 Name
:= 'ls'+s
+'Model';
1860 Items
:= g_PlayerModel_GetNames();
1861 OnChange
:= ProcSelectModel
;
1863 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1865 Name
:= 'sc'+s
+'Red';
1867 OnChange
:= ProcChangeColor
;
1869 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1871 Name
:= 'sc'+s
+'Green';
1873 OnChange
:= ProcChangeColor
;
1875 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1877 Name
:= 'sc'+s
+'Blue';
1879 OnChange
:= ProcChangeColor
;
1882 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1883 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1884 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1885 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1887 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1889 Name
:= 'mv'+s
+'Model';
1890 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1891 Y
:= GetControl('ls'+s
+'Model').Y
;
1894 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1895 g_GUI_AddWindow(Menu
);
1898 procedure CreateAllMenus();
1902 a
, cx
, _y
, i
: Integer;
1905 Menu
:= TGUIWindow
.Create('MainMenu');
1906 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1908 Name
:= 'mmMainMenu';
1909 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1910 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1911 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1912 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1913 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1914 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1916 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1918 Color
:= _RGB(255, 255, 255);
1919 X
:= gScreenWidth
-GetWidth
-8;
1920 Y
:= gScreenHeight
-GetHeight
-8;
1922 Menu
.DefControl
:= 'mmMainMenu';
1923 Menu
.MainWindow
:= True;
1924 g_GUI_AddWindow(Menu
);
1926 Menu
:= TGUIWindow
.Create('NewGameMenu');
1927 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1929 Name
:= 'mmNewGameMenu';
1930 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1931 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1932 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1933 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1935 Menu
.DefControl
:= 'mmNewGameMenu';
1936 g_GUI_AddWindow(Menu
);
1938 Menu
:= TGUIWindow
.Create('NetGameMenu');
1939 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1941 Name
:= 'mmNetGameMenu';
1942 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1943 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1945 Menu
.DefControl
:= 'mmNetGameMenu';
1946 g_GUI_AddWindow(Menu
);
1948 Menu
:= TGUIWindow
.Create('NetServerMenu');
1949 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1951 Name
:= 'mNetServerMenu';
1952 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1954 Name
:= 'edSrvName';
1955 OnlyDigits
:= False;
1958 Text := NetServerName
;
1960 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1962 Name
:= 'edSrvPassword';
1963 OnlyDigits
:= False;
1966 Text := NetPassword
;
1968 with AddEdit(_lc
[I_NET_PORT
]) do
1974 Text := IntToStr(NetPort
);
1976 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1978 Name
:= 'edMaxPlayers';
1982 Text := IntToStr(NetMaxClients
);
1984 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1986 Name
:= 'swUseMaster';
1987 AddItem(_lc
[I_MENU_YES
]);
1988 AddItem(_lc
[I_MENU_NO
]);
1989 if NetUseMaster
then
1995 with AddLabel(_lc
[I_MENU_MAP
]) do
2000 OnClick
:= @ProcSelectMapMenu
;
2002 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2004 Name
:= 'swGameMode';
2005 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2006 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2007 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2008 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2009 case g_Game_TextToMode(gnGameMode
) of
2011 GM_DM
: ItemIndex
:= 0;
2012 GM_TDM
: ItemIndex
:= 1;
2013 GM_CTF
: ItemIndex
:= 2;
2015 GM_COOP
: ItemIndex
:= 3;
2017 OnChange
:= ProcSwitchMonstersNet
;
2019 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2021 Name
:= 'edTimeLimit';
2025 if gnTimeLimit
> 0 then
2026 Text := IntToStr(gnTimeLimit
);
2028 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2030 Name
:= 'edGoalLimit';
2034 if gnGoalLimit
> 0 then
2035 Text := IntToStr(gnGoalLimit
);
2037 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2039 Name
:= 'edMaxLives';
2043 if gnMaxLives
> 0 then
2044 Text := IntToStr(gnMaxLives
);
2046 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2048 Name
:= 'swPlayers';
2049 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2050 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2051 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2052 ItemIndex
:= gnPlayers
;
2054 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2056 Name
:= 'swTeamDamage';
2057 AddItem(_lc
[I_MENU_YES
]);
2058 AddItem(_lc
[I_MENU_NO
]);
2059 if gnTeamDamage
then
2064 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2066 Name
:= 'swEnableExits';
2067 AddItem(_lc
[I_MENU_YES
]);
2068 AddItem(_lc
[I_MENU_NO
]);
2074 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2076 Name
:= 'swWeaponStay';
2077 AddItem(_lc
[I_MENU_YES
]);
2078 AddItem(_lc
[I_MENU_NO
]);
2079 if gnWeaponStay
then
2084 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2086 Name
:= 'swMonsters';
2087 AddItem(_lc
[I_MENU_YES
]);
2088 AddItem(_lc
[I_MENU_NO
]);
2094 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2097 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2098 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2099 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2101 if gnBotsVS
= 'Players' then
2103 if gnBotsVS
= 'Monsters' then
2107 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2111 Menu
.DefControl
:= 'mNetServerMenu';
2112 g_GUI_AddWindow(Menu
);
2114 Menu
:= TGUIWindow
.Create('NetClientMenu');
2115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2117 Name
:= 'mNetClientMenu';
2119 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2122 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2128 Text := 'localhost';
2130 with AddEdit(_lc
[I_NET_PORT
]) do
2138 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2141 OnlyDigits
:= False;
2148 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2152 Menu
.DefControl
:= 'mNetClientMenu';
2153 g_GUI_AddWindow(Menu
);
2155 Menu
:= TGUIWindow
.Create('LoadMenu');
2156 Menu
.OnShow
:= ProcLoadMenu
;
2157 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2159 Name
:= 'mmLoadMenu';
2164 Name
:= 'edSlot'+IntToStr(a
);
2167 OnEnter
:= ProcLoadGame
;
2170 Menu
.DefControl
:= 'mmLoadMenu';
2171 g_GUI_AddWindow(Menu
);
2173 Menu
:= TGUIWindow
.Create('SaveMenu');
2174 Menu
.OnShow
:= ProcSaveMenu
;
2175 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2177 Name
:= 'mmSaveMenu';
2182 Name
:= 'edSlot'+IntToStr(a
);
2185 OnChange
:= ProcSaveGame
;
2188 Menu
.DefControl
:= 'mmSaveMenu';
2189 g_GUI_AddWindow(Menu
);
2191 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2192 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2194 Name
:= 'mCustomGameMenu';
2195 with AddLabel(_lc
[I_MENU_MAP
]) do
2200 OnClick
:= @ProcSelectMapMenu
;
2202 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2204 Name
:= 'swGameMode';
2205 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2206 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2207 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2208 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2209 case g_Game_TextToMode(gcGameMode
) of
2211 GM_DM
: ItemIndex
:= 0;
2212 GM_TDM
: ItemIndex
:= 1;
2213 GM_CTF
: ItemIndex
:= 2;
2215 GM_COOP
: ItemIndex
:= 3;
2217 OnChange
:= ProcSwitchMonstersCustom
;
2219 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2221 Name
:= 'edTimeLimit';
2225 if gcTimeLimit
> 0 then
2226 Text := IntToStr(gcTimeLimit
);
2228 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2230 Name
:= 'edGoalLimit';
2234 if gcGoalLimit
> 0 then
2235 Text := IntToStr(gcGoalLimit
);
2237 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2239 Name
:= 'edMaxLives';
2243 if gcMaxLives
> 0 then
2244 Text := IntToStr(gcMaxLives
);
2246 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2248 Name
:= 'swPlayers';
2249 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2250 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2251 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2252 ItemIndex
:= gcPlayers
;
2254 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2256 Name
:= 'swTeamDamage';
2257 AddItem(_lc
[I_MENU_YES
]);
2258 AddItem(_lc
[I_MENU_NO
]);
2259 if gcTeamDamage
then
2264 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2266 Name
:= 'swEnableExits';
2267 AddItem(_lc
[I_MENU_YES
]);
2268 AddItem(_lc
[I_MENU_NO
]);
2274 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2276 Name
:= 'swWeaponStay';
2277 AddItem(_lc
[I_MENU_YES
]);
2278 AddItem(_lc
[I_MENU_NO
]);
2279 if gcWeaponStay
then
2284 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2286 Name
:= 'swMonsters';
2287 AddItem(_lc
[I_MENU_YES
]);
2288 AddItem(_lc
[I_MENU_NO
]);
2294 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2297 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2298 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2299 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2301 if gcBotsVS
= 'Players' then
2303 if gcBotsVS
= 'Monsters' then
2307 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2311 Menu
.DefControl
:= 'mCustomGameMenu';
2312 g_GUI_AddWindow(Menu
);
2314 Menu
:= TGUIWindow
.Create('CampaignMenu');
2315 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2317 Name
:= 'mCampaignMenu';
2326 with AddFileList('', 15, 4) do
2329 OnChange
:= ProcSelectCampaignWAD
;
2333 FileMask
:= '*.wad|*.pk3|*.zip';
2334 SetBase(MapsDir
+'megawads/');
2337 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2339 Name
:= 'lbWADName';
2343 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2345 Name
:= 'lbWADAuthor';
2349 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2350 with AddMemo('', 15, 3) do
2352 Name
:= 'meWADDescription';
2353 Color
:= MENU_ITEMSCTRL_COLOR
;
2355 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2357 Name
:= 'swPlayers';
2358 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2359 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2362 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2366 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2368 Name
:= 'mpWADImage';
2369 DefaultRes
:= 'NOPIC';
2370 X
:= GetControl('lsWAD').X
+4;
2371 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2374 Menu
.DefControl
:= 'mCampaignMenu';
2375 g_GUI_AddWindow(Menu
);
2377 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2378 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2380 Name
:= 'mSelectMapMenu';
2381 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2384 OnChange
:= ProcSelectWAD
;
2388 FileMask
:= '*.wad|*.pk3|*.zip';
2391 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2395 OnChange
:= ProcSelectMap
;
2398 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2400 Name
:= 'lbMapName';
2404 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2406 Name
:= 'lbMapAuthor';
2410 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2412 Name
:= 'lbMapSize';
2416 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2418 Name
:= 'meMapDescription';
2423 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2425 Name
:= 'mpMapPreview';
2426 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2427 Y
:= GetControl('lsMapWAD').Y
;
2429 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2431 Name
:= 'lbMapScale';
2434 Color
:= MENU_ITEMSCTRL_COLOR
;
2435 X
:= GetControl('lsMapWAD').X
+
2436 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2437 2 + MAPPREVIEW_WIDTH
*4;
2438 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2441 Menu
.OnClose
:= ProcSetMap
;
2442 Menu
.DefControl
:= 'mSelectMapMenu';
2443 g_GUI_AddWindow(Menu
);
2445 Menu
:= TGUIWindow
.Create('OptionsMenu');
2446 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2448 Name
:= 'mmOptionsMenu';
2449 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2450 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2451 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2452 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2453 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2454 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2456 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2457 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2459 Menu
.OnClose
:= ProcApplyOptions
;
2460 Menu
.DefControl
:= 'mmOptionsMenu';
2461 g_GUI_AddWindow(Menu
);
2463 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2464 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2465 g_GUI_AddWindow(Menu
);
2467 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2468 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2470 Name
:= 'mOptionsVideoMenu';
2471 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2472 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2478 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2481 AddItem(_lc
[I_MENU_YES
]);
2482 AddItem(_lc
[I_MENU_NO
]);
2484 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2486 Name
:= 'swTextureFilter';
2487 AddItem(_lc
[I_MENU_YES
]);
2488 AddItem(_lc
[I_MENU_NO
]);
2490 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2492 Name
:= 'swLegacyNPOT';
2493 AddItem(_lc
[I_MENU_NO
]);
2494 AddItem(_lc
[I_MENU_YES
]);
2497 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2500 Menu
.DefControl
:= 'mOptionsVideoMenu';
2501 g_GUI_AddWindow(Menu
);
2503 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2504 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2506 Name
:= 'mOptionsVideoResMenu';
2507 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2509 Name
:= 'lbCurrentRes';
2513 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2515 Name
:= 'lsResolution';
2518 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2520 Name
:= 'swFullScreen';
2521 AddItem(_lc
[I_MENU_YES
]);
2522 AddItem(_lc
[I_MENU_NO
]);
2525 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2528 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2529 g_GUI_AddWindow(Menu
);
2531 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2532 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2534 Name
:= 'mOptionsSoundMenu';
2535 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2537 Name
:= 'scMusicLevel';
2539 OnChange
:= ProcChangeSoundSettings
;
2541 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2543 Name
:= 'scSoundLevel';
2545 OnChange
:= ProcChangeSoundSettings
;
2547 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2549 Name
:= 'scMaxSimSounds';
2552 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2554 Name
:= 'swAnnouncer';
2555 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2556 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2557 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2558 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2560 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2561 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2563 Name
:= 'swSoundEffects';
2564 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2565 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2567 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2568 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2570 Name
:= 'swChatSpeech';
2571 AddItem(_lc
[I_MENU_YES
]);
2572 AddItem(_lc
[I_MENU_NO
]);
2574 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2576 Name
:= 'swInactiveSounds';
2577 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2578 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2582 Menu
.DefControl
:= 'mOptionsSoundMenu';
2583 g_GUI_AddWindow(Menu
);
2585 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2586 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2588 Name
:= 'mOptionsGameMenu';
2589 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2591 Name
:= 'scParticlesCount';
2594 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2596 Name
:= 'swBloodCount';
2597 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2598 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2599 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2600 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2601 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2603 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2605 Name
:= 'scShellsMax';
2608 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2610 Name
:= 'scGibsMax';
2613 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2615 Name
:= 'scCorpsesMax';
2618 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2620 Name
:= 'swGibsCount';
2621 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2622 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2623 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2624 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2625 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2627 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2629 Name
:= 'swCorpseType';
2630 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2631 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2633 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2635 Name
:= 'swGibsType';
2636 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2637 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2639 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2641 Name
:= 'swBloodType';
2642 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2643 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2645 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2647 Name
:= 'swScreenFlash';
2648 AddItem(_lc
[I_MENU_NO
]);
2649 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2650 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2652 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2654 Name
:= 'swBackground';
2655 AddItem(_lc
[I_MENU_YES
]);
2656 AddItem(_lc
[I_MENU_NO
]);
2658 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2660 Name
:= 'swMessages';
2661 AddItem(_lc
[I_MENU_YES
]);
2662 AddItem(_lc
[I_MENU_NO
]);
2664 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2666 Name
:= 'swRevertPlayers';
2667 AddItem(_lc
[I_MENU_YES
]);
2668 AddItem(_lc
[I_MENU_NO
]);
2670 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2672 Name
:= 'swChatBubble';
2673 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2674 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2675 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2676 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2677 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2681 Menu
.DefControl
:= 'mOptionsGameMenu';
2682 g_GUI_AddWindow(Menu
);
2684 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2685 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2687 Name
:= 'mOptionsControlsMenu';
2688 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2689 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2690 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2691 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2692 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2694 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2695 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2696 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2697 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2698 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2699 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2701 if e_JoysticksAvailable
<> 0 then
2702 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2704 Menu
.DefControl
:= 'mOptionsControlsMenu';
2705 g_GUI_AddWindow(Menu
);
2707 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2708 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2710 Name
:= 'mOptionsControlsP1Menu';
2711 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2712 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2713 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2714 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2715 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2716 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2717 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2718 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2719 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2720 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2722 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2723 g_GUI_AddWindow(Menu
);
2725 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2726 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2728 Name
:= 'mOptionsControlsP1MenuWeapons';
2729 for i
:= WP_FIRST
to WP_LAST
do
2730 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2731 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2733 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2734 g_GUI_AddWindow(Menu
);
2736 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2737 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2739 Name
:= 'mOptionsControlsP2Menu';
2740 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2741 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2742 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2743 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2744 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2745 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2746 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2747 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2748 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2749 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2751 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2752 g_GUI_AddWindow(Menu
);
2754 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2755 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2757 Name
:= 'mOptionsControlsP2MenuWeapons';
2758 for i
:= WP_FIRST
to WP_LAST
do
2759 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2760 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2762 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2763 g_GUI_AddWindow(Menu
);
2765 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2766 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2768 Name
:= 'mOptionsControlsJoystickMenu';
2769 for i
:= 0 to e_JoysticksAvailable
-1 do
2770 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2772 Name
:= 'scDeadzone' + IntToStr(i
);
2776 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2777 g_GUI_AddWindow(Menu
);
2779 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2780 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2782 Name
:= 'mOptionsPlayersMenu';
2783 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2784 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2786 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2787 g_GUI_AddWindow(Menu
);
2789 CreatePlayerOptionsMenu('P1');
2790 CreatePlayerOptionsMenu('P2');
2792 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2793 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2795 Name
:= 'mOptionsPlayersMIMenu';
2796 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2801 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2806 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2808 Name
:= 'meComment';
2811 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2812 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2815 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2819 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2820 g_GUI_AddWindow(Menu
);
2822 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2823 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2825 Name
:= 'mOptionsLanguageMenu';
2826 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2827 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2830 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2831 g_GUI_AddWindow(Menu
);
2833 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2834 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2835 g_GUI_AddWindow(Menu
);
2837 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2838 Menu
.BackTexture
:= 'INTER';
2839 Menu
.OnClose
:= ProcAuthorsClose
;
2843 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2845 Color
:= _RGB(255, 0, 0);
2846 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2848 _y
:= _y
+GetHeight();
2850 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2852 Color
:= _RGB(255, 0, 0);
2853 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2855 _y
:= _y
+GetHeight()+32;
2857 // ×òî äåëàë: Êòî äåëàë
2858 cx
:= gScreenWidth
div 2 - 320 + 64;
2859 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2861 Color
:= _RGB(255, 0, 0);
2866 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2868 Color
:= _RGB(255, 255, 255);
2873 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2875 Color
:= _RGB(255, 0, 0);
2880 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2882 Color
:= _RGB(255, 255, 255);
2887 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2889 Color
:= _RGB(255, 255, 255);
2894 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2896 Color
:= _RGB(255, 0, 0);
2901 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2903 Color
:= _RGB(255, 255, 255);
2908 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2910 Color
:= _RGB(255, 0, 0);
2915 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2917 Color
:= _RGB(255, 255, 255);
2920 _y
:= gScreenHeight
- 128;
2923 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2925 Color
:= _RGB(255, 0, 0);
2930 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2932 Color
:= _RGB(255, 255, 255);
2935 _y
:= _y
+GetHeight();
2937 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2939 Color
:= _RGB(255, 255, 255);
2942 _y
:= _y
+GetHeight();
2944 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2946 Color
:= _RGB(255, 255, 255);
2949 _y
:= gScreenHeight
- 32;
2951 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2953 Color
:= _RGB(255, 0, 0);
2954 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2957 g_GUI_AddWindow(Menu
);
2959 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2960 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2961 g_GUI_AddWindow(Menu
);
2963 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2964 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2966 Name
:= 'mmGameSingleMenu';
2967 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2968 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2969 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2970 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2971 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2972 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2974 Menu
.DefControl
:= 'mmGameSingleMenu';
2975 Menu
.MainWindow
:= True;
2976 Menu
.OnClose
:= ProcGMClose
;
2977 Menu
.OnShow
:= ProcGMShow
;
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2981 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2982 g_GUI_AddWindow(Menu
);
2984 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2985 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2986 g_GUI_AddWindow(Menu
);
2988 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2989 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2991 Name
:= 'mmGameCustomMenu';
2992 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2993 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2994 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2995 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2996 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2997 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2998 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3000 Menu
.DefControl
:= 'mmGameCustomMenu';
3001 Menu
.MainWindow
:= True;
3002 Menu
.OnClose
:= ProcGMClose
;
3003 Menu
.OnShow
:= ProcGMShow
;
3004 g_GUI_AddWindow(Menu
);
3006 Menu
:= TGUIWindow
.Create('GameServerMenu');
3007 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3009 Name
:= 'mmGameServerMenu';
3010 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3011 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3012 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3013 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3014 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3016 Menu
.DefControl
:= 'mmGameServerMenu';
3017 Menu
.MainWindow
:= True;
3018 Menu
.OnClose
:= ProcGMClose
;
3019 Menu
.OnShow
:= ProcGMShow
;
3020 g_GUI_AddWindow(Menu
);
3022 Menu
:= TGUIWindow
.Create('GameClientMenu');
3023 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3025 Name
:= 'mmGameClientMenu';
3026 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3027 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3028 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3030 Menu
.DefControl
:= 'mmGameClientMenu';
3031 Menu
.MainWindow
:= True;
3032 Menu
.OnClose
:= ProcGMClose
;
3033 Menu
.OnShow
:= ProcGMShow
;
3034 g_GUI_AddWindow(Menu
);
3036 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3037 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3039 Name
:= 'mClientPasswordMenu';
3040 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3048 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3051 Menu
.DefControl
:= 'mClientPasswordMenu';
3052 g_GUI_AddWindow(Menu
);
3054 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3055 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3057 Name
:= 'mGameSetGameMenu';
3058 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3060 Name
:= 'swTeamDamage';
3061 AddItem(_lc
[I_MENU_YES
]);
3062 AddItem(_lc
[I_MENU_NO
]);
3065 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3067 Name
:= 'edTimeLimit';
3072 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3074 Name
:= 'edGoalLimit';
3079 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3081 Name
:= 'edMaxLives';
3086 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3089 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3090 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3091 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3097 Menu
.DefControl
:= 'mGameSetGameMenu';
3098 Menu
.OnClose
:= ProcApplyGameSet
;
3099 g_GUI_AddWindow(Menu
);
3101 Menu
:= TGUIWindow
.Create('TeamMenu');
3102 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3104 Name
:= 'mmTeamMenu';
3105 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3106 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3107 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3108 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3109 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3111 Menu
.DefControl
:= 'mmTeamMenu';
3112 Menu
.OnShow
:= ProcChangePlayers
;
3113 g_GUI_AddWindow(Menu
);
3116 procedure g_Menu_Show_SaveMenu();
3118 if g_Game_IsTestMap
then
3120 if gGameSettings
.GameType
= GT_SINGLE
then
3121 g_GUI_ShowWindow('GameSingleMenu')
3124 if g_Game_IsClient
then
3127 if g_Game_IsNet
then
3130 g_GUI_ShowWindow('GameCustomMenu');
3132 g_GUI_ShowWindow('SaveMenu');
3133 g_Sound_PlayEx('MENU_OPEN');
3136 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3138 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3139 if gGameSettings
.GameType
= GT_SINGLE
then
3141 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3145 if g_Game_IsClient
then exit
;
3146 if g_Game_IsNet
then exit
;
3147 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3149 g_GUI_ShowWindow('LoadMenu');
3150 g_Sound_PlayEx('MENU_OPEN');
3153 procedure g_Menu_Show_GameSetGame();
3155 if gGameSettings
.GameType
= GT_SINGLE
then
3156 g_GUI_ShowWindow('GameSingleMenu')
3159 if g_Game_IsClient
then
3162 if g_Game_IsNet
then
3163 g_GUI_ShowWindow('GameServerMenu')
3165 g_GUI_ShowWindow('GameCustomMenu');
3168 g_GUI_ShowWindow('GameSetGameMenu');
3169 g_Sound_PlayEx('MENU_OPEN');
3172 procedure g_Menu_Show_OptionsVideo();
3174 if gGameSettings
.GameType
= GT_SINGLE
then
3175 g_GUI_ShowWindow('GameSingleMenu')
3178 if g_Game_IsClient
then
3179 g_GUI_ShowWindow('GameClientMenu')
3181 if g_Game_IsNet
then
3182 g_GUI_ShowWindow('GameServerMenu')
3184 g_GUI_ShowWindow('GameCustomMenu');
3187 g_GUI_ShowWindow('OptionsMenu');
3188 g_GUI_ShowWindow('OptionsVideoMenu');
3189 g_Sound_PlayEx('MENU_OPEN');
3192 procedure g_Menu_Show_OptionsSound();
3194 if gGameSettings
.GameType
= GT_SINGLE
then
3195 g_GUI_ShowWindow('GameSingleMenu')
3198 if g_Game_IsClient
then
3199 g_GUI_ShowWindow('GameClientMenu')
3201 if g_Game_IsNet
then
3202 g_GUI_ShowWindow('GameServerMenu')
3204 g_GUI_ShowWindow('GameCustomMenu');
3207 g_GUI_ShowWindow('OptionsMenu');
3208 g_GUI_ShowWindow('OptionsSoundMenu');
3209 g_Sound_PlayEx('MENU_OPEN');
3212 procedure g_Menu_Show_EndGameMenu();
3214 g_GUI_ShowWindow('EndGameMenu');
3215 g_Sound_PlayEx('MENU_OPEN');
3218 procedure g_Menu_Show_QuitGameMenu();
3220 g_GUI_ShowWindow('ExitMenu');
3221 g_Sound_PlayEx('MENU_OPEN');
3224 procedure g_Menu_Init();
3231 procedure g_Menu_Free();
3235 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3240 procedure g_Menu_Reset();
3244 g_GUI_SaveMenuPos();
3245 ex
:= g_GUI_Destroy();
3249 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3254 g_Game_SetDebugMode();
3256 g_GUI_LoadMenuPos();