1 (* Copyright (C) DooM 2D:Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
45 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
46 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, wadreader
, Math
, g_saveload
,
49 e_texture
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
;
53 type TYNCallback
= procedure (yes
:Boolean);
55 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
57 if win
.UserData
= nil then exit
;
59 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
60 IK_N
: TYNCallback(win
.UserData
)(false);
64 procedure YesButtonCB (ctl
: TGUITextButton
);
66 if ctl
.UserData
= nil then exit
;
67 TYNCallback(ctl
.UserData
)(true);
70 procedure NoButtonCB (ctl
: TGUITextButton
);
72 if ctl
.UserData
= nil then exit
;
73 TYNCallback(ctl
.UserData
)(false);
76 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
80 //if length(Text) = 0 then exit;
81 Result
:= TGUIWindow
.Create(WinName
);
84 //OnKeyDownEx := @YNKeyDownProc;
85 //UserData := @ActionProc;
86 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
89 Name
:= '__temp_yes_no_menu:'+WinName
;
91 AddText(Text, MaxLen
);
92 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
93 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
95 DefControl
:= '__temp_yes_no_menu:'+WinName
;
101 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
102 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
104 procedure ProcApplyOptions();
109 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
111 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
115 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
116 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
117 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
121 g_Sound_SetupAllVolumes(
122 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
123 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
126 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
127 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
128 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
129 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
133 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
134 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
135 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
136 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
138 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
143 else gGibsCount
:= 48;
146 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
147 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
148 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
149 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
150 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
151 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
152 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
153 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
154 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
156 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
158 with menu
, gGameControls
.GameControls
do
160 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
161 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
162 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
163 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
167 with menu
, gGameControls
.P1Control
do
169 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
170 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
171 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
172 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
173 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
174 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
175 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
176 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
177 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
178 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
180 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
181 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
182 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
183 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
184 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
185 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
186 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
187 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
188 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
189 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
192 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
193 with menu
, gGameControls
.P1Control
do
195 for i
:= WP_FIRST
to WP_LAST
do
197 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
198 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
202 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
203 with menu
, gGameControls
.P2Control
do
205 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
206 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
207 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
208 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
209 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
210 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
211 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
212 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
213 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
214 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
216 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
217 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
218 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
219 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
220 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
221 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
222 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
223 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
224 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
225 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
228 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
229 with menu
, gGameControls
.P2Control
do
231 for i
:= WP_FIRST
to WP_LAST
do
233 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
234 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
238 if e_JoysticksAvailable
> 0 then
240 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
243 for i
:= 0 to e_JoysticksAvailable
-1 do
244 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
248 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
250 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
251 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
252 TEAM_RED
, TEAM_BLUE
);
254 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
256 gPlayer1Settings
.Model
:= Model
.Name
;
257 gPlayer1Settings
.Color
:= Model
.Color
;
260 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
262 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
263 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
264 TEAM_RED
, TEAM_BLUE
);
265 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
267 gPlayer2Settings
.Model
:= Model
.Name
;
268 gPlayer2Settings
.Color
:= Model
.Color
;
271 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
272 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
274 if g_Game_IsServer
then
276 if gPlayer1
<> nil then
278 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
279 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
280 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
281 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
283 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
286 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
289 if gPlayer2
<> nil then
291 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
292 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
293 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
294 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
296 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
301 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
303 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
306 procedure ReadOptions();
311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
313 with TGUISwitch(menu
.GetControl('swBPP')) do
319 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
320 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
322 with TGUISwitch(menu
.GetControl('swVSync')) do
323 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
325 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
326 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
328 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
330 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
331 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
332 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
334 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
335 if gMuteWhenInactive
then
340 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
342 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
343 if gSoundEffectsDF
then
348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
349 with menu
, gGameControls
.P1Control
do
351 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
352 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
353 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
354 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
355 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
356 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
357 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
358 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
362 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
374 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
375 with menu
, gGameControls
.P1Control
do
377 for i
:= WP_FIRST
to WP_LAST
do
379 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
380 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
384 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
385 with menu
, gGameControls
.P2Control
do
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
398 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
410 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
411 with menu
, gGameControls
.P2Control
do
413 for i
:= WP_FIRST
to WP_LAST
do
415 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
416 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
420 if e_JoysticksAvailable
> 0 then
422 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
425 for i
:= 0 to e_JoysticksAvailable
-1 do
426 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
430 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
431 with menu
, gGameControls
.GameControls
do
433 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
434 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
435 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
436 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
439 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
441 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
442 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
443 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
444 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
445 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
447 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
450 with TGUISwitch(menu
.GetControl('swBloodType')) do
451 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
453 with TGUISwitch(menu
.GetControl('swCorpseType')) do
454 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
456 with TGUISwitch(menu
.GetControl('swGibsType')) do
457 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
459 with TGUISwitch(menu
.GetControl('swGibsCount')) do
468 with TGUISwitch(menu
.GetControl('swBackGround')) do
469 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
471 with TGUISwitch(menu
.GetControl('swMessages')) do
472 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
474 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
475 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
477 with TGUISwitch(menu
.GetControl('swChatBubble')) do
478 ItemIndex
:= gChatBubble
;
480 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
482 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
483 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
485 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
486 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
488 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
489 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
490 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
492 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
494 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
495 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
497 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
498 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
500 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
501 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
502 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
504 ProcSelectModel(nil);
507 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
509 // don't turn off monsters in DM
511 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
512 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
513 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
515 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
518 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
519 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
520 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
521 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
525 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
527 // don't turn off monsters in DM
529 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
530 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
531 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
533 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
536 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
537 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
538 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
539 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
543 procedure ProcStartCustomGame();
549 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
551 Map
:= TGUILabel(GetControl('lbMap')).Text;
554 if Pos(':\', Map
) = 0 then
557 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
558 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
559 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
560 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
561 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
563 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
564 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
565 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
566 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
569 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
571 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
573 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
575 Options
:= Options
or GAME_OPTION_MONSTERS
;
576 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
578 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
580 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
581 gcBotsVS
:= 'Monsters';
584 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
585 gcBotsVS
:= 'Everybody';
588 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
589 gcBotsVS
:= 'Players';
596 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
598 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
599 gcMaxLives
, Options
, gcPlayers
);
603 procedure ProcStartNetGame();
609 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
611 Map
:= TGUILabel(GetControl('lbMap')).Text;
614 if Pos(':\', Map
) = 0 then
617 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
618 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
619 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
620 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
621 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
622 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
624 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
625 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
626 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
627 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
630 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
632 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
634 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
636 Options
:= Options
or GAME_OPTION_MONSTERS
;
637 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
639 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
641 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
642 gnBotsVS
:= 'Monsters';
645 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
646 gnBotsVS
:= 'Everybody';
649 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
650 gnBotsVS
:= 'Players';
655 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
656 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
657 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
658 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
659 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
662 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
663 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
665 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
666 Options
, gnPlayers
, 0, NetPort
);
669 procedure ProcConnectNetGame();
673 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
675 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
676 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
677 PW
:= TGUIEdit(GetControl('edPW')).Text;
680 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
681 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
684 procedure ProcEnterPassword();
688 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
690 NetClientIP
:= PromptIP
;
691 NetClientPort
:= PromptPort
;
692 PW
:= TGUIEdit(GetControl('edPW')).Text;
695 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
696 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
699 procedure ProcServerlist();
701 if not NetInitDone
then
703 if (not g_Net_Init()) then
705 g_Console_Add('NET: ERROR: Failed to init ENet!');
712 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
714 gState
:= STATE_SLIST
;
715 g_ActiveWindow
:= nil;
717 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
722 slReturnPressed
:= True;
723 if g_Net_Slist_Fetch(slCurrent
) then
725 if slCurrent
= nil then
726 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
729 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
732 procedure ProcStartCampaign();
738 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
740 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
741 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
748 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
751 procedure ProcSelectMap(Sender
: TGUIControl
);
755 wad
, map
, res
: String;
757 win
:= g_GUI_GetWindow('SelectMapMenu');
758 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
760 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
761 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
763 if (wad
= '') or (map
= '') then
764 begin // Ýòî íå êàðòà
765 TGUILabel(GetControl('lbMapName')).Text := '';
766 TGUILabel(GetControl('lbMapAuthor')).Text := '';
767 TGUILabel(GetControl('lbMapSize')).Text := '';
768 TGUIMemo(GetControl('meMapDescription')).SetText('');
769 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
770 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
776 a
:= g_Map_GetMapInfo(res
);
778 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
779 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
780 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
781 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
782 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
783 TGUILabel(win
.GetControl('lbMapScale')).Text :=
784 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
789 procedure ProcSelectWAD(Sender
: TGUIControl
);
794 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
796 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
798 with TGUIListBox(GetControl('lsMapRes')) do
804 list
:= g_Map_GetMapsList(wad
);
818 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
824 win
:= g_GUI_GetWindow('CampaignMenu');
825 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
827 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
831 TGUILabel(GetControl('lbWADName')).Text := '';
832 TGUILabel(GetControl('lbWADAuthor')).Text := '';
833 TGUIMemo(GetControl('meWADDescription')).SetText('');
836 a
:= g_Game_GetMegaWADInfo(wad
);
838 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
839 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
840 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
842 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
846 fn
:= g_ExtractWadName(a
.pic
);
848 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
850 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
855 procedure ProcChangeColor(Sender
: TGUIControl
);
859 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
860 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
861 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
862 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
863 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
864 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
866 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
867 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
868 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
869 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
870 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
871 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
874 procedure ProcSelectModel(Sender
: TGUIControl
);
879 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
880 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
881 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
883 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
884 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
885 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
887 ProcChangeColor(nil);
890 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
902 wad
:= TWADFile
.Create
;
903 if wad
.ReadFile(GameWAD
) then
904 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
909 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
911 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
912 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
913 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
914 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
916 if g_Texture_Get('FONT_STD', ID
) then
917 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
922 if cfglen
<> 0 then FreeMem(cfgdata
);
925 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
931 cfgdata
, fntdata
: Pointer;
932 cfglen
, fntlen
: Integer;
940 wad
:= TWADFile
.Create
;
941 if wad
.ReadFile(GameWAD
) then
943 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
944 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
950 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
951 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
952 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
954 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
955 FontID
:= e_CharFont_Create(spc
);
959 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
960 if chrwidth
= 0 then Continue
;
962 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
964 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
970 if cfglen
<> 0 then FreeMem(cfgdata
);
971 if fntlen
<> 0 then FreeMem(fntdata
);
974 procedure MenuLoadData();
976 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
978 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
979 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
980 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
981 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
982 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
983 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
984 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
985 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
986 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
987 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
988 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
989 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
990 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
991 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
992 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
993 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
994 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
995 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
996 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
997 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
998 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
999 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1000 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1001 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1003 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1004 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1005 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1006 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1007 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1008 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1009 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1012 procedure MenuFreeData();
1014 e_CharFont_Remove(gMenuFont
);
1015 e_CharFont_Remove(gMenuSmallFont
);
1017 g_Texture_Delete('MAINMENU_MARKER1');
1018 g_Texture_Delete('MAINMENU_MARKER2');
1019 g_Texture_Delete('SCROLL_LEFT');
1020 g_Texture_Delete('SCROLL_RIGHT');
1021 g_Texture_Delete('SCROLL_MIDDLE');
1022 g_Texture_Delete('SCROLL_MARKER');
1023 g_Texture_Delete('EDIT_LEFT');
1024 g_Texture_Delete('EDIT_RIGHT');
1025 g_Texture_Delete('EDIT_MIDDLE');
1026 g_Texture_Delete('BOX1');
1027 g_Texture_Delete('BOX2');
1028 g_Texture_Delete('BOX3');
1029 g_Texture_Delete('BOX4');
1030 g_Texture_Delete('BOX5');
1031 g_Texture_Delete('BOX6');
1032 g_Texture_Delete('BOX7');
1033 g_Texture_Delete('BOX8');
1034 g_Texture_Delete('BOX9');
1035 g_Texture_Delete('BSCROLL_UP_A');
1036 g_Texture_Delete('BSCROLL_UP_U');
1037 g_Texture_Delete('BSCROLL_DOWN_A');
1038 g_Texture_Delete('BSCROLL_DOWN_U');
1039 g_Texture_Delete('BSCROLL_MIDDLE');
1040 g_Texture_Delete('NOPIC');
1042 g_Sound_Delete('MENU_SELECT');
1043 g_Sound_Delete('MENU_OPEN');
1044 g_Sound_Delete('MENU_CLOSE');
1045 g_Sound_Delete('MENU_CHANGE');
1046 g_Sound_Delete('SCROLL_ADD');
1047 g_Sound_Delete('SCROLL_SUB');
1048 g_Sound_Delete('SOUND_PLAYER_FALL');
1051 procedure ProcAuthorsMenu();
1053 gMusic
.SetByName('MUSIC_INTERMUS');
1057 procedure ProcExitMenuKeyDown (yes
: Boolean);
1060 snd
: TPlayableSound
;
1065 g_Game_StopAllSounds(True);
1066 case (Random(18)) of
1067 0: s
:= 'SOUND_MONSTER_PAIN';
1068 1: s
:= 'SOUND_MONSTER_DIE_3';
1069 2: s
:= 'SOUND_MONSTER_SLOP';
1070 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1071 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1072 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1073 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1074 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1075 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1076 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1077 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1078 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1079 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1080 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1081 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1082 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1083 else s
:= 'SOUND_PLAYER_FALL';
1085 snd
:= TPlayableSound
.Create();
1086 res
:= snd
.SetByName(s
);
1087 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1091 while snd
.IsPlaying() do begin end;
1099 procedure ProcLoadMenu();
1104 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1108 procedure ProcSaveMenu();
1113 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1117 procedure ProcSaveGame(Sender
: TGUIControl
);
1121 if g_Game_IsNet
then Exit
;
1122 if g_Game_IsTestMap
then Exit
;
1123 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1124 g_Game_PauseAllSounds(True);
1125 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1127 g_ActiveWindow
:= nil;
1128 g_Game_Pause(False);
1131 procedure ProcLoadGame(Sender
: TGUIControl
);
1135 if g_Game_IsNet
then Exit
;
1136 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1137 if g_LoadGame(a
) then
1138 g_Game_PauseAllSounds(False)
1139 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1140 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1143 procedure ProcSingle1Player();
1145 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1148 procedure ProcSingle2Players();
1150 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1153 procedure ProcSelectMapMenu();
1156 wad_lb
: TGUIFileListBox
;
1157 map_lb
: TGUIListBox
;
1160 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1161 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1162 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1164 if wad_lb
.SelectedItem() <> '' then
1165 map
:= map_lb
.SelectedItem()
1169 wad_lb
.UpdateFileList();
1172 if wad_lb
.SelectedItem() <> '' then
1175 map_lb
.SelectItem(map
);
1177 if map_lb
.SelectedItem() <> '' then
1181 g_GUI_ShowWindow('SelectMapMenu');
1184 procedure ProcSelectCampaignMenu();
1187 wad_lb
: TGUIFileListBox
;
1189 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1190 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1192 wad_lb
.UpdateFileList();
1194 if wad_lb
.SelectedItem() <> '' then
1195 ProcSelectCampaignWAD(nil);
1198 procedure ProcSetMap();
1200 wad
, map
, res
: String;
1202 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1204 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1205 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1208 if (wad
= '') or (map
= '') then
1211 res
:= wad
+':\'+map
;
1213 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1214 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1217 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1221 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1223 g_Sound_SetupAllVolumes(
1224 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1225 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1229 procedure ProcOptionsPlayersMIMenu();
1234 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1236 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1238 if a
= '' then Exit
;
1240 b
:= g_PlayerModel_GetInfo(a
);
1242 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1244 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1245 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1246 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1248 if b
.HaveWeapon
then
1249 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1251 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1254 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1257 procedure ProcOptionsPlayersAnim();
1261 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1266 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1269 Model
.GetCurrentAnimation
.Loop
:= True;
1270 Model
.GetCurrentAnimationMask
.Loop
:= True;
1274 procedure ProcOptionsPlayersWeap();
1278 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1283 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1287 procedure ProcOptionsPlayersRot();
1291 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1292 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1293 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1296 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1300 g_Options_SetDefault();
1306 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1308 if yes
then ReadOptions();
1312 procedure ProcAuthorsClose();
1314 gMusic
.SetByName('MUSIC_MENU');
1316 gState
:= STATE_MENU
;
1319 procedure ProcGMClose();
1321 g_Game_InGameMenu(False);
1324 procedure ProcGMShow();
1329 if (gGameSettings
.GameType
= GT_SINGLE
) and
1330 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1331 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1332 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1334 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1335 if g_Game_IsTestMap
then
1336 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1337 TGUIMainMenu(g_ActiveWindow
.GetControl(
1338 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1341 procedure ProcChangePlayers();
1343 TeamGame
, Spectator
, AddTwo
: Boolean;
1344 P1Team
{, P2Team}: Byte;
1345 bP2
: TGUITextButton
;
1347 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1348 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1349 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1350 P1Team
:= TEAM_NONE
;
1351 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1353 //P2Team := TEAM_NONE;
1354 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1356 TGUIMainMenu(g_ActiveWindow
.GetControl(
1357 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1358 TGUIMainMenu(g_ActiveWindow
.GetControl(
1359 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1360 TGUIMainMenu(g_ActiveWindow
.GetControl(
1361 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1363 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1364 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1365 bP2
.Enabled
:= AddTwo
and not Spectator
;
1367 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1369 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1370 if gPlayer2
= nil then
1371 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1373 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1375 TGUIMainMenu(g_ActiveWindow
.GetControl(
1376 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1379 procedure ProcJoinRed();
1381 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1383 if g_Game_IsServer
then
1385 if gPlayer1
= nil then
1386 g_Game_AddPlayer(TEAM_RED
)
1389 if gPlayer1
.Team
<> TEAM_RED
then
1391 gPlayer1
.SwitchTeam
;
1392 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1395 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1400 gPlayer1Settings
.Team
:= TEAM_RED
;
1401 MC_SEND_PlayerSettings
;
1402 if gPlayer1
= nil then
1403 g_Game_AddPlayer(TEAM_RED
);
1405 g_ActiveWindow
:= nil;
1406 g_Game_Pause(False);
1409 procedure ProcJoinBlue();
1411 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1413 if g_Game_IsServer
then
1415 if gPlayer1
= nil then
1416 g_Game_AddPlayer(TEAM_BLUE
)
1419 if gPlayer1
.Team
<> TEAM_BLUE
then
1421 gPlayer1
.SwitchTeam
;
1422 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1425 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1430 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1431 MC_SEND_PlayerSettings
;
1432 if gPlayer1
= nil then
1433 g_Game_AddPlayer(TEAM_BLUE
);
1435 g_ActiveWindow
:= nil;
1436 g_Game_Pause(False);
1439 procedure ProcJoinGame();
1441 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1443 if gPlayer1
= nil then
1445 g_ActiveWindow
:= nil;
1446 g_Game_Pause(False);
1449 procedure ProcSwitchP2();
1451 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1453 if gPlayer1
= nil then
1455 if gPlayer2
= nil then
1458 g_Game_RemovePlayer();
1459 g_ActiveWindow
:= nil;
1460 g_Game_Pause(False);
1463 procedure ProcSpectate();
1465 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1468 g_ActiveWindow
:= nil;
1469 g_Game_Pause(False);
1472 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1474 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1477 procedure ProcEndMenuKeyDown (yes
: Boolean);
1479 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1482 procedure ProcSetRussianLanguage();
1484 if gLanguage
<> LANGUAGE_RUSSIAN
then
1486 gLanguage
:= LANGUAGE_RUSSIAN
;
1487 gLanguageChange
:= True;
1488 gAskLanguage
:= False;
1490 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1492 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1497 procedure ProcSetEnglishLanguage();
1499 if gLanguage
<> LANGUAGE_ENGLISH
then
1501 gLanguage
:= LANGUAGE_ENGLISH
;
1502 gLanguageChange
:= True;
1503 gAskLanguage
:= False;
1505 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1507 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1512 procedure ReadGameSettings();
1516 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1518 with gGameSettings
do
1520 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1521 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1526 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1527 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1528 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1530 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1531 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1532 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1535 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1540 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1542 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1543 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1544 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1545 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1546 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1547 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1548 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1549 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1553 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1554 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1559 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1560 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1565 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1566 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1571 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1572 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1577 procedure ProcApplyGameSet();
1581 stat
: TPlayerStatArray
;
1583 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1585 if not g_Game_IsServer
then Exit
;
1587 with gGameSettings
do
1589 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1591 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1592 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1594 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1597 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1599 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1605 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1607 TimeLimit
:= Max(n
, b
);
1611 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1613 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1620 if GameMode
= GM_DM
then
1622 stat
:= g_Player_GetStats();
1624 for a
:= 0 to High(stat
) do
1625 if stat
[a
].Frags
> b
then
1629 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1631 GoalLimit
:= Max(n
, b
);
1635 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1637 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1638 if n
< 0 then n
:= 0;
1639 if n
> 255 then n
:= 255;
1645 stat
:= g_Player_GetStats();
1647 for a
:= 0 to High(stat
) do
1648 if stat
[a
].Lives
> b
then
1651 MaxLives
:= Max(n
, b
);
1655 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1657 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1660 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1661 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1665 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1666 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1670 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1671 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1677 if g_Game_IsNet
then MH_SEND_GameSettings
;
1680 procedure ProcVideoOptionsRes();
1686 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1688 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1689 IntToStr(gScreenWidth
) +
1690 ' x ' + IntToStr(gScreenHeight
) +
1691 ', ' + IntToStr(gBPP
) + ' bpp';
1693 with TGUIListBox(menu
.GetControl('lsResolution')) do
1695 list
:= GetDisplayModes(gBPP
, SR
);
1706 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1713 procedure ProcApplyVideoOptions();
1716 Fullscreen
: Boolean;
1717 SWidth
, SHeight
: Integer;
1720 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1722 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1723 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1725 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1727 if (SWidth
<> gScreenWidth
) or
1728 (SHeight
<> gScreenHeight
) or
1729 (Fullscreen
<> gFullscreen
) then
1731 gResolutionChange
:= True;
1732 gRC_Width
:= SWidth
;
1733 gRC_Height
:= SHeight
;
1734 gRC_FullScreen
:= Fullscreen
;
1735 gRC_Maximized
:= gWinMaximized
;
1738 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1742 procedure ProcSetFirstRussianLanguage();
1744 gLanguage
:= LANGUAGE_RUSSIAN
;
1745 gLanguageChange
:= True;
1746 gAskLanguage
:= False;
1748 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1751 procedure ProcSetFirstEnglishLanguage();
1753 gLanguage
:= LANGUAGE_ENGLISH
;
1754 gLanguageChange
:= True;
1755 gAskLanguage
:= False;
1757 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1760 procedure ProcRecallAddress();
1762 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1764 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1765 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1769 procedure CreateFirstLanguageMenu();
1773 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1775 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1777 Name
:= 'mmFirstLanguageMenu';
1778 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1779 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1782 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1783 Menu
.MainWindow
:= True;
1784 g_GUI_AddWindow(Menu
);
1787 procedure g_Menu_AskLanguage();
1789 CreateFirstLanguageMenu();
1790 g_GUI_ShowWindow('FirstLanguageMenu');
1793 procedure CreatePlayerOptionsMenu(s
: String);
1798 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1800 a
:= _lc
[I_MENU_PLAYER_1
]
1802 a
:= _lc
[I_MENU_PLAYER_2
];
1803 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1805 Name
:= 'mOptionsPlayers'+s
+'Menu';
1806 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1808 Name
:= 'ed'+s
+'Name';
1812 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1814 Name
:= 'sw'+s
+'Team';
1815 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1816 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1818 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1820 Name
:= 'ls'+s
+'Model';
1822 Items
:= g_PlayerModel_GetNames();
1823 OnChange
:= ProcSelectModel
;
1825 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1827 Name
:= 'sc'+s
+'Red';
1829 OnChange
:= ProcChangeColor
;
1831 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1833 Name
:= 'sc'+s
+'Green';
1835 OnChange
:= ProcChangeColor
;
1837 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1839 Name
:= 'sc'+s
+'Blue';
1841 OnChange
:= ProcChangeColor
;
1844 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1845 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1846 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1847 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1849 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1851 Name
:= 'mv'+s
+'Model';
1852 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1853 Y
:= GetControl('ls'+s
+'Model').Y
;
1856 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1857 g_GUI_AddWindow(Menu
);
1860 procedure CreateAllMenus();
1864 a
, cx
, _y
, i
: Integer;
1867 Menu
:= TGUIWindow
.Create('MainMenu');
1868 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1870 Name
:= 'mmMainMenu';
1871 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1872 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1873 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1874 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1875 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1876 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1878 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1880 Color
:= _RGB(255, 255, 255);
1881 X
:= gScreenWidth
-GetWidth
-8;
1882 Y
:= gScreenHeight
-GetHeight
-8;
1884 Menu
.DefControl
:= 'mmMainMenu';
1885 Menu
.MainWindow
:= True;
1886 g_GUI_AddWindow(Menu
);
1888 Menu
:= TGUIWindow
.Create('NewGameMenu');
1889 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1891 Name
:= 'mmNewGameMenu';
1892 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1893 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1894 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1895 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1897 Menu
.DefControl
:= 'mmNewGameMenu';
1898 g_GUI_AddWindow(Menu
);
1900 Menu
:= TGUIWindow
.Create('NetGameMenu');
1901 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1903 Name
:= 'mmNetGameMenu';
1904 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1905 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1907 Menu
.DefControl
:= 'mmNetGameMenu';
1908 g_GUI_AddWindow(Menu
);
1910 Menu
:= TGUIWindow
.Create('NetServerMenu');
1911 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1913 Name
:= 'mNetServerMenu';
1914 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1916 Name
:= 'edSrvName';
1917 OnlyDigits
:= False;
1920 Text := NetServerName
;
1922 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1924 Name
:= 'edSrvPassword';
1925 OnlyDigits
:= False;
1928 Text := NetPassword
;
1930 with AddEdit(_lc
[I_NET_PORT
]) do
1936 Text := IntToStr(NetPort
);
1938 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1940 Name
:= 'edMaxPlayers';
1944 Text := IntToStr(NetMaxClients
);
1946 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1948 Name
:= 'swUseMaster';
1949 AddItem(_lc
[I_MENU_YES
]);
1950 AddItem(_lc
[I_MENU_NO
]);
1951 if NetUseMaster
then
1957 with AddLabel(_lc
[I_MENU_MAP
]) do
1962 OnClick
:= @ProcSelectMapMenu
;
1964 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1966 Name
:= 'swGameMode';
1967 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1968 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1969 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1970 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1971 case g_Game_TextToMode(gnGameMode
) of
1973 GM_DM
: ItemIndex
:= 0;
1974 GM_TDM
: ItemIndex
:= 1;
1975 GM_CTF
: ItemIndex
:= 2;
1977 GM_COOP
: ItemIndex
:= 3;
1979 OnChange
:= ProcSwitchMonstersNet
;
1981 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1983 Name
:= 'edTimeLimit';
1987 if gnTimeLimit
> 0 then
1988 Text := IntToStr(gnTimeLimit
);
1990 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1992 Name
:= 'edGoalLimit';
1996 if gnGoalLimit
> 0 then
1997 Text := IntToStr(gnGoalLimit
);
1999 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2001 Name
:= 'edMaxLives';
2005 if gnMaxLives
> 0 then
2006 Text := IntToStr(gnMaxLives
);
2008 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2010 Name
:= 'swPlayers';
2011 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2012 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2013 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2014 ItemIndex
:= gnPlayers
;
2016 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2018 Name
:= 'swTeamDamage';
2019 AddItem(_lc
[I_MENU_YES
]);
2020 AddItem(_lc
[I_MENU_NO
]);
2021 if gnTeamDamage
then
2026 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2028 Name
:= 'swEnableExits';
2029 AddItem(_lc
[I_MENU_YES
]);
2030 AddItem(_lc
[I_MENU_NO
]);
2036 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2038 Name
:= 'swWeaponStay';
2039 AddItem(_lc
[I_MENU_YES
]);
2040 AddItem(_lc
[I_MENU_NO
]);
2041 if gnWeaponStay
then
2046 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2048 Name
:= 'swMonsters';
2049 AddItem(_lc
[I_MENU_YES
]);
2050 AddItem(_lc
[I_MENU_NO
]);
2056 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2059 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2060 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2061 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2063 if gnBotsVS
= 'Players' then
2065 if gnBotsVS
= 'Monsters' then
2069 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2073 Menu
.DefControl
:= 'mNetServerMenu';
2074 g_GUI_AddWindow(Menu
);
2076 Menu
:= TGUIWindow
.Create('NetClientMenu');
2077 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2079 Name
:= 'mNetClientMenu';
2081 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2084 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2090 Text := 'localhost';
2092 with AddEdit(_lc
[I_NET_PORT
]) do
2100 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2103 OnlyDigits
:= False;
2110 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2114 Menu
.DefControl
:= 'mNetClientMenu';
2115 g_GUI_AddWindow(Menu
);
2117 Menu
:= TGUIWindow
.Create('LoadMenu');
2118 Menu
.OnShow
:= ProcLoadMenu
;
2119 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2121 Name
:= 'mmLoadMenu';
2126 Name
:= 'edSlot'+IntToStr(a
);
2129 OnEnter
:= ProcLoadGame
;
2132 Menu
.DefControl
:= 'mmLoadMenu';
2133 g_GUI_AddWindow(Menu
);
2135 Menu
:= TGUIWindow
.Create('SaveMenu');
2136 Menu
.OnShow
:= ProcSaveMenu
;
2137 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2139 Name
:= 'mmSaveMenu';
2144 Name
:= 'edSlot'+IntToStr(a
);
2147 OnChange
:= ProcSaveGame
;
2150 Menu
.DefControl
:= 'mmSaveMenu';
2151 g_GUI_AddWindow(Menu
);
2153 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2154 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2156 Name
:= 'mCustomGameMenu';
2157 with AddLabel(_lc
[I_MENU_MAP
]) do
2162 OnClick
:= @ProcSelectMapMenu
;
2164 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2166 Name
:= 'swGameMode';
2167 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2168 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2169 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2170 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2171 case g_Game_TextToMode(gcGameMode
) of
2173 GM_DM
: ItemIndex
:= 0;
2174 GM_TDM
: ItemIndex
:= 1;
2175 GM_CTF
: ItemIndex
:= 2;
2177 GM_COOP
: ItemIndex
:= 3;
2179 OnChange
:= ProcSwitchMonstersCustom
;
2181 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2183 Name
:= 'edTimeLimit';
2187 if gcTimeLimit
> 0 then
2188 Text := IntToStr(gcTimeLimit
);
2190 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2192 Name
:= 'edGoalLimit';
2196 if gcGoalLimit
> 0 then
2197 Text := IntToStr(gcGoalLimit
);
2199 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2201 Name
:= 'edMaxLives';
2205 if gcMaxLives
> 0 then
2206 Text := IntToStr(gcMaxLives
);
2208 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2210 Name
:= 'swPlayers';
2211 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2212 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2213 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2214 ItemIndex
:= gcPlayers
;
2216 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2218 Name
:= 'swTeamDamage';
2219 AddItem(_lc
[I_MENU_YES
]);
2220 AddItem(_lc
[I_MENU_NO
]);
2221 if gcTeamDamage
then
2226 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2228 Name
:= 'swEnableExits';
2229 AddItem(_lc
[I_MENU_YES
]);
2230 AddItem(_lc
[I_MENU_NO
]);
2236 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2238 Name
:= 'swWeaponStay';
2239 AddItem(_lc
[I_MENU_YES
]);
2240 AddItem(_lc
[I_MENU_NO
]);
2241 if gcWeaponStay
then
2246 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2248 Name
:= 'swMonsters';
2249 AddItem(_lc
[I_MENU_YES
]);
2250 AddItem(_lc
[I_MENU_NO
]);
2256 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2259 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2260 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2261 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2263 if gcBotsVS
= 'Players' then
2265 if gcBotsVS
= 'Monsters' then
2269 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2273 Menu
.DefControl
:= 'mCustomGameMenu';
2274 g_GUI_AddWindow(Menu
);
2276 Menu
:= TGUIWindow
.Create('CampaignMenu');
2277 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2279 Name
:= 'mCampaignMenu';
2288 with AddFileList('', 15, 4) do
2291 OnChange
:= ProcSelectCampaignWAD
;
2295 FileMask
:= '*.wad|*.pk3|*.zip';
2296 SetBase(MapsDir
+'megawads/');
2299 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2301 Name
:= 'lbWADName';
2305 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2307 Name
:= 'lbWADAuthor';
2311 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2312 with AddMemo('', 15, 3) do
2314 Name
:= 'meWADDescription';
2315 Color
:= MENU_ITEMSCTRL_COLOR
;
2317 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2319 Name
:= 'swPlayers';
2320 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2321 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2324 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2328 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2330 Name
:= 'mpWADImage';
2331 DefaultRes
:= 'NOPIC';
2332 X
:= GetControl('lsWAD').X
+4;
2333 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2336 Menu
.DefControl
:= 'mCampaignMenu';
2337 g_GUI_AddWindow(Menu
);
2339 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2340 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2342 Name
:= 'mSelectMapMenu';
2343 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2346 OnChange
:= ProcSelectWAD
;
2350 FileMask
:= '*.wad|*.pk3|*.zip';
2353 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2357 OnChange
:= ProcSelectMap
;
2360 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2362 Name
:= 'lbMapName';
2366 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2368 Name
:= 'lbMapAuthor';
2372 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2374 Name
:= 'lbMapSize';
2378 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2380 Name
:= 'meMapDescription';
2385 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2387 Name
:= 'mpMapPreview';
2388 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2389 Y
:= GetControl('lsMapWAD').Y
;
2391 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2393 Name
:= 'lbMapScale';
2396 Color
:= MENU_ITEMSCTRL_COLOR
;
2397 X
:= GetControl('lsMapWAD').X
+
2398 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2399 2 + MAPPREVIEW_WIDTH
*4;
2400 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2403 Menu
.OnClose
:= ProcSetMap
;
2404 Menu
.DefControl
:= 'mSelectMapMenu';
2405 g_GUI_AddWindow(Menu
);
2407 Menu
:= TGUIWindow
.Create('OptionsMenu');
2408 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2410 Name
:= 'mmOptionsMenu';
2411 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2412 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2413 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2414 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2415 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2416 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2418 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2419 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2421 Menu
.OnClose
:= ProcApplyOptions
;
2422 Menu
.DefControl
:= 'mmOptionsMenu';
2423 g_GUI_AddWindow(Menu
);
2425 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2426 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2427 g_GUI_AddWindow(Menu
);
2429 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2430 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2432 Name
:= 'mOptionsVideoMenu';
2433 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2434 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2440 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2443 AddItem(_lc
[I_MENU_YES
]);
2444 AddItem(_lc
[I_MENU_NO
]);
2446 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2448 Name
:= 'swTextureFilter';
2449 AddItem(_lc
[I_MENU_YES
]);
2450 AddItem(_lc
[I_MENU_NO
]);
2452 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2454 Name
:= 'swLegacyNPOT';
2455 AddItem(_lc
[I_MENU_NO
]);
2456 AddItem(_lc
[I_MENU_YES
]);
2459 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2462 Menu
.DefControl
:= 'mOptionsVideoMenu';
2463 g_GUI_AddWindow(Menu
);
2465 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2466 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2468 Name
:= 'mOptionsVideoResMenu';
2469 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2471 Name
:= 'lbCurrentRes';
2475 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2477 Name
:= 'lsResolution';
2480 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2482 Name
:= 'swFullScreen';
2483 AddItem(_lc
[I_MENU_YES
]);
2484 AddItem(_lc
[I_MENU_NO
]);
2487 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2490 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2491 g_GUI_AddWindow(Menu
);
2493 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2494 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2496 Name
:= 'mOptionsSoundMenu';
2497 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2499 Name
:= 'scMusicLevel';
2501 OnChange
:= ProcChangeSoundSettings
;
2503 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2505 Name
:= 'scSoundLevel';
2507 OnChange
:= ProcChangeSoundSettings
;
2509 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2511 Name
:= 'scMaxSimSounds';
2514 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2516 Name
:= 'swAnnouncer';
2517 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2518 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2519 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2520 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2522 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2523 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2525 Name
:= 'swSoundEffects';
2526 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2527 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2529 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2531 Name
:= 'swInactiveSounds';
2532 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2533 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2537 Menu
.DefControl
:= 'mOptionsSoundMenu';
2538 g_GUI_AddWindow(Menu
);
2540 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2541 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2543 Name
:= 'mOptionsGameMenu';
2544 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2546 Name
:= 'scParticlesCount';
2549 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2551 Name
:= 'swBloodCount';
2552 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2553 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2554 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2555 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2556 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2558 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2560 Name
:= 'scShellsMax';
2563 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2565 Name
:= 'scGibsMax';
2568 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2570 Name
:= 'scCorpsesMax';
2573 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2575 Name
:= 'swGibsCount';
2576 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2577 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2578 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2579 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2580 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2582 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2584 Name
:= 'swCorpseType';
2585 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2586 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2588 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2590 Name
:= 'swGibsType';
2591 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2592 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2594 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2596 Name
:= 'swBloodType';
2597 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2598 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2600 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2602 Name
:= 'swScreenFlash';
2603 AddItem(_lc
[I_MENU_NO
]);
2604 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2605 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2607 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2609 Name
:= 'swBackground';
2610 AddItem(_lc
[I_MENU_YES
]);
2611 AddItem(_lc
[I_MENU_NO
]);
2613 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2615 Name
:= 'swMessages';
2616 AddItem(_lc
[I_MENU_YES
]);
2617 AddItem(_lc
[I_MENU_NO
]);
2619 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2621 Name
:= 'swRevertPlayers';
2622 AddItem(_lc
[I_MENU_YES
]);
2623 AddItem(_lc
[I_MENU_NO
]);
2625 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2627 Name
:= 'swChatBubble';
2628 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2629 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2630 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2631 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2632 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2636 Menu
.DefControl
:= 'mOptionsGameMenu';
2637 g_GUI_AddWindow(Menu
);
2639 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2640 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2642 Name
:= 'mOptionsControlsMenu';
2643 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2644 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2645 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2646 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2647 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2649 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2650 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2651 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2652 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2653 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2654 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2656 if e_JoysticksAvailable
<> 0 then
2657 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2659 Menu
.DefControl
:= 'mOptionsControlsMenu';
2660 g_GUI_AddWindow(Menu
);
2662 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2663 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2665 Name
:= 'mOptionsControlsP1Menu';
2666 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2667 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2668 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2669 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2670 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2671 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2672 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2673 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2674 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2675 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2677 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2678 g_GUI_AddWindow(Menu
);
2680 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2681 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2683 Name
:= 'mOptionsControlsP1MenuWeapons';
2684 for i
:= WP_FIRST
to WP_LAST
do
2685 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2686 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2688 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2689 g_GUI_AddWindow(Menu
);
2691 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2692 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2694 Name
:= 'mOptionsControlsP2Menu';
2695 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2696 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2697 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2698 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2699 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2700 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2701 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2702 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2703 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2704 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2706 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2707 g_GUI_AddWindow(Menu
);
2709 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2710 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2712 Name
:= 'mOptionsControlsP2MenuWeapons';
2713 for i
:= WP_FIRST
to WP_LAST
do
2714 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2715 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2717 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2718 g_GUI_AddWindow(Menu
);
2720 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2721 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2723 Name
:= 'mOptionsControlsJoystickMenu';
2724 for i
:= 0 to e_JoysticksAvailable
-1 do
2725 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2727 Name
:= 'scDeadzone' + IntToStr(i
);
2731 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2732 g_GUI_AddWindow(Menu
);
2734 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2735 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2737 Name
:= 'mOptionsPlayersMenu';
2738 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2739 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2741 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2742 g_GUI_AddWindow(Menu
);
2744 CreatePlayerOptionsMenu('P1');
2745 CreatePlayerOptionsMenu('P2');
2747 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2748 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2750 Name
:= 'mOptionsPlayersMIMenu';
2751 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2756 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2761 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2763 Name
:= 'meComment';
2766 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2767 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2770 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2774 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2775 g_GUI_AddWindow(Menu
);
2777 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2778 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2780 Name
:= 'mOptionsLanguageMenu';
2781 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2782 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2785 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2786 g_GUI_AddWindow(Menu
);
2788 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2789 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2790 g_GUI_AddWindow(Menu
);
2792 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2793 Menu
.BackTexture
:= 'INTER';
2794 Menu
.OnClose
:= ProcAuthorsClose
;
2798 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2800 Color
:= _RGB(255, 0, 0);
2801 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2803 _y
:= _y
+GetHeight();
2805 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2807 Color
:= _RGB(255, 0, 0);
2808 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2810 _y
:= _y
+GetHeight()+32;
2812 // ×òî äåëàë: Êòî äåëàë
2813 cx
:= gScreenWidth
div 2 - 320 + 64;
2814 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2816 Color
:= _RGB(255, 0, 0);
2821 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2823 Color
:= _RGB(255, 255, 255);
2828 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2830 Color
:= _RGB(255, 0, 0);
2835 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2837 Color
:= _RGB(255, 255, 255);
2842 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2844 Color
:= _RGB(255, 255, 255);
2849 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2851 Color
:= _RGB(255, 0, 0);
2856 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2858 Color
:= _RGB(255, 255, 255);
2863 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2865 Color
:= _RGB(255, 0, 0);
2870 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2872 Color
:= _RGB(255, 255, 255);
2875 _y
:= gScreenHeight
- 128;
2878 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2880 Color
:= _RGB(255, 0, 0);
2885 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2887 Color
:= _RGB(255, 255, 255);
2890 _y
:= _y
+GetHeight();
2892 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2894 Color
:= _RGB(255, 255, 255);
2897 _y
:= _y
+GetHeight();
2899 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2901 Color
:= _RGB(255, 255, 255);
2904 _y
:= gScreenHeight
- 32;
2906 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2908 Color
:= _RGB(255, 0, 0);
2909 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2912 g_GUI_AddWindow(Menu
);
2914 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2915 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2916 g_GUI_AddWindow(Menu
);
2918 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2919 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2921 Name
:= 'mmGameSingleMenu';
2922 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2923 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2924 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2925 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2926 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2927 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2929 Menu
.DefControl
:= 'mmGameSingleMenu';
2930 Menu
.MainWindow
:= True;
2931 Menu
.OnClose
:= ProcGMClose
;
2932 Menu
.OnShow
:= ProcGMShow
;
2933 g_GUI_AddWindow(Menu
);
2935 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2936 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2937 g_GUI_AddWindow(Menu
);
2939 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2940 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2941 g_GUI_AddWindow(Menu
);
2943 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2944 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2946 Name
:= 'mmGameCustomMenu';
2947 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2948 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2949 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2950 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2951 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2952 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2953 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2955 Menu
.DefControl
:= 'mmGameCustomMenu';
2956 Menu
.MainWindow
:= True;
2957 Menu
.OnClose
:= ProcGMClose
;
2958 Menu
.OnShow
:= ProcGMShow
;
2959 g_GUI_AddWindow(Menu
);
2961 Menu
:= TGUIWindow
.Create('GameServerMenu');
2962 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2964 Name
:= 'mmGameServerMenu';
2965 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2966 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2967 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2968 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2969 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2971 Menu
.DefControl
:= 'mmGameServerMenu';
2972 Menu
.MainWindow
:= True;
2973 Menu
.OnClose
:= ProcGMClose
;
2974 Menu
.OnShow
:= ProcGMShow
;
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= TGUIWindow
.Create('GameClientMenu');
2978 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2980 Name
:= 'mmGameClientMenu';
2981 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2982 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2983 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2985 Menu
.DefControl
:= 'mmGameClientMenu';
2986 Menu
.MainWindow
:= True;
2987 Menu
.OnClose
:= ProcGMClose
;
2988 Menu
.OnShow
:= ProcGMShow
;
2989 g_GUI_AddWindow(Menu
);
2991 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2992 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2994 Name
:= 'mClientPasswordMenu';
2995 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3003 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3006 Menu
.DefControl
:= 'mClientPasswordMenu';
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3012 Name
:= 'mGameSetGameMenu';
3013 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3015 Name
:= 'swTeamDamage';
3016 AddItem(_lc
[I_MENU_YES
]);
3017 AddItem(_lc
[I_MENU_NO
]);
3020 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3022 Name
:= 'edTimeLimit';
3027 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3029 Name
:= 'edGoalLimit';
3034 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3036 Name
:= 'edMaxLives';
3041 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3044 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3045 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3046 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3052 Menu
.DefControl
:= 'mGameSetGameMenu';
3053 Menu
.OnClose
:= ProcApplyGameSet
;
3054 g_GUI_AddWindow(Menu
);
3056 Menu
:= TGUIWindow
.Create('TeamMenu');
3057 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3059 Name
:= 'mmTeamMenu';
3060 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3061 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3062 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3063 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3064 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3066 Menu
.DefControl
:= 'mmTeamMenu';
3067 Menu
.OnShow
:= ProcChangePlayers
;
3068 g_GUI_AddWindow(Menu
);
3071 procedure g_Menu_Show_SaveMenu();
3073 if g_Game_IsTestMap
then
3075 if gGameSettings
.GameType
= GT_SINGLE
then
3076 g_GUI_ShowWindow('GameSingleMenu')
3079 if g_Game_IsClient
then
3082 if g_Game_IsNet
then
3085 g_GUI_ShowWindow('GameCustomMenu');
3087 g_GUI_ShowWindow('SaveMenu');
3088 g_Sound_PlayEx('MENU_OPEN');
3091 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3093 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3094 if gGameSettings
.GameType
= GT_SINGLE
then
3096 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3100 if g_Game_IsClient
then exit
;
3101 if g_Game_IsNet
then exit
;
3102 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3104 g_GUI_ShowWindow('LoadMenu');
3105 g_Sound_PlayEx('MENU_OPEN');
3108 procedure g_Menu_Show_GameSetGame();
3110 if gGameSettings
.GameType
= GT_SINGLE
then
3111 g_GUI_ShowWindow('GameSingleMenu')
3114 if g_Game_IsClient
then
3117 if g_Game_IsNet
then
3118 g_GUI_ShowWindow('GameServerMenu')
3120 g_GUI_ShowWindow('GameCustomMenu');
3123 g_GUI_ShowWindow('GameSetGameMenu');
3124 g_Sound_PlayEx('MENU_OPEN');
3127 procedure g_Menu_Show_OptionsVideo();
3129 if gGameSettings
.GameType
= GT_SINGLE
then
3130 g_GUI_ShowWindow('GameSingleMenu')
3133 if g_Game_IsClient
then
3134 g_GUI_ShowWindow('GameClientMenu')
3136 if g_Game_IsNet
then
3137 g_GUI_ShowWindow('GameServerMenu')
3139 g_GUI_ShowWindow('GameCustomMenu');
3142 g_GUI_ShowWindow('OptionsMenu');
3143 g_GUI_ShowWindow('OptionsVideoMenu');
3144 g_Sound_PlayEx('MENU_OPEN');
3147 procedure g_Menu_Show_OptionsSound();
3149 if gGameSettings
.GameType
= GT_SINGLE
then
3150 g_GUI_ShowWindow('GameSingleMenu')
3153 if g_Game_IsClient
then
3154 g_GUI_ShowWindow('GameClientMenu')
3156 if g_Game_IsNet
then
3157 g_GUI_ShowWindow('GameServerMenu')
3159 g_GUI_ShowWindow('GameCustomMenu');
3162 g_GUI_ShowWindow('OptionsMenu');
3163 g_GUI_ShowWindow('OptionsSoundMenu');
3164 g_Sound_PlayEx('MENU_OPEN');
3167 procedure g_Menu_Show_EndGameMenu();
3169 g_GUI_ShowWindow('EndGameMenu');
3170 g_Sound_PlayEx('MENU_OPEN');
3173 procedure g_Menu_Show_QuitGameMenu();
3175 g_GUI_ShowWindow('ExitMenu');
3176 g_Sound_PlayEx('MENU_OPEN');
3179 procedure g_Menu_Init();
3186 procedure g_Menu_Free();
3190 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3195 procedure g_Menu_Reset();
3199 g_GUI_SaveMenuPos();
3200 ex
:= g_GUI_Destroy();
3204 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3209 g_Game_SetDebugMode();
3211 g_GUI_LoadMenuPos();