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
;
167 g_dbg_scale
:= TGUIScroll(menu
.GetControl('swScaleFactor')).Value
+ 1;
169 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
171 with menu
, gGameControls
.GameControls
do
173 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
174 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
175 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
176 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
179 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
180 with menu
, gGameControls
.P1Control
do
182 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
183 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
184 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
185 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
186 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
187 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
188 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
189 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
190 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
191 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
193 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
194 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
195 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
196 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
197 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
198 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
199 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
200 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
201 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
202 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
205 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
206 with menu
, gGameControls
.P1Control
do
208 for i
:= WP_FIRST
to WP_LAST
do
210 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
211 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
215 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
216 with menu
, gGameControls
.P2Control
do
218 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
219 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
220 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
221 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
222 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
223 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
224 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
225 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
226 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
227 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
229 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
230 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
231 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
232 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
233 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
234 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
235 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
236 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
237 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
238 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
241 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
242 with menu
, gGameControls
.P2Control
do
244 for i
:= WP_FIRST
to WP_LAST
do
246 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
247 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
251 if e_JoysticksAvailable
> 0 then
253 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
256 for i
:= 0 to e_JoysticksAvailable
-1 do
257 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
261 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
263 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
264 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
265 TEAM_RED
, TEAM_BLUE
);
267 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
269 gPlayer1Settings
.Model
:= Model
.Name
;
270 gPlayer1Settings
.Color
:= Model
.Color
;
273 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
275 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
276 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
277 TEAM_RED
, TEAM_BLUE
);
278 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
280 gPlayer2Settings
.Model
:= Model
.Name
;
281 gPlayer2Settings
.Color
:= Model
.Color
;
284 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
285 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
287 if g_Game_IsServer
then
289 if gPlayer1
<> nil then
291 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
292 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
293 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
294 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
296 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
299 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
302 if gPlayer2
<> nil then
304 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
305 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
306 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
307 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
309 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
314 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
316 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
319 procedure ReadOptions();
324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
326 with TGUISwitch(menu
.GetControl('swBPP')) do
332 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
333 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
335 with TGUISwitch(menu
.GetControl('swVSync')) do
336 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
338 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
339 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
341 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
343 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
344 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
345 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
347 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
348 if gMuteWhenInactive
then
353 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
355 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
356 if gSoundEffectsDF
then
361 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
362 if gUseChatSounds
then
367 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
368 with menu
, gGameControls
.P1Control
do
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
374 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
393 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
394 with menu
, gGameControls
.P1Control
do
396 for i
:= WP_FIRST
to WP_LAST
do
398 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
399 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
403 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
404 with menu
, gGameControls
.P2Control
do
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
409 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
410 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
411 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
412 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
413 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
418 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
421 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
422 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
423 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
424 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
429 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
430 with menu
, gGameControls
.P2Control
do
432 for i
:= WP_FIRST
to WP_LAST
do
434 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
435 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
439 if e_JoysticksAvailable
> 0 then
441 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
444 for i
:= 0 to e_JoysticksAvailable
-1 do
445 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
449 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
450 with menu
, gGameControls
.GameControls
do
452 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
453 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
454 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
455 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
458 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
460 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
461 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
462 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
463 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
464 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
466 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
469 with TGUISwitch(menu
.GetControl('swBloodType')) do
470 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
472 with TGUISwitch(menu
.GetControl('swCorpseType')) do
473 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
475 with TGUISwitch(menu
.GetControl('swGibsType')) do
476 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
478 with TGUISwitch(menu
.GetControl('swGibsCount')) do
487 with TGUISwitch(menu
.GetControl('swBackGround')) do
488 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
490 with TGUISwitch(menu
.GetControl('swMessages')) do
491 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
493 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
494 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
496 with TGUISwitch(menu
.GetControl('swChatBubble')) do
497 ItemIndex
:= gChatBubble
;
499 TGUIScroll(menu
.GetControl('swScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
501 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
503 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
504 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
506 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
507 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
509 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
510 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
511 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
515 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
516 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
518 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
519 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
521 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
522 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
523 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
525 ProcSelectModel(nil);
528 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
530 // don't turn off monsters in DM
532 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
533 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
534 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
536 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
539 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
540 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
541 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
542 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
546 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
548 // don't turn off monsters in DM
550 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
551 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
552 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
554 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
557 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
558 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
559 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
560 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
564 procedure ProcStartCustomGame();
570 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
572 Map
:= TGUILabel(GetControl('lbMap')).Text;
575 if not isWadPath(Map
) then
578 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
579 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
580 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
581 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
582 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
584 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
585 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
586 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
587 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
590 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
592 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
594 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
596 Options
:= Options
or GAME_OPTION_MONSTERS
;
597 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
599 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
601 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
602 gcBotsVS
:= 'Monsters';
605 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
606 gcBotsVS
:= 'Everybody';
609 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
610 gcBotsVS
:= 'Players';
617 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
619 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
620 gcMaxLives
, Options
, gcPlayers
);
624 procedure ProcStartNetGame();
630 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
632 Map
:= TGUILabel(GetControl('lbMap')).Text;
635 if not isWadPath(Map
) then
638 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
639 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
640 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
641 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
642 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
643 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
645 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
646 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
647 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
648 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
651 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
653 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
655 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
657 Options
:= Options
or GAME_OPTION_MONSTERS
;
658 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
660 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
662 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
663 gnBotsVS
:= 'Monsters';
666 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
667 gnBotsVS
:= 'Everybody';
670 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
671 gnBotsVS
:= 'Players';
676 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
677 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
678 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
679 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
680 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
683 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
684 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
686 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
687 Options
, gnPlayers
, 0, NetPort
);
690 procedure ProcConnectNetGame();
694 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
696 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
697 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
698 PW
:= TGUIEdit(GetControl('edPW')).Text;
701 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
702 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
705 procedure ProcEnterPassword();
709 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
711 NetClientIP
:= PromptIP
;
712 NetClientPort
:= PromptPort
;
713 PW
:= TGUIEdit(GetControl('edPW')).Text;
716 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
717 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
720 procedure ProcServerlist();
722 if not NetInitDone
then
724 if (not g_Net_Init()) then
726 g_Console_Add('NET: ERROR: Failed to init ENet!');
733 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
735 gState
:= STATE_SLIST
;
736 g_ActiveWindow
:= nil;
738 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
743 slReturnPressed
:= True;
744 if g_Net_Slist_Fetch(slCurrent
) then
746 if slCurrent
= nil then
747 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
750 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
753 procedure ProcStartCampaign();
759 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
761 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
762 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
769 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
772 procedure ProcSelectMap(Sender
: TGUIControl
);
776 wad
, map
, res
: String;
778 win
:= g_GUI_GetWindow('SelectMapMenu');
779 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
781 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
782 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
784 if (wad
= '') or (map
= '') then
785 begin // Ýòî íå êàðòà
786 TGUILabel(GetControl('lbMapName')).Text := '';
787 TGUILabel(GetControl('lbMapAuthor')).Text := '';
788 TGUILabel(GetControl('lbMapSize')).Text := '';
789 TGUIMemo(GetControl('meMapDescription')).SetText('');
790 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
791 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
797 a
:= g_Map_GetMapInfo(res
);
799 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
800 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
801 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
802 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
803 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
804 TGUILabel(win
.GetControl('lbMapScale')).Text :=
805 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
810 procedure ProcSelectWAD(Sender
: TGUIControl
);
815 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
817 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
819 with TGUIListBox(GetControl('lsMapRes')) do
825 list
:= g_Map_GetMapsList(wad
);
839 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
845 win
:= g_GUI_GetWindow('CampaignMenu');
846 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
848 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
852 TGUILabel(GetControl('lbWADName')).Text := '';
853 TGUILabel(GetControl('lbWADAuthor')).Text := '';
854 TGUIMemo(GetControl('meWADDescription')).SetText('');
857 a
:= g_Game_GetMegaWADInfo(wad
);
859 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
860 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
861 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
863 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
867 fn
:= g_ExtractWadName(a
.pic
);
869 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
871 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
876 procedure ProcChangeColor(Sender
: TGUIControl
);
880 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
881 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
882 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
883 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
884 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
885 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
887 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
888 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
889 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
890 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
891 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
892 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
895 procedure ProcSelectModel(Sender
: TGUIControl
);
900 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
901 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
902 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
904 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
905 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
906 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
908 ProcChangeColor(nil);
911 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
923 wad
:= TWADFile
.Create
;
924 if wad
.ReadFile(GameWAD
) then
925 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
930 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
932 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
933 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
934 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
935 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
937 if g_Texture_Get('FONT_STD', ID
) then
938 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
943 if cfglen
<> 0 then FreeMem(cfgdata
);
946 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
952 cfgdata
, fntdata
: Pointer;
953 cfglen
, fntlen
: Integer;
961 wad
:= TWADFile
.Create
;
962 if wad
.ReadFile(GameWAD
) then
964 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
965 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
971 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
972 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
973 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
975 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
976 FontID
:= e_CharFont_Create(spc
);
980 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
981 if chrwidth
= 0 then Continue
;
983 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
985 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
991 if cfglen
<> 0 then FreeMem(cfgdata
);
992 if fntlen
<> 0 then FreeMem(fntdata
);
995 procedure MenuLoadData();
997 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
999 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1000 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1001 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1002 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1003 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1004 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1005 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1006 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1007 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1008 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1009 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1010 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1011 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1012 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1013 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1014 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1015 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1016 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1017 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1018 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1019 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1020 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1021 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1022 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1024 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1025 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1026 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1027 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1028 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1029 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1030 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1033 procedure MenuFreeData();
1035 e_CharFont_Remove(gMenuFont
);
1036 e_CharFont_Remove(gMenuSmallFont
);
1038 g_Texture_Delete('MAINMENU_MARKER1');
1039 g_Texture_Delete('MAINMENU_MARKER2');
1040 g_Texture_Delete('SCROLL_LEFT');
1041 g_Texture_Delete('SCROLL_RIGHT');
1042 g_Texture_Delete('SCROLL_MIDDLE');
1043 g_Texture_Delete('SCROLL_MARKER');
1044 g_Texture_Delete('EDIT_LEFT');
1045 g_Texture_Delete('EDIT_RIGHT');
1046 g_Texture_Delete('EDIT_MIDDLE');
1047 g_Texture_Delete('BOX1');
1048 g_Texture_Delete('BOX2');
1049 g_Texture_Delete('BOX3');
1050 g_Texture_Delete('BOX4');
1051 g_Texture_Delete('BOX5');
1052 g_Texture_Delete('BOX6');
1053 g_Texture_Delete('BOX7');
1054 g_Texture_Delete('BOX8');
1055 g_Texture_Delete('BOX9');
1056 g_Texture_Delete('BSCROLL_UP_A');
1057 g_Texture_Delete('BSCROLL_UP_U');
1058 g_Texture_Delete('BSCROLL_DOWN_A');
1059 g_Texture_Delete('BSCROLL_DOWN_U');
1060 g_Texture_Delete('BSCROLL_MIDDLE');
1061 g_Texture_Delete('NOPIC');
1063 g_Sound_Delete('MENU_SELECT');
1064 g_Sound_Delete('MENU_OPEN');
1065 g_Sound_Delete('MENU_CLOSE');
1066 g_Sound_Delete('MENU_CHANGE');
1067 g_Sound_Delete('SCROLL_ADD');
1068 g_Sound_Delete('SCROLL_SUB');
1069 g_Sound_Delete('SOUND_PLAYER_FALL');
1072 procedure ProcAuthorsMenu();
1074 gMusic
.SetByName('MUSIC_INTERMUS');
1078 procedure ProcExitMenuKeyDown (yes
: Boolean);
1081 snd
: TPlayableSound
;
1086 g_Game_StopAllSounds(True);
1087 case (Random(18)) of
1088 0: s
:= 'SOUND_MONSTER_PAIN';
1089 1: s
:= 'SOUND_MONSTER_DIE_3';
1090 2: s
:= 'SOUND_MONSTER_SLOP';
1091 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1092 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1093 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1094 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1095 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1096 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1097 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1098 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1099 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1100 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1101 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1102 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1103 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1104 else s
:= 'SOUND_PLAYER_FALL';
1106 snd
:= TPlayableSound
.Create();
1107 res
:= snd
.SetByName(s
);
1108 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1112 while snd
.IsPlaying() do begin end;
1120 procedure ProcLoadMenu();
1127 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1128 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1129 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1133 procedure ProcSaveMenu();
1141 name
:= g_GetSaveName(a
, valid
);
1142 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1143 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1147 procedure ProcSaveGame(Sender
: TGUIControl
);
1151 if g_Game_IsNet
then Exit
;
1152 if g_Game_IsTestMap
then Exit
;
1153 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1154 g_Game_PauseAllSounds(True);
1155 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1157 g_ActiveWindow
:= nil;
1158 g_Game_Pause(False);
1161 procedure ProcLoadGame(Sender
: TGUIControl
);
1165 if g_Game_IsNet
then Exit
;
1166 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1167 if g_LoadGame(a
) then
1169 g_Game_PauseAllSounds(False)
1171 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1173 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1174 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1175 //g_ActiveWindow := nil;
1179 procedure ProcSingle1Player();
1181 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1184 procedure ProcSingle2Players();
1186 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1189 procedure ProcSelectMapMenu();
1192 wad_lb
: TGUIFileListBox
;
1193 map_lb
: TGUIListBox
;
1196 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1197 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1198 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1200 if wad_lb
.SelectedItem() <> '' then
1201 map
:= map_lb
.SelectedItem()
1205 wad_lb
.UpdateFileList();
1208 if wad_lb
.SelectedItem() <> '' then
1211 map_lb
.SelectItem(map
);
1213 if map_lb
.SelectedItem() <> '' then
1217 g_GUI_ShowWindow('SelectMapMenu');
1220 procedure ProcSelectCampaignMenu();
1223 wad_lb
: TGUIFileListBox
;
1225 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1226 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1228 wad_lb
.UpdateFileList();
1230 if wad_lb
.SelectedItem() <> '' then
1231 ProcSelectCampaignWAD(nil);
1234 procedure ProcSetMap();
1236 wad
, map
, res
: String;
1238 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1240 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1241 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1244 if (wad
= '') or (map
= '') then
1247 res
:= wad
+':\'+map
;
1249 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1250 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1253 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1257 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1259 g_Sound_SetupAllVolumes(
1260 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1261 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1265 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1269 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1270 g_dbg_scale
:= TGUIScroll(menu
.GetControl('swScaleFactor')).Value
+ 1;
1273 procedure ProcOptionsPlayersMIMenu();
1278 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1280 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1282 if a
= '' then Exit
;
1284 b
:= g_PlayerModel_GetInfo(a
);
1286 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1288 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1289 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1290 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1292 if b
.HaveWeapon
then
1293 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1295 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1298 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1301 procedure ProcOptionsPlayersAnim();
1305 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1310 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1313 Model
.GetCurrentAnimation
.Loop
:= True;
1314 Model
.GetCurrentAnimationMask
.Loop
:= True;
1318 procedure ProcOptionsPlayersWeap();
1322 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1327 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1331 procedure ProcOptionsPlayersRot();
1335 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1336 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1338 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1342 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1346 g_Options_SetDefault();
1352 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1354 if yes
then ReadOptions();
1358 procedure ProcAuthorsClose();
1360 gMusic
.SetByName('MUSIC_MENU');
1362 gState
:= STATE_MENU
;
1365 procedure ProcGMClose();
1367 g_Game_InGameMenu(False);
1370 procedure ProcGMShow();
1375 if (gGameSettings
.GameType
= GT_SINGLE
) and
1376 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1377 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1378 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1380 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1381 if g_Game_IsTestMap
then
1382 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1383 TGUIMainMenu(g_ActiveWindow
.GetControl(
1384 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1387 procedure ProcChangePlayers();
1389 TeamGame
, Spectator
, AddTwo
: Boolean;
1390 P1Team
{, P2Team}: Byte;
1391 bP2
: TGUITextButton
;
1393 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1394 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1395 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1396 P1Team
:= TEAM_NONE
;
1397 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1399 //P2Team := TEAM_NONE;
1400 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1402 TGUIMainMenu(g_ActiveWindow
.GetControl(
1403 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1404 TGUIMainMenu(g_ActiveWindow
.GetControl(
1405 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1406 TGUIMainMenu(g_ActiveWindow
.GetControl(
1407 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1409 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1410 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1411 bP2
.Enabled
:= AddTwo
and not Spectator
;
1413 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1415 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1416 if gPlayer2
= nil then
1417 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1419 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1421 TGUIMainMenu(g_ActiveWindow
.GetControl(
1422 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1425 procedure ProcJoinRed();
1427 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1429 if g_Game_IsServer
then
1431 if gPlayer1
= nil then
1432 g_Game_AddPlayer(TEAM_RED
)
1435 if gPlayer1
.Team
<> TEAM_RED
then
1437 gPlayer1
.SwitchTeam
;
1438 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1441 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1446 gPlayer1Settings
.Team
:= TEAM_RED
;
1447 MC_SEND_PlayerSettings
;
1448 if gPlayer1
= nil then
1449 g_Game_AddPlayer(TEAM_RED
);
1451 g_ActiveWindow
:= nil;
1452 g_Game_Pause(False);
1455 procedure ProcJoinBlue();
1457 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1459 if g_Game_IsServer
then
1461 if gPlayer1
= nil then
1462 g_Game_AddPlayer(TEAM_BLUE
)
1465 if gPlayer1
.Team
<> TEAM_BLUE
then
1467 gPlayer1
.SwitchTeam
;
1468 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1471 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1476 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1477 MC_SEND_PlayerSettings
;
1478 if gPlayer1
= nil then
1479 g_Game_AddPlayer(TEAM_BLUE
);
1481 g_ActiveWindow
:= nil;
1482 g_Game_Pause(False);
1485 procedure ProcJoinGame();
1487 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1489 if gPlayer1
= nil then
1491 g_ActiveWindow
:= nil;
1492 g_Game_Pause(False);
1495 procedure ProcSwitchP2();
1497 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1499 if gPlayer1
= nil then
1501 if gPlayer2
= nil then
1504 g_Game_RemovePlayer();
1505 g_ActiveWindow
:= nil;
1506 g_Game_Pause(False);
1509 procedure ProcSpectate();
1511 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1514 g_ActiveWindow
:= nil;
1515 g_Game_Pause(False);
1518 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1520 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1523 procedure ProcEndMenuKeyDown (yes
: Boolean);
1525 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1528 procedure ProcSetRussianLanguage();
1530 if gLanguage
<> LANGUAGE_RUSSIAN
then
1532 gLanguage
:= LANGUAGE_RUSSIAN
;
1533 gLanguageChange
:= True;
1534 gAskLanguage
:= False;
1536 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1538 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1543 procedure ProcSetEnglishLanguage();
1545 if gLanguage
<> LANGUAGE_ENGLISH
then
1547 gLanguage
:= LANGUAGE_ENGLISH
;
1548 gLanguageChange
:= True;
1549 gAskLanguage
:= False;
1551 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1553 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1558 procedure ReadGameSettings();
1562 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1564 with gGameSettings
do
1566 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1567 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1572 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1573 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1574 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1576 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1577 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1578 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1581 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1586 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1588 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1589 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1590 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1591 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1592 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1593 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1594 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1595 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1599 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1600 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1605 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1606 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1611 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1612 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1617 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1618 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1623 procedure ProcApplyGameSet();
1627 stat
: TPlayerStatArray
;
1629 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1631 if not g_Game_IsServer
then Exit
;
1633 with gGameSettings
do
1635 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1637 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1638 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1640 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1643 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1645 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1651 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1653 TimeLimit
:= Max(n
, b
);
1657 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1659 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1666 if GameMode
= GM_DM
then
1668 stat
:= g_Player_GetStats();
1670 for a
:= 0 to High(stat
) do
1671 if stat
[a
].Frags
> b
then
1675 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1677 GoalLimit
:= Max(n
, b
);
1681 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1683 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1684 if n
< 0 then n
:= 0;
1685 if n
> 255 then n
:= 255;
1691 stat
:= g_Player_GetStats();
1693 for a
:= 0 to High(stat
) do
1694 if stat
[a
].Lives
> b
then
1697 MaxLives
:= Max(n
, b
);
1701 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1703 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1706 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1707 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1711 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1712 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1716 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1717 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1723 if g_Game_IsNet
then MH_SEND_GameSettings
;
1726 procedure ProcVideoOptionsRes();
1732 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1734 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1735 IntToStr(gScreenWidth
) +
1736 ' x ' + IntToStr(gScreenHeight
) +
1737 ', ' + IntToStr(gBPP
) + ' bpp';
1739 with TGUIListBox(menu
.GetControl('lsResolution')) do
1741 list
:= GetDisplayModes(gBPP
, SR
);
1752 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1759 procedure ProcApplyVideoOptions();
1762 Fullscreen
: Boolean;
1763 SWidth
, SHeight
: Integer;
1766 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1768 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1769 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1771 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1773 if (SWidth
<> gScreenWidth
) or
1774 (SHeight
<> gScreenHeight
) or
1775 (Fullscreen
<> gFullscreen
) then
1777 gResolutionChange
:= True;
1778 gRC_Width
:= SWidth
;
1779 gRC_Height
:= SHeight
;
1780 gRC_FullScreen
:= Fullscreen
;
1781 gRC_Maximized
:= gWinMaximized
;
1784 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1788 procedure ProcSetFirstRussianLanguage();
1790 gLanguage
:= LANGUAGE_RUSSIAN
;
1791 gLanguageChange
:= True;
1792 gAskLanguage
:= False;
1794 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1797 procedure ProcSetFirstEnglishLanguage();
1799 gLanguage
:= LANGUAGE_ENGLISH
;
1800 gLanguageChange
:= True;
1801 gAskLanguage
:= False;
1803 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1806 procedure ProcRecallAddress();
1808 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1810 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1811 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1815 procedure CreateFirstLanguageMenu();
1819 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1821 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1823 Name
:= 'mmFirstLanguageMenu';
1824 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1825 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1828 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1829 Menu
.MainWindow
:= True;
1830 g_GUI_AddWindow(Menu
);
1833 procedure g_Menu_AskLanguage();
1835 CreateFirstLanguageMenu();
1836 g_GUI_ShowWindow('FirstLanguageMenu');
1839 procedure CreatePlayerOptionsMenu(s
: String);
1844 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1846 a
:= _lc
[I_MENU_PLAYER_1
]
1848 a
:= _lc
[I_MENU_PLAYER_2
];
1849 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1851 Name
:= 'mOptionsPlayers'+s
+'Menu';
1852 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1854 Name
:= 'ed'+s
+'Name';
1858 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1860 Name
:= 'sw'+s
+'Team';
1861 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1862 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1864 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1866 Name
:= 'ls'+s
+'Model';
1868 Items
:= g_PlayerModel_GetNames();
1869 OnChange
:= ProcSelectModel
;
1871 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1873 Name
:= 'sc'+s
+'Red';
1875 OnChange
:= ProcChangeColor
;
1877 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1879 Name
:= 'sc'+s
+'Green';
1881 OnChange
:= ProcChangeColor
;
1883 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1885 Name
:= 'sc'+s
+'Blue';
1887 OnChange
:= ProcChangeColor
;
1890 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1891 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1892 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1893 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1895 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1897 Name
:= 'mv'+s
+'Model';
1898 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1899 Y
:= GetControl('ls'+s
+'Model').Y
;
1902 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1903 g_GUI_AddWindow(Menu
);
1906 procedure CreateAllMenus();
1910 a
, cx
, _y
, i
: Integer;
1913 Menu
:= TGUIWindow
.Create('MainMenu');
1914 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1916 Name
:= 'mmMainMenu';
1917 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1918 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1919 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1920 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1921 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1922 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1924 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1926 Color
:= _RGB(255, 255, 255);
1927 X
:= gScreenWidth
-GetWidth
-8;
1928 Y
:= gScreenHeight
-GetHeight
-8;
1930 Menu
.DefControl
:= 'mmMainMenu';
1931 Menu
.MainWindow
:= True;
1932 g_GUI_AddWindow(Menu
);
1934 Menu
:= TGUIWindow
.Create('NewGameMenu');
1935 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1937 Name
:= 'mmNewGameMenu';
1938 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1939 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1940 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1941 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1943 Menu
.DefControl
:= 'mmNewGameMenu';
1944 g_GUI_AddWindow(Menu
);
1946 Menu
:= TGUIWindow
.Create('NetGameMenu');
1947 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1949 Name
:= 'mmNetGameMenu';
1950 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1951 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1953 Menu
.DefControl
:= 'mmNetGameMenu';
1954 g_GUI_AddWindow(Menu
);
1956 Menu
:= TGUIWindow
.Create('NetServerMenu');
1957 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1959 Name
:= 'mNetServerMenu';
1960 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1962 Name
:= 'edSrvName';
1963 OnlyDigits
:= False;
1966 Text := NetServerName
;
1968 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1970 Name
:= 'edSrvPassword';
1971 OnlyDigits
:= False;
1974 Text := NetPassword
;
1976 with AddEdit(_lc
[I_NET_PORT
]) do
1982 Text := IntToStr(NetPort
);
1984 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1986 Name
:= 'edMaxPlayers';
1990 Text := IntToStr(NetMaxClients
);
1992 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1994 Name
:= 'swUseMaster';
1995 AddItem(_lc
[I_MENU_YES
]);
1996 AddItem(_lc
[I_MENU_NO
]);
1997 if NetUseMaster
then
2003 with AddLabel(_lc
[I_MENU_MAP
]) do
2008 OnClick
:= @ProcSelectMapMenu
;
2010 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2012 Name
:= 'swGameMode';
2013 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2014 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2015 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2016 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2017 case g_Game_TextToMode(gnGameMode
) of
2019 GM_DM
: ItemIndex
:= 0;
2020 GM_TDM
: ItemIndex
:= 1;
2021 GM_CTF
: ItemIndex
:= 2;
2023 GM_COOP
: ItemIndex
:= 3;
2025 OnChange
:= ProcSwitchMonstersNet
;
2027 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2029 Name
:= 'edTimeLimit';
2033 if gnTimeLimit
> 0 then
2034 Text := IntToStr(gnTimeLimit
);
2036 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2038 Name
:= 'edGoalLimit';
2042 if gnGoalLimit
> 0 then
2043 Text := IntToStr(gnGoalLimit
);
2045 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2047 Name
:= 'edMaxLives';
2051 if gnMaxLives
> 0 then
2052 Text := IntToStr(gnMaxLives
);
2054 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2056 Name
:= 'swPlayers';
2057 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2058 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2059 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2060 ItemIndex
:= gnPlayers
;
2062 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2064 Name
:= 'swTeamDamage';
2065 AddItem(_lc
[I_MENU_YES
]);
2066 AddItem(_lc
[I_MENU_NO
]);
2067 if gnTeamDamage
then
2072 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2074 Name
:= 'swEnableExits';
2075 AddItem(_lc
[I_MENU_YES
]);
2076 AddItem(_lc
[I_MENU_NO
]);
2082 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2084 Name
:= 'swWeaponStay';
2085 AddItem(_lc
[I_MENU_YES
]);
2086 AddItem(_lc
[I_MENU_NO
]);
2087 if gnWeaponStay
then
2092 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2094 Name
:= 'swMonsters';
2095 AddItem(_lc
[I_MENU_YES
]);
2096 AddItem(_lc
[I_MENU_NO
]);
2102 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2105 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2106 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2107 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2109 if gnBotsVS
= 'Players' then
2111 if gnBotsVS
= 'Monsters' then
2115 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2119 Menu
.DefControl
:= 'mNetServerMenu';
2120 g_GUI_AddWindow(Menu
);
2122 Menu
:= TGUIWindow
.Create('NetClientMenu');
2123 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2125 Name
:= 'mNetClientMenu';
2127 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2130 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2136 Text := 'localhost';
2138 with AddEdit(_lc
[I_NET_PORT
]) do
2146 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2149 OnlyDigits
:= False;
2156 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2160 Menu
.DefControl
:= 'mNetClientMenu';
2161 g_GUI_AddWindow(Menu
);
2163 Menu
:= TGUIWindow
.Create('LoadMenu');
2164 Menu
.OnShow
:= ProcLoadMenu
;
2165 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2167 Name
:= 'mmLoadMenu';
2172 Name
:= 'edSlot'+IntToStr(a
);
2175 OnEnter
:= ProcLoadGame
;
2178 Menu
.DefControl
:= 'mmLoadMenu';
2179 g_GUI_AddWindow(Menu
);
2181 Menu
:= TGUIWindow
.Create('SaveMenu');
2182 Menu
.OnShow
:= ProcSaveMenu
;
2183 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2185 Name
:= 'mmSaveMenu';
2190 Name
:= 'edSlot'+IntToStr(a
);
2193 OnChange
:= ProcSaveGame
;
2196 Menu
.DefControl
:= 'mmSaveMenu';
2197 g_GUI_AddWindow(Menu
);
2199 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2200 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2202 Name
:= 'mCustomGameMenu';
2203 with AddLabel(_lc
[I_MENU_MAP
]) do
2208 OnClick
:= @ProcSelectMapMenu
;
2210 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2212 Name
:= 'swGameMode';
2213 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2214 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2215 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2216 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2217 case g_Game_TextToMode(gcGameMode
) of
2219 GM_DM
: ItemIndex
:= 0;
2220 GM_TDM
: ItemIndex
:= 1;
2221 GM_CTF
: ItemIndex
:= 2;
2223 GM_COOP
: ItemIndex
:= 3;
2225 OnChange
:= ProcSwitchMonstersCustom
;
2227 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2229 Name
:= 'edTimeLimit';
2233 if gcTimeLimit
> 0 then
2234 Text := IntToStr(gcTimeLimit
);
2236 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2238 Name
:= 'edGoalLimit';
2242 if gcGoalLimit
> 0 then
2243 Text := IntToStr(gcGoalLimit
);
2245 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2247 Name
:= 'edMaxLives';
2251 if gcMaxLives
> 0 then
2252 Text := IntToStr(gcMaxLives
);
2254 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2256 Name
:= 'swPlayers';
2257 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2258 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2259 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2260 ItemIndex
:= gcPlayers
;
2262 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2264 Name
:= 'swTeamDamage';
2265 AddItem(_lc
[I_MENU_YES
]);
2266 AddItem(_lc
[I_MENU_NO
]);
2267 if gcTeamDamage
then
2272 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2274 Name
:= 'swEnableExits';
2275 AddItem(_lc
[I_MENU_YES
]);
2276 AddItem(_lc
[I_MENU_NO
]);
2282 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2284 Name
:= 'swWeaponStay';
2285 AddItem(_lc
[I_MENU_YES
]);
2286 AddItem(_lc
[I_MENU_NO
]);
2287 if gcWeaponStay
then
2292 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2294 Name
:= 'swMonsters';
2295 AddItem(_lc
[I_MENU_YES
]);
2296 AddItem(_lc
[I_MENU_NO
]);
2302 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2305 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2306 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2307 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2309 if gcBotsVS
= 'Players' then
2311 if gcBotsVS
= 'Monsters' then
2315 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2319 Menu
.DefControl
:= 'mCustomGameMenu';
2320 g_GUI_AddWindow(Menu
);
2322 Menu
:= TGUIWindow
.Create('CampaignMenu');
2323 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2325 Name
:= 'mCampaignMenu';
2334 with AddFileList('', 15, 4) do
2337 OnChange
:= ProcSelectCampaignWAD
;
2341 FileMask
:= '*.wad|*.pk3|*.zip';
2342 SetBase(MapsDir
+'megawads/');
2345 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2347 Name
:= 'lbWADName';
2351 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2353 Name
:= 'lbWADAuthor';
2357 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2358 with AddMemo('', 15, 3) do
2360 Name
:= 'meWADDescription';
2361 Color
:= MENU_ITEMSCTRL_COLOR
;
2363 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2365 Name
:= 'swPlayers';
2366 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2367 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2370 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2374 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2376 Name
:= 'mpWADImage';
2377 DefaultRes
:= 'NOPIC';
2378 X
:= GetControl('lsWAD').X
+4;
2379 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2382 Menu
.DefControl
:= 'mCampaignMenu';
2383 g_GUI_AddWindow(Menu
);
2385 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2386 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2388 Name
:= 'mSelectMapMenu';
2389 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2392 OnChange
:= ProcSelectWAD
;
2396 FileMask
:= '*.wad|*.pk3|*.zip';
2399 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2403 OnChange
:= ProcSelectMap
;
2406 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2408 Name
:= 'lbMapName';
2412 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2414 Name
:= 'lbMapAuthor';
2418 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2420 Name
:= 'lbMapSize';
2424 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2426 Name
:= 'meMapDescription';
2431 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2433 Name
:= 'mpMapPreview';
2434 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2435 Y
:= GetControl('lsMapWAD').Y
;
2437 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2439 Name
:= 'lbMapScale';
2442 Color
:= MENU_ITEMSCTRL_COLOR
;
2443 X
:= GetControl('lsMapWAD').X
+
2444 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2445 2 + MAPPREVIEW_WIDTH
*4;
2446 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2449 Menu
.OnClose
:= ProcSetMap
;
2450 Menu
.DefControl
:= 'mSelectMapMenu';
2451 g_GUI_AddWindow(Menu
);
2453 Menu
:= TGUIWindow
.Create('OptionsMenu');
2454 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2456 Name
:= 'mmOptionsMenu';
2457 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2458 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2459 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2460 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2461 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2462 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2464 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2465 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2467 Menu
.OnClose
:= ProcApplyOptions
;
2468 Menu
.DefControl
:= 'mmOptionsMenu';
2469 g_GUI_AddWindow(Menu
);
2471 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2472 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2473 g_GUI_AddWindow(Menu
);
2475 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2476 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2478 Name
:= 'mOptionsVideoMenu';
2479 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2480 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2486 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2489 AddItem(_lc
[I_MENU_YES
]);
2490 AddItem(_lc
[I_MENU_NO
]);
2492 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2494 Name
:= 'swTextureFilter';
2495 AddItem(_lc
[I_MENU_YES
]);
2496 AddItem(_lc
[I_MENU_NO
]);
2498 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2500 Name
:= 'swLegacyNPOT';
2501 AddItem(_lc
[I_MENU_NO
]);
2502 AddItem(_lc
[I_MENU_YES
]);
2505 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2508 Menu
.DefControl
:= 'mOptionsVideoMenu';
2509 g_GUI_AddWindow(Menu
);
2511 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2512 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2514 Name
:= 'mOptionsVideoResMenu';
2515 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2517 Name
:= 'lbCurrentRes';
2521 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2523 Name
:= 'lsResolution';
2526 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2528 Name
:= 'swFullScreen';
2529 AddItem(_lc
[I_MENU_YES
]);
2530 AddItem(_lc
[I_MENU_NO
]);
2533 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2536 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2537 g_GUI_AddWindow(Menu
);
2539 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2540 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2542 Name
:= 'mOptionsSoundMenu';
2543 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2545 Name
:= 'scMusicLevel';
2547 OnChange
:= ProcChangeSoundSettings
;
2549 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2551 Name
:= 'scSoundLevel';
2553 OnChange
:= ProcChangeSoundSettings
;
2555 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2557 Name
:= 'scMaxSimSounds';
2560 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2562 Name
:= 'swAnnouncer';
2563 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2564 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2565 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2566 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2568 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2569 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2571 Name
:= 'swSoundEffects';
2572 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2573 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2575 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2576 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2578 Name
:= 'swChatSpeech';
2579 AddItem(_lc
[I_MENU_YES
]);
2580 AddItem(_lc
[I_MENU_NO
]);
2582 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2584 Name
:= 'swInactiveSounds';
2585 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2586 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2590 Menu
.DefControl
:= 'mOptionsSoundMenu';
2591 g_GUI_AddWindow(Menu
);
2593 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2594 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2596 Name
:= 'mOptionsGameMenu';
2597 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2599 Name
:= 'scParticlesCount';
2602 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2604 Name
:= 'swBloodCount';
2605 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2606 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2607 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2608 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2609 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2611 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2613 Name
:= 'scShellsMax';
2616 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2618 Name
:= 'scGibsMax';
2621 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2623 Name
:= 'scCorpsesMax';
2626 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2628 Name
:= 'swGibsCount';
2629 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2630 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2631 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2632 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2633 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2635 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2637 Name
:= 'swCorpseType';
2638 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2639 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2641 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2643 Name
:= 'swGibsType';
2644 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2645 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2647 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2649 Name
:= 'swBloodType';
2650 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2651 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2653 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2655 Name
:= 'swScreenFlash';
2656 AddItem(_lc
[I_MENU_NO
]);
2657 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2658 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2660 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2662 Name
:= 'swBackground';
2663 AddItem(_lc
[I_MENU_YES
]);
2664 AddItem(_lc
[I_MENU_NO
]);
2666 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2668 Name
:= 'swMessages';
2669 AddItem(_lc
[I_MENU_YES
]);
2670 AddItem(_lc
[I_MENU_NO
]);
2672 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2674 Name
:= 'swRevertPlayers';
2675 AddItem(_lc
[I_MENU_YES
]);
2676 AddItem(_lc
[I_MENU_NO
]);
2678 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2680 Name
:= 'swChatBubble';
2681 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2682 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2683 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2684 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2685 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2687 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2689 Name
:= 'swScaleFactor';
2691 OnChange
:= ProcChangeGameSettings
;
2695 Menu
.DefControl
:= 'mOptionsGameMenu';
2696 g_GUI_AddWindow(Menu
);
2698 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2699 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2701 Name
:= 'mOptionsControlsMenu';
2702 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2703 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2704 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2705 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2706 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2708 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2709 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2710 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2711 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2712 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2713 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2715 if e_JoysticksAvailable
<> 0 then
2716 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2718 Menu
.DefControl
:= 'mOptionsControlsMenu';
2719 g_GUI_AddWindow(Menu
);
2721 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2722 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2724 Name
:= 'mOptionsControlsP1Menu';
2725 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2726 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2727 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2728 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2729 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2730 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2731 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2732 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2733 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2734 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2736 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2737 g_GUI_AddWindow(Menu
);
2739 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2740 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2742 Name
:= 'mOptionsControlsP1MenuWeapons';
2743 for i
:= WP_FIRST
to WP_LAST
do
2744 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2745 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2747 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2748 g_GUI_AddWindow(Menu
);
2750 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2751 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2753 Name
:= 'mOptionsControlsP2Menu';
2754 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2755 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2756 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2757 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2758 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2759 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2760 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2761 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2762 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2763 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2765 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2766 g_GUI_AddWindow(Menu
);
2768 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2769 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2771 Name
:= 'mOptionsControlsP2MenuWeapons';
2772 for i
:= WP_FIRST
to WP_LAST
do
2773 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2774 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2776 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2777 g_GUI_AddWindow(Menu
);
2779 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2780 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2782 Name
:= 'mOptionsControlsJoystickMenu';
2783 for i
:= 0 to e_JoysticksAvailable
-1 do
2784 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2786 Name
:= 'scDeadzone' + IntToStr(i
);
2790 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2791 g_GUI_AddWindow(Menu
);
2793 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2794 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2796 Name
:= 'mOptionsPlayersMenu';
2797 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2798 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2800 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2801 g_GUI_AddWindow(Menu
);
2803 CreatePlayerOptionsMenu('P1');
2804 CreatePlayerOptionsMenu('P2');
2806 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2807 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2809 Name
:= 'mOptionsPlayersMIMenu';
2810 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2815 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2820 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2822 Name
:= 'meComment';
2825 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2826 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2829 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2833 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2834 g_GUI_AddWindow(Menu
);
2836 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2837 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2839 Name
:= 'mOptionsLanguageMenu';
2840 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2841 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2844 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2845 g_GUI_AddWindow(Menu
);
2847 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2848 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2849 g_GUI_AddWindow(Menu
);
2851 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2852 Menu
.BackTexture
:= 'INTER';
2853 Menu
.OnClose
:= ProcAuthorsClose
;
2857 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2859 Color
:= _RGB(255, 0, 0);
2860 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2862 _y
:= _y
+GetHeight();
2864 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2866 Color
:= _RGB(255, 0, 0);
2867 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2869 _y
:= _y
+GetHeight()+32;
2871 // ×òî äåëàë: Êòî äåëàë
2872 cx
:= gScreenWidth
div 2 - 320 + 64;
2873 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2875 Color
:= _RGB(255, 0, 0);
2880 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2882 Color
:= _RGB(255, 255, 255);
2887 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2889 Color
:= _RGB(255, 0, 0);
2894 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2896 Color
:= _RGB(255, 255, 255);
2901 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2903 Color
:= _RGB(255, 255, 255);
2908 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2910 Color
:= _RGB(255, 0, 0);
2915 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2917 Color
:= _RGB(255, 255, 255);
2922 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2924 Color
:= _RGB(255, 0, 0);
2929 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2931 Color
:= _RGB(255, 255, 255);
2934 _y
:= gScreenHeight
- 128;
2937 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2939 Color
:= _RGB(255, 0, 0);
2944 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2946 Color
:= _RGB(255, 255, 255);
2949 _y
:= _y
+GetHeight();
2951 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2953 Color
:= _RGB(255, 255, 255);
2956 _y
:= _y
+GetHeight();
2958 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2960 Color
:= _RGB(255, 255, 255);
2963 _y
:= gScreenHeight
- 32;
2965 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2967 Color
:= _RGB(255, 0, 0);
2968 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2974 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2978 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2980 Name
:= 'mmGameSingleMenu';
2981 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2982 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2983 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2984 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2985 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2986 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2988 Menu
.DefControl
:= 'mmGameSingleMenu';
2989 Menu
.MainWindow
:= True;
2990 Menu
.OnClose
:= ProcGMClose
;
2991 Menu
.OnShow
:= ProcGMShow
;
2992 g_GUI_AddWindow(Menu
);
2994 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2995 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2999 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3000 g_GUI_AddWindow(Menu
);
3002 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3003 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3005 Name
:= 'mmGameCustomMenu';
3006 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3007 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3008 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3009 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3010 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3011 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3012 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3014 Menu
.DefControl
:= 'mmGameCustomMenu';
3015 Menu
.MainWindow
:= True;
3016 Menu
.OnClose
:= ProcGMClose
;
3017 Menu
.OnShow
:= ProcGMShow
;
3018 g_GUI_AddWindow(Menu
);
3020 Menu
:= TGUIWindow
.Create('GameServerMenu');
3021 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3023 Name
:= 'mmGameServerMenu';
3024 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3025 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3026 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3027 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3028 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3030 Menu
.DefControl
:= 'mmGameServerMenu';
3031 Menu
.MainWindow
:= True;
3032 Menu
.OnClose
:= ProcGMClose
;
3033 Menu
.OnShow
:= ProcGMShow
;
3034 g_GUI_AddWindow(Menu
);
3036 Menu
:= TGUIWindow
.Create('GameClientMenu');
3037 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3039 Name
:= 'mmGameClientMenu';
3040 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3041 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3042 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3044 Menu
.DefControl
:= 'mmGameClientMenu';
3045 Menu
.MainWindow
:= True;
3046 Menu
.OnClose
:= ProcGMClose
;
3047 Menu
.OnShow
:= ProcGMShow
;
3048 g_GUI_AddWindow(Menu
);
3050 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3051 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3053 Name
:= 'mClientPasswordMenu';
3054 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3062 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3065 Menu
.DefControl
:= 'mClientPasswordMenu';
3066 g_GUI_AddWindow(Menu
);
3068 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3069 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3071 Name
:= 'mGameSetGameMenu';
3072 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3074 Name
:= 'swTeamDamage';
3075 AddItem(_lc
[I_MENU_YES
]);
3076 AddItem(_lc
[I_MENU_NO
]);
3079 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3081 Name
:= 'edTimeLimit';
3086 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3088 Name
:= 'edGoalLimit';
3093 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3095 Name
:= 'edMaxLives';
3100 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3103 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3104 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3105 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3111 Menu
.DefControl
:= 'mGameSetGameMenu';
3112 Menu
.OnClose
:= ProcApplyGameSet
;
3113 g_GUI_AddWindow(Menu
);
3115 Menu
:= TGUIWindow
.Create('TeamMenu');
3116 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3118 Name
:= 'mmTeamMenu';
3119 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3120 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3121 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3122 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3123 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3125 Menu
.DefControl
:= 'mmTeamMenu';
3126 Menu
.OnShow
:= ProcChangePlayers
;
3127 g_GUI_AddWindow(Menu
);
3130 procedure g_Menu_Show_SaveMenu();
3132 if g_Game_IsTestMap
then
3134 if gGameSettings
.GameType
= GT_SINGLE
then
3135 g_GUI_ShowWindow('GameSingleMenu')
3138 if g_Game_IsClient
then
3141 if g_Game_IsNet
then
3144 g_GUI_ShowWindow('GameCustomMenu');
3146 g_GUI_ShowWindow('SaveMenu');
3147 g_Sound_PlayEx('MENU_OPEN');
3150 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3152 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3153 if gGameSettings
.GameType
= GT_SINGLE
then
3155 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3159 if g_Game_IsClient
then exit
;
3160 if g_Game_IsNet
then exit
;
3161 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3163 g_GUI_ShowWindow('LoadMenu');
3164 g_Sound_PlayEx('MENU_OPEN');
3167 procedure g_Menu_Show_GameSetGame();
3169 if gGameSettings
.GameType
= GT_SINGLE
then
3170 g_GUI_ShowWindow('GameSingleMenu')
3173 if g_Game_IsClient
then
3176 if g_Game_IsNet
then
3177 g_GUI_ShowWindow('GameServerMenu')
3179 g_GUI_ShowWindow('GameCustomMenu');
3182 g_GUI_ShowWindow('GameSetGameMenu');
3183 g_Sound_PlayEx('MENU_OPEN');
3186 procedure g_Menu_Show_OptionsVideo();
3188 if gGameSettings
.GameType
= GT_SINGLE
then
3189 g_GUI_ShowWindow('GameSingleMenu')
3192 if g_Game_IsClient
then
3193 g_GUI_ShowWindow('GameClientMenu')
3195 if g_Game_IsNet
then
3196 g_GUI_ShowWindow('GameServerMenu')
3198 g_GUI_ShowWindow('GameCustomMenu');
3201 g_GUI_ShowWindow('OptionsMenu');
3202 g_GUI_ShowWindow('OptionsVideoMenu');
3203 g_Sound_PlayEx('MENU_OPEN');
3206 procedure g_Menu_Show_OptionsSound();
3208 if gGameSettings
.GameType
= GT_SINGLE
then
3209 g_GUI_ShowWindow('GameSingleMenu')
3212 if g_Game_IsClient
then
3213 g_GUI_ShowWindow('GameClientMenu')
3215 if g_Game_IsNet
then
3216 g_GUI_ShowWindow('GameServerMenu')
3218 g_GUI_ShowWindow('GameCustomMenu');
3221 g_GUI_ShowWindow('OptionsMenu');
3222 g_GUI_ShowWindow('OptionsSoundMenu');
3223 g_Sound_PlayEx('MENU_OPEN');
3226 procedure g_Menu_Show_EndGameMenu();
3228 g_GUI_ShowWindow('EndGameMenu');
3229 g_Sound_PlayEx('MENU_OPEN');
3232 procedure g_Menu_Show_QuitGameMenu();
3234 g_GUI_ShowWindow('ExitMenu');
3235 g_Sound_PlayEx('MENU_OPEN');
3238 procedure g_Menu_Init();
3245 procedure g_Menu_Free();
3249 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3254 procedure g_Menu_Reset();
3258 g_GUI_SaveMenuPos();
3259 ex
:= g_GUI_Destroy();
3263 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3268 g_Game_SetDebugMode();
3270 g_GUI_LoadMenuPos();