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
;
50 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
51 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
52 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
, sdl2
,
53 MAPDEF
, Math
, g_saveload
,
54 e_texture
, g_language
,
55 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
59 type TYNCallback
= procedure (yes
:Boolean);
61 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
63 if win
.UserData
= nil then exit
;
65 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
66 IK_N
: TYNCallback(win
.UserData
)(false);
70 procedure YesButtonCB (ctl
: TGUITextButton
);
72 if ctl
.UserData
= nil then exit
;
73 TYNCallback(ctl
.UserData
)(true);
76 procedure NoButtonCB (ctl
: TGUITextButton
);
78 if ctl
.UserData
= nil then exit
;
79 TYNCallback(ctl
.UserData
)(false);
82 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
86 //if length(Text) = 0 then exit;
87 Result
:= TGUIWindow
.Create(WinName
);
90 //OnKeyDownEx := @YNKeyDownProc;
91 //UserData := @ActionProc;
92 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
95 Name
:= '__temp_yes_no_menu:'+WinName
;
97 AddText(Text, MaxLen
);
98 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
99 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
101 DefControl
:= '__temp_yes_no_menu:'+WinName
;
107 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
108 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
110 procedure ProcApplyOptions();
116 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
118 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
124 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
125 if (ovs
<> gVSync
) then g_SetVSync(gVSync
);
127 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
128 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
130 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
132 g_Sound_SetupAllVolumes(
133 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
134 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
137 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
138 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
139 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
140 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
141 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
143 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
145 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
146 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
147 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
148 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
150 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
155 else gGibsCount
:= 48;
158 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
159 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
160 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
161 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
162 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
163 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
164 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
165 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
166 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
168 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
170 with menu
, gGameControls
.GameControls
do
172 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
173 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
174 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
175 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
178 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
179 with menu
, gGameControls
.P1Control
do
181 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
182 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
183 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
184 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
185 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
186 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
187 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
188 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
189 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
190 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
192 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
193 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
194 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
195 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
196 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
197 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
198 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
199 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
200 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
201 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
204 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
205 with menu
, gGameControls
.P1Control
do
207 for i
:= WP_FIRST
to WP_LAST
do
209 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
210 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
214 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
215 with menu
, gGameControls
.P2Control
do
217 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
218 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
219 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
220 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
221 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
222 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
223 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
224 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
225 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
226 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
228 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
229 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
230 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
231 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
232 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
233 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
234 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
235 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
236 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
237 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
240 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
241 with menu
, gGameControls
.P2Control
do
243 for i
:= WP_FIRST
to WP_LAST
do
245 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
246 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
250 if e_JoysticksAvailable
> 0 then
252 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
255 for i
:= 0 to e_JoysticksAvailable
-1 do
256 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
260 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
262 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
263 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
264 TEAM_RED
, TEAM_BLUE
);
266 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
268 gPlayer1Settings
.Model
:= Model
.Name
;
269 gPlayer1Settings
.Color
:= Model
.Color
;
272 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
274 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
275 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
276 TEAM_RED
, TEAM_BLUE
);
277 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
279 gPlayer2Settings
.Model
:= Model
.Name
;
280 gPlayer2Settings
.Color
:= Model
.Color
;
283 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
284 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
286 if g_Game_IsServer
then
288 if gPlayer1
<> nil then
290 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
291 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
292 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
293 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
295 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
298 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
301 if gPlayer2
<> nil then
303 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
304 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
305 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
306 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
308 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
313 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
315 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
318 procedure ReadOptions();
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
325 with TGUISwitch(menu
.GetControl('swBPP')) do
331 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
332 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
334 with TGUISwitch(menu
.GetControl('swVSync')) do
335 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
337 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
338 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
340 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
342 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
343 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
344 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
346 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
347 if gMuteWhenInactive
then
352 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
354 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
355 if gSoundEffectsDF
then
360 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
361 if gUseChatSounds
then
366 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
367 with menu
, gGameControls
.P1Control
do
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
374 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
392 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
393 with menu
, gGameControls
.P1Control
do
395 for i
:= WP_FIRST
to WP_LAST
do
397 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
398 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
403 with menu
, gGameControls
.P2Control
do
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
409 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
410 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
411 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
412 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
413 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
416 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
418 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
421 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
422 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
423 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
424 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
428 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
429 with menu
, gGameControls
.P2Control
do
431 for i
:= WP_FIRST
to WP_LAST
do
433 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
434 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
438 if e_JoysticksAvailable
> 0 then
440 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
443 for i
:= 0 to e_JoysticksAvailable
-1 do
444 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
448 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
449 with menu
, gGameControls
.GameControls
do
451 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
452 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
453 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
454 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
457 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
459 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
460 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
461 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
462 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
463 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
465 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
468 with TGUISwitch(menu
.GetControl('swBloodType')) do
469 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
471 with TGUISwitch(menu
.GetControl('swCorpseType')) do
472 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
474 with TGUISwitch(menu
.GetControl('swGibsType')) do
475 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
477 with TGUISwitch(menu
.GetControl('swGibsCount')) do
486 with TGUISwitch(menu
.GetControl('swBackGround')) do
487 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
489 with TGUISwitch(menu
.GetControl('swMessages')) do
490 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
492 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
493 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
495 with TGUISwitch(menu
.GetControl('swChatBubble')) do
496 ItemIndex
:= gChatBubble
;
498 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
500 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
501 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
503 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
504 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
506 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
507 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
508 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
510 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
512 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
513 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
515 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
516 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
518 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
519 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
520 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
522 ProcSelectModel(nil);
525 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
527 // don't turn off monsters in DM
529 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
530 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
531 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
533 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
536 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
537 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
538 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
539 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
543 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
545 // don't turn off monsters in DM
547 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
548 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
549 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
551 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
554 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
555 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
556 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
557 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
561 procedure ProcStartCustomGame();
567 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
569 Map
:= TGUILabel(GetControl('lbMap')).Text;
572 if not isWadPath(Map
) then
575 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
576 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
577 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
578 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
579 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
581 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
582 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
583 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
584 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
587 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
589 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
591 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
593 Options
:= Options
or GAME_OPTION_MONSTERS
;
594 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
596 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
598 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
599 gcBotsVS
:= 'Monsters';
602 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
603 gcBotsVS
:= 'Everybody';
606 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
607 gcBotsVS
:= 'Players';
614 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
616 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
617 gcMaxLives
, Options
, gcPlayers
);
621 procedure ProcStartNetGame();
627 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
629 Map
:= TGUILabel(GetControl('lbMap')).Text;
632 if not isWadPath(Map
) then
635 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
636 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
637 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
638 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
639 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
640 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
642 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
643 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
644 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
645 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
648 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
650 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
652 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
654 Options
:= Options
or GAME_OPTION_MONSTERS
;
655 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
657 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
659 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
660 gnBotsVS
:= 'Monsters';
663 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
664 gnBotsVS
:= 'Everybody';
667 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
668 gnBotsVS
:= 'Players';
673 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
674 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
675 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
676 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
677 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
680 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
681 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
683 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
684 Options
, gnPlayers
, 0, NetPort
);
687 procedure ProcConnectNetGame();
691 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
693 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
694 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
695 PW
:= TGUIEdit(GetControl('edPW')).Text;
698 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
699 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
702 procedure ProcEnterPassword();
706 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
708 NetClientIP
:= PromptIP
;
709 NetClientPort
:= PromptPort
;
710 PW
:= TGUIEdit(GetControl('edPW')).Text;
713 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
714 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
717 procedure ProcServerlist();
719 if not NetInitDone
then
721 if (not g_Net_Init()) then
723 g_Console_Add('NET: ERROR: Failed to init ENet!');
730 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
732 gState
:= STATE_SLIST
;
733 g_ActiveWindow
:= nil;
735 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
740 slReturnPressed
:= True;
741 if g_Net_Slist_Fetch(slCurrent
) then
743 if slCurrent
= nil then
744 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
747 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
750 procedure ProcStartCampaign();
756 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
758 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
759 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
766 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
769 procedure ProcSelectMap(Sender
: TGUIControl
);
773 wad
, map
, res
: String;
775 win
:= g_GUI_GetWindow('SelectMapMenu');
776 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
778 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
779 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
781 if (wad
= '') or (map
= '') then
782 begin // Ýòî íå êàðòà
783 TGUILabel(GetControl('lbMapName')).Text := '';
784 TGUILabel(GetControl('lbMapAuthor')).Text := '';
785 TGUILabel(GetControl('lbMapSize')).Text := '';
786 TGUIMemo(GetControl('meMapDescription')).SetText('');
787 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
788 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
794 a
:= g_Map_GetMapInfo(res
);
796 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
797 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
798 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
799 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
800 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
801 TGUILabel(win
.GetControl('lbMapScale')).Text :=
802 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
807 procedure ProcSelectWAD(Sender
: TGUIControl
);
812 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
814 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
816 with TGUIListBox(GetControl('lsMapRes')) do
822 list
:= g_Map_GetMapsList(wad
);
836 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
842 win
:= g_GUI_GetWindow('CampaignMenu');
843 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
845 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
849 TGUILabel(GetControl('lbWADName')).Text := '';
850 TGUILabel(GetControl('lbWADAuthor')).Text := '';
851 TGUIMemo(GetControl('meWADDescription')).SetText('');
854 a
:= g_Game_GetMegaWADInfo(wad
);
856 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
857 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
858 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
860 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
864 fn
:= g_ExtractWadName(a
.pic
);
866 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
868 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
873 procedure ProcChangeColor(Sender
: TGUIControl
);
877 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
878 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
879 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
880 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
881 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
882 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
884 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
885 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
886 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
887 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
888 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
889 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
892 procedure ProcSelectModel(Sender
: TGUIControl
);
897 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
898 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
899 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
901 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
902 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
903 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
905 ProcChangeColor(nil);
908 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
920 wad
:= TWADFile
.Create
;
921 if wad
.ReadFile(GameWAD
) then
922 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
927 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
929 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
930 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
931 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
932 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
934 if g_Texture_Get('FONT_STD', ID
) then
935 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
940 if cfglen
<> 0 then FreeMem(cfgdata
);
943 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
949 cfgdata
, fntdata
: Pointer;
950 cfglen
, fntlen
: Integer;
958 wad
:= TWADFile
.Create
;
959 if wad
.ReadFile(GameWAD
) then
961 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
962 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
968 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
969 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
970 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
972 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
973 FontID
:= e_CharFont_Create(spc
);
977 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
978 if chrwidth
= 0 then Continue
;
980 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
982 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
988 if cfglen
<> 0 then FreeMem(cfgdata
);
989 if fntlen
<> 0 then FreeMem(fntdata
);
992 procedure MenuLoadData();
994 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
996 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
997 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
998 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
999 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1000 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1001 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1002 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1003 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1004 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1005 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1006 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1007 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1008 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1009 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1010 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1011 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1012 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1013 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1014 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1015 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1016 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1017 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1018 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1019 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1021 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1022 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1023 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1024 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1025 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1026 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1027 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1030 procedure MenuFreeData();
1032 e_CharFont_Remove(gMenuFont
);
1033 e_CharFont_Remove(gMenuSmallFont
);
1035 g_Texture_Delete('MAINMENU_MARKER1');
1036 g_Texture_Delete('MAINMENU_MARKER2');
1037 g_Texture_Delete('SCROLL_LEFT');
1038 g_Texture_Delete('SCROLL_RIGHT');
1039 g_Texture_Delete('SCROLL_MIDDLE');
1040 g_Texture_Delete('SCROLL_MARKER');
1041 g_Texture_Delete('EDIT_LEFT');
1042 g_Texture_Delete('EDIT_RIGHT');
1043 g_Texture_Delete('EDIT_MIDDLE');
1044 g_Texture_Delete('BOX1');
1045 g_Texture_Delete('BOX2');
1046 g_Texture_Delete('BOX3');
1047 g_Texture_Delete('BOX4');
1048 g_Texture_Delete('BOX5');
1049 g_Texture_Delete('BOX6');
1050 g_Texture_Delete('BOX7');
1051 g_Texture_Delete('BOX8');
1052 g_Texture_Delete('BOX9');
1053 g_Texture_Delete('BSCROLL_UP_A');
1054 g_Texture_Delete('BSCROLL_UP_U');
1055 g_Texture_Delete('BSCROLL_DOWN_A');
1056 g_Texture_Delete('BSCROLL_DOWN_U');
1057 g_Texture_Delete('BSCROLL_MIDDLE');
1058 g_Texture_Delete('NOPIC');
1060 g_Sound_Delete('MENU_SELECT');
1061 g_Sound_Delete('MENU_OPEN');
1062 g_Sound_Delete('MENU_CLOSE');
1063 g_Sound_Delete('MENU_CHANGE');
1064 g_Sound_Delete('SCROLL_ADD');
1065 g_Sound_Delete('SCROLL_SUB');
1066 g_Sound_Delete('SOUND_PLAYER_FALL');
1069 procedure ProcAuthorsMenu();
1071 gMusic
.SetByName('MUSIC_INTERMUS');
1075 procedure ProcExitMenuKeyDown (yes
: Boolean);
1078 snd
: TPlayableSound
;
1083 g_Game_StopAllSounds(True);
1084 case (Random(18)) of
1085 0: s
:= 'SOUND_MONSTER_PAIN';
1086 1: s
:= 'SOUND_MONSTER_DIE_3';
1087 2: s
:= 'SOUND_MONSTER_SLOP';
1088 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1089 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1090 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1091 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1092 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1093 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1094 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1095 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1096 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1097 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1098 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1099 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1100 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1101 else s
:= 'SOUND_PLAYER_FALL';
1103 snd
:= TPlayableSound
.Create();
1104 res
:= snd
.SetByName(s
);
1105 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1109 while snd
.IsPlaying() do begin end;
1117 procedure ProcLoadMenu();
1124 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1125 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1126 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1130 procedure ProcSaveMenu();
1138 name
:= g_GetSaveName(a
, valid
);
1139 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1140 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1144 procedure ProcSaveGame(Sender
: TGUIControl
);
1148 if g_Game_IsNet
then Exit
;
1149 if g_Game_IsTestMap
then Exit
;
1150 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1151 g_Game_PauseAllSounds(True);
1152 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1154 g_ActiveWindow
:= nil;
1155 g_Game_Pause(False);
1158 procedure ProcLoadGame(Sender
: TGUIControl
);
1162 if g_Game_IsNet
then Exit
;
1163 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1164 if g_LoadGame(a
) then
1166 g_Game_PauseAllSounds(False)
1168 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1170 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1171 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1172 //g_ActiveWindow := nil;
1176 procedure ProcSingle1Player();
1178 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1181 procedure ProcSingle2Players();
1183 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1186 procedure ProcSelectMapMenu();
1189 wad_lb
: TGUIFileListBox
;
1190 map_lb
: TGUIListBox
;
1193 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1194 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1195 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1197 if wad_lb
.SelectedItem() <> '' then
1198 map
:= map_lb
.SelectedItem()
1202 wad_lb
.UpdateFileList();
1205 if wad_lb
.SelectedItem() <> '' then
1208 map_lb
.SelectItem(map
);
1210 if map_lb
.SelectedItem() <> '' then
1214 g_GUI_ShowWindow('SelectMapMenu');
1217 procedure ProcSelectCampaignMenu();
1220 wad_lb
: TGUIFileListBox
;
1222 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1223 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1225 wad_lb
.UpdateFileList();
1227 if wad_lb
.SelectedItem() <> '' then
1228 ProcSelectCampaignWAD(nil);
1231 procedure ProcSetMap();
1233 wad
, map
, res
: String;
1235 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1237 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1238 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1241 if (wad
= '') or (map
= '') then
1244 res
:= wad
+':\'+map
;
1246 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1247 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1250 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1254 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1256 g_Sound_SetupAllVolumes(
1257 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1258 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1262 procedure ProcOptionsPlayersMIMenu();
1267 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1269 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1271 if a
= '' then Exit
;
1273 b
:= g_PlayerModel_GetInfo(a
);
1275 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1277 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1278 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1279 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1281 if b
.HaveWeapon
then
1282 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1284 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1287 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1290 procedure ProcOptionsPlayersAnim();
1294 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1299 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1302 Model
.GetCurrentAnimation
.Loop
:= True;
1303 Model
.GetCurrentAnimationMask
.Loop
:= True;
1307 procedure ProcOptionsPlayersWeap();
1311 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1316 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1320 procedure ProcOptionsPlayersRot();
1324 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1325 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1327 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1331 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1335 g_Options_SetDefault();
1341 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1343 if yes
then ReadOptions();
1347 procedure ProcAuthorsClose();
1349 gMusic
.SetByName('MUSIC_MENU');
1351 gState
:= STATE_MENU
;
1354 procedure ProcGMClose();
1356 g_Game_InGameMenu(False);
1359 procedure ProcGMShow();
1364 if (gGameSettings
.GameType
= GT_SINGLE
) and
1365 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1366 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1367 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1369 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1370 if g_Game_IsTestMap
then
1371 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1372 TGUIMainMenu(g_ActiveWindow
.GetControl(
1373 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1376 procedure ProcChangePlayers();
1378 TeamGame
, Spectator
, AddTwo
: Boolean;
1379 P1Team
{, P2Team}: Byte;
1380 bP2
: TGUITextButton
;
1382 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1383 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1384 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1385 P1Team
:= TEAM_NONE
;
1386 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1388 //P2Team := TEAM_NONE;
1389 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1391 TGUIMainMenu(g_ActiveWindow
.GetControl(
1392 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1393 TGUIMainMenu(g_ActiveWindow
.GetControl(
1394 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1395 TGUIMainMenu(g_ActiveWindow
.GetControl(
1396 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1398 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1399 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1400 bP2
.Enabled
:= AddTwo
and not Spectator
;
1402 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1404 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1405 if gPlayer2
= nil then
1406 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1408 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1410 TGUIMainMenu(g_ActiveWindow
.GetControl(
1411 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1414 procedure ProcJoinRed();
1416 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1418 if g_Game_IsServer
then
1420 if gPlayer1
= nil then
1421 g_Game_AddPlayer(TEAM_RED
)
1424 if gPlayer1
.Team
<> TEAM_RED
then
1426 gPlayer1
.SwitchTeam
;
1427 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1430 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1435 gPlayer1Settings
.Team
:= TEAM_RED
;
1436 MC_SEND_PlayerSettings
;
1437 if gPlayer1
= nil then
1438 g_Game_AddPlayer(TEAM_RED
);
1440 g_ActiveWindow
:= nil;
1441 g_Game_Pause(False);
1444 procedure ProcJoinBlue();
1446 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1448 if g_Game_IsServer
then
1450 if gPlayer1
= nil then
1451 g_Game_AddPlayer(TEAM_BLUE
)
1454 if gPlayer1
.Team
<> TEAM_BLUE
then
1456 gPlayer1
.SwitchTeam
;
1457 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1460 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1465 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1466 MC_SEND_PlayerSettings
;
1467 if gPlayer1
= nil then
1468 g_Game_AddPlayer(TEAM_BLUE
);
1470 g_ActiveWindow
:= nil;
1471 g_Game_Pause(False);
1474 procedure ProcJoinGame();
1476 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1478 if gPlayer1
= nil then
1480 g_ActiveWindow
:= nil;
1481 g_Game_Pause(False);
1484 procedure ProcSwitchP2();
1486 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1488 if gPlayer1
= nil then
1490 if gPlayer2
= nil then
1493 g_Game_RemovePlayer();
1494 g_ActiveWindow
:= nil;
1495 g_Game_Pause(False);
1498 procedure ProcSpectate();
1500 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1503 g_ActiveWindow
:= nil;
1504 g_Game_Pause(False);
1507 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1509 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1512 procedure ProcEndMenuKeyDown (yes
: Boolean);
1514 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1517 procedure ProcSetRussianLanguage();
1519 if gLanguage
<> LANGUAGE_RUSSIAN
then
1521 gLanguage
:= LANGUAGE_RUSSIAN
;
1522 gLanguageChange
:= True;
1523 gAskLanguage
:= False;
1525 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1527 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1532 procedure ProcSetEnglishLanguage();
1534 if gLanguage
<> LANGUAGE_ENGLISH
then
1536 gLanguage
:= LANGUAGE_ENGLISH
;
1537 gLanguageChange
:= True;
1538 gAskLanguage
:= False;
1540 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1542 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1547 procedure ReadGameSettings();
1551 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1553 with gGameSettings
do
1555 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1556 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1561 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1562 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1563 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1565 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1566 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1567 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1570 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1575 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1577 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1578 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1579 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1580 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1581 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1582 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1583 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1584 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1588 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1589 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1594 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1595 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1600 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1601 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1606 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1607 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1612 procedure ProcApplyGameSet();
1616 stat
: TPlayerStatArray
;
1618 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1620 if not g_Game_IsServer
then Exit
;
1622 with gGameSettings
do
1624 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1626 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1627 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1629 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1632 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1634 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1640 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1642 TimeLimit
:= Max(n
, b
);
1646 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1648 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1655 if GameMode
= GM_DM
then
1657 stat
:= g_Player_GetStats();
1659 for a
:= 0 to High(stat
) do
1660 if stat
[a
].Frags
> b
then
1664 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1666 GoalLimit
:= Max(n
, b
);
1670 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1672 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1673 if n
< 0 then n
:= 0;
1674 if n
> 255 then n
:= 255;
1680 stat
:= g_Player_GetStats();
1682 for a
:= 0 to High(stat
) do
1683 if stat
[a
].Lives
> b
then
1686 MaxLives
:= Max(n
, b
);
1690 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1692 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1695 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1696 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1700 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1701 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1705 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1706 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1712 if g_Game_IsNet
then MH_SEND_GameSettings
;
1715 procedure ProcVideoOptionsRes();
1721 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1723 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1724 IntToStr(gScreenWidth
) +
1725 ' x ' + IntToStr(gScreenHeight
) +
1726 ', ' + IntToStr(gBPP
) + ' bpp';
1728 with TGUIListBox(menu
.GetControl('lsResolution')) do
1730 list
:= GetDisplayModes(gBPP
, SR
);
1741 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1748 procedure ProcApplyVideoOptions();
1751 Fullscreen
: Boolean;
1752 SWidth
, SHeight
: Integer;
1755 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1757 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1758 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1760 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1762 if (SWidth
<> gScreenWidth
) or
1763 (SHeight
<> gScreenHeight
) or
1764 (Fullscreen
<> gFullscreen
) then
1766 gResolutionChange
:= True;
1767 gRC_Width
:= SWidth
;
1768 gRC_Height
:= SHeight
;
1769 gRC_FullScreen
:= Fullscreen
;
1770 gRC_Maximized
:= gWinMaximized
;
1773 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1777 procedure ProcSetFirstRussianLanguage();
1779 gLanguage
:= LANGUAGE_RUSSIAN
;
1780 gLanguageChange
:= True;
1781 gAskLanguage
:= False;
1783 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1786 procedure ProcSetFirstEnglishLanguage();
1788 gLanguage
:= LANGUAGE_ENGLISH
;
1789 gLanguageChange
:= True;
1790 gAskLanguage
:= False;
1792 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1795 procedure ProcRecallAddress();
1797 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1799 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1800 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1804 procedure CreateFirstLanguageMenu();
1808 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1810 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1812 Name
:= 'mmFirstLanguageMenu';
1813 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1814 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1817 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1818 Menu
.MainWindow
:= True;
1819 g_GUI_AddWindow(Menu
);
1822 procedure g_Menu_AskLanguage();
1824 CreateFirstLanguageMenu();
1825 g_GUI_ShowWindow('FirstLanguageMenu');
1828 procedure CreatePlayerOptionsMenu(s
: String);
1833 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1835 a
:= _lc
[I_MENU_PLAYER_1
]
1837 a
:= _lc
[I_MENU_PLAYER_2
];
1838 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1840 Name
:= 'mOptionsPlayers'+s
+'Menu';
1841 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1843 Name
:= 'ed'+s
+'Name';
1847 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1849 Name
:= 'sw'+s
+'Team';
1850 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1851 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1853 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1855 Name
:= 'ls'+s
+'Model';
1857 Items
:= g_PlayerModel_GetNames();
1858 OnChange
:= ProcSelectModel
;
1860 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1862 Name
:= 'sc'+s
+'Red';
1864 OnChange
:= ProcChangeColor
;
1866 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1868 Name
:= 'sc'+s
+'Green';
1870 OnChange
:= ProcChangeColor
;
1872 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1874 Name
:= 'sc'+s
+'Blue';
1876 OnChange
:= ProcChangeColor
;
1879 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1880 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1881 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1882 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1884 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1886 Name
:= 'mv'+s
+'Model';
1887 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1888 Y
:= GetControl('ls'+s
+'Model').Y
;
1891 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1892 g_GUI_AddWindow(Menu
);
1895 procedure CreateAllMenus();
1899 a
, cx
, _y
, i
: Integer;
1902 Menu
:= TGUIWindow
.Create('MainMenu');
1903 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1905 Name
:= 'mmMainMenu';
1906 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1907 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1908 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1909 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1910 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1911 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1913 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1915 Color
:= _RGB(255, 255, 255);
1916 X
:= gScreenWidth
-GetWidth
-8;
1917 Y
:= gScreenHeight
-GetHeight
-8;
1919 Menu
.DefControl
:= 'mmMainMenu';
1920 Menu
.MainWindow
:= True;
1921 g_GUI_AddWindow(Menu
);
1923 Menu
:= TGUIWindow
.Create('NewGameMenu');
1924 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1926 Name
:= 'mmNewGameMenu';
1927 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1928 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1929 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1930 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1932 Menu
.DefControl
:= 'mmNewGameMenu';
1933 g_GUI_AddWindow(Menu
);
1935 Menu
:= TGUIWindow
.Create('NetGameMenu');
1936 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1938 Name
:= 'mmNetGameMenu';
1939 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1940 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1942 Menu
.DefControl
:= 'mmNetGameMenu';
1943 g_GUI_AddWindow(Menu
);
1945 Menu
:= TGUIWindow
.Create('NetServerMenu');
1946 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1948 Name
:= 'mNetServerMenu';
1949 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1951 Name
:= 'edSrvName';
1952 OnlyDigits
:= False;
1955 Text := NetServerName
;
1957 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1959 Name
:= 'edSrvPassword';
1960 OnlyDigits
:= False;
1963 Text := NetPassword
;
1965 with AddEdit(_lc
[I_NET_PORT
]) do
1971 Text := IntToStr(NetPort
);
1973 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1975 Name
:= 'edMaxPlayers';
1979 Text := IntToStr(NetMaxClients
);
1981 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1983 Name
:= 'swUseMaster';
1984 AddItem(_lc
[I_MENU_YES
]);
1985 AddItem(_lc
[I_MENU_NO
]);
1986 if NetUseMaster
then
1992 with AddLabel(_lc
[I_MENU_MAP
]) do
1997 OnClick
:= @ProcSelectMapMenu
;
1999 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2001 Name
:= 'swGameMode';
2002 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2003 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2004 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2005 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2006 case g_Game_TextToMode(gnGameMode
) of
2008 GM_DM
: ItemIndex
:= 0;
2009 GM_TDM
: ItemIndex
:= 1;
2010 GM_CTF
: ItemIndex
:= 2;
2012 GM_COOP
: ItemIndex
:= 3;
2014 OnChange
:= ProcSwitchMonstersNet
;
2016 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2018 Name
:= 'edTimeLimit';
2022 if gnTimeLimit
> 0 then
2023 Text := IntToStr(gnTimeLimit
);
2025 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2027 Name
:= 'edGoalLimit';
2031 if gnGoalLimit
> 0 then
2032 Text := IntToStr(gnGoalLimit
);
2034 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2036 Name
:= 'edMaxLives';
2040 if gnMaxLives
> 0 then
2041 Text := IntToStr(gnMaxLives
);
2043 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2045 Name
:= 'swPlayers';
2046 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2047 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2048 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2049 ItemIndex
:= gnPlayers
;
2051 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2053 Name
:= 'swTeamDamage';
2054 AddItem(_lc
[I_MENU_YES
]);
2055 AddItem(_lc
[I_MENU_NO
]);
2056 if gnTeamDamage
then
2061 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2063 Name
:= 'swEnableExits';
2064 AddItem(_lc
[I_MENU_YES
]);
2065 AddItem(_lc
[I_MENU_NO
]);
2071 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2073 Name
:= 'swWeaponStay';
2074 AddItem(_lc
[I_MENU_YES
]);
2075 AddItem(_lc
[I_MENU_NO
]);
2076 if gnWeaponStay
then
2081 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2083 Name
:= 'swMonsters';
2084 AddItem(_lc
[I_MENU_YES
]);
2085 AddItem(_lc
[I_MENU_NO
]);
2091 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2094 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2095 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2096 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2098 if gnBotsVS
= 'Players' then
2100 if gnBotsVS
= 'Monsters' then
2104 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2108 Menu
.DefControl
:= 'mNetServerMenu';
2109 g_GUI_AddWindow(Menu
);
2111 Menu
:= TGUIWindow
.Create('NetClientMenu');
2112 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2114 Name
:= 'mNetClientMenu';
2116 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2119 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2125 Text := 'localhost';
2127 with AddEdit(_lc
[I_NET_PORT
]) do
2135 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2138 OnlyDigits
:= False;
2145 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2149 Menu
.DefControl
:= 'mNetClientMenu';
2150 g_GUI_AddWindow(Menu
);
2152 Menu
:= TGUIWindow
.Create('LoadMenu');
2153 Menu
.OnShow
:= ProcLoadMenu
;
2154 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2156 Name
:= 'mmLoadMenu';
2161 Name
:= 'edSlot'+IntToStr(a
);
2164 OnEnter
:= ProcLoadGame
;
2167 Menu
.DefControl
:= 'mmLoadMenu';
2168 g_GUI_AddWindow(Menu
);
2170 Menu
:= TGUIWindow
.Create('SaveMenu');
2171 Menu
.OnShow
:= ProcSaveMenu
;
2172 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2174 Name
:= 'mmSaveMenu';
2179 Name
:= 'edSlot'+IntToStr(a
);
2182 OnChange
:= ProcSaveGame
;
2185 Menu
.DefControl
:= 'mmSaveMenu';
2186 g_GUI_AddWindow(Menu
);
2188 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2189 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2191 Name
:= 'mCustomGameMenu';
2192 with AddLabel(_lc
[I_MENU_MAP
]) do
2197 OnClick
:= @ProcSelectMapMenu
;
2199 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2201 Name
:= 'swGameMode';
2202 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2203 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2204 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2205 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2206 case g_Game_TextToMode(gcGameMode
) of
2208 GM_DM
: ItemIndex
:= 0;
2209 GM_TDM
: ItemIndex
:= 1;
2210 GM_CTF
: ItemIndex
:= 2;
2212 GM_COOP
: ItemIndex
:= 3;
2214 OnChange
:= ProcSwitchMonstersCustom
;
2216 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2218 Name
:= 'edTimeLimit';
2222 if gcTimeLimit
> 0 then
2223 Text := IntToStr(gcTimeLimit
);
2225 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2227 Name
:= 'edGoalLimit';
2231 if gcGoalLimit
> 0 then
2232 Text := IntToStr(gcGoalLimit
);
2234 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2236 Name
:= 'edMaxLives';
2240 if gcMaxLives
> 0 then
2241 Text := IntToStr(gcMaxLives
);
2243 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2245 Name
:= 'swPlayers';
2246 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2247 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2248 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2249 ItemIndex
:= gcPlayers
;
2251 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2253 Name
:= 'swTeamDamage';
2254 AddItem(_lc
[I_MENU_YES
]);
2255 AddItem(_lc
[I_MENU_NO
]);
2256 if gcTeamDamage
then
2261 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2263 Name
:= 'swEnableExits';
2264 AddItem(_lc
[I_MENU_YES
]);
2265 AddItem(_lc
[I_MENU_NO
]);
2271 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2273 Name
:= 'swWeaponStay';
2274 AddItem(_lc
[I_MENU_YES
]);
2275 AddItem(_lc
[I_MENU_NO
]);
2276 if gcWeaponStay
then
2281 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2283 Name
:= 'swMonsters';
2284 AddItem(_lc
[I_MENU_YES
]);
2285 AddItem(_lc
[I_MENU_NO
]);
2291 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2294 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2295 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2296 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2298 if gcBotsVS
= 'Players' then
2300 if gcBotsVS
= 'Monsters' then
2304 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2308 Menu
.DefControl
:= 'mCustomGameMenu';
2309 g_GUI_AddWindow(Menu
);
2311 Menu
:= TGUIWindow
.Create('CampaignMenu');
2312 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2314 Name
:= 'mCampaignMenu';
2323 with AddFileList('', 15, 4) do
2326 OnChange
:= ProcSelectCampaignWAD
;
2330 FileMask
:= '*.wad|*.pk3|*.zip';
2331 SetBase(MapsDir
+'megawads/');
2334 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2336 Name
:= 'lbWADName';
2340 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2342 Name
:= 'lbWADAuthor';
2346 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2347 with AddMemo('', 15, 3) do
2349 Name
:= 'meWADDescription';
2350 Color
:= MENU_ITEMSCTRL_COLOR
;
2352 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2354 Name
:= 'swPlayers';
2355 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2356 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2359 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2363 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2365 Name
:= 'mpWADImage';
2366 DefaultRes
:= 'NOPIC';
2367 X
:= GetControl('lsWAD').X
+4;
2368 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2371 Menu
.DefControl
:= 'mCampaignMenu';
2372 g_GUI_AddWindow(Menu
);
2374 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2375 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2377 Name
:= 'mSelectMapMenu';
2378 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2381 OnChange
:= ProcSelectWAD
;
2385 FileMask
:= '*.wad|*.pk3|*.zip';
2388 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2392 OnChange
:= ProcSelectMap
;
2395 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2397 Name
:= 'lbMapName';
2401 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2403 Name
:= 'lbMapAuthor';
2407 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2409 Name
:= 'lbMapSize';
2413 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2415 Name
:= 'meMapDescription';
2420 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2422 Name
:= 'mpMapPreview';
2423 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2424 Y
:= GetControl('lsMapWAD').Y
;
2426 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2428 Name
:= 'lbMapScale';
2431 Color
:= MENU_ITEMSCTRL_COLOR
;
2432 X
:= GetControl('lsMapWAD').X
+
2433 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2434 2 + MAPPREVIEW_WIDTH
*4;
2435 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2438 Menu
.OnClose
:= ProcSetMap
;
2439 Menu
.DefControl
:= 'mSelectMapMenu';
2440 g_GUI_AddWindow(Menu
);
2442 Menu
:= TGUIWindow
.Create('OptionsMenu');
2443 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2445 Name
:= 'mmOptionsMenu';
2446 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2447 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2448 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2449 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2450 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2451 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2453 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2454 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2456 Menu
.OnClose
:= ProcApplyOptions
;
2457 Menu
.DefControl
:= 'mmOptionsMenu';
2458 g_GUI_AddWindow(Menu
);
2460 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2461 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2462 g_GUI_AddWindow(Menu
);
2464 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2465 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2467 Name
:= 'mOptionsVideoMenu';
2468 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2469 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2475 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2478 AddItem(_lc
[I_MENU_YES
]);
2479 AddItem(_lc
[I_MENU_NO
]);
2481 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2483 Name
:= 'swTextureFilter';
2484 AddItem(_lc
[I_MENU_YES
]);
2485 AddItem(_lc
[I_MENU_NO
]);
2487 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2489 Name
:= 'swLegacyNPOT';
2490 AddItem(_lc
[I_MENU_NO
]);
2491 AddItem(_lc
[I_MENU_YES
]);
2494 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2497 Menu
.DefControl
:= 'mOptionsVideoMenu';
2498 g_GUI_AddWindow(Menu
);
2500 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2501 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2503 Name
:= 'mOptionsVideoResMenu';
2504 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2506 Name
:= 'lbCurrentRes';
2510 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2512 Name
:= 'lsResolution';
2515 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2517 Name
:= 'swFullScreen';
2518 AddItem(_lc
[I_MENU_YES
]);
2519 AddItem(_lc
[I_MENU_NO
]);
2522 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2525 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2526 g_GUI_AddWindow(Menu
);
2528 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2529 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2531 Name
:= 'mOptionsSoundMenu';
2532 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2534 Name
:= 'scMusicLevel';
2536 OnChange
:= ProcChangeSoundSettings
;
2538 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2540 Name
:= 'scSoundLevel';
2542 OnChange
:= ProcChangeSoundSettings
;
2544 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2546 Name
:= 'scMaxSimSounds';
2549 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2551 Name
:= 'swAnnouncer';
2552 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2553 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2554 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2555 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2557 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2558 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2560 Name
:= 'swSoundEffects';
2561 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2562 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2564 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2565 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2567 Name
:= 'swChatSpeech';
2568 AddItem(_lc
[I_MENU_YES
]);
2569 AddItem(_lc
[I_MENU_NO
]);
2571 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2573 Name
:= 'swInactiveSounds';
2574 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2575 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2579 Menu
.DefControl
:= 'mOptionsSoundMenu';
2580 g_GUI_AddWindow(Menu
);
2582 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2583 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2585 Name
:= 'mOptionsGameMenu';
2586 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2588 Name
:= 'scParticlesCount';
2591 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2593 Name
:= 'swBloodCount';
2594 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2595 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2596 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2597 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2598 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2600 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2602 Name
:= 'scShellsMax';
2605 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2607 Name
:= 'scGibsMax';
2610 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2612 Name
:= 'scCorpsesMax';
2615 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2617 Name
:= 'swGibsCount';
2618 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2619 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2620 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2621 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2622 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2624 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2626 Name
:= 'swCorpseType';
2627 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2628 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2630 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2632 Name
:= 'swGibsType';
2633 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2634 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2636 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2638 Name
:= 'swBloodType';
2639 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2640 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2642 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2644 Name
:= 'swScreenFlash';
2645 AddItem(_lc
[I_MENU_NO
]);
2646 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2647 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2649 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2651 Name
:= 'swBackground';
2652 AddItem(_lc
[I_MENU_YES
]);
2653 AddItem(_lc
[I_MENU_NO
]);
2655 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2657 Name
:= 'swMessages';
2658 AddItem(_lc
[I_MENU_YES
]);
2659 AddItem(_lc
[I_MENU_NO
]);
2661 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2663 Name
:= 'swRevertPlayers';
2664 AddItem(_lc
[I_MENU_YES
]);
2665 AddItem(_lc
[I_MENU_NO
]);
2667 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2669 Name
:= 'swChatBubble';
2670 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2671 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2672 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2673 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2674 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2678 Menu
.DefControl
:= 'mOptionsGameMenu';
2679 g_GUI_AddWindow(Menu
);
2681 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2682 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2684 Name
:= 'mOptionsControlsMenu';
2685 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2686 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2687 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2688 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2689 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2691 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2692 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2693 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2694 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2695 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2696 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2698 if e_JoysticksAvailable
<> 0 then
2699 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2701 Menu
.DefControl
:= 'mOptionsControlsMenu';
2702 g_GUI_AddWindow(Menu
);
2704 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2705 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2707 Name
:= 'mOptionsControlsP1Menu';
2708 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2709 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2710 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2711 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2712 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2713 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2714 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2715 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2716 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2717 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2719 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2720 g_GUI_AddWindow(Menu
);
2722 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2723 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2725 Name
:= 'mOptionsControlsP1MenuWeapons';
2726 for i
:= WP_FIRST
to WP_LAST
do
2727 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2728 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2730 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2731 g_GUI_AddWindow(Menu
);
2733 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2734 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2736 Name
:= 'mOptionsControlsP2Menu';
2737 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2738 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2739 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2740 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2741 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2742 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2743 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2744 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2745 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2746 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2748 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2749 g_GUI_AddWindow(Menu
);
2751 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2752 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2754 Name
:= 'mOptionsControlsP2MenuWeapons';
2755 for i
:= WP_FIRST
to WP_LAST
do
2756 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2757 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2759 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2760 g_GUI_AddWindow(Menu
);
2762 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2763 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2765 Name
:= 'mOptionsControlsJoystickMenu';
2766 for i
:= 0 to e_JoysticksAvailable
-1 do
2767 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2769 Name
:= 'scDeadzone' + IntToStr(i
);
2773 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2774 g_GUI_AddWindow(Menu
);
2776 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2777 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2779 Name
:= 'mOptionsPlayersMenu';
2780 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2781 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2783 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2784 g_GUI_AddWindow(Menu
);
2786 CreatePlayerOptionsMenu('P1');
2787 CreatePlayerOptionsMenu('P2');
2789 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2790 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2792 Name
:= 'mOptionsPlayersMIMenu';
2793 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2798 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2803 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2805 Name
:= 'meComment';
2808 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2809 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2812 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2816 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2817 g_GUI_AddWindow(Menu
);
2819 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2820 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2822 Name
:= 'mOptionsLanguageMenu';
2823 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2824 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2827 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2828 g_GUI_AddWindow(Menu
);
2830 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2831 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2832 g_GUI_AddWindow(Menu
);
2834 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2835 Menu
.BackTexture
:= 'INTER';
2836 Menu
.OnClose
:= ProcAuthorsClose
;
2840 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2842 Color
:= _RGB(255, 0, 0);
2843 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2845 _y
:= _y
+GetHeight();
2847 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2849 Color
:= _RGB(255, 0, 0);
2850 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2852 _y
:= _y
+GetHeight()+32;
2854 // ×òî äåëàë: Êòî äåëàë
2855 cx
:= gScreenWidth
div 2 - 320 + 64;
2856 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2858 Color
:= _RGB(255, 0, 0);
2863 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2865 Color
:= _RGB(255, 255, 255);
2870 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2872 Color
:= _RGB(255, 0, 0);
2877 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2879 Color
:= _RGB(255, 255, 255);
2884 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2886 Color
:= _RGB(255, 255, 255);
2891 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2893 Color
:= _RGB(255, 0, 0);
2898 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2900 Color
:= _RGB(255, 255, 255);
2905 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2907 Color
:= _RGB(255, 0, 0);
2912 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2914 Color
:= _RGB(255, 255, 255);
2917 _y
:= gScreenHeight
- 128;
2920 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2922 Color
:= _RGB(255, 0, 0);
2927 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2929 Color
:= _RGB(255, 255, 255);
2932 _y
:= _y
+GetHeight();
2934 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2936 Color
:= _RGB(255, 255, 255);
2939 _y
:= _y
+GetHeight();
2941 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2943 Color
:= _RGB(255, 255, 255);
2946 _y
:= gScreenHeight
- 32;
2948 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2950 Color
:= _RGB(255, 0, 0);
2951 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2954 g_GUI_AddWindow(Menu
);
2956 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2957 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2958 g_GUI_AddWindow(Menu
);
2960 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2961 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2963 Name
:= 'mmGameSingleMenu';
2964 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2965 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2966 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2967 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2968 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2969 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2971 Menu
.DefControl
:= 'mmGameSingleMenu';
2972 Menu
.MainWindow
:= True;
2973 Menu
.OnClose
:= ProcGMClose
;
2974 Menu
.OnShow
:= ProcGMShow
;
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2978 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2979 g_GUI_AddWindow(Menu
);
2981 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2982 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2983 g_GUI_AddWindow(Menu
);
2985 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2986 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2988 Name
:= 'mmGameCustomMenu';
2989 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2990 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2991 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2992 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2993 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2994 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2995 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2997 Menu
.DefControl
:= 'mmGameCustomMenu';
2998 Menu
.MainWindow
:= True;
2999 Menu
.OnClose
:= ProcGMClose
;
3000 Menu
.OnShow
:= ProcGMShow
;
3001 g_GUI_AddWindow(Menu
);
3003 Menu
:= TGUIWindow
.Create('GameServerMenu');
3004 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3006 Name
:= 'mmGameServerMenu';
3007 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3008 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3009 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3010 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3011 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3013 Menu
.DefControl
:= 'mmGameServerMenu';
3014 Menu
.MainWindow
:= True;
3015 Menu
.OnClose
:= ProcGMClose
;
3016 Menu
.OnShow
:= ProcGMShow
;
3017 g_GUI_AddWindow(Menu
);
3019 Menu
:= TGUIWindow
.Create('GameClientMenu');
3020 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3022 Name
:= 'mmGameClientMenu';
3023 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3024 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3025 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3027 Menu
.DefControl
:= 'mmGameClientMenu';
3028 Menu
.MainWindow
:= True;
3029 Menu
.OnClose
:= ProcGMClose
;
3030 Menu
.OnShow
:= ProcGMShow
;
3031 g_GUI_AddWindow(Menu
);
3033 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3034 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3036 Name
:= 'mClientPasswordMenu';
3037 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3045 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3048 Menu
.DefControl
:= 'mClientPasswordMenu';
3049 g_GUI_AddWindow(Menu
);
3051 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3052 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3054 Name
:= 'mGameSetGameMenu';
3055 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3057 Name
:= 'swTeamDamage';
3058 AddItem(_lc
[I_MENU_YES
]);
3059 AddItem(_lc
[I_MENU_NO
]);
3062 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3064 Name
:= 'edTimeLimit';
3069 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3071 Name
:= 'edGoalLimit';
3076 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3078 Name
:= 'edMaxLives';
3083 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3086 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3087 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3088 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3094 Menu
.DefControl
:= 'mGameSetGameMenu';
3095 Menu
.OnClose
:= ProcApplyGameSet
;
3096 g_GUI_AddWindow(Menu
);
3098 Menu
:= TGUIWindow
.Create('TeamMenu');
3099 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3101 Name
:= 'mmTeamMenu';
3102 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3103 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3104 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3105 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3106 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3108 Menu
.DefControl
:= 'mmTeamMenu';
3109 Menu
.OnShow
:= ProcChangePlayers
;
3110 g_GUI_AddWindow(Menu
);
3113 procedure g_Menu_Show_SaveMenu();
3115 if g_Game_IsTestMap
then
3117 if gGameSettings
.GameType
= GT_SINGLE
then
3118 g_GUI_ShowWindow('GameSingleMenu')
3121 if g_Game_IsClient
then
3124 if g_Game_IsNet
then
3127 g_GUI_ShowWindow('GameCustomMenu');
3129 g_GUI_ShowWindow('SaveMenu');
3130 g_Sound_PlayEx('MENU_OPEN');
3133 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3135 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3136 if gGameSettings
.GameType
= GT_SINGLE
then
3138 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3142 if g_Game_IsClient
then exit
;
3143 if g_Game_IsNet
then exit
;
3144 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3146 g_GUI_ShowWindow('LoadMenu');
3147 g_Sound_PlayEx('MENU_OPEN');
3150 procedure g_Menu_Show_GameSetGame();
3152 if gGameSettings
.GameType
= GT_SINGLE
then
3153 g_GUI_ShowWindow('GameSingleMenu')
3156 if g_Game_IsClient
then
3159 if g_Game_IsNet
then
3160 g_GUI_ShowWindow('GameServerMenu')
3162 g_GUI_ShowWindow('GameCustomMenu');
3165 g_GUI_ShowWindow('GameSetGameMenu');
3166 g_Sound_PlayEx('MENU_OPEN');
3169 procedure g_Menu_Show_OptionsVideo();
3171 if gGameSettings
.GameType
= GT_SINGLE
then
3172 g_GUI_ShowWindow('GameSingleMenu')
3175 if g_Game_IsClient
then
3176 g_GUI_ShowWindow('GameClientMenu')
3178 if g_Game_IsNet
then
3179 g_GUI_ShowWindow('GameServerMenu')
3181 g_GUI_ShowWindow('GameCustomMenu');
3184 g_GUI_ShowWindow('OptionsMenu');
3185 g_GUI_ShowWindow('OptionsVideoMenu');
3186 g_Sound_PlayEx('MENU_OPEN');
3189 procedure g_Menu_Show_OptionsSound();
3191 if gGameSettings
.GameType
= GT_SINGLE
then
3192 g_GUI_ShowWindow('GameSingleMenu')
3195 if g_Game_IsClient
then
3196 g_GUI_ShowWindow('GameClientMenu')
3198 if g_Game_IsNet
then
3199 g_GUI_ShowWindow('GameServerMenu')
3201 g_GUI_ShowWindow('GameCustomMenu');
3204 g_GUI_ShowWindow('OptionsMenu');
3205 g_GUI_ShowWindow('OptionsSoundMenu');
3206 g_Sound_PlayEx('MENU_OPEN');
3209 procedure g_Menu_Show_EndGameMenu();
3211 g_GUI_ShowWindow('EndGameMenu');
3212 g_Sound_PlayEx('MENU_OPEN');
3215 procedure g_Menu_Show_QuitGameMenu();
3217 g_GUI_ShowWindow('ExitMenu');
3218 g_Sound_PlayEx('MENU_OPEN');
3221 procedure g_Menu_Init();
3228 procedure g_Menu_Free();
3232 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3237 procedure g_Menu_Reset();
3241 g_GUI_SaveMenuPos();
3242 ex
:= g_GUI_Destroy();
3246 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3251 g_Game_SetDebugMode();
3253 g_GUI_LoadMenuPos();