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();
111 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
113 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
119 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
120 if (ovs
<> gVSync
) then g_SetVSync(gVSync
);
122 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
123 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
125 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
127 g_Sound_SetupAllVolumes(
128 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
129 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
132 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
133 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
134 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
135 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
136 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
138 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
140 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
141 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
142 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
143 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
145 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
150 else gGibsCount
:= 48;
153 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
154 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
155 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
156 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
157 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
158 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
159 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
160 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
161 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
163 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
165 with menu
, gGameControls
.GameControls
do
167 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
168 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
169 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
170 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
173 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
174 with menu
, gGameControls
.P1Control
do
176 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
177 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
178 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
179 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
180 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
181 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
182 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
183 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
184 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
185 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
187 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
188 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
189 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
190 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
191 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
192 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
193 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
194 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
195 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
196 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
199 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
200 with menu
, gGameControls
.P1Control
do
202 for i
:= WP_FIRST
to WP_LAST
do
204 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
205 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
209 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
210 with menu
, gGameControls
.P2Control
do
212 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
213 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
214 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
215 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
216 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
217 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
218 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
219 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
220 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
221 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
223 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
224 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
225 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
226 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
227 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
228 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
229 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
230 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
231 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
232 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
235 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
236 with menu
, gGameControls
.P2Control
do
238 for i
:= WP_FIRST
to WP_LAST
do
240 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
241 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
245 if e_JoysticksAvailable
> 0 then
247 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
250 for i
:= 0 to e_JoysticksAvailable
-1 do
251 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
255 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
257 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
258 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
259 TEAM_RED
, TEAM_BLUE
);
261 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
263 gPlayer1Settings
.Model
:= Model
.Name
;
264 gPlayer1Settings
.Color
:= Model
.Color
;
267 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
269 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
270 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
271 TEAM_RED
, TEAM_BLUE
);
272 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
274 gPlayer2Settings
.Model
:= Model
.Name
;
275 gPlayer2Settings
.Color
:= Model
.Color
;
278 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
279 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
281 if g_Game_IsServer
then
283 if gPlayer1
<> nil then
285 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
286 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
287 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
288 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
290 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
293 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
296 if gPlayer2
<> nil then
298 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
299 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
300 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
301 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
303 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
308 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
310 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
313 procedure ReadOptions();
318 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
320 with TGUISwitch(menu
.GetControl('swBPP')) do
326 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
327 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
329 with TGUISwitch(menu
.GetControl('swVSync')) do
330 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
332 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
333 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
337 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
338 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
339 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
341 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
342 if gMuteWhenInactive
then
347 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
349 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
350 if gSoundEffectsDF
then
355 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
356 if gUseChatSounds
then
361 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
362 with menu
, gGameControls
.P1Control
do
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
387 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
388 with menu
, gGameControls
.P1Control
do
390 for i
:= WP_FIRST
to WP_LAST
do
392 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
393 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
397 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
398 with menu
, gGameControls
.P2Control
do
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
409 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
411 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
412 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
413 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
416 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
418 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
423 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
424 with menu
, gGameControls
.P2Control
do
426 for i
:= WP_FIRST
to WP_LAST
do
428 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
429 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
433 if e_JoysticksAvailable
> 0 then
435 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
438 for i
:= 0 to e_JoysticksAvailable
-1 do
439 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
443 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
444 with menu
, gGameControls
.GameControls
do
446 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
447 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
448 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
449 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
452 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
454 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
455 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
456 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
457 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
458 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
460 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
463 with TGUISwitch(menu
.GetControl('swBloodType')) do
464 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
466 with TGUISwitch(menu
.GetControl('swCorpseType')) do
467 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
469 with TGUISwitch(menu
.GetControl('swGibsType')) do
470 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
472 with TGUISwitch(menu
.GetControl('swGibsCount')) do
481 with TGUISwitch(menu
.GetControl('swBackGround')) do
482 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
484 with TGUISwitch(menu
.GetControl('swMessages')) do
485 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
487 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
488 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
490 with TGUISwitch(menu
.GetControl('swChatBubble')) do
491 ItemIndex
:= gChatBubble
;
493 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
495 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
496 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
498 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
499 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
501 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
502 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
503 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
505 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
507 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
508 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
510 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
511 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
513 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
514 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
515 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
517 ProcSelectModel(nil);
520 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
522 // don't turn off monsters in DM
524 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
525 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
526 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
528 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
531 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
532 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
533 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
534 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
538 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
540 // don't turn off monsters in DM
542 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
543 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
544 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
546 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
549 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
550 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
551 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
552 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
556 procedure ProcStartCustomGame();
562 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
564 Map
:= TGUILabel(GetControl('lbMap')).Text;
567 if not isWadPath(Map
) then
570 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
571 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
572 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
573 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
574 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
576 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
577 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
578 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
579 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
582 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
584 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
586 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
588 Options
:= Options
or GAME_OPTION_MONSTERS
;
589 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
591 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
593 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
594 gcBotsVS
:= 'Monsters';
597 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
598 gcBotsVS
:= 'Everybody';
601 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
602 gcBotsVS
:= 'Players';
609 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
611 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
612 gcMaxLives
, Options
, gcPlayers
);
616 procedure ProcStartNetGame();
622 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
624 Map
:= TGUILabel(GetControl('lbMap')).Text;
627 if not isWadPath(Map
) then
630 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
631 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
632 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
633 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
634 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
635 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
637 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
638 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
639 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
640 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
643 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
645 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
647 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
649 Options
:= Options
or GAME_OPTION_MONSTERS
;
650 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
652 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
654 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
655 gnBotsVS
:= 'Monsters';
658 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
659 gnBotsVS
:= 'Everybody';
662 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
663 gnBotsVS
:= 'Players';
668 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
669 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
670 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
671 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
672 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
675 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
676 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
678 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
679 Options
, gnPlayers
, 0, NetPort
);
682 procedure ProcConnectNetGame();
686 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
688 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
689 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
690 PW
:= TGUIEdit(GetControl('edPW')).Text;
693 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
694 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
697 procedure ProcEnterPassword();
701 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
703 NetClientIP
:= PromptIP
;
704 NetClientPort
:= PromptPort
;
705 PW
:= TGUIEdit(GetControl('edPW')).Text;
708 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
709 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
712 procedure ProcServerlist();
714 if not NetInitDone
then
716 if (not g_Net_Init()) then
718 g_Console_Add('NET: ERROR: Failed to init ENet!');
725 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
727 gState
:= STATE_SLIST
;
728 g_ActiveWindow
:= nil;
730 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
735 slReturnPressed
:= True;
736 if g_Net_Slist_Fetch(slCurrent
) then
738 if slCurrent
= nil then
739 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
742 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
745 procedure ProcStartCampaign();
751 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
753 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
754 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
761 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
764 procedure ProcSelectMap(Sender
: TGUIControl
);
768 wad
, map
, res
: String;
770 win
:= g_GUI_GetWindow('SelectMapMenu');
771 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
773 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
774 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
776 if (wad
= '') or (map
= '') then
777 begin // Ýòî íå êàðòà
778 TGUILabel(GetControl('lbMapName')).Text := '';
779 TGUILabel(GetControl('lbMapAuthor')).Text := '';
780 TGUILabel(GetControl('lbMapSize')).Text := '';
781 TGUIMemo(GetControl('meMapDescription')).SetText('');
782 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
783 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
789 a
:= g_Map_GetMapInfo(res
);
791 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
792 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
793 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
794 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
795 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
796 TGUILabel(win
.GetControl('lbMapScale')).Text :=
797 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
802 procedure ProcSelectWAD(Sender
: TGUIControl
);
807 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
809 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
811 with TGUIListBox(GetControl('lsMapRes')) do
817 list
:= g_Map_GetMapsList(wad
);
831 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
837 win
:= g_GUI_GetWindow('CampaignMenu');
838 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
840 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
844 TGUILabel(GetControl('lbWADName')).Text := '';
845 TGUILabel(GetControl('lbWADAuthor')).Text := '';
846 TGUIMemo(GetControl('meWADDescription')).SetText('');
849 a
:= g_Game_GetMegaWADInfo(wad
);
851 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
852 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
853 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
855 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
859 fn
:= g_ExtractWadName(a
.pic
);
861 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
863 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
868 procedure ProcChangeColor(Sender
: TGUIControl
);
872 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
873 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
874 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
875 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
876 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
877 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
879 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
880 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
881 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
882 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
883 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
884 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
887 procedure ProcSelectModel(Sender
: TGUIControl
);
892 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
893 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
894 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
896 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
897 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
898 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
900 ProcChangeColor(nil);
903 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
915 wad
:= TWADFile
.Create
;
916 if wad
.ReadFile(GameWAD
) then
917 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
922 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
924 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
925 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
926 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
927 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
929 if g_Texture_Get('FONT_STD', ID
) then
930 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
935 if cfglen
<> 0 then FreeMem(cfgdata
);
938 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
944 cfgdata
, fntdata
: Pointer;
945 cfglen
, fntlen
: Integer;
953 wad
:= TWADFile
.Create
;
954 if wad
.ReadFile(GameWAD
) then
956 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
957 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
963 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
964 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
965 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
967 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
968 FontID
:= e_CharFont_Create(spc
);
972 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
973 if chrwidth
= 0 then Continue
;
975 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
977 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
983 if cfglen
<> 0 then FreeMem(cfgdata
);
984 if fntlen
<> 0 then FreeMem(fntdata
);
987 procedure MenuLoadData();
989 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
991 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
992 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
993 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
994 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
995 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
996 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
997 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
998 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
999 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1000 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1001 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1002 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1003 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1004 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1005 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1006 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1007 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1008 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1009 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1010 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1011 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1012 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1013 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1014 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1016 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1017 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1018 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1019 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1020 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1021 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1022 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1025 procedure MenuFreeData();
1027 e_CharFont_Remove(gMenuFont
);
1028 e_CharFont_Remove(gMenuSmallFont
);
1030 g_Texture_Delete('MAINMENU_MARKER1');
1031 g_Texture_Delete('MAINMENU_MARKER2');
1032 g_Texture_Delete('SCROLL_LEFT');
1033 g_Texture_Delete('SCROLL_RIGHT');
1034 g_Texture_Delete('SCROLL_MIDDLE');
1035 g_Texture_Delete('SCROLL_MARKER');
1036 g_Texture_Delete('EDIT_LEFT');
1037 g_Texture_Delete('EDIT_RIGHT');
1038 g_Texture_Delete('EDIT_MIDDLE');
1039 g_Texture_Delete('BOX1');
1040 g_Texture_Delete('BOX2');
1041 g_Texture_Delete('BOX3');
1042 g_Texture_Delete('BOX4');
1043 g_Texture_Delete('BOX5');
1044 g_Texture_Delete('BOX6');
1045 g_Texture_Delete('BOX7');
1046 g_Texture_Delete('BOX8');
1047 g_Texture_Delete('BOX9');
1048 g_Texture_Delete('BSCROLL_UP_A');
1049 g_Texture_Delete('BSCROLL_UP_U');
1050 g_Texture_Delete('BSCROLL_DOWN_A');
1051 g_Texture_Delete('BSCROLL_DOWN_U');
1052 g_Texture_Delete('BSCROLL_MIDDLE');
1053 g_Texture_Delete('NOPIC');
1055 g_Sound_Delete('MENU_SELECT');
1056 g_Sound_Delete('MENU_OPEN');
1057 g_Sound_Delete('MENU_CLOSE');
1058 g_Sound_Delete('MENU_CHANGE');
1059 g_Sound_Delete('SCROLL_ADD');
1060 g_Sound_Delete('SCROLL_SUB');
1061 g_Sound_Delete('SOUND_PLAYER_FALL');
1064 procedure ProcAuthorsMenu();
1066 gMusic
.SetByName('MUSIC_INTERMUS');
1070 procedure ProcExitMenuKeyDown (yes
: Boolean);
1073 snd
: TPlayableSound
;
1078 g_Game_StopAllSounds(True);
1079 case (Random(18)) of
1080 0: s
:= 'SOUND_MONSTER_PAIN';
1081 1: s
:= 'SOUND_MONSTER_DIE_3';
1082 2: s
:= 'SOUND_MONSTER_SLOP';
1083 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1084 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1085 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1086 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1087 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1088 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1089 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1090 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1091 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1092 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1093 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1094 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1095 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1096 else s
:= 'SOUND_PLAYER_FALL';
1098 snd
:= TPlayableSound
.Create();
1099 res
:= snd
.SetByName(s
);
1100 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1104 while snd
.IsPlaying() do begin end;
1112 procedure ProcLoadMenu();
1119 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1120 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1121 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1125 procedure ProcSaveMenu();
1133 name
:= g_GetSaveName(a
, valid
);
1134 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1135 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1139 procedure ProcSaveGame(Sender
: TGUIControl
);
1143 if g_Game_IsNet
then Exit
;
1144 if g_Game_IsTestMap
then Exit
;
1145 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1146 g_Game_PauseAllSounds(True);
1147 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1149 g_ActiveWindow
:= nil;
1150 g_Game_Pause(False);
1153 procedure ProcLoadGame(Sender
: TGUIControl
);
1157 if g_Game_IsNet
then Exit
;
1158 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1159 if g_LoadGame(a
) then
1161 g_Game_PauseAllSounds(False)
1163 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1165 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1166 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1167 //g_ActiveWindow := nil;
1171 procedure ProcSingle1Player();
1173 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1176 procedure ProcSingle2Players();
1178 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1181 procedure ProcSelectMapMenu();
1184 wad_lb
: TGUIFileListBox
;
1185 map_lb
: TGUIListBox
;
1188 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1189 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1190 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1192 if wad_lb
.SelectedItem() <> '' then
1193 map
:= map_lb
.SelectedItem()
1197 wad_lb
.UpdateFileList();
1200 if wad_lb
.SelectedItem() <> '' then
1203 map_lb
.SelectItem(map
);
1205 if map_lb
.SelectedItem() <> '' then
1209 g_GUI_ShowWindow('SelectMapMenu');
1212 procedure ProcSelectCampaignMenu();
1215 wad_lb
: TGUIFileListBox
;
1217 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1218 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1220 wad_lb
.UpdateFileList();
1222 if wad_lb
.SelectedItem() <> '' then
1223 ProcSelectCampaignWAD(nil);
1226 procedure ProcSetMap();
1228 wad
, map
, res
: String;
1230 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1232 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1233 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1236 if (wad
= '') or (map
= '') then
1239 res
:= wad
+':\'+map
;
1241 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1242 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1245 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1249 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1251 g_Sound_SetupAllVolumes(
1252 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1253 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1257 procedure ProcOptionsPlayersMIMenu();
1262 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1264 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1266 if a
= '' then Exit
;
1268 b
:= g_PlayerModel_GetInfo(a
);
1270 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1272 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1273 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1274 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1276 if b
.HaveWeapon
then
1277 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1279 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1282 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1285 procedure ProcOptionsPlayersAnim();
1289 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1294 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1297 Model
.GetCurrentAnimation
.Loop
:= True;
1298 Model
.GetCurrentAnimationMask
.Loop
:= True;
1302 procedure ProcOptionsPlayersWeap();
1306 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1311 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1315 procedure ProcOptionsPlayersRot();
1319 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1320 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1322 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1326 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1330 g_Options_SetDefault();
1336 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1338 if yes
then ReadOptions();
1342 procedure ProcAuthorsClose();
1344 gMusic
.SetByName('MUSIC_MENU');
1346 gState
:= STATE_MENU
;
1349 procedure ProcGMClose();
1351 g_Game_InGameMenu(False);
1354 procedure ProcGMShow();
1359 if (gGameSettings
.GameType
= GT_SINGLE
) and
1360 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1361 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1362 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1364 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1365 if g_Game_IsTestMap
then
1366 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1367 TGUIMainMenu(g_ActiveWindow
.GetControl(
1368 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1371 procedure ProcChangePlayers();
1373 TeamGame
, Spectator
, AddTwo
: Boolean;
1374 P1Team
{, P2Team}: Byte;
1375 bP2
: TGUITextButton
;
1377 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1378 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1379 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1380 P1Team
:= TEAM_NONE
;
1381 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1383 //P2Team := TEAM_NONE;
1384 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1386 TGUIMainMenu(g_ActiveWindow
.GetControl(
1387 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1388 TGUIMainMenu(g_ActiveWindow
.GetControl(
1389 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1390 TGUIMainMenu(g_ActiveWindow
.GetControl(
1391 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1393 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1394 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1395 bP2
.Enabled
:= AddTwo
and not Spectator
;
1397 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1399 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1400 if gPlayer2
= nil then
1401 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1403 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1405 TGUIMainMenu(g_ActiveWindow
.GetControl(
1406 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1409 procedure ProcJoinRed();
1411 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1413 if g_Game_IsServer
then
1415 if gPlayer1
= nil then
1416 g_Game_AddPlayer(TEAM_RED
)
1419 if gPlayer1
.Team
<> TEAM_RED
then
1421 gPlayer1
.SwitchTeam
;
1422 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1425 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1430 gPlayer1Settings
.Team
:= TEAM_RED
;
1431 MC_SEND_PlayerSettings
;
1432 if gPlayer1
= nil then
1433 g_Game_AddPlayer(TEAM_RED
);
1435 g_ActiveWindow
:= nil;
1436 g_Game_Pause(False);
1439 procedure ProcJoinBlue();
1441 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1443 if g_Game_IsServer
then
1445 if gPlayer1
= nil then
1446 g_Game_AddPlayer(TEAM_BLUE
)
1449 if gPlayer1
.Team
<> TEAM_BLUE
then
1451 gPlayer1
.SwitchTeam
;
1452 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1455 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1460 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1461 MC_SEND_PlayerSettings
;
1462 if gPlayer1
= nil then
1463 g_Game_AddPlayer(TEAM_BLUE
);
1465 g_ActiveWindow
:= nil;
1466 g_Game_Pause(False);
1469 procedure ProcJoinGame();
1471 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1473 if gPlayer1
= nil then
1475 g_ActiveWindow
:= nil;
1476 g_Game_Pause(False);
1479 procedure ProcSwitchP2();
1481 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1483 if gPlayer1
= nil then
1485 if gPlayer2
= nil then
1488 g_Game_RemovePlayer();
1489 g_ActiveWindow
:= nil;
1490 g_Game_Pause(False);
1493 procedure ProcSpectate();
1495 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1498 g_ActiveWindow
:= nil;
1499 g_Game_Pause(False);
1502 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1504 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1507 procedure ProcEndMenuKeyDown (yes
: Boolean);
1509 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1512 procedure ProcSetRussianLanguage();
1514 if gLanguage
<> LANGUAGE_RUSSIAN
then
1516 gLanguage
:= LANGUAGE_RUSSIAN
;
1517 gLanguageChange
:= True;
1518 gAskLanguage
:= False;
1520 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1522 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1527 procedure ProcSetEnglishLanguage();
1529 if gLanguage
<> LANGUAGE_ENGLISH
then
1531 gLanguage
:= LANGUAGE_ENGLISH
;
1532 gLanguageChange
:= True;
1533 gAskLanguage
:= False;
1535 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1537 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1542 procedure ReadGameSettings();
1546 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1548 with gGameSettings
do
1550 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1551 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1556 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1557 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1558 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1560 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1561 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1562 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1565 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1570 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1572 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1573 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1574 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1575 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1576 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1577 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1578 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1579 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1583 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1584 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1589 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1590 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1595 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1596 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1601 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1602 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1607 procedure ProcApplyGameSet();
1611 stat
: TPlayerStatArray
;
1613 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1615 if not g_Game_IsServer
then Exit
;
1617 with gGameSettings
do
1619 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1621 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1622 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1624 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1627 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1629 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1635 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1637 TimeLimit
:= Max(n
, b
);
1641 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1643 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1650 if GameMode
= GM_DM
then
1652 stat
:= g_Player_GetStats();
1654 for a
:= 0 to High(stat
) do
1655 if stat
[a
].Frags
> b
then
1659 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1661 GoalLimit
:= Max(n
, b
);
1665 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1667 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1668 if n
< 0 then n
:= 0;
1669 if n
> 255 then n
:= 255;
1675 stat
:= g_Player_GetStats();
1677 for a
:= 0 to High(stat
) do
1678 if stat
[a
].Lives
> b
then
1681 MaxLives
:= Max(n
, b
);
1685 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1687 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1690 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1691 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1695 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1696 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1700 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1701 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1707 if g_Game_IsNet
then MH_SEND_GameSettings
;
1710 procedure ProcVideoOptionsRes();
1716 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1718 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1719 IntToStr(gScreenWidth
) +
1720 ' x ' + IntToStr(gScreenHeight
) +
1721 ', ' + IntToStr(gBPP
) + ' bpp';
1723 with TGUIListBox(menu
.GetControl('lsResolution')) do
1725 list
:= GetDisplayModes(gBPP
, SR
);
1736 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1743 procedure ProcApplyVideoOptions();
1746 Fullscreen
: Boolean;
1747 SWidth
, SHeight
: Integer;
1750 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1752 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1753 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1755 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1757 if (SWidth
<> gScreenWidth
) or
1758 (SHeight
<> gScreenHeight
) or
1759 (Fullscreen
<> gFullscreen
) then
1761 gResolutionChange
:= True;
1762 gRC_Width
:= SWidth
;
1763 gRC_Height
:= SHeight
;
1764 gRC_FullScreen
:= Fullscreen
;
1765 gRC_Maximized
:= gWinMaximized
;
1768 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1772 procedure ProcSetFirstRussianLanguage();
1774 gLanguage
:= LANGUAGE_RUSSIAN
;
1775 gLanguageChange
:= True;
1776 gAskLanguage
:= False;
1778 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1781 procedure ProcSetFirstEnglishLanguage();
1783 gLanguage
:= LANGUAGE_ENGLISH
;
1784 gLanguageChange
:= True;
1785 gAskLanguage
:= False;
1787 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1790 procedure ProcRecallAddress();
1792 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1794 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1795 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1799 procedure CreateFirstLanguageMenu();
1803 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1805 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1807 Name
:= 'mmFirstLanguageMenu';
1808 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1809 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1812 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1813 Menu
.MainWindow
:= True;
1814 g_GUI_AddWindow(Menu
);
1817 procedure g_Menu_AskLanguage();
1819 CreateFirstLanguageMenu();
1820 g_GUI_ShowWindow('FirstLanguageMenu');
1823 procedure CreatePlayerOptionsMenu(s
: String);
1828 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1830 a
:= _lc
[I_MENU_PLAYER_1
]
1832 a
:= _lc
[I_MENU_PLAYER_2
];
1833 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1835 Name
:= 'mOptionsPlayers'+s
+'Menu';
1836 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1838 Name
:= 'ed'+s
+'Name';
1842 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1844 Name
:= 'sw'+s
+'Team';
1845 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1846 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1848 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1850 Name
:= 'ls'+s
+'Model';
1852 Items
:= g_PlayerModel_GetNames();
1853 OnChange
:= ProcSelectModel
;
1855 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1857 Name
:= 'sc'+s
+'Red';
1859 OnChange
:= ProcChangeColor
;
1861 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1863 Name
:= 'sc'+s
+'Green';
1865 OnChange
:= ProcChangeColor
;
1867 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1869 Name
:= 'sc'+s
+'Blue';
1871 OnChange
:= ProcChangeColor
;
1874 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1875 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1876 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1877 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1879 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1881 Name
:= 'mv'+s
+'Model';
1882 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1883 Y
:= GetControl('ls'+s
+'Model').Y
;
1886 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1887 g_GUI_AddWindow(Menu
);
1890 procedure CreateAllMenus();
1894 a
, cx
, _y
, i
: Integer;
1897 Menu
:= TGUIWindow
.Create('MainMenu');
1898 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1900 Name
:= 'mmMainMenu';
1901 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1902 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1903 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1904 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1905 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1906 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1908 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1910 Color
:= _RGB(255, 255, 255);
1911 X
:= gScreenWidth
-GetWidth
-8;
1912 Y
:= gScreenHeight
-GetHeight
-8;
1914 Menu
.DefControl
:= 'mmMainMenu';
1915 Menu
.MainWindow
:= True;
1916 g_GUI_AddWindow(Menu
);
1918 Menu
:= TGUIWindow
.Create('NewGameMenu');
1919 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1921 Name
:= 'mmNewGameMenu';
1922 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1923 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1924 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1925 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1927 Menu
.DefControl
:= 'mmNewGameMenu';
1928 g_GUI_AddWindow(Menu
);
1930 Menu
:= TGUIWindow
.Create('NetGameMenu');
1931 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1933 Name
:= 'mmNetGameMenu';
1934 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1935 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1937 Menu
.DefControl
:= 'mmNetGameMenu';
1938 g_GUI_AddWindow(Menu
);
1940 Menu
:= TGUIWindow
.Create('NetServerMenu');
1941 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1943 Name
:= 'mNetServerMenu';
1944 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1946 Name
:= 'edSrvName';
1947 OnlyDigits
:= False;
1950 Text := NetServerName
;
1952 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1954 Name
:= 'edSrvPassword';
1955 OnlyDigits
:= False;
1958 Text := NetPassword
;
1960 with AddEdit(_lc
[I_NET_PORT
]) do
1966 Text := IntToStr(NetPort
);
1968 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1970 Name
:= 'edMaxPlayers';
1974 Text := IntToStr(NetMaxClients
);
1976 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1978 Name
:= 'swUseMaster';
1979 AddItem(_lc
[I_MENU_YES
]);
1980 AddItem(_lc
[I_MENU_NO
]);
1981 if NetUseMaster
then
1987 with AddLabel(_lc
[I_MENU_MAP
]) do
1992 OnClick
:= @ProcSelectMapMenu
;
1994 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1996 Name
:= 'swGameMode';
1997 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1998 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1999 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2000 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2001 case g_Game_TextToMode(gnGameMode
) of
2003 GM_DM
: ItemIndex
:= 0;
2004 GM_TDM
: ItemIndex
:= 1;
2005 GM_CTF
: ItemIndex
:= 2;
2007 GM_COOP
: ItemIndex
:= 3;
2009 OnChange
:= ProcSwitchMonstersNet
;
2011 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2013 Name
:= 'edTimeLimit';
2017 if gnTimeLimit
> 0 then
2018 Text := IntToStr(gnTimeLimit
);
2020 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2022 Name
:= 'edGoalLimit';
2026 if gnGoalLimit
> 0 then
2027 Text := IntToStr(gnGoalLimit
);
2029 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2031 Name
:= 'edMaxLives';
2035 if gnMaxLives
> 0 then
2036 Text := IntToStr(gnMaxLives
);
2038 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2040 Name
:= 'swPlayers';
2041 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2042 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2043 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2044 ItemIndex
:= gnPlayers
;
2046 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2048 Name
:= 'swTeamDamage';
2049 AddItem(_lc
[I_MENU_YES
]);
2050 AddItem(_lc
[I_MENU_NO
]);
2051 if gnTeamDamage
then
2056 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2058 Name
:= 'swEnableExits';
2059 AddItem(_lc
[I_MENU_YES
]);
2060 AddItem(_lc
[I_MENU_NO
]);
2066 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2068 Name
:= 'swWeaponStay';
2069 AddItem(_lc
[I_MENU_YES
]);
2070 AddItem(_lc
[I_MENU_NO
]);
2071 if gnWeaponStay
then
2076 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2078 Name
:= 'swMonsters';
2079 AddItem(_lc
[I_MENU_YES
]);
2080 AddItem(_lc
[I_MENU_NO
]);
2086 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2089 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2090 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2091 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2093 if gnBotsVS
= 'Players' then
2095 if gnBotsVS
= 'Monsters' then
2099 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2103 Menu
.DefControl
:= 'mNetServerMenu';
2104 g_GUI_AddWindow(Menu
);
2106 Menu
:= TGUIWindow
.Create('NetClientMenu');
2107 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2109 Name
:= 'mNetClientMenu';
2111 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2114 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2120 Text := 'localhost';
2122 with AddEdit(_lc
[I_NET_PORT
]) do
2130 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2133 OnlyDigits
:= False;
2140 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2144 Menu
.DefControl
:= 'mNetClientMenu';
2145 g_GUI_AddWindow(Menu
);
2147 Menu
:= TGUIWindow
.Create('LoadMenu');
2148 Menu
.OnShow
:= ProcLoadMenu
;
2149 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2151 Name
:= 'mmLoadMenu';
2156 Name
:= 'edSlot'+IntToStr(a
);
2159 OnEnter
:= ProcLoadGame
;
2162 Menu
.DefControl
:= 'mmLoadMenu';
2163 g_GUI_AddWindow(Menu
);
2165 Menu
:= TGUIWindow
.Create('SaveMenu');
2166 Menu
.OnShow
:= ProcSaveMenu
;
2167 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2169 Name
:= 'mmSaveMenu';
2174 Name
:= 'edSlot'+IntToStr(a
);
2177 OnChange
:= ProcSaveGame
;
2180 Menu
.DefControl
:= 'mmSaveMenu';
2181 g_GUI_AddWindow(Menu
);
2183 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2184 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2186 Name
:= 'mCustomGameMenu';
2187 with AddLabel(_lc
[I_MENU_MAP
]) do
2192 OnClick
:= @ProcSelectMapMenu
;
2194 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2196 Name
:= 'swGameMode';
2197 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2198 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2199 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2200 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2201 case g_Game_TextToMode(gcGameMode
) of
2203 GM_DM
: ItemIndex
:= 0;
2204 GM_TDM
: ItemIndex
:= 1;
2205 GM_CTF
: ItemIndex
:= 2;
2207 GM_COOP
: ItemIndex
:= 3;
2209 OnChange
:= ProcSwitchMonstersCustom
;
2211 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2213 Name
:= 'edTimeLimit';
2217 if gcTimeLimit
> 0 then
2218 Text := IntToStr(gcTimeLimit
);
2220 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2222 Name
:= 'edGoalLimit';
2226 if gcGoalLimit
> 0 then
2227 Text := IntToStr(gcGoalLimit
);
2229 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2231 Name
:= 'edMaxLives';
2235 if gcMaxLives
> 0 then
2236 Text := IntToStr(gcMaxLives
);
2238 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2240 Name
:= 'swPlayers';
2241 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2242 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2243 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2244 ItemIndex
:= gcPlayers
;
2246 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2248 Name
:= 'swTeamDamage';
2249 AddItem(_lc
[I_MENU_YES
]);
2250 AddItem(_lc
[I_MENU_NO
]);
2251 if gcTeamDamage
then
2256 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2258 Name
:= 'swEnableExits';
2259 AddItem(_lc
[I_MENU_YES
]);
2260 AddItem(_lc
[I_MENU_NO
]);
2266 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2268 Name
:= 'swWeaponStay';
2269 AddItem(_lc
[I_MENU_YES
]);
2270 AddItem(_lc
[I_MENU_NO
]);
2271 if gcWeaponStay
then
2276 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2278 Name
:= 'swMonsters';
2279 AddItem(_lc
[I_MENU_YES
]);
2280 AddItem(_lc
[I_MENU_NO
]);
2286 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2289 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2290 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2291 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2293 if gcBotsVS
= 'Players' then
2295 if gcBotsVS
= 'Monsters' then
2299 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2303 Menu
.DefControl
:= 'mCustomGameMenu';
2304 g_GUI_AddWindow(Menu
);
2306 Menu
:= TGUIWindow
.Create('CampaignMenu');
2307 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2309 Name
:= 'mCampaignMenu';
2318 with AddFileList('', 15, 4) do
2321 OnChange
:= ProcSelectCampaignWAD
;
2325 FileMask
:= '*.wad|*.pk3|*.zip';
2326 SetBase(MapsDir
+'megawads/');
2329 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2331 Name
:= 'lbWADName';
2335 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2337 Name
:= 'lbWADAuthor';
2341 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2342 with AddMemo('', 15, 3) do
2344 Name
:= 'meWADDescription';
2345 Color
:= MENU_ITEMSCTRL_COLOR
;
2347 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2349 Name
:= 'swPlayers';
2350 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2351 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2354 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2358 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2360 Name
:= 'mpWADImage';
2361 DefaultRes
:= 'NOPIC';
2362 X
:= GetControl('lsWAD').X
+4;
2363 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2366 Menu
.DefControl
:= 'mCampaignMenu';
2367 g_GUI_AddWindow(Menu
);
2369 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2370 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2372 Name
:= 'mSelectMapMenu';
2373 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2376 OnChange
:= ProcSelectWAD
;
2380 FileMask
:= '*.wad|*.pk3|*.zip';
2383 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2387 OnChange
:= ProcSelectMap
;
2390 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2392 Name
:= 'lbMapName';
2396 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2398 Name
:= 'lbMapAuthor';
2402 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2404 Name
:= 'lbMapSize';
2408 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2410 Name
:= 'meMapDescription';
2415 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2417 Name
:= 'mpMapPreview';
2418 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2419 Y
:= GetControl('lsMapWAD').Y
;
2421 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2423 Name
:= 'lbMapScale';
2426 Color
:= MENU_ITEMSCTRL_COLOR
;
2427 X
:= GetControl('lsMapWAD').X
+
2428 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2429 2 + MAPPREVIEW_WIDTH
*4;
2430 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2433 Menu
.OnClose
:= ProcSetMap
;
2434 Menu
.DefControl
:= 'mSelectMapMenu';
2435 g_GUI_AddWindow(Menu
);
2437 Menu
:= TGUIWindow
.Create('OptionsMenu');
2438 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2440 Name
:= 'mmOptionsMenu';
2441 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2442 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2443 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2444 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2445 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2446 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2448 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2449 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2451 Menu
.OnClose
:= ProcApplyOptions
;
2452 Menu
.DefControl
:= 'mmOptionsMenu';
2453 g_GUI_AddWindow(Menu
);
2455 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2456 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2457 g_GUI_AddWindow(Menu
);
2459 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2460 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2462 Name
:= 'mOptionsVideoMenu';
2463 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2464 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2470 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2473 AddItem(_lc
[I_MENU_YES
]);
2474 AddItem(_lc
[I_MENU_NO
]);
2476 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2478 Name
:= 'swTextureFilter';
2479 AddItem(_lc
[I_MENU_YES
]);
2480 AddItem(_lc
[I_MENU_NO
]);
2482 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2484 Name
:= 'swLegacyNPOT';
2485 AddItem(_lc
[I_MENU_NO
]);
2486 AddItem(_lc
[I_MENU_YES
]);
2489 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2492 Menu
.DefControl
:= 'mOptionsVideoMenu';
2493 g_GUI_AddWindow(Menu
);
2495 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2496 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2498 Name
:= 'mOptionsVideoResMenu';
2499 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2501 Name
:= 'lbCurrentRes';
2505 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2507 Name
:= 'lsResolution';
2510 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2512 Name
:= 'swFullScreen';
2513 AddItem(_lc
[I_MENU_YES
]);
2514 AddItem(_lc
[I_MENU_NO
]);
2517 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2520 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2521 g_GUI_AddWindow(Menu
);
2523 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2524 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2526 Name
:= 'mOptionsSoundMenu';
2527 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2529 Name
:= 'scMusicLevel';
2531 OnChange
:= ProcChangeSoundSettings
;
2533 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2535 Name
:= 'scSoundLevel';
2537 OnChange
:= ProcChangeSoundSettings
;
2539 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2541 Name
:= 'scMaxSimSounds';
2544 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2546 Name
:= 'swAnnouncer';
2547 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2548 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2549 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2550 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2552 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2553 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2555 Name
:= 'swSoundEffects';
2556 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2557 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2559 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2560 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2562 Name
:= 'swChatSpeech';
2563 AddItem(_lc
[I_MENU_YES
]);
2564 AddItem(_lc
[I_MENU_NO
]);
2566 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2568 Name
:= 'swInactiveSounds';
2569 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2570 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2574 Menu
.DefControl
:= 'mOptionsSoundMenu';
2575 g_GUI_AddWindow(Menu
);
2577 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2578 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2580 Name
:= 'mOptionsGameMenu';
2581 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2583 Name
:= 'scParticlesCount';
2586 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2588 Name
:= 'swBloodCount';
2589 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2590 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2591 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2592 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2593 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2595 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2597 Name
:= 'scShellsMax';
2600 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2602 Name
:= 'scGibsMax';
2605 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2607 Name
:= 'scCorpsesMax';
2610 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2612 Name
:= 'swGibsCount';
2613 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2614 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2615 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2616 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2617 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2619 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2621 Name
:= 'swCorpseType';
2622 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2623 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2625 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2627 Name
:= 'swGibsType';
2628 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2629 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2631 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2633 Name
:= 'swBloodType';
2634 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2635 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2637 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2639 Name
:= 'swScreenFlash';
2640 AddItem(_lc
[I_MENU_NO
]);
2641 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2642 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2644 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2646 Name
:= 'swBackground';
2647 AddItem(_lc
[I_MENU_YES
]);
2648 AddItem(_lc
[I_MENU_NO
]);
2650 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2652 Name
:= 'swMessages';
2653 AddItem(_lc
[I_MENU_YES
]);
2654 AddItem(_lc
[I_MENU_NO
]);
2656 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2658 Name
:= 'swRevertPlayers';
2659 AddItem(_lc
[I_MENU_YES
]);
2660 AddItem(_lc
[I_MENU_NO
]);
2662 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2664 Name
:= 'swChatBubble';
2665 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2666 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2667 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2668 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2669 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2673 Menu
.DefControl
:= 'mOptionsGameMenu';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2677 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2679 Name
:= 'mOptionsControlsMenu';
2680 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2681 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2682 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2683 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2684 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2686 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2687 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2688 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2689 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2690 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2691 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2693 if e_JoysticksAvailable
<> 0 then
2694 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2696 Menu
.DefControl
:= 'mOptionsControlsMenu';
2697 g_GUI_AddWindow(Menu
);
2699 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2700 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2702 Name
:= 'mOptionsControlsP1Menu';
2703 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2704 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2705 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2706 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2707 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2708 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2709 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2710 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2711 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2712 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2714 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2715 g_GUI_AddWindow(Menu
);
2717 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2718 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2720 Name
:= 'mOptionsControlsP1MenuWeapons';
2721 for i
:= WP_FIRST
to WP_LAST
do
2722 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2723 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2725 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2726 g_GUI_AddWindow(Menu
);
2728 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2729 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2731 Name
:= 'mOptionsControlsP2Menu';
2732 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2733 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2734 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2735 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2736 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2737 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2738 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2739 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2740 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2741 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2743 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2744 g_GUI_AddWindow(Menu
);
2746 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2747 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2749 Name
:= 'mOptionsControlsP2MenuWeapons';
2750 for i
:= WP_FIRST
to WP_LAST
do
2751 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2752 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2754 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2755 g_GUI_AddWindow(Menu
);
2757 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2758 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2760 Name
:= 'mOptionsControlsJoystickMenu';
2761 for i
:= 0 to e_JoysticksAvailable
-1 do
2762 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2764 Name
:= 'scDeadzone' + IntToStr(i
);
2768 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2769 g_GUI_AddWindow(Menu
);
2771 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2772 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2774 Name
:= 'mOptionsPlayersMenu';
2775 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2776 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2778 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2779 g_GUI_AddWindow(Menu
);
2781 CreatePlayerOptionsMenu('P1');
2782 CreatePlayerOptionsMenu('P2');
2784 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2785 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2787 Name
:= 'mOptionsPlayersMIMenu';
2788 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2793 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2798 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2800 Name
:= 'meComment';
2803 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2804 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2807 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2811 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2812 g_GUI_AddWindow(Menu
);
2814 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2815 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2817 Name
:= 'mOptionsLanguageMenu';
2818 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2819 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2822 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2823 g_GUI_AddWindow(Menu
);
2825 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2826 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2827 g_GUI_AddWindow(Menu
);
2829 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2830 Menu
.BackTexture
:= 'INTER';
2831 Menu
.OnClose
:= ProcAuthorsClose
;
2835 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2837 Color
:= _RGB(255, 0, 0);
2838 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2840 _y
:= _y
+GetHeight();
2842 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2844 Color
:= _RGB(255, 0, 0);
2845 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2847 _y
:= _y
+GetHeight()+32;
2849 // ×òî äåëàë: Êòî äåëàë
2850 cx
:= gScreenWidth
div 2 - 320 + 64;
2851 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2853 Color
:= _RGB(255, 0, 0);
2858 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2860 Color
:= _RGB(255, 255, 255);
2865 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2867 Color
:= _RGB(255, 0, 0);
2872 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2874 Color
:= _RGB(255, 255, 255);
2879 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2881 Color
:= _RGB(255, 255, 255);
2886 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2888 Color
:= _RGB(255, 0, 0);
2893 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2895 Color
:= _RGB(255, 255, 255);
2900 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2902 Color
:= _RGB(255, 0, 0);
2907 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2909 Color
:= _RGB(255, 255, 255);
2912 _y
:= gScreenHeight
- 128;
2915 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2917 Color
:= _RGB(255, 0, 0);
2922 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2924 Color
:= _RGB(255, 255, 255);
2927 _y
:= _y
+GetHeight();
2929 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2931 Color
:= _RGB(255, 255, 255);
2934 _y
:= _y
+GetHeight();
2936 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2938 Color
:= _RGB(255, 255, 255);
2941 _y
:= gScreenHeight
- 32;
2943 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2945 Color
:= _RGB(255, 0, 0);
2946 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2949 g_GUI_AddWindow(Menu
);
2951 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2952 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2953 g_GUI_AddWindow(Menu
);
2955 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2956 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2958 Name
:= 'mmGameSingleMenu';
2959 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2960 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2961 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2962 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2963 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2964 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2966 Menu
.DefControl
:= 'mmGameSingleMenu';
2967 Menu
.MainWindow
:= True;
2968 Menu
.OnClose
:= ProcGMClose
;
2969 Menu
.OnShow
:= ProcGMShow
;
2970 g_GUI_AddWindow(Menu
);
2972 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2973 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2977 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2981 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2983 Name
:= 'mmGameCustomMenu';
2984 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2985 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2986 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2987 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2988 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2989 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2990 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2992 Menu
.DefControl
:= 'mmGameCustomMenu';
2993 Menu
.MainWindow
:= True;
2994 Menu
.OnClose
:= ProcGMClose
;
2995 Menu
.OnShow
:= ProcGMShow
;
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= TGUIWindow
.Create('GameServerMenu');
2999 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3001 Name
:= 'mmGameServerMenu';
3002 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3003 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3004 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3005 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3006 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3008 Menu
.DefControl
:= 'mmGameServerMenu';
3009 Menu
.MainWindow
:= True;
3010 Menu
.OnClose
:= ProcGMClose
;
3011 Menu
.OnShow
:= ProcGMShow
;
3012 g_GUI_AddWindow(Menu
);
3014 Menu
:= TGUIWindow
.Create('GameClientMenu');
3015 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3017 Name
:= 'mmGameClientMenu';
3018 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3019 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3020 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3022 Menu
.DefControl
:= 'mmGameClientMenu';
3023 Menu
.MainWindow
:= True;
3024 Menu
.OnClose
:= ProcGMClose
;
3025 Menu
.OnShow
:= ProcGMShow
;
3026 g_GUI_AddWindow(Menu
);
3028 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3029 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3031 Name
:= 'mClientPasswordMenu';
3032 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3040 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3043 Menu
.DefControl
:= 'mClientPasswordMenu';
3044 g_GUI_AddWindow(Menu
);
3046 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3047 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3049 Name
:= 'mGameSetGameMenu';
3050 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3052 Name
:= 'swTeamDamage';
3053 AddItem(_lc
[I_MENU_YES
]);
3054 AddItem(_lc
[I_MENU_NO
]);
3057 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3059 Name
:= 'edTimeLimit';
3064 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3066 Name
:= 'edGoalLimit';
3071 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3073 Name
:= 'edMaxLives';
3078 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3081 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3082 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3083 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3089 Menu
.DefControl
:= 'mGameSetGameMenu';
3090 Menu
.OnClose
:= ProcApplyGameSet
;
3091 g_GUI_AddWindow(Menu
);
3093 Menu
:= TGUIWindow
.Create('TeamMenu');
3094 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3096 Name
:= 'mmTeamMenu';
3097 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3098 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3099 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3100 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3101 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3103 Menu
.DefControl
:= 'mmTeamMenu';
3104 Menu
.OnShow
:= ProcChangePlayers
;
3105 g_GUI_AddWindow(Menu
);
3108 procedure g_Menu_Show_SaveMenu();
3110 if g_Game_IsTestMap
then
3112 if gGameSettings
.GameType
= GT_SINGLE
then
3113 g_GUI_ShowWindow('GameSingleMenu')
3116 if g_Game_IsClient
then
3119 if g_Game_IsNet
then
3122 g_GUI_ShowWindow('GameCustomMenu');
3124 g_GUI_ShowWindow('SaveMenu');
3125 g_Sound_PlayEx('MENU_OPEN');
3128 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3130 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3131 if gGameSettings
.GameType
= GT_SINGLE
then
3133 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3137 if g_Game_IsClient
then exit
;
3138 if g_Game_IsNet
then exit
;
3139 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3141 g_GUI_ShowWindow('LoadMenu');
3142 g_Sound_PlayEx('MENU_OPEN');
3145 procedure g_Menu_Show_GameSetGame();
3147 if gGameSettings
.GameType
= GT_SINGLE
then
3148 g_GUI_ShowWindow('GameSingleMenu')
3151 if g_Game_IsClient
then
3154 if g_Game_IsNet
then
3155 g_GUI_ShowWindow('GameServerMenu')
3157 g_GUI_ShowWindow('GameCustomMenu');
3160 g_GUI_ShowWindow('GameSetGameMenu');
3161 g_Sound_PlayEx('MENU_OPEN');
3164 procedure g_Menu_Show_OptionsVideo();
3166 if gGameSettings
.GameType
= GT_SINGLE
then
3167 g_GUI_ShowWindow('GameSingleMenu')
3170 if g_Game_IsClient
then
3171 g_GUI_ShowWindow('GameClientMenu')
3173 if g_Game_IsNet
then
3174 g_GUI_ShowWindow('GameServerMenu')
3176 g_GUI_ShowWindow('GameCustomMenu');
3179 g_GUI_ShowWindow('OptionsMenu');
3180 g_GUI_ShowWindow('OptionsVideoMenu');
3181 g_Sound_PlayEx('MENU_OPEN');
3184 procedure g_Menu_Show_OptionsSound();
3186 if gGameSettings
.GameType
= GT_SINGLE
then
3187 g_GUI_ShowWindow('GameSingleMenu')
3190 if g_Game_IsClient
then
3191 g_GUI_ShowWindow('GameClientMenu')
3193 if g_Game_IsNet
then
3194 g_GUI_ShowWindow('GameServerMenu')
3196 g_GUI_ShowWindow('GameCustomMenu');
3199 g_GUI_ShowWindow('OptionsMenu');
3200 g_GUI_ShowWindow('OptionsSoundMenu');
3201 g_Sound_PlayEx('MENU_OPEN');
3204 procedure g_Menu_Show_EndGameMenu();
3206 g_GUI_ShowWindow('EndGameMenu');
3207 g_Sound_PlayEx('MENU_OPEN');
3210 procedure g_Menu_Show_QuitGameMenu();
3212 g_GUI_ShowWindow('ExitMenu');
3213 g_Sound_PlayEx('MENU_OPEN');
3216 procedure g_Menu_Init();
3223 procedure g_Menu_Free();
3227 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3232 procedure g_Menu_Reset();
3236 g_GUI_SaveMenuPos();
3237 ex
:= g_GUI_Destroy();
3241 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3246 g_Game_SetDebugMode();
3248 g_GUI_LoadMenuPos();