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
, g_touch
,
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('scScaleFactor')).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 if g_touch_enabled
then
263 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
264 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
265 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
266 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
267 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
270 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
272 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
273 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
274 TEAM_RED
, TEAM_BLUE
);
276 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
278 gPlayer1Settings
.Model
:= Model
.Name
;
279 gPlayer1Settings
.Color
:= Model
.Color
;
282 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
284 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
285 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
286 TEAM_RED
, TEAM_BLUE
);
287 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
289 gPlayer2Settings
.Model
:= Model
.Name
;
290 gPlayer2Settings
.Color
:= Model
.Color
;
293 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
294 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
296 if g_Game_IsServer
then
298 if gPlayer1
<> nil then
300 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
301 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
302 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
303 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
305 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
308 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
311 if gPlayer2
<> nil then
313 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
314 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
315 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
316 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
318 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
323 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
325 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
328 procedure ReadOptions();
333 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
335 with TGUISwitch(menu
.GetControl('swBPP')) do
341 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
342 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
344 with TGUISwitch(menu
.GetControl('swVSync')) do
345 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
347 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
348 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
350 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
352 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
353 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
354 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
356 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
357 if gMuteWhenInactive
then
362 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
364 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
365 if gSoundEffectsDF
then
370 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
371 if gUseChatSounds
then
376 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
377 with menu
, gGameControls
.P1Control
do
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
397 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
398 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
403 with menu
, gGameControls
.P1Control
do
405 for i
:= WP_FIRST
to WP_LAST
do
407 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
408 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
412 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
413 with menu
, gGameControls
.P2Control
do
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
416 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
418 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
421 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
422 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
423 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
424 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
438 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
439 with menu
, gGameControls
.P2Control
do
441 for i
:= WP_FIRST
to WP_LAST
do
443 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
444 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
448 if e_JoysticksAvailable
> 0 then
450 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
453 for i
:= 0 to e_JoysticksAvailable
-1 do
454 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
458 if g_touch_enabled
then
460 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
461 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
462 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
463 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
464 with TGUISwitch(menu
.GetControl('swTouchFire')) do
465 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
466 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
469 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
470 with menu
, gGameControls
.GameControls
do
472 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
473 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
474 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
475 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
478 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
480 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
481 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
482 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
483 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
484 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
486 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
489 with TGUISwitch(menu
.GetControl('swBloodType')) do
490 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
492 with TGUISwitch(menu
.GetControl('swCorpseType')) do
493 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
495 with TGUISwitch(menu
.GetControl('swGibsType')) do
496 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
498 with TGUISwitch(menu
.GetControl('swGibsCount')) do
507 with TGUISwitch(menu
.GetControl('swBackGround')) do
508 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
510 with TGUISwitch(menu
.GetControl('swMessages')) do
511 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
513 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
514 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
516 with TGUISwitch(menu
.GetControl('swChatBubble')) do
517 ItemIndex
:= gChatBubble
;
519 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
521 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
523 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
524 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
526 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
527 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
529 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
530 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
531 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
533 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
535 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
536 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
538 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
539 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
541 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
542 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
543 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
545 ProcSelectModel(nil);
548 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
550 // don't turn off monsters in DM
552 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
553 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
554 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
556 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
559 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
560 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
561 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
562 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
566 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
568 // don't turn off monsters in DM
570 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
571 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
572 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
574 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
577 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
578 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
579 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
580 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
584 procedure ProcStartCustomGame();
590 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
592 Map
:= TGUILabel(GetControl('lbMap')).Text;
595 if not isWadPath(Map
) then
598 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
599 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
600 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
601 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
602 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
604 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
605 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
606 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
607 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
610 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
612 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
614 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
616 Options
:= Options
or GAME_OPTION_MONSTERS
;
617 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
619 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
621 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
622 gcBotsVS
:= 'Monsters';
625 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
626 gcBotsVS
:= 'Everybody';
629 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
630 gcBotsVS
:= 'Players';
637 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
639 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
640 gcMaxLives
, Options
, gcPlayers
);
644 procedure ProcStartNetGame();
650 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
652 Map
:= TGUILabel(GetControl('lbMap')).Text;
655 if not isWadPath(Map
) then
658 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
659 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
660 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
661 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
662 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
663 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
665 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
666 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
667 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
668 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
671 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
673 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
675 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
677 Options
:= Options
or GAME_OPTION_MONSTERS
;
678 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
680 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
682 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
683 gnBotsVS
:= 'Monsters';
686 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
687 gnBotsVS
:= 'Everybody';
690 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
691 gnBotsVS
:= 'Players';
696 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
697 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
698 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
699 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
700 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
703 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
704 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
706 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
707 Options
, gnPlayers
, 0, NetPort
);
710 procedure ProcConnectNetGame();
714 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
716 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
717 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
718 PW
:= TGUIEdit(GetControl('edPW')).Text;
721 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
722 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
725 procedure ProcEnterPassword();
729 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
731 NetClientIP
:= PromptIP
;
732 NetClientPort
:= PromptPort
;
733 PW
:= TGUIEdit(GetControl('edPW')).Text;
736 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
737 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
740 procedure ProcServerlist();
742 if not NetInitDone
then
744 if (not g_Net_Init()) then
746 g_Console_Add('NET: ERROR: Failed to init ENet!');
753 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
755 gState
:= STATE_SLIST
;
756 g_ActiveWindow
:= nil;
758 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
763 slReturnPressed
:= True;
764 if g_Net_Slist_Fetch(slCurrent
) then
766 if slCurrent
= nil then
767 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
770 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
773 procedure ProcStartCampaign();
779 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
781 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
782 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
789 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
792 procedure ProcSelectMap(Sender
: TGUIControl
);
796 wad
, map
, res
: String;
798 win
:= g_GUI_GetWindow('SelectMapMenu');
799 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
801 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
802 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
804 if (wad
= '') or (map
= '') then
805 begin // Ýòî íå êàðòà
806 TGUILabel(GetControl('lbMapName')).Text := '';
807 TGUILabel(GetControl('lbMapAuthor')).Text := '';
808 TGUILabel(GetControl('lbMapSize')).Text := '';
809 TGUIMemo(GetControl('meMapDescription')).SetText('');
810 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
811 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
817 a
:= g_Map_GetMapInfo(res
);
819 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
820 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
821 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
822 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
823 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
824 TGUILabel(win
.GetControl('lbMapScale')).Text :=
825 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
830 procedure ProcSelectWAD(Sender
: TGUIControl
);
835 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
837 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
839 with TGUIListBox(GetControl('lsMapRes')) do
845 list
:= g_Map_GetMapsList(wad
);
859 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
865 win
:= g_GUI_GetWindow('CampaignMenu');
866 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
868 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
872 TGUILabel(GetControl('lbWADName')).Text := '';
873 TGUILabel(GetControl('lbWADAuthor')).Text := '';
874 TGUIMemo(GetControl('meWADDescription')).SetText('');
877 a
:= g_Game_GetMegaWADInfo(wad
);
879 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
880 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
881 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
883 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
887 fn
:= g_ExtractWadName(a
.pic
);
889 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
891 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
896 procedure ProcChangeColor(Sender
: TGUIControl
);
900 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
901 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
902 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
903 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
904 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
905 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
907 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
908 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
909 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
910 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
911 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
912 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
915 procedure ProcSelectModel(Sender
: TGUIControl
);
920 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
921 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
922 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
924 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
925 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
926 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
928 ProcChangeColor(nil);
931 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
943 wad
:= TWADFile
.Create
;
944 if wad
.ReadFile(GameWAD
) then
945 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
950 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
952 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
953 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
954 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
955 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
957 if g_Texture_Get('FONT_STD', ID
) then
958 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
963 if cfglen
<> 0 then FreeMem(cfgdata
);
966 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
972 cfgdata
, fntdata
: Pointer;
973 cfglen
, fntlen
: Integer;
981 wad
:= TWADFile
.Create
;
982 if wad
.ReadFile(GameWAD
) then
984 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
985 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
991 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
992 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
993 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
995 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
996 FontID
:= e_CharFont_Create(spc
);
1000 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1001 if chrwidth
= 0 then Continue
;
1003 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1005 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1011 if cfglen
<> 0 then FreeMem(cfgdata
);
1012 if fntlen
<> 0 then FreeMem(fntdata
);
1015 procedure MenuLoadData();
1017 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1019 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1020 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1021 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1022 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1023 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1024 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1025 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1026 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1027 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1028 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1029 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1030 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1031 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1032 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1033 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1034 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1035 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1036 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1037 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1038 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1039 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1040 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1041 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1042 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1044 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1045 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1046 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1047 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1048 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1049 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1050 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1053 procedure MenuFreeData();
1055 e_CharFont_Remove(gMenuFont
);
1056 e_CharFont_Remove(gMenuSmallFont
);
1058 g_Texture_Delete('MAINMENU_MARKER1');
1059 g_Texture_Delete('MAINMENU_MARKER2');
1060 g_Texture_Delete('SCROLL_LEFT');
1061 g_Texture_Delete('SCROLL_RIGHT');
1062 g_Texture_Delete('SCROLL_MIDDLE');
1063 g_Texture_Delete('SCROLL_MARKER');
1064 g_Texture_Delete('EDIT_LEFT');
1065 g_Texture_Delete('EDIT_RIGHT');
1066 g_Texture_Delete('EDIT_MIDDLE');
1067 g_Texture_Delete('BOX1');
1068 g_Texture_Delete('BOX2');
1069 g_Texture_Delete('BOX3');
1070 g_Texture_Delete('BOX4');
1071 g_Texture_Delete('BOX5');
1072 g_Texture_Delete('BOX6');
1073 g_Texture_Delete('BOX7');
1074 g_Texture_Delete('BOX8');
1075 g_Texture_Delete('BOX9');
1076 g_Texture_Delete('BSCROLL_UP_A');
1077 g_Texture_Delete('BSCROLL_UP_U');
1078 g_Texture_Delete('BSCROLL_DOWN_A');
1079 g_Texture_Delete('BSCROLL_DOWN_U');
1080 g_Texture_Delete('BSCROLL_MIDDLE');
1081 g_Texture_Delete('NOPIC');
1083 g_Sound_Delete('MENU_SELECT');
1084 g_Sound_Delete('MENU_OPEN');
1085 g_Sound_Delete('MENU_CLOSE');
1086 g_Sound_Delete('MENU_CHANGE');
1087 g_Sound_Delete('SCROLL_ADD');
1088 g_Sound_Delete('SCROLL_SUB');
1089 g_Sound_Delete('SOUND_PLAYER_FALL');
1092 procedure ProcAuthorsMenu();
1094 gMusic
.SetByName('MUSIC_INTERMUS');
1098 procedure ProcExitMenuKeyDown (yes
: Boolean);
1101 snd
: TPlayableSound
;
1106 g_Game_StopAllSounds(True);
1107 case (Random(18)) of
1108 0: s
:= 'SOUND_MONSTER_PAIN';
1109 1: s
:= 'SOUND_MONSTER_DIE_3';
1110 2: s
:= 'SOUND_MONSTER_SLOP';
1111 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1112 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1113 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1114 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1115 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1116 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1117 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1118 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1119 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1120 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1121 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1122 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1123 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1124 else s
:= 'SOUND_PLAYER_FALL';
1126 snd
:= TPlayableSound
.Create();
1127 res
:= snd
.SetByName(s
);
1128 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1132 while snd
.IsPlaying() do begin end;
1140 procedure ProcLoadMenu();
1147 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1148 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1149 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1153 procedure ProcSaveMenu();
1161 name
:= g_GetSaveName(a
, valid
);
1162 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1163 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1167 procedure ProcSaveGame(Sender
: TGUIControl
);
1171 if g_Game_IsNet
then Exit
;
1172 if g_Game_IsTestMap
then Exit
;
1173 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1174 g_Game_PauseAllSounds(True);
1175 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1177 g_ActiveWindow
:= nil;
1178 g_Game_Pause(False);
1181 procedure ProcLoadGame(Sender
: TGUIControl
);
1185 if g_Game_IsNet
then Exit
;
1186 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1187 if g_LoadGame(a
) then
1189 g_Game_PauseAllSounds(False)
1191 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1193 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1194 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1195 //g_ActiveWindow := nil;
1199 procedure ProcSingle1Player();
1201 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1204 procedure ProcSingle2Players();
1206 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1209 procedure ProcSelectMapMenu();
1212 wad_lb
: TGUIFileListBox
;
1213 map_lb
: TGUIListBox
;
1216 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1217 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1218 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1220 if wad_lb
.SelectedItem() <> '' then
1221 map
:= map_lb
.SelectedItem()
1225 wad_lb
.UpdateFileList();
1228 if wad_lb
.SelectedItem() <> '' then
1231 map_lb
.SelectItem(map
);
1233 if map_lb
.SelectedItem() <> '' then
1237 g_GUI_ShowWindow('SelectMapMenu');
1240 procedure ProcSelectCampaignMenu();
1243 wad_lb
: TGUIFileListBox
;
1245 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1246 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1248 wad_lb
.UpdateFileList();
1250 if wad_lb
.SelectedItem() <> '' then
1251 ProcSelectCampaignWAD(nil);
1254 procedure ProcSetMap();
1256 wad
, map
, res
: String;
1258 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1260 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1261 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1264 if (wad
= '') or (map
= '') then
1267 res
:= wad
+':\'+map
;
1269 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1270 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1273 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1277 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1279 g_Sound_SetupAllVolumes(
1280 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1281 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1285 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1289 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1290 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
1293 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1297 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1298 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1299 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1300 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1303 procedure ProcOptionsPlayersMIMenu();
1308 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1310 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1312 if a
= '' then Exit
;
1314 b
:= g_PlayerModel_GetInfo(a
);
1316 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1318 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1319 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1320 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1322 if b
.HaveWeapon
then
1323 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1325 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1328 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1331 procedure ProcOptionsPlayersAnim();
1335 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1340 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1343 Model
.GetCurrentAnimation
.Loop
:= True;
1344 Model
.GetCurrentAnimationMask
.Loop
:= True;
1348 procedure ProcOptionsPlayersWeap();
1352 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1357 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1361 procedure ProcOptionsPlayersRot();
1365 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1366 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1368 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1372 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1376 g_Options_SetDefault();
1382 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1384 if yes
then ReadOptions();
1388 procedure ProcAuthorsClose();
1390 gMusic
.SetByName('MUSIC_MENU');
1392 gState
:= STATE_MENU
;
1395 procedure ProcGMClose();
1397 g_Game_InGameMenu(False);
1400 procedure ProcGMShow();
1405 if (gGameSettings
.GameType
= GT_SINGLE
) and
1406 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1407 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1408 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1410 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1411 if g_Game_IsTestMap
then
1412 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1413 TGUIMainMenu(g_ActiveWindow
.GetControl(
1414 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1417 procedure ProcChangePlayers();
1419 TeamGame
, Spectator
, AddTwo
: Boolean;
1420 P1Team
{, P2Team}: Byte;
1421 bP2
: TGUITextButton
;
1423 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1424 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1425 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1426 P1Team
:= TEAM_NONE
;
1427 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1429 //P2Team := TEAM_NONE;
1430 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1432 TGUIMainMenu(g_ActiveWindow
.GetControl(
1433 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1434 TGUIMainMenu(g_ActiveWindow
.GetControl(
1435 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1436 TGUIMainMenu(g_ActiveWindow
.GetControl(
1437 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1439 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1440 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1441 bP2
.Enabled
:= AddTwo
and not Spectator
;
1443 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1445 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1446 if gPlayer2
= nil then
1447 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1449 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1451 TGUIMainMenu(g_ActiveWindow
.GetControl(
1452 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1455 procedure ProcJoinRed();
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_RED
)
1465 if gPlayer1
.Team
<> TEAM_RED
then
1467 gPlayer1
.SwitchTeam
;
1468 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1471 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1476 gPlayer1Settings
.Team
:= TEAM_RED
;
1477 MC_SEND_PlayerSettings
;
1478 if gPlayer1
= nil then
1479 g_Game_AddPlayer(TEAM_RED
);
1481 g_ActiveWindow
:= nil;
1482 g_Game_Pause(False);
1485 procedure ProcJoinBlue();
1487 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1489 if g_Game_IsServer
then
1491 if gPlayer1
= nil then
1492 g_Game_AddPlayer(TEAM_BLUE
)
1495 if gPlayer1
.Team
<> TEAM_BLUE
then
1497 gPlayer1
.SwitchTeam
;
1498 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1501 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1506 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1507 MC_SEND_PlayerSettings
;
1508 if gPlayer1
= nil then
1509 g_Game_AddPlayer(TEAM_BLUE
);
1511 g_ActiveWindow
:= nil;
1512 g_Game_Pause(False);
1515 procedure ProcJoinGame();
1517 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1519 if gPlayer1
= nil then
1521 g_ActiveWindow
:= nil;
1522 g_Game_Pause(False);
1525 procedure ProcSwitchP2();
1527 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1529 if gPlayer1
= nil then
1531 if gPlayer2
= nil then
1534 g_Game_RemovePlayer();
1535 g_ActiveWindow
:= nil;
1536 g_Game_Pause(False);
1539 procedure ProcSpectate();
1541 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1544 g_ActiveWindow
:= nil;
1545 g_Game_Pause(False);
1548 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1550 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1553 procedure ProcEndMenuKeyDown (yes
: Boolean);
1555 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1558 procedure ProcSetRussianLanguage();
1560 if gLanguage
<> LANGUAGE_RUSSIAN
then
1562 gLanguage
:= LANGUAGE_RUSSIAN
;
1563 gLanguageChange
:= True;
1564 gAskLanguage
:= False;
1566 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1568 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1573 procedure ProcSetEnglishLanguage();
1575 if gLanguage
<> LANGUAGE_ENGLISH
then
1577 gLanguage
:= LANGUAGE_ENGLISH
;
1578 gLanguageChange
:= True;
1579 gAskLanguage
:= False;
1581 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1583 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1588 procedure ReadGameSettings();
1592 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1594 with gGameSettings
do
1596 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1597 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1602 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1603 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1604 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1606 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1607 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1608 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1611 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1616 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1618 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1619 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1620 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1621 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1622 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1623 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1624 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1625 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1629 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1630 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1635 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1636 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1641 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1642 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1647 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1648 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1653 procedure ProcApplyGameSet();
1657 stat
: TPlayerStatArray
;
1659 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1661 if not g_Game_IsServer
then Exit
;
1663 with gGameSettings
do
1665 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1667 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1668 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1670 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1673 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1675 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1681 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1683 TimeLimit
:= Max(n
, b
);
1687 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1689 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1696 if GameMode
= GM_DM
then
1698 stat
:= g_Player_GetStats();
1700 for a
:= 0 to High(stat
) do
1701 if stat
[a
].Frags
> b
then
1705 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1707 GoalLimit
:= Max(n
, b
);
1711 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1713 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1714 if n
< 0 then n
:= 0;
1715 if n
> 255 then n
:= 255;
1721 stat
:= g_Player_GetStats();
1723 for a
:= 0 to High(stat
) do
1724 if stat
[a
].Lives
> b
then
1727 MaxLives
:= Max(n
, b
);
1731 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1733 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1736 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1737 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1741 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1742 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1746 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1747 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1753 if g_Game_IsNet
then MH_SEND_GameSettings
;
1756 procedure ProcVideoOptionsRes();
1762 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1764 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1765 IntToStr(gScreenWidth
) +
1766 ' x ' + IntToStr(gScreenHeight
) +
1767 ', ' + IntToStr(gBPP
) + ' bpp';
1769 with TGUIListBox(menu
.GetControl('lsResolution')) do
1771 list
:= GetDisplayModes(gBPP
, SR
);
1782 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1789 procedure ProcApplyVideoOptions();
1792 Fullscreen
: Boolean;
1793 SWidth
, SHeight
: Integer;
1796 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1798 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1799 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1801 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1803 if (SWidth
<> gScreenWidth
) or
1804 (SHeight
<> gScreenHeight
) or
1805 (Fullscreen
<> gFullscreen
) then
1807 gResolutionChange
:= True;
1808 gRC_Width
:= SWidth
;
1809 gRC_Height
:= SHeight
;
1810 gRC_FullScreen
:= Fullscreen
;
1811 gRC_Maximized
:= gWinMaximized
;
1814 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1818 procedure ProcSetFirstRussianLanguage();
1820 gLanguage
:= LANGUAGE_RUSSIAN
;
1821 gLanguageChange
:= True;
1822 gAskLanguage
:= False;
1824 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1827 procedure ProcSetFirstEnglishLanguage();
1829 gLanguage
:= LANGUAGE_ENGLISH
;
1830 gLanguageChange
:= True;
1831 gAskLanguage
:= False;
1833 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1836 procedure ProcRecallAddress();
1838 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1840 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1841 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1845 procedure CreateFirstLanguageMenu();
1849 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1851 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1853 Name
:= 'mmFirstLanguageMenu';
1854 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1855 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1858 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1859 Menu
.MainWindow
:= True;
1860 g_GUI_AddWindow(Menu
);
1863 procedure g_Menu_AskLanguage();
1865 CreateFirstLanguageMenu();
1866 g_GUI_ShowWindow('FirstLanguageMenu');
1869 procedure CreatePlayerOptionsMenu(s
: String);
1874 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1876 a
:= _lc
[I_MENU_PLAYER_1
]
1878 a
:= _lc
[I_MENU_PLAYER_2
];
1879 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1881 Name
:= 'mOptionsPlayers'+s
+'Menu';
1882 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1884 Name
:= 'ed'+s
+'Name';
1888 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1890 Name
:= 'sw'+s
+'Team';
1891 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1892 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1894 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1896 Name
:= 'ls'+s
+'Model';
1898 Items
:= g_PlayerModel_GetNames();
1899 OnChange
:= ProcSelectModel
;
1901 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1903 Name
:= 'sc'+s
+'Red';
1905 OnChange
:= ProcChangeColor
;
1907 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1909 Name
:= 'sc'+s
+'Green';
1911 OnChange
:= ProcChangeColor
;
1913 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1915 Name
:= 'sc'+s
+'Blue';
1917 OnChange
:= ProcChangeColor
;
1920 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1921 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1922 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1923 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1925 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1927 Name
:= 'mv'+s
+'Model';
1928 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1929 Y
:= GetControl('ls'+s
+'Model').Y
;
1932 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1933 g_GUI_AddWindow(Menu
);
1936 procedure CreateAllMenus();
1940 a
, cx
, _y
, i
: Integer;
1943 Menu
:= TGUIWindow
.Create('MainMenu');
1944 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1946 Name
:= 'mmMainMenu';
1947 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1948 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1949 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1950 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1951 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1952 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1954 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1956 Color
:= _RGB(255, 255, 255);
1957 X
:= gScreenWidth
-GetWidth
-8;
1958 Y
:= gScreenHeight
-GetHeight
-8;
1960 Menu
.DefControl
:= 'mmMainMenu';
1961 Menu
.MainWindow
:= True;
1962 g_GUI_AddWindow(Menu
);
1964 Menu
:= TGUIWindow
.Create('NewGameMenu');
1965 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1967 Name
:= 'mmNewGameMenu';
1968 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1969 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1970 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1971 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1973 Menu
.DefControl
:= 'mmNewGameMenu';
1974 g_GUI_AddWindow(Menu
);
1976 Menu
:= TGUIWindow
.Create('NetGameMenu');
1977 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1979 Name
:= 'mmNetGameMenu';
1980 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1981 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1983 Menu
.DefControl
:= 'mmNetGameMenu';
1984 g_GUI_AddWindow(Menu
);
1986 Menu
:= TGUIWindow
.Create('NetServerMenu');
1987 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1989 Name
:= 'mNetServerMenu';
1990 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1992 Name
:= 'edSrvName';
1993 OnlyDigits
:= False;
1996 Text := NetServerName
;
1998 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2000 Name
:= 'edSrvPassword';
2001 OnlyDigits
:= False;
2004 Text := NetPassword
;
2006 with AddEdit(_lc
[I_NET_PORT
]) do
2012 Text := IntToStr(NetPort
);
2014 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2016 Name
:= 'edMaxPlayers';
2020 Text := IntToStr(NetMaxClients
);
2022 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2024 Name
:= 'swUseMaster';
2025 AddItem(_lc
[I_MENU_YES
]);
2026 AddItem(_lc
[I_MENU_NO
]);
2027 if NetUseMaster
then
2033 with AddLabel(_lc
[I_MENU_MAP
]) do
2038 OnClick
:= @ProcSelectMapMenu
;
2040 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2042 Name
:= 'swGameMode';
2043 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2044 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2045 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2046 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2047 case g_Game_TextToMode(gnGameMode
) of
2049 GM_DM
: ItemIndex
:= 0;
2050 GM_TDM
: ItemIndex
:= 1;
2051 GM_CTF
: ItemIndex
:= 2;
2053 GM_COOP
: ItemIndex
:= 3;
2055 OnChange
:= ProcSwitchMonstersNet
;
2057 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2059 Name
:= 'edTimeLimit';
2063 if gnTimeLimit
> 0 then
2064 Text := IntToStr(gnTimeLimit
);
2066 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2068 Name
:= 'edGoalLimit';
2072 if gnGoalLimit
> 0 then
2073 Text := IntToStr(gnGoalLimit
);
2075 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2077 Name
:= 'edMaxLives';
2081 if gnMaxLives
> 0 then
2082 Text := IntToStr(gnMaxLives
);
2084 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2086 Name
:= 'swPlayers';
2087 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2088 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2089 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2090 ItemIndex
:= gnPlayers
;
2092 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2094 Name
:= 'swTeamDamage';
2095 AddItem(_lc
[I_MENU_YES
]);
2096 AddItem(_lc
[I_MENU_NO
]);
2097 if gnTeamDamage
then
2102 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2104 Name
:= 'swEnableExits';
2105 AddItem(_lc
[I_MENU_YES
]);
2106 AddItem(_lc
[I_MENU_NO
]);
2112 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2114 Name
:= 'swWeaponStay';
2115 AddItem(_lc
[I_MENU_YES
]);
2116 AddItem(_lc
[I_MENU_NO
]);
2117 if gnWeaponStay
then
2122 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2124 Name
:= 'swMonsters';
2125 AddItem(_lc
[I_MENU_YES
]);
2126 AddItem(_lc
[I_MENU_NO
]);
2132 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2135 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2136 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2137 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2139 if gnBotsVS
= 'Players' then
2141 if gnBotsVS
= 'Monsters' then
2145 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2149 Menu
.DefControl
:= 'mNetServerMenu';
2150 g_GUI_AddWindow(Menu
);
2152 Menu
:= TGUIWindow
.Create('NetClientMenu');
2153 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2155 Name
:= 'mNetClientMenu';
2157 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2160 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2166 Text := 'localhost';
2168 with AddEdit(_lc
[I_NET_PORT
]) do
2176 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2179 OnlyDigits
:= False;
2186 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2190 Menu
.DefControl
:= 'mNetClientMenu';
2191 g_GUI_AddWindow(Menu
);
2193 Menu
:= TGUIWindow
.Create('LoadMenu');
2194 Menu
.OnShow
:= ProcLoadMenu
;
2195 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2197 Name
:= 'mmLoadMenu';
2202 Name
:= 'edSlot'+IntToStr(a
);
2205 OnEnter
:= ProcLoadGame
;
2208 Menu
.DefControl
:= 'mmLoadMenu';
2209 g_GUI_AddWindow(Menu
);
2211 Menu
:= TGUIWindow
.Create('SaveMenu');
2212 Menu
.OnShow
:= ProcSaveMenu
;
2213 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2215 Name
:= 'mmSaveMenu';
2220 Name
:= 'edSlot'+IntToStr(a
);
2223 OnChange
:= ProcSaveGame
;
2226 Menu
.DefControl
:= 'mmSaveMenu';
2227 g_GUI_AddWindow(Menu
);
2229 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2230 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2232 Name
:= 'mCustomGameMenu';
2233 with AddLabel(_lc
[I_MENU_MAP
]) do
2238 OnClick
:= @ProcSelectMapMenu
;
2240 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2242 Name
:= 'swGameMode';
2243 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2244 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2245 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2246 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2247 case g_Game_TextToMode(gcGameMode
) of
2249 GM_DM
: ItemIndex
:= 0;
2250 GM_TDM
: ItemIndex
:= 1;
2251 GM_CTF
: ItemIndex
:= 2;
2253 GM_COOP
: ItemIndex
:= 3;
2255 OnChange
:= ProcSwitchMonstersCustom
;
2257 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2259 Name
:= 'edTimeLimit';
2263 if gcTimeLimit
> 0 then
2264 Text := IntToStr(gcTimeLimit
);
2266 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2268 Name
:= 'edGoalLimit';
2272 if gcGoalLimit
> 0 then
2273 Text := IntToStr(gcGoalLimit
);
2275 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2277 Name
:= 'edMaxLives';
2281 if gcMaxLives
> 0 then
2282 Text := IntToStr(gcMaxLives
);
2284 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2286 Name
:= 'swPlayers';
2287 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2288 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2289 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2290 ItemIndex
:= gcPlayers
;
2292 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2294 Name
:= 'swTeamDamage';
2295 AddItem(_lc
[I_MENU_YES
]);
2296 AddItem(_lc
[I_MENU_NO
]);
2297 if gcTeamDamage
then
2302 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2304 Name
:= 'swEnableExits';
2305 AddItem(_lc
[I_MENU_YES
]);
2306 AddItem(_lc
[I_MENU_NO
]);
2312 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2314 Name
:= 'swWeaponStay';
2315 AddItem(_lc
[I_MENU_YES
]);
2316 AddItem(_lc
[I_MENU_NO
]);
2317 if gcWeaponStay
then
2322 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2324 Name
:= 'swMonsters';
2325 AddItem(_lc
[I_MENU_YES
]);
2326 AddItem(_lc
[I_MENU_NO
]);
2332 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2335 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2336 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2337 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2339 if gcBotsVS
= 'Players' then
2341 if gcBotsVS
= 'Monsters' then
2345 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2349 Menu
.DefControl
:= 'mCustomGameMenu';
2350 g_GUI_AddWindow(Menu
);
2352 Menu
:= TGUIWindow
.Create('CampaignMenu');
2353 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2355 Name
:= 'mCampaignMenu';
2364 with AddFileList('', 15, 4) do
2367 OnChange
:= ProcSelectCampaignWAD
;
2371 FileMask
:= '*.wad|*.pk3|*.zip';
2372 SetBase(MapsDir
+'megawads/');
2375 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2377 Name
:= 'lbWADName';
2381 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2383 Name
:= 'lbWADAuthor';
2387 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2388 with AddMemo('', 15, 3) do
2390 Name
:= 'meWADDescription';
2391 Color
:= MENU_ITEMSCTRL_COLOR
;
2393 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2395 Name
:= 'swPlayers';
2396 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2397 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2400 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2404 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2406 Name
:= 'mpWADImage';
2407 DefaultRes
:= 'NOPIC';
2408 X
:= GetControl('lsWAD').X
+4;
2409 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2412 Menu
.DefControl
:= 'mCampaignMenu';
2413 g_GUI_AddWindow(Menu
);
2415 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2416 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2418 Name
:= 'mSelectMapMenu';
2419 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2422 OnChange
:= ProcSelectWAD
;
2426 FileMask
:= '*.wad|*.pk3|*.zip';
2429 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2433 OnChange
:= ProcSelectMap
;
2436 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2438 Name
:= 'lbMapName';
2442 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2444 Name
:= 'lbMapAuthor';
2448 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2450 Name
:= 'lbMapSize';
2454 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2456 Name
:= 'meMapDescription';
2461 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2463 Name
:= 'mpMapPreview';
2464 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2465 Y
:= GetControl('lsMapWAD').Y
;
2467 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2469 Name
:= 'lbMapScale';
2472 Color
:= MENU_ITEMSCTRL_COLOR
;
2473 X
:= GetControl('lsMapWAD').X
+
2474 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2475 2 + MAPPREVIEW_WIDTH
*4;
2476 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2479 Menu
.OnClose
:= ProcSetMap
;
2480 Menu
.DefControl
:= 'mSelectMapMenu';
2481 g_GUI_AddWindow(Menu
);
2483 Menu
:= TGUIWindow
.Create('OptionsMenu');
2484 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2486 Name
:= 'mmOptionsMenu';
2487 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2488 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2489 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2490 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2491 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2492 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2494 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2495 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2497 Menu
.OnClose
:= ProcApplyOptions
;
2498 Menu
.DefControl
:= 'mmOptionsMenu';
2499 g_GUI_AddWindow(Menu
);
2501 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2502 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2503 g_GUI_AddWindow(Menu
);
2505 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2506 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2508 Name
:= 'mOptionsVideoMenu';
2509 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2510 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2516 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2519 AddItem(_lc
[I_MENU_YES
]);
2520 AddItem(_lc
[I_MENU_NO
]);
2522 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2524 Name
:= 'swTextureFilter';
2525 AddItem(_lc
[I_MENU_YES
]);
2526 AddItem(_lc
[I_MENU_NO
]);
2528 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2530 Name
:= 'swLegacyNPOT';
2531 AddItem(_lc
[I_MENU_NO
]);
2532 AddItem(_lc
[I_MENU_YES
]);
2535 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2538 Menu
.DefControl
:= 'mOptionsVideoMenu';
2539 g_GUI_AddWindow(Menu
);
2541 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2542 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2544 Name
:= 'mOptionsVideoResMenu';
2545 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2547 Name
:= 'lbCurrentRes';
2551 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2553 Name
:= 'lsResolution';
2556 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2558 Name
:= 'swFullScreen';
2559 AddItem(_lc
[I_MENU_YES
]);
2560 AddItem(_lc
[I_MENU_NO
]);
2563 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2566 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2567 g_GUI_AddWindow(Menu
);
2569 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2570 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2572 Name
:= 'mOptionsSoundMenu';
2573 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2575 Name
:= 'scMusicLevel';
2577 OnChange
:= ProcChangeSoundSettings
;
2579 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2581 Name
:= 'scSoundLevel';
2583 OnChange
:= ProcChangeSoundSettings
;
2585 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2587 Name
:= 'scMaxSimSounds';
2590 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2592 Name
:= 'swAnnouncer';
2593 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2594 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2595 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2596 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2598 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2599 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2601 Name
:= 'swSoundEffects';
2602 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2603 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2605 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2606 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2608 Name
:= 'swChatSpeech';
2609 AddItem(_lc
[I_MENU_YES
]);
2610 AddItem(_lc
[I_MENU_NO
]);
2612 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2614 Name
:= 'swInactiveSounds';
2615 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2616 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2620 Menu
.DefControl
:= 'mOptionsSoundMenu';
2621 g_GUI_AddWindow(Menu
);
2623 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2624 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2626 Name
:= 'mOptionsGameMenu';
2627 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2629 Name
:= 'scParticlesCount';
2632 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2634 Name
:= 'swBloodCount';
2635 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2636 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2637 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2638 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2639 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2641 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2643 Name
:= 'scShellsMax';
2646 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2648 Name
:= 'scGibsMax';
2651 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2653 Name
:= 'scCorpsesMax';
2656 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2658 Name
:= 'swGibsCount';
2659 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2660 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2661 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2662 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2663 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2665 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2667 Name
:= 'swCorpseType';
2668 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2669 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2671 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2673 Name
:= 'swGibsType';
2674 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2675 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2677 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2679 Name
:= 'swBloodType';
2680 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2681 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2683 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2685 Name
:= 'swScreenFlash';
2686 AddItem(_lc
[I_MENU_NO
]);
2687 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2688 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2690 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2692 Name
:= 'swBackground';
2693 AddItem(_lc
[I_MENU_YES
]);
2694 AddItem(_lc
[I_MENU_NO
]);
2696 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2698 Name
:= 'swMessages';
2699 AddItem(_lc
[I_MENU_YES
]);
2700 AddItem(_lc
[I_MENU_NO
]);
2702 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2704 Name
:= 'swRevertPlayers';
2705 AddItem(_lc
[I_MENU_YES
]);
2706 AddItem(_lc
[I_MENU_NO
]);
2708 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2710 Name
:= 'swChatBubble';
2711 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2712 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2713 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2714 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2715 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2717 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2719 Name
:= 'scScaleFactor';
2721 OnChange
:= ProcChangeGameSettings
;
2725 Menu
.DefControl
:= 'mOptionsGameMenu';
2726 g_GUI_AddWindow(Menu
);
2728 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2729 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2731 Name
:= 'mOptionsControlsMenu';
2732 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2733 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2734 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2735 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2736 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2738 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2739 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2740 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2741 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2742 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2743 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2744 if e_JoysticksAvailable
<> 0 then
2747 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2749 if g_touch_enabled
then
2752 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2755 Menu
.DefControl
:= 'mOptionsControlsMenu';
2756 g_GUI_AddWindow(Menu
);
2758 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2759 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2761 Name
:= 'mOptionsControlsP1Menu';
2762 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2763 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2764 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2765 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2766 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2767 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2768 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2769 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2770 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2771 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2773 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2774 g_GUI_AddWindow(Menu
);
2776 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2777 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2779 Name
:= 'mOptionsControlsP1MenuWeapons';
2780 for i
:= WP_FIRST
to WP_LAST
do
2781 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2782 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2784 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2785 g_GUI_AddWindow(Menu
);
2787 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2788 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2790 Name
:= 'mOptionsControlsP2Menu';
2791 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2792 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2793 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2794 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2795 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2796 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2797 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2798 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2799 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2800 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2802 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2803 g_GUI_AddWindow(Menu
);
2805 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2806 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2808 Name
:= 'mOptionsControlsP2MenuWeapons';
2809 for i
:= WP_FIRST
to WP_LAST
do
2810 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2811 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2813 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2814 g_GUI_AddWindow(Menu
);
2816 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2817 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2819 Name
:= 'mOptionsControlsJoystickMenu';
2820 for i
:= 0 to e_JoysticksAvailable
-1 do
2821 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2823 Name
:= 'scDeadzone' + IntToStr(i
);
2827 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2828 g_GUI_AddWindow(Menu
);
2830 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2831 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2833 Name
:= 'mOptionsControlsTouchMenu';
2834 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2836 Name
:= 'swTouchAlt';
2837 AddItem(_lc
[I_MENU_NO
]);
2838 AddItem(_lc
[I_MENU_YES
]);
2839 OnChange
:= ProcChangeTouchSettings
;
2841 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2843 Name
:= 'scTouchSize';
2845 OnChange
:= ProcChangeTouchSettings
;
2847 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2849 Name
:= 'swTouchFire';
2850 AddItem(_lc
[I_MENU_NO
]);
2851 AddItem(_lc
[I_MENU_YES
]);
2853 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2855 Name
:= 'scTouchOffset';
2857 OnChange
:= ProcChangeTouchSettings
;
2860 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2861 g_GUI_AddWindow(Menu
);
2863 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2864 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2866 Name
:= 'mOptionsPlayersMenu';
2867 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2868 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2870 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2871 g_GUI_AddWindow(Menu
);
2873 CreatePlayerOptionsMenu('P1');
2874 CreatePlayerOptionsMenu('P2');
2876 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2877 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2879 Name
:= 'mOptionsPlayersMIMenu';
2880 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2885 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2890 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2892 Name
:= 'meComment';
2895 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2896 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2899 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2903 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2909 Name
:= 'mOptionsLanguageMenu';
2910 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2911 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2914 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2918 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2919 g_GUI_AddWindow(Menu
);
2921 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2922 Menu
.BackTexture
:= 'INTER';
2923 Menu
.OnClose
:= ProcAuthorsClose
;
2927 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2929 Color
:= _RGB(255, 0, 0);
2930 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2932 _y
:= _y
+GetHeight();
2934 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2936 Color
:= _RGB(255, 0, 0);
2937 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2939 _y
:= _y
+GetHeight()+32;
2941 // ×òî äåëàë: Êòî äåëàë
2942 cx
:= gScreenWidth
div 2 - 320 + 64;
2943 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2945 Color
:= _RGB(255, 0, 0);
2950 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2952 Color
:= _RGB(255, 255, 255);
2957 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2959 Color
:= _RGB(255, 0, 0);
2964 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2966 Color
:= _RGB(255, 255, 255);
2971 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2973 Color
:= _RGB(255, 255, 255);
2978 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2980 Color
:= _RGB(255, 0, 0);
2985 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2987 Color
:= _RGB(255, 255, 255);
2992 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2994 Color
:= _RGB(255, 0, 0);
2999 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3001 Color
:= _RGB(255, 255, 255);
3004 _y
:= gScreenHeight
- 128;
3007 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3009 Color
:= _RGB(255, 0, 0);
3014 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3016 Color
:= _RGB(255, 255, 255);
3019 _y
:= _y
+GetHeight();
3021 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3023 Color
:= _RGB(255, 255, 255);
3026 _y
:= _y
+GetHeight();
3028 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3030 Color
:= _RGB(255, 255, 255);
3033 _y
:= gScreenHeight
- 32;
3035 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3037 Color
:= _RGB(255, 0, 0);
3038 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3041 g_GUI_AddWindow(Menu
);
3043 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3044 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3045 g_GUI_AddWindow(Menu
);
3047 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3048 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3050 Name
:= 'mmGameSingleMenu';
3051 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3052 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3053 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3054 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3055 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3056 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3058 Menu
.DefControl
:= 'mmGameSingleMenu';
3059 Menu
.MainWindow
:= True;
3060 Menu
.OnClose
:= ProcGMClose
;
3061 Menu
.OnShow
:= ProcGMShow
;
3062 g_GUI_AddWindow(Menu
);
3064 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3065 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3066 g_GUI_AddWindow(Menu
);
3068 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3069 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3070 g_GUI_AddWindow(Menu
);
3072 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3073 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3075 Name
:= 'mmGameCustomMenu';
3076 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3077 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3078 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3079 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3080 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3081 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3082 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3084 Menu
.DefControl
:= 'mmGameCustomMenu';
3085 Menu
.MainWindow
:= True;
3086 Menu
.OnClose
:= ProcGMClose
;
3087 Menu
.OnShow
:= ProcGMShow
;
3088 g_GUI_AddWindow(Menu
);
3090 Menu
:= TGUIWindow
.Create('GameServerMenu');
3091 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3093 Name
:= 'mmGameServerMenu';
3094 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3095 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3096 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3097 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3098 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3100 Menu
.DefControl
:= 'mmGameServerMenu';
3101 Menu
.MainWindow
:= True;
3102 Menu
.OnClose
:= ProcGMClose
;
3103 Menu
.OnShow
:= ProcGMShow
;
3104 g_GUI_AddWindow(Menu
);
3106 Menu
:= TGUIWindow
.Create('GameClientMenu');
3107 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3109 Name
:= 'mmGameClientMenu';
3110 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3111 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3112 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3114 Menu
.DefControl
:= 'mmGameClientMenu';
3115 Menu
.MainWindow
:= True;
3116 Menu
.OnClose
:= ProcGMClose
;
3117 Menu
.OnShow
:= ProcGMShow
;
3118 g_GUI_AddWindow(Menu
);
3120 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3121 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3123 Name
:= 'mClientPasswordMenu';
3124 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3132 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3135 Menu
.DefControl
:= 'mClientPasswordMenu';
3136 g_GUI_AddWindow(Menu
);
3138 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3139 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3141 Name
:= 'mGameSetGameMenu';
3142 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3144 Name
:= 'swTeamDamage';
3145 AddItem(_lc
[I_MENU_YES
]);
3146 AddItem(_lc
[I_MENU_NO
]);
3149 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3151 Name
:= 'edTimeLimit';
3156 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3158 Name
:= 'edGoalLimit';
3163 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3165 Name
:= 'edMaxLives';
3170 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3173 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3174 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3175 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3181 Menu
.DefControl
:= 'mGameSetGameMenu';
3182 Menu
.OnClose
:= ProcApplyGameSet
;
3183 g_GUI_AddWindow(Menu
);
3185 Menu
:= TGUIWindow
.Create('TeamMenu');
3186 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3188 Name
:= 'mmTeamMenu';
3189 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3190 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3191 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3192 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3193 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3195 Menu
.DefControl
:= 'mmTeamMenu';
3196 Menu
.OnShow
:= ProcChangePlayers
;
3197 g_GUI_AddWindow(Menu
);
3200 procedure g_Menu_Show_SaveMenu();
3202 if g_Game_IsTestMap
then
3204 if gGameSettings
.GameType
= GT_SINGLE
then
3205 g_GUI_ShowWindow('GameSingleMenu')
3208 if g_Game_IsClient
then
3211 if g_Game_IsNet
then
3214 g_GUI_ShowWindow('GameCustomMenu');
3216 g_GUI_ShowWindow('SaveMenu');
3217 g_Sound_PlayEx('MENU_OPEN');
3220 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3222 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3223 if gGameSettings
.GameType
= GT_SINGLE
then
3225 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3229 if g_Game_IsClient
then exit
;
3230 if g_Game_IsNet
then exit
;
3231 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3233 g_GUI_ShowWindow('LoadMenu');
3234 g_Sound_PlayEx('MENU_OPEN');
3237 procedure g_Menu_Show_GameSetGame();
3239 if gGameSettings
.GameType
= GT_SINGLE
then
3240 g_GUI_ShowWindow('GameSingleMenu')
3243 if g_Game_IsClient
then
3246 if g_Game_IsNet
then
3247 g_GUI_ShowWindow('GameServerMenu')
3249 g_GUI_ShowWindow('GameCustomMenu');
3252 g_GUI_ShowWindow('GameSetGameMenu');
3253 g_Sound_PlayEx('MENU_OPEN');
3256 procedure g_Menu_Show_OptionsVideo();
3258 if gGameSettings
.GameType
= GT_SINGLE
then
3259 g_GUI_ShowWindow('GameSingleMenu')
3262 if g_Game_IsClient
then
3263 g_GUI_ShowWindow('GameClientMenu')
3265 if g_Game_IsNet
then
3266 g_GUI_ShowWindow('GameServerMenu')
3268 g_GUI_ShowWindow('GameCustomMenu');
3271 g_GUI_ShowWindow('OptionsMenu');
3272 g_GUI_ShowWindow('OptionsVideoMenu');
3273 g_Sound_PlayEx('MENU_OPEN');
3276 procedure g_Menu_Show_OptionsSound();
3278 if gGameSettings
.GameType
= GT_SINGLE
then
3279 g_GUI_ShowWindow('GameSingleMenu')
3282 if g_Game_IsClient
then
3283 g_GUI_ShowWindow('GameClientMenu')
3285 if g_Game_IsNet
then
3286 g_GUI_ShowWindow('GameServerMenu')
3288 g_GUI_ShowWindow('GameCustomMenu');
3291 g_GUI_ShowWindow('OptionsMenu');
3292 g_GUI_ShowWindow('OptionsSoundMenu');
3293 g_Sound_PlayEx('MENU_OPEN');
3296 procedure g_Menu_Show_EndGameMenu();
3298 g_GUI_ShowWindow('EndGameMenu');
3299 g_Sound_PlayEx('MENU_OPEN');
3302 procedure g_Menu_Show_QuitGameMenu();
3304 g_GUI_ShowWindow('ExitMenu');
3305 g_Sound_PlayEx('MENU_OPEN');
3308 procedure g_Menu_Init();
3315 procedure g_Menu_Free();
3319 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3324 procedure g_Menu_Reset();
3328 g_GUI_SaveMenuPos();
3329 ex
:= g_GUI_Destroy();
3333 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3338 g_Game_SetDebugMode();
3340 g_GUI_LoadMenuPos();