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 SDL_GetNumTouchDevices() > 0 then
263 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
264 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
265 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
266 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
269 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
271 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
272 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
273 TEAM_RED
, TEAM_BLUE
);
275 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
277 gPlayer1Settings
.Model
:= Model
.Name
;
278 gPlayer1Settings
.Color
:= Model
.Color
;
281 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
283 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
284 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
285 TEAM_RED
, TEAM_BLUE
);
286 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
288 gPlayer2Settings
.Model
:= Model
.Name
;
289 gPlayer2Settings
.Color
:= Model
.Color
;
292 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
293 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
295 if g_Game_IsServer
then
297 if gPlayer1
<> nil then
299 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
300 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
301 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
302 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
304 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
307 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
310 if gPlayer2
<> nil then
312 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
313 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
314 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
315 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
317 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
322 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
324 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
327 procedure ReadOptions();
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
334 with TGUISwitch(menu
.GetControl('swBPP')) do
340 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
341 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
343 with TGUISwitch(menu
.GetControl('swVSync')) do
344 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
346 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
347 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
351 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
352 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
353 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
355 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
356 if gMuteWhenInactive
then
361 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
363 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
364 if gSoundEffectsDF
then
369 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
370 if gUseChatSounds
then
375 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
376 with menu
, gGameControls
.P1Control
do
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
381 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
397 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
398 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
401 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
402 with menu
, gGameControls
.P1Control
do
404 for i
:= WP_FIRST
to WP_LAST
do
406 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
407 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
412 with menu
, gGameControls
.P2Control
do
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
416 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
417 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
418 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
419 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
420 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
421 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
422 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
423 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
437 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
438 with menu
, gGameControls
.P2Control
do
440 for i
:= WP_FIRST
to WP_LAST
do
442 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
443 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
447 if e_JoysticksAvailable
> 0 then
449 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
452 for i
:= 0 to e_JoysticksAvailable
-1 do
453 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
457 if SDL_GetNumTouchDevices() > 0 then
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
460 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
461 with TGUISwitch(menu
.GetControl('swTouchFire')) do
462 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
463 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
466 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
467 with menu
, gGameControls
.GameControls
do
469 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
470 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
471 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
472 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
475 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
477 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
478 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
479 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
480 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
481 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
483 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
486 with TGUISwitch(menu
.GetControl('swBloodType')) do
487 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
489 with TGUISwitch(menu
.GetControl('swCorpseType')) do
490 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
492 with TGUISwitch(menu
.GetControl('swGibsType')) do
493 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
495 with TGUISwitch(menu
.GetControl('swGibsCount')) do
504 with TGUISwitch(menu
.GetControl('swBackGround')) do
505 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
507 with TGUISwitch(menu
.GetControl('swMessages')) do
508 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
510 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
511 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
513 with TGUISwitch(menu
.GetControl('swChatBubble')) do
514 ItemIndex
:= gChatBubble
;
516 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
520 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
521 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
523 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
524 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
526 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
527 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
528 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
530 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
532 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
533 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
535 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
536 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
538 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
539 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
540 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
542 ProcSelectModel(nil);
545 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
547 // don't turn off monsters in DM
549 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
550 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
551 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
553 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
556 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
557 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
558 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
559 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
563 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
565 // don't turn off monsters in DM
567 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
568 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
569 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
571 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
574 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
575 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
576 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
577 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
581 procedure ProcStartCustomGame();
587 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
589 Map
:= TGUILabel(GetControl('lbMap')).Text;
592 if not isWadPath(Map
) then
595 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
596 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
597 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
598 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
599 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
601 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
602 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
603 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
604 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
607 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
609 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
611 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
613 Options
:= Options
or GAME_OPTION_MONSTERS
;
614 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
616 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
618 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
619 gcBotsVS
:= 'Monsters';
622 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
623 gcBotsVS
:= 'Everybody';
626 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
627 gcBotsVS
:= 'Players';
634 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
636 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
637 gcMaxLives
, Options
, gcPlayers
);
641 procedure ProcStartNetGame();
647 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
649 Map
:= TGUILabel(GetControl('lbMap')).Text;
652 if not isWadPath(Map
) then
655 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
656 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
657 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
658 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
659 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
660 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
662 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
663 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
664 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
665 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
668 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
670 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
672 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
674 Options
:= Options
or GAME_OPTION_MONSTERS
;
675 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
677 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
679 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
680 gnBotsVS
:= 'Monsters';
683 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
684 gnBotsVS
:= 'Everybody';
687 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
688 gnBotsVS
:= 'Players';
693 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
694 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
695 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
696 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
697 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
700 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
701 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
703 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
704 Options
, gnPlayers
, 0, NetPort
);
707 procedure ProcConnectNetGame();
711 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
713 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
714 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
715 PW
:= TGUIEdit(GetControl('edPW')).Text;
718 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
719 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
722 procedure ProcEnterPassword();
726 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
728 NetClientIP
:= PromptIP
;
729 NetClientPort
:= PromptPort
;
730 PW
:= TGUIEdit(GetControl('edPW')).Text;
733 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
734 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
737 procedure ProcServerlist();
739 if not NetInitDone
then
741 if (not g_Net_Init()) then
743 g_Console_Add('NET: ERROR: Failed to init ENet!');
750 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
752 gState
:= STATE_SLIST
;
753 g_ActiveWindow
:= nil;
755 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
760 slReturnPressed
:= True;
761 if g_Net_Slist_Fetch(slCurrent
) then
763 if slCurrent
= nil then
764 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
767 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
770 procedure ProcStartCampaign();
776 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
778 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
779 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
786 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
789 procedure ProcSelectMap(Sender
: TGUIControl
);
793 wad
, map
, res
: String;
795 win
:= g_GUI_GetWindow('SelectMapMenu');
796 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
798 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
799 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
801 if (wad
= '') or (map
= '') then
802 begin // Ýòî íå êàðòà
803 TGUILabel(GetControl('lbMapName')).Text := '';
804 TGUILabel(GetControl('lbMapAuthor')).Text := '';
805 TGUILabel(GetControl('lbMapSize')).Text := '';
806 TGUIMemo(GetControl('meMapDescription')).SetText('');
807 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
808 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
814 a
:= g_Map_GetMapInfo(res
);
816 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
817 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
818 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
819 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
820 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
821 TGUILabel(win
.GetControl('lbMapScale')).Text :=
822 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
827 procedure ProcSelectWAD(Sender
: TGUIControl
);
832 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
834 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
836 with TGUIListBox(GetControl('lsMapRes')) do
842 list
:= g_Map_GetMapsList(wad
);
856 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
862 win
:= g_GUI_GetWindow('CampaignMenu');
863 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
865 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
869 TGUILabel(GetControl('lbWADName')).Text := '';
870 TGUILabel(GetControl('lbWADAuthor')).Text := '';
871 TGUIMemo(GetControl('meWADDescription')).SetText('');
874 a
:= g_Game_GetMegaWADInfo(wad
);
876 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
877 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
878 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
880 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
884 fn
:= g_ExtractWadName(a
.pic
);
886 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
888 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
893 procedure ProcChangeColor(Sender
: TGUIControl
);
897 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
898 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
899 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
900 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
901 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
902 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
904 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
905 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
906 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
907 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
908 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
909 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
912 procedure ProcSelectModel(Sender
: TGUIControl
);
917 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
918 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
919 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
921 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
922 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
923 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
925 ProcChangeColor(nil);
928 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
940 wad
:= TWADFile
.Create
;
941 if wad
.ReadFile(GameWAD
) then
942 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
947 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
949 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
950 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
951 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
952 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
954 if g_Texture_Get('FONT_STD', ID
) then
955 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
960 if cfglen
<> 0 then FreeMem(cfgdata
);
963 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
969 cfgdata
, fntdata
: Pointer;
970 cfglen
, fntlen
: Integer;
978 wad
:= TWADFile
.Create
;
979 if wad
.ReadFile(GameWAD
) then
981 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
982 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
988 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
989 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
990 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
992 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
993 FontID
:= e_CharFont_Create(spc
);
997 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
998 if chrwidth
= 0 then Continue
;
1000 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1002 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1008 if cfglen
<> 0 then FreeMem(cfgdata
);
1009 if fntlen
<> 0 then FreeMem(fntdata
);
1012 procedure MenuLoadData();
1014 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1016 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1017 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1018 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1019 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1020 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1021 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1022 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1023 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1024 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1025 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1026 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1027 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1028 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1029 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1030 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1031 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1032 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1033 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1034 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1035 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1036 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1037 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1038 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1039 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1041 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1042 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1043 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1044 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1045 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1046 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1047 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1050 procedure MenuFreeData();
1052 e_CharFont_Remove(gMenuFont
);
1053 e_CharFont_Remove(gMenuSmallFont
);
1055 g_Texture_Delete('MAINMENU_MARKER1');
1056 g_Texture_Delete('MAINMENU_MARKER2');
1057 g_Texture_Delete('SCROLL_LEFT');
1058 g_Texture_Delete('SCROLL_RIGHT');
1059 g_Texture_Delete('SCROLL_MIDDLE');
1060 g_Texture_Delete('SCROLL_MARKER');
1061 g_Texture_Delete('EDIT_LEFT');
1062 g_Texture_Delete('EDIT_RIGHT');
1063 g_Texture_Delete('EDIT_MIDDLE');
1064 g_Texture_Delete('BOX1');
1065 g_Texture_Delete('BOX2');
1066 g_Texture_Delete('BOX3');
1067 g_Texture_Delete('BOX4');
1068 g_Texture_Delete('BOX5');
1069 g_Texture_Delete('BOX6');
1070 g_Texture_Delete('BOX7');
1071 g_Texture_Delete('BOX8');
1072 g_Texture_Delete('BOX9');
1073 g_Texture_Delete('BSCROLL_UP_A');
1074 g_Texture_Delete('BSCROLL_UP_U');
1075 g_Texture_Delete('BSCROLL_DOWN_A');
1076 g_Texture_Delete('BSCROLL_DOWN_U');
1077 g_Texture_Delete('BSCROLL_MIDDLE');
1078 g_Texture_Delete('NOPIC');
1080 g_Sound_Delete('MENU_SELECT');
1081 g_Sound_Delete('MENU_OPEN');
1082 g_Sound_Delete('MENU_CLOSE');
1083 g_Sound_Delete('MENU_CHANGE');
1084 g_Sound_Delete('SCROLL_ADD');
1085 g_Sound_Delete('SCROLL_SUB');
1086 g_Sound_Delete('SOUND_PLAYER_FALL');
1089 procedure ProcAuthorsMenu();
1091 gMusic
.SetByName('MUSIC_INTERMUS');
1095 procedure ProcExitMenuKeyDown (yes
: Boolean);
1098 snd
: TPlayableSound
;
1103 g_Game_StopAllSounds(True);
1104 case (Random(18)) of
1105 0: s
:= 'SOUND_MONSTER_PAIN';
1106 1: s
:= 'SOUND_MONSTER_DIE_3';
1107 2: s
:= 'SOUND_MONSTER_SLOP';
1108 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1109 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1110 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1111 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1112 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1113 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1114 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1115 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1116 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1117 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1118 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1119 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1120 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1121 else s
:= 'SOUND_PLAYER_FALL';
1123 snd
:= TPlayableSound
.Create();
1124 res
:= snd
.SetByName(s
);
1125 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1129 while snd
.IsPlaying() do begin end;
1137 procedure ProcLoadMenu();
1144 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1145 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1146 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1150 procedure ProcSaveMenu();
1158 name
:= g_GetSaveName(a
, valid
);
1159 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1160 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1164 procedure ProcSaveGame(Sender
: TGUIControl
);
1168 if g_Game_IsNet
then Exit
;
1169 if g_Game_IsTestMap
then Exit
;
1170 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1171 g_Game_PauseAllSounds(True);
1172 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1174 g_ActiveWindow
:= nil;
1175 g_Game_Pause(False);
1178 procedure ProcLoadGame(Sender
: TGUIControl
);
1182 if g_Game_IsNet
then Exit
;
1183 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1184 if g_LoadGame(a
) then
1186 g_Game_PauseAllSounds(False)
1188 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1190 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1191 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1192 //g_ActiveWindow := nil;
1196 procedure ProcSingle1Player();
1198 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1201 procedure ProcSingle2Players();
1203 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1206 procedure ProcSelectMapMenu();
1209 wad_lb
: TGUIFileListBox
;
1210 map_lb
: TGUIListBox
;
1213 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1214 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1215 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1217 if wad_lb
.SelectedItem() <> '' then
1218 map
:= map_lb
.SelectedItem()
1222 wad_lb
.UpdateFileList();
1225 if wad_lb
.SelectedItem() <> '' then
1228 map_lb
.SelectItem(map
);
1230 if map_lb
.SelectedItem() <> '' then
1234 g_GUI_ShowWindow('SelectMapMenu');
1237 procedure ProcSelectCampaignMenu();
1240 wad_lb
: TGUIFileListBox
;
1242 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1243 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1245 wad_lb
.UpdateFileList();
1247 if wad_lb
.SelectedItem() <> '' then
1248 ProcSelectCampaignWAD(nil);
1251 procedure ProcSetMap();
1253 wad
, map
, res
: String;
1255 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1257 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1258 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1261 if (wad
= '') or (map
= '') then
1264 res
:= wad
+':\'+map
;
1266 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1267 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1270 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1274 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1276 g_Sound_SetupAllVolumes(
1277 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1278 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1282 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1286 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1287 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
1290 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1294 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1295 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1296 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1299 procedure ProcOptionsPlayersMIMenu();
1304 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1306 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1308 if a
= '' then Exit
;
1310 b
:= g_PlayerModel_GetInfo(a
);
1312 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1314 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1315 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1316 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1318 if b
.HaveWeapon
then
1319 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1321 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1324 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1327 procedure ProcOptionsPlayersAnim();
1331 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1336 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1339 Model
.GetCurrentAnimation
.Loop
:= True;
1340 Model
.GetCurrentAnimationMask
.Loop
:= True;
1344 procedure ProcOptionsPlayersWeap();
1348 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1353 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1357 procedure ProcOptionsPlayersRot();
1361 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1362 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1364 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1368 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1372 g_Options_SetDefault();
1378 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1380 if yes
then ReadOptions();
1384 procedure ProcAuthorsClose();
1386 gMusic
.SetByName('MUSIC_MENU');
1388 gState
:= STATE_MENU
;
1391 procedure ProcGMClose();
1393 g_Game_InGameMenu(False);
1396 procedure ProcGMShow();
1401 if (gGameSettings
.GameType
= GT_SINGLE
) and
1402 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1403 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1404 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1406 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1407 if g_Game_IsTestMap
then
1408 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1409 TGUIMainMenu(g_ActiveWindow
.GetControl(
1410 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1413 procedure ProcChangePlayers();
1415 TeamGame
, Spectator
, AddTwo
: Boolean;
1416 P1Team
{, P2Team}: Byte;
1417 bP2
: TGUITextButton
;
1419 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1420 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1421 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1422 P1Team
:= TEAM_NONE
;
1423 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1425 //P2Team := TEAM_NONE;
1426 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1428 TGUIMainMenu(g_ActiveWindow
.GetControl(
1429 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1430 TGUIMainMenu(g_ActiveWindow
.GetControl(
1431 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1432 TGUIMainMenu(g_ActiveWindow
.GetControl(
1433 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1435 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1436 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1437 bP2
.Enabled
:= AddTwo
and not Spectator
;
1439 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1441 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1442 if gPlayer2
= nil then
1443 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1445 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1447 TGUIMainMenu(g_ActiveWindow
.GetControl(
1448 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1451 procedure ProcJoinRed();
1453 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1455 if g_Game_IsServer
then
1457 if gPlayer1
= nil then
1458 g_Game_AddPlayer(TEAM_RED
)
1461 if gPlayer1
.Team
<> TEAM_RED
then
1463 gPlayer1
.SwitchTeam
;
1464 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1467 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1472 gPlayer1Settings
.Team
:= TEAM_RED
;
1473 MC_SEND_PlayerSettings
;
1474 if gPlayer1
= nil then
1475 g_Game_AddPlayer(TEAM_RED
);
1477 g_ActiveWindow
:= nil;
1478 g_Game_Pause(False);
1481 procedure ProcJoinBlue();
1483 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1485 if g_Game_IsServer
then
1487 if gPlayer1
= nil then
1488 g_Game_AddPlayer(TEAM_BLUE
)
1491 if gPlayer1
.Team
<> TEAM_BLUE
then
1493 gPlayer1
.SwitchTeam
;
1494 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1497 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1502 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1503 MC_SEND_PlayerSettings
;
1504 if gPlayer1
= nil then
1505 g_Game_AddPlayer(TEAM_BLUE
);
1507 g_ActiveWindow
:= nil;
1508 g_Game_Pause(False);
1511 procedure ProcJoinGame();
1513 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1515 if gPlayer1
= nil then
1517 g_ActiveWindow
:= nil;
1518 g_Game_Pause(False);
1521 procedure ProcSwitchP2();
1523 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1525 if gPlayer1
= nil then
1527 if gPlayer2
= nil then
1530 g_Game_RemovePlayer();
1531 g_ActiveWindow
:= nil;
1532 g_Game_Pause(False);
1535 procedure ProcSpectate();
1537 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1540 g_ActiveWindow
:= nil;
1541 g_Game_Pause(False);
1544 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1546 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1549 procedure ProcEndMenuKeyDown (yes
: Boolean);
1551 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1554 procedure ProcSetRussianLanguage();
1556 if gLanguage
<> LANGUAGE_RUSSIAN
then
1558 gLanguage
:= LANGUAGE_RUSSIAN
;
1559 gLanguageChange
:= True;
1560 gAskLanguage
:= False;
1562 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1564 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1569 procedure ProcSetEnglishLanguage();
1571 if gLanguage
<> LANGUAGE_ENGLISH
then
1573 gLanguage
:= LANGUAGE_ENGLISH
;
1574 gLanguageChange
:= True;
1575 gAskLanguage
:= False;
1577 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1579 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1584 procedure ReadGameSettings();
1588 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1590 with gGameSettings
do
1592 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1593 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1598 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1599 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1600 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1602 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1603 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1604 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1607 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1612 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1614 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1615 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1616 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1617 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1618 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1619 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1620 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1621 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1625 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1626 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1631 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1632 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1637 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1638 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1643 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1644 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1649 procedure ProcApplyGameSet();
1653 stat
: TPlayerStatArray
;
1655 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1657 if not g_Game_IsServer
then Exit
;
1659 with gGameSettings
do
1661 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1663 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1664 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1666 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1669 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1671 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1677 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1679 TimeLimit
:= Max(n
, b
);
1683 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1685 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1692 if GameMode
= GM_DM
then
1694 stat
:= g_Player_GetStats();
1696 for a
:= 0 to High(stat
) do
1697 if stat
[a
].Frags
> b
then
1701 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1703 GoalLimit
:= Max(n
, b
);
1707 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1709 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1710 if n
< 0 then n
:= 0;
1711 if n
> 255 then n
:= 255;
1717 stat
:= g_Player_GetStats();
1719 for a
:= 0 to High(stat
) do
1720 if stat
[a
].Lives
> b
then
1723 MaxLives
:= Max(n
, b
);
1727 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1729 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1732 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1733 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1737 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1738 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1742 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1743 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1749 if g_Game_IsNet
then MH_SEND_GameSettings
;
1752 procedure ProcVideoOptionsRes();
1758 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1760 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1761 IntToStr(gScreenWidth
) +
1762 ' x ' + IntToStr(gScreenHeight
) +
1763 ', ' + IntToStr(gBPP
) + ' bpp';
1765 with TGUIListBox(menu
.GetControl('lsResolution')) do
1767 list
:= GetDisplayModes(gBPP
, SR
);
1778 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1785 procedure ProcApplyVideoOptions();
1788 Fullscreen
: Boolean;
1789 SWidth
, SHeight
: Integer;
1792 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1794 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1795 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1797 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1799 if (SWidth
<> gScreenWidth
) or
1800 (SHeight
<> gScreenHeight
) or
1801 (Fullscreen
<> gFullscreen
) then
1803 gResolutionChange
:= True;
1804 gRC_Width
:= SWidth
;
1805 gRC_Height
:= SHeight
;
1806 gRC_FullScreen
:= Fullscreen
;
1807 gRC_Maximized
:= gWinMaximized
;
1810 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1814 procedure ProcSetFirstRussianLanguage();
1816 gLanguage
:= LANGUAGE_RUSSIAN
;
1817 gLanguageChange
:= True;
1818 gAskLanguage
:= False;
1820 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1823 procedure ProcSetFirstEnglishLanguage();
1825 gLanguage
:= LANGUAGE_ENGLISH
;
1826 gLanguageChange
:= True;
1827 gAskLanguage
:= False;
1829 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1832 procedure ProcRecallAddress();
1834 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1836 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1837 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1841 procedure CreateFirstLanguageMenu();
1845 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1847 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1849 Name
:= 'mmFirstLanguageMenu';
1850 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1851 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1854 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1855 Menu
.MainWindow
:= True;
1856 g_GUI_AddWindow(Menu
);
1859 procedure g_Menu_AskLanguage();
1861 CreateFirstLanguageMenu();
1862 g_GUI_ShowWindow('FirstLanguageMenu');
1865 procedure CreatePlayerOptionsMenu(s
: String);
1870 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1872 a
:= _lc
[I_MENU_PLAYER_1
]
1874 a
:= _lc
[I_MENU_PLAYER_2
];
1875 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1877 Name
:= 'mOptionsPlayers'+s
+'Menu';
1878 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1880 Name
:= 'ed'+s
+'Name';
1884 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1886 Name
:= 'sw'+s
+'Team';
1887 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1888 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1890 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1892 Name
:= 'ls'+s
+'Model';
1894 Items
:= g_PlayerModel_GetNames();
1895 OnChange
:= ProcSelectModel
;
1897 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1899 Name
:= 'sc'+s
+'Red';
1901 OnChange
:= ProcChangeColor
;
1903 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1905 Name
:= 'sc'+s
+'Green';
1907 OnChange
:= ProcChangeColor
;
1909 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1911 Name
:= 'sc'+s
+'Blue';
1913 OnChange
:= ProcChangeColor
;
1916 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1917 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1918 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1919 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1921 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1923 Name
:= 'mv'+s
+'Model';
1924 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1925 Y
:= GetControl('ls'+s
+'Model').Y
;
1928 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1929 g_GUI_AddWindow(Menu
);
1932 procedure CreateAllMenus();
1936 a
, cx
, _y
, i
: Integer;
1939 Menu
:= TGUIWindow
.Create('MainMenu');
1940 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1942 Name
:= 'mmMainMenu';
1943 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1944 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1945 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1946 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1947 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1948 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1950 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1952 Color
:= _RGB(255, 255, 255);
1953 X
:= gScreenWidth
-GetWidth
-8;
1954 Y
:= gScreenHeight
-GetHeight
-8;
1956 Menu
.DefControl
:= 'mmMainMenu';
1957 Menu
.MainWindow
:= True;
1958 g_GUI_AddWindow(Menu
);
1960 Menu
:= TGUIWindow
.Create('NewGameMenu');
1961 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1963 Name
:= 'mmNewGameMenu';
1964 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1965 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1966 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1967 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1969 Menu
.DefControl
:= 'mmNewGameMenu';
1970 g_GUI_AddWindow(Menu
);
1972 Menu
:= TGUIWindow
.Create('NetGameMenu');
1973 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1975 Name
:= 'mmNetGameMenu';
1976 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1977 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1979 Menu
.DefControl
:= 'mmNetGameMenu';
1980 g_GUI_AddWindow(Menu
);
1982 Menu
:= TGUIWindow
.Create('NetServerMenu');
1983 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1985 Name
:= 'mNetServerMenu';
1986 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1988 Name
:= 'edSrvName';
1989 OnlyDigits
:= False;
1992 Text := NetServerName
;
1994 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1996 Name
:= 'edSrvPassword';
1997 OnlyDigits
:= False;
2000 Text := NetPassword
;
2002 with AddEdit(_lc
[I_NET_PORT
]) do
2008 Text := IntToStr(NetPort
);
2010 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2012 Name
:= 'edMaxPlayers';
2016 Text := IntToStr(NetMaxClients
);
2018 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2020 Name
:= 'swUseMaster';
2021 AddItem(_lc
[I_MENU_YES
]);
2022 AddItem(_lc
[I_MENU_NO
]);
2023 if NetUseMaster
then
2029 with AddLabel(_lc
[I_MENU_MAP
]) do
2034 OnClick
:= @ProcSelectMapMenu
;
2036 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2038 Name
:= 'swGameMode';
2039 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2040 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2041 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2042 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2043 case g_Game_TextToMode(gnGameMode
) of
2045 GM_DM
: ItemIndex
:= 0;
2046 GM_TDM
: ItemIndex
:= 1;
2047 GM_CTF
: ItemIndex
:= 2;
2049 GM_COOP
: ItemIndex
:= 3;
2051 OnChange
:= ProcSwitchMonstersNet
;
2053 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2055 Name
:= 'edTimeLimit';
2059 if gnTimeLimit
> 0 then
2060 Text := IntToStr(gnTimeLimit
);
2062 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2064 Name
:= 'edGoalLimit';
2068 if gnGoalLimit
> 0 then
2069 Text := IntToStr(gnGoalLimit
);
2071 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2073 Name
:= 'edMaxLives';
2077 if gnMaxLives
> 0 then
2078 Text := IntToStr(gnMaxLives
);
2080 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2082 Name
:= 'swPlayers';
2083 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2084 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2085 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2086 ItemIndex
:= gnPlayers
;
2088 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2090 Name
:= 'swTeamDamage';
2091 AddItem(_lc
[I_MENU_YES
]);
2092 AddItem(_lc
[I_MENU_NO
]);
2093 if gnTeamDamage
then
2098 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2100 Name
:= 'swEnableExits';
2101 AddItem(_lc
[I_MENU_YES
]);
2102 AddItem(_lc
[I_MENU_NO
]);
2108 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2110 Name
:= 'swWeaponStay';
2111 AddItem(_lc
[I_MENU_YES
]);
2112 AddItem(_lc
[I_MENU_NO
]);
2113 if gnWeaponStay
then
2118 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2120 Name
:= 'swMonsters';
2121 AddItem(_lc
[I_MENU_YES
]);
2122 AddItem(_lc
[I_MENU_NO
]);
2128 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2131 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2132 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2133 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2135 if gnBotsVS
= 'Players' then
2137 if gnBotsVS
= 'Monsters' then
2141 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2145 Menu
.DefControl
:= 'mNetServerMenu';
2146 g_GUI_AddWindow(Menu
);
2148 Menu
:= TGUIWindow
.Create('NetClientMenu');
2149 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2151 Name
:= 'mNetClientMenu';
2153 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2156 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2162 Text := 'localhost';
2164 with AddEdit(_lc
[I_NET_PORT
]) do
2172 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2175 OnlyDigits
:= False;
2182 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2186 Menu
.DefControl
:= 'mNetClientMenu';
2187 g_GUI_AddWindow(Menu
);
2189 Menu
:= TGUIWindow
.Create('LoadMenu');
2190 Menu
.OnShow
:= ProcLoadMenu
;
2191 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2193 Name
:= 'mmLoadMenu';
2198 Name
:= 'edSlot'+IntToStr(a
);
2201 OnEnter
:= ProcLoadGame
;
2204 Menu
.DefControl
:= 'mmLoadMenu';
2205 g_GUI_AddWindow(Menu
);
2207 Menu
:= TGUIWindow
.Create('SaveMenu');
2208 Menu
.OnShow
:= ProcSaveMenu
;
2209 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2211 Name
:= 'mmSaveMenu';
2216 Name
:= 'edSlot'+IntToStr(a
);
2219 OnChange
:= ProcSaveGame
;
2222 Menu
.DefControl
:= 'mmSaveMenu';
2223 g_GUI_AddWindow(Menu
);
2225 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2226 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2228 Name
:= 'mCustomGameMenu';
2229 with AddLabel(_lc
[I_MENU_MAP
]) do
2234 OnClick
:= @ProcSelectMapMenu
;
2236 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2238 Name
:= 'swGameMode';
2239 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2240 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2241 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2242 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2243 case g_Game_TextToMode(gcGameMode
) of
2245 GM_DM
: ItemIndex
:= 0;
2246 GM_TDM
: ItemIndex
:= 1;
2247 GM_CTF
: ItemIndex
:= 2;
2249 GM_COOP
: ItemIndex
:= 3;
2251 OnChange
:= ProcSwitchMonstersCustom
;
2253 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2255 Name
:= 'edTimeLimit';
2259 if gcTimeLimit
> 0 then
2260 Text := IntToStr(gcTimeLimit
);
2262 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2264 Name
:= 'edGoalLimit';
2268 if gcGoalLimit
> 0 then
2269 Text := IntToStr(gcGoalLimit
);
2271 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2273 Name
:= 'edMaxLives';
2277 if gcMaxLives
> 0 then
2278 Text := IntToStr(gcMaxLives
);
2280 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2282 Name
:= 'swPlayers';
2283 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2284 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2285 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2286 ItemIndex
:= gcPlayers
;
2288 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2290 Name
:= 'swTeamDamage';
2291 AddItem(_lc
[I_MENU_YES
]);
2292 AddItem(_lc
[I_MENU_NO
]);
2293 if gcTeamDamage
then
2298 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2300 Name
:= 'swEnableExits';
2301 AddItem(_lc
[I_MENU_YES
]);
2302 AddItem(_lc
[I_MENU_NO
]);
2308 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2310 Name
:= 'swWeaponStay';
2311 AddItem(_lc
[I_MENU_YES
]);
2312 AddItem(_lc
[I_MENU_NO
]);
2313 if gcWeaponStay
then
2318 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2320 Name
:= 'swMonsters';
2321 AddItem(_lc
[I_MENU_YES
]);
2322 AddItem(_lc
[I_MENU_NO
]);
2328 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2331 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2332 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2333 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2335 if gcBotsVS
= 'Players' then
2337 if gcBotsVS
= 'Monsters' then
2341 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2345 Menu
.DefControl
:= 'mCustomGameMenu';
2346 g_GUI_AddWindow(Menu
);
2348 Menu
:= TGUIWindow
.Create('CampaignMenu');
2349 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2351 Name
:= 'mCampaignMenu';
2360 with AddFileList('', 15, 4) do
2363 OnChange
:= ProcSelectCampaignWAD
;
2367 FileMask
:= '*.wad|*.pk3|*.zip';
2368 SetBase(MapsDir
+'megawads/');
2371 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2373 Name
:= 'lbWADName';
2377 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2379 Name
:= 'lbWADAuthor';
2383 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2384 with AddMemo('', 15, 3) do
2386 Name
:= 'meWADDescription';
2387 Color
:= MENU_ITEMSCTRL_COLOR
;
2389 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2391 Name
:= 'swPlayers';
2392 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2393 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2396 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2400 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2402 Name
:= 'mpWADImage';
2403 DefaultRes
:= 'NOPIC';
2404 X
:= GetControl('lsWAD').X
+4;
2405 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2408 Menu
.DefControl
:= 'mCampaignMenu';
2409 g_GUI_AddWindow(Menu
);
2411 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2412 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2414 Name
:= 'mSelectMapMenu';
2415 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2418 OnChange
:= ProcSelectWAD
;
2422 FileMask
:= '*.wad|*.pk3|*.zip';
2425 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2429 OnChange
:= ProcSelectMap
;
2432 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2434 Name
:= 'lbMapName';
2438 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2440 Name
:= 'lbMapAuthor';
2444 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2446 Name
:= 'lbMapSize';
2450 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2452 Name
:= 'meMapDescription';
2457 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2459 Name
:= 'mpMapPreview';
2460 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2461 Y
:= GetControl('lsMapWAD').Y
;
2463 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2465 Name
:= 'lbMapScale';
2468 Color
:= MENU_ITEMSCTRL_COLOR
;
2469 X
:= GetControl('lsMapWAD').X
+
2470 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2471 2 + MAPPREVIEW_WIDTH
*4;
2472 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2475 Menu
.OnClose
:= ProcSetMap
;
2476 Menu
.DefControl
:= 'mSelectMapMenu';
2477 g_GUI_AddWindow(Menu
);
2479 Menu
:= TGUIWindow
.Create('OptionsMenu');
2480 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2482 Name
:= 'mmOptionsMenu';
2483 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2484 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2485 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2486 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2487 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2488 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2490 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2491 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2493 Menu
.OnClose
:= ProcApplyOptions
;
2494 Menu
.DefControl
:= 'mmOptionsMenu';
2495 g_GUI_AddWindow(Menu
);
2497 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2498 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2499 g_GUI_AddWindow(Menu
);
2501 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2502 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2504 Name
:= 'mOptionsVideoMenu';
2505 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2506 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2512 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2515 AddItem(_lc
[I_MENU_YES
]);
2516 AddItem(_lc
[I_MENU_NO
]);
2518 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2520 Name
:= 'swTextureFilter';
2521 AddItem(_lc
[I_MENU_YES
]);
2522 AddItem(_lc
[I_MENU_NO
]);
2524 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2526 Name
:= 'swLegacyNPOT';
2527 AddItem(_lc
[I_MENU_NO
]);
2528 AddItem(_lc
[I_MENU_YES
]);
2531 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2534 Menu
.DefControl
:= 'mOptionsVideoMenu';
2535 g_GUI_AddWindow(Menu
);
2537 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2538 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2540 Name
:= 'mOptionsVideoResMenu';
2541 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2543 Name
:= 'lbCurrentRes';
2547 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2549 Name
:= 'lsResolution';
2552 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2554 Name
:= 'swFullScreen';
2555 AddItem(_lc
[I_MENU_YES
]);
2556 AddItem(_lc
[I_MENU_NO
]);
2559 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2562 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2563 g_GUI_AddWindow(Menu
);
2565 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2566 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2568 Name
:= 'mOptionsSoundMenu';
2569 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2571 Name
:= 'scMusicLevel';
2573 OnChange
:= ProcChangeSoundSettings
;
2575 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2577 Name
:= 'scSoundLevel';
2579 OnChange
:= ProcChangeSoundSettings
;
2581 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2583 Name
:= 'scMaxSimSounds';
2586 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2588 Name
:= 'swAnnouncer';
2589 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2590 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2591 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2592 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2594 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2595 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2597 Name
:= 'swSoundEffects';
2598 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2599 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2601 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2602 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2604 Name
:= 'swChatSpeech';
2605 AddItem(_lc
[I_MENU_YES
]);
2606 AddItem(_lc
[I_MENU_NO
]);
2608 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2610 Name
:= 'swInactiveSounds';
2611 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2612 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2616 Menu
.DefControl
:= 'mOptionsSoundMenu';
2617 g_GUI_AddWindow(Menu
);
2619 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2620 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2622 Name
:= 'mOptionsGameMenu';
2623 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2625 Name
:= 'scParticlesCount';
2628 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2630 Name
:= 'swBloodCount';
2631 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2632 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2633 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2634 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2635 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2637 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2639 Name
:= 'scShellsMax';
2642 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2644 Name
:= 'scGibsMax';
2647 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2649 Name
:= 'scCorpsesMax';
2652 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2654 Name
:= 'swGibsCount';
2655 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2656 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2657 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2658 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2659 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2661 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2663 Name
:= 'swCorpseType';
2664 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2665 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2667 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2669 Name
:= 'swGibsType';
2670 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2671 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2673 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2675 Name
:= 'swBloodType';
2676 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2677 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2679 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2681 Name
:= 'swScreenFlash';
2682 AddItem(_lc
[I_MENU_NO
]);
2683 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2684 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2686 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2688 Name
:= 'swBackground';
2689 AddItem(_lc
[I_MENU_YES
]);
2690 AddItem(_lc
[I_MENU_NO
]);
2692 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2694 Name
:= 'swMessages';
2695 AddItem(_lc
[I_MENU_YES
]);
2696 AddItem(_lc
[I_MENU_NO
]);
2698 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2700 Name
:= 'swRevertPlayers';
2701 AddItem(_lc
[I_MENU_YES
]);
2702 AddItem(_lc
[I_MENU_NO
]);
2704 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2706 Name
:= 'swChatBubble';
2707 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2708 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2709 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2710 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2711 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2713 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2715 Name
:= 'scScaleFactor';
2717 OnChange
:= ProcChangeGameSettings
;
2721 Menu
.DefControl
:= 'mOptionsGameMenu';
2722 g_GUI_AddWindow(Menu
);
2724 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2725 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2727 Name
:= 'mOptionsControlsMenu';
2728 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2729 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2730 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2731 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2732 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2734 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2735 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2736 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2737 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2738 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2739 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2740 if e_JoysticksAvailable
<> 0 then
2743 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2745 if SDL_GetNumTouchDevices() > 0 then
2748 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2751 Menu
.DefControl
:= 'mOptionsControlsMenu';
2752 g_GUI_AddWindow(Menu
);
2754 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2755 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2757 Name
:= 'mOptionsControlsP1Menu';
2758 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2759 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2760 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2761 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2762 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2763 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2764 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2765 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2766 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2767 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2769 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2770 g_GUI_AddWindow(Menu
);
2772 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2773 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2775 Name
:= 'mOptionsControlsP1MenuWeapons';
2776 for i
:= WP_FIRST
to WP_LAST
do
2777 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2778 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2780 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2781 g_GUI_AddWindow(Menu
);
2783 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2784 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2786 Name
:= 'mOptionsControlsP2Menu';
2787 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2788 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2789 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2790 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2791 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2792 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2793 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2794 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2795 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2796 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2798 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2799 g_GUI_AddWindow(Menu
);
2801 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2802 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2804 Name
:= 'mOptionsControlsP2MenuWeapons';
2805 for i
:= WP_FIRST
to WP_LAST
do
2806 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2807 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2809 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2810 g_GUI_AddWindow(Menu
);
2812 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2813 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2815 Name
:= 'mOptionsControlsJoystickMenu';
2816 for i
:= 0 to e_JoysticksAvailable
-1 do
2817 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2819 Name
:= 'scDeadzone' + IntToStr(i
);
2823 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2824 g_GUI_AddWindow(Menu
);
2826 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2827 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2829 Name
:= 'mOptionsControlsTouchMenu';
2830 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2832 Name
:= 'scTouchSize';
2834 OnChange
:= ProcChangeTouchSettings
;
2836 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2838 Name
:= 'swTouchFire';
2839 AddItem(_lc
[I_MENU_NO
]);
2840 AddItem(_lc
[I_MENU_YES
]);
2842 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2844 Name
:= 'scTouchOffset';
2846 OnChange
:= ProcChangeTouchSettings
;
2849 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2850 g_GUI_AddWindow(Menu
);
2852 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2853 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2855 Name
:= 'mOptionsPlayersMenu';
2856 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2857 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2859 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2860 g_GUI_AddWindow(Menu
);
2862 CreatePlayerOptionsMenu('P1');
2863 CreatePlayerOptionsMenu('P2');
2865 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2866 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2868 Name
:= 'mOptionsPlayersMIMenu';
2869 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2874 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2879 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2881 Name
:= 'meComment';
2884 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2885 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2888 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2892 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2893 g_GUI_AddWindow(Menu
);
2895 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2896 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2898 Name
:= 'mOptionsLanguageMenu';
2899 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2900 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2903 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2907 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2908 g_GUI_AddWindow(Menu
);
2910 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2911 Menu
.BackTexture
:= 'INTER';
2912 Menu
.OnClose
:= ProcAuthorsClose
;
2916 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2918 Color
:= _RGB(255, 0, 0);
2919 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2921 _y
:= _y
+GetHeight();
2923 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2925 Color
:= _RGB(255, 0, 0);
2926 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2928 _y
:= _y
+GetHeight()+32;
2930 // ×òî äåëàë: Êòî äåëàë
2931 cx
:= gScreenWidth
div 2 - 320 + 64;
2932 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2934 Color
:= _RGB(255, 0, 0);
2939 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2941 Color
:= _RGB(255, 255, 255);
2946 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2948 Color
:= _RGB(255, 0, 0);
2953 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2955 Color
:= _RGB(255, 255, 255);
2960 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2962 Color
:= _RGB(255, 255, 255);
2967 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2969 Color
:= _RGB(255, 0, 0);
2974 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2976 Color
:= _RGB(255, 255, 255);
2981 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2983 Color
:= _RGB(255, 0, 0);
2988 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2990 Color
:= _RGB(255, 255, 255);
2993 _y
:= gScreenHeight
- 128;
2996 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2998 Color
:= _RGB(255, 0, 0);
3003 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3005 Color
:= _RGB(255, 255, 255);
3008 _y
:= _y
+GetHeight();
3010 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3012 Color
:= _RGB(255, 255, 255);
3015 _y
:= _y
+GetHeight();
3017 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3019 Color
:= _RGB(255, 255, 255);
3022 _y
:= gScreenHeight
- 32;
3024 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3026 Color
:= _RGB(255, 0, 0);
3027 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3030 g_GUI_AddWindow(Menu
);
3032 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3033 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3034 g_GUI_AddWindow(Menu
);
3036 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3037 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3039 Name
:= 'mmGameSingleMenu';
3040 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3041 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3042 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3043 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3044 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3045 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3047 Menu
.DefControl
:= 'mmGameSingleMenu';
3048 Menu
.MainWindow
:= True;
3049 Menu
.OnClose
:= ProcGMClose
;
3050 Menu
.OnShow
:= ProcGMShow
;
3051 g_GUI_AddWindow(Menu
);
3053 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3054 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3055 g_GUI_AddWindow(Menu
);
3057 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3058 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3059 g_GUI_AddWindow(Menu
);
3061 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3062 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3064 Name
:= 'mmGameCustomMenu';
3065 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3066 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3067 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3068 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3069 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3070 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3071 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3073 Menu
.DefControl
:= 'mmGameCustomMenu';
3074 Menu
.MainWindow
:= True;
3075 Menu
.OnClose
:= ProcGMClose
;
3076 Menu
.OnShow
:= ProcGMShow
;
3077 g_GUI_AddWindow(Menu
);
3079 Menu
:= TGUIWindow
.Create('GameServerMenu');
3080 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3082 Name
:= 'mmGameServerMenu';
3083 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3084 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3085 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3086 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3087 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3089 Menu
.DefControl
:= 'mmGameServerMenu';
3090 Menu
.MainWindow
:= True;
3091 Menu
.OnClose
:= ProcGMClose
;
3092 Menu
.OnShow
:= ProcGMShow
;
3093 g_GUI_AddWindow(Menu
);
3095 Menu
:= TGUIWindow
.Create('GameClientMenu');
3096 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3098 Name
:= 'mmGameClientMenu';
3099 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3100 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3101 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3103 Menu
.DefControl
:= 'mmGameClientMenu';
3104 Menu
.MainWindow
:= True;
3105 Menu
.OnClose
:= ProcGMClose
;
3106 Menu
.OnShow
:= ProcGMShow
;
3107 g_GUI_AddWindow(Menu
);
3109 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3110 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3112 Name
:= 'mClientPasswordMenu';
3113 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3121 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3124 Menu
.DefControl
:= 'mClientPasswordMenu';
3125 g_GUI_AddWindow(Menu
);
3127 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3128 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3130 Name
:= 'mGameSetGameMenu';
3131 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3133 Name
:= 'swTeamDamage';
3134 AddItem(_lc
[I_MENU_YES
]);
3135 AddItem(_lc
[I_MENU_NO
]);
3138 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3140 Name
:= 'edTimeLimit';
3145 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3147 Name
:= 'edGoalLimit';
3152 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3154 Name
:= 'edMaxLives';
3159 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3162 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3163 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3164 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3170 Menu
.DefControl
:= 'mGameSetGameMenu';
3171 Menu
.OnClose
:= ProcApplyGameSet
;
3172 g_GUI_AddWindow(Menu
);
3174 Menu
:= TGUIWindow
.Create('TeamMenu');
3175 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3177 Name
:= 'mmTeamMenu';
3178 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3179 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3180 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3181 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3182 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3184 Menu
.DefControl
:= 'mmTeamMenu';
3185 Menu
.OnShow
:= ProcChangePlayers
;
3186 g_GUI_AddWindow(Menu
);
3189 procedure g_Menu_Show_SaveMenu();
3191 if g_Game_IsTestMap
then
3193 if gGameSettings
.GameType
= GT_SINGLE
then
3194 g_GUI_ShowWindow('GameSingleMenu')
3197 if g_Game_IsClient
then
3200 if g_Game_IsNet
then
3203 g_GUI_ShowWindow('GameCustomMenu');
3205 g_GUI_ShowWindow('SaveMenu');
3206 g_Sound_PlayEx('MENU_OPEN');
3209 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3211 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3212 if gGameSettings
.GameType
= GT_SINGLE
then
3214 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3218 if g_Game_IsClient
then exit
;
3219 if g_Game_IsNet
then exit
;
3220 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3222 g_GUI_ShowWindow('LoadMenu');
3223 g_Sound_PlayEx('MENU_OPEN');
3226 procedure g_Menu_Show_GameSetGame();
3228 if gGameSettings
.GameType
= GT_SINGLE
then
3229 g_GUI_ShowWindow('GameSingleMenu')
3232 if g_Game_IsClient
then
3235 if g_Game_IsNet
then
3236 g_GUI_ShowWindow('GameServerMenu')
3238 g_GUI_ShowWindow('GameCustomMenu');
3241 g_GUI_ShowWindow('GameSetGameMenu');
3242 g_Sound_PlayEx('MENU_OPEN');
3245 procedure g_Menu_Show_OptionsVideo();
3247 if gGameSettings
.GameType
= GT_SINGLE
then
3248 g_GUI_ShowWindow('GameSingleMenu')
3251 if g_Game_IsClient
then
3252 g_GUI_ShowWindow('GameClientMenu')
3254 if g_Game_IsNet
then
3255 g_GUI_ShowWindow('GameServerMenu')
3257 g_GUI_ShowWindow('GameCustomMenu');
3260 g_GUI_ShowWindow('OptionsMenu');
3261 g_GUI_ShowWindow('OptionsVideoMenu');
3262 g_Sound_PlayEx('MENU_OPEN');
3265 procedure g_Menu_Show_OptionsSound();
3267 if gGameSettings
.GameType
= GT_SINGLE
then
3268 g_GUI_ShowWindow('GameSingleMenu')
3271 if g_Game_IsClient
then
3272 g_GUI_ShowWindow('GameClientMenu')
3274 if g_Game_IsNet
then
3275 g_GUI_ShowWindow('GameServerMenu')
3277 g_GUI_ShowWindow('GameCustomMenu');
3280 g_GUI_ShowWindow('OptionsMenu');
3281 g_GUI_ShowWindow('OptionsSoundMenu');
3282 g_Sound_PlayEx('MENU_OPEN');
3285 procedure g_Menu_Show_EndGameMenu();
3287 g_GUI_ShowWindow('EndGameMenu');
3288 g_Sound_PlayEx('MENU_OPEN');
3291 procedure g_Menu_Show_QuitGameMenu();
3293 g_GUI_ShowWindow('ExitMenu');
3294 g_Sound_PlayEx('MENU_OPEN');
3297 procedure g_Menu_Init();
3304 procedure g_Menu_Free();
3308 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3313 procedure g_Menu_Reset();
3317 g_GUI_SaveMenuPos();
3318 ex
:= g_GUI_Destroy();
3322 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3327 g_Game_SetDebugMode();
3329 g_GUI_LoadMenuPos();