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/>.
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();
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
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPSTRUCT
, wadreader
, Math
, g_saveload
,
49 e_textures
, 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
196 KeyWeapon
[i
] := TGUIKeyRead(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key
;
199 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
200 with menu
, gGameControls
.P2Control
do
202 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
203 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
204 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
205 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
206 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
207 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
208 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
209 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
210 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
211 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
213 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
214 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
215 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
216 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
217 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
218 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
219 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
220 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
221 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
222 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
225 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
226 with menu
, gGameControls
.P2Control
do
229 KeyWeapon
[i
] := TGUIKeyRead(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key
;
232 if e_JoysticksAvailable
> 0 then
234 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
237 for i
:= 0 to e_JoysticksAvailable
-1 do
238 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
244 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
245 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
246 TEAM_RED
, TEAM_BLUE
);
248 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
250 gPlayer1Settings
.Model
:= Model
.Name
;
251 gPlayer1Settings
.Color
:= Model
.Color
;
254 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
256 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
257 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
258 TEAM_RED
, TEAM_BLUE
);
259 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
261 gPlayer2Settings
.Model
:= Model
.Name
;
262 gPlayer2Settings
.Color
:= Model
.Color
;
265 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
266 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
268 if g_Game_IsServer
then
270 if gPlayer1
<> nil then
272 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
273 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
274 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
275 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
277 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
280 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
283 if gPlayer2
<> nil then
285 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
286 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
287 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
288 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
290 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
295 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
297 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
300 procedure ReadOptions();
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
307 with TGUISwitch(menu
.GetControl('swBPP')) do
313 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
314 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
316 with TGUISwitch(menu
.GetControl('swVSync')) do
317 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
319 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
320 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
322 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
324 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
325 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
326 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
328 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
329 if gMuteWhenInactive
then
334 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
336 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
337 if gSoundEffectsDF
then
342 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
343 with menu
, gGameControls
.P1Control
do
345 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
346 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
347 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
348 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
349 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
350 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
351 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
352 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
353 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
354 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe
;
356 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
357 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
358 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
361 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
362 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
368 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
369 with menu
, gGameControls
.P2Control
do
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
374 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
380 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
382 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
383 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
384 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
385 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
386 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
387 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
394 if e_JoysticksAvailable
> 0 then
396 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
399 for i
:= 0 to e_JoysticksAvailable
-1 do
400 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
404 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
405 with menu
, gGameControls
.GameControls
do
407 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
408 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
409 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
410 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
413 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
415 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
416 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
417 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
418 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
419 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
421 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
424 with TGUISwitch(menu
.GetControl('swBloodType')) do
425 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
427 with TGUISwitch(menu
.GetControl('swCorpseType')) do
428 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
430 with TGUISwitch(menu
.GetControl('swGibsType')) do
431 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
433 with TGUISwitch(menu
.GetControl('swGibsCount')) do
442 with TGUISwitch(menu
.GetControl('swBackGround')) do
443 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
445 with TGUISwitch(menu
.GetControl('swMessages')) do
446 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
448 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
449 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
451 with TGUISwitch(menu
.GetControl('swChatBubble')) do
452 ItemIndex
:= gChatBubble
;
454 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
456 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
457 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
459 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
460 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
462 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
463 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
464 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
466 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
468 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
469 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
471 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
472 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
474 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
475 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
476 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
478 ProcSelectModel(nil);
481 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
483 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
484 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
485 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
487 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
490 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
492 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
493 if TGUISwitch(GetControl('swGameMode')).GetText
= _lc
[I_MENU_GAME_TYPE_COOP
] then
494 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
496 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
499 procedure ProcStartCustomGame();
505 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
507 Map
:= TGUILabel(GetControl('lbMap')).Text;
510 if Pos(':\', Map
) = 0 then
513 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
514 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
515 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
516 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
517 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
519 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
520 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
521 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
522 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
525 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
527 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
529 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
531 Options
:= Options
or GAME_OPTION_MONSTERS
;
532 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
534 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
536 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
537 gcBotsVS
:= 'Monsters';
540 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
541 gcBotsVS
:= 'Everybody';
544 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
545 gcBotsVS
:= 'Players';
552 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
554 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
555 gcMaxLives
, Options
, gcPlayers
);
559 procedure ProcStartNetGame();
565 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
567 Map
:= TGUILabel(GetControl('lbMap')).Text;
570 if Pos(':\', Map
) = 0 then
573 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
574 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
575 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
576 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
577 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
578 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
580 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
581 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
582 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
583 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
586 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
588 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
590 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
592 Options
:= Options
or GAME_OPTION_MONSTERS
;
593 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
595 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
597 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
598 gnBotsVS
:= 'Monsters';
601 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
602 gnBotsVS
:= 'Everybody';
605 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
606 gnBotsVS
:= 'Players';
611 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
612 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
613 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
614 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
615 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
618 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
619 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
621 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
622 Options
, gnPlayers
, 0, NetPort
);
625 procedure ProcConnectNetGame();
629 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
631 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
632 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
633 PW
:= TGUIEdit(GetControl('edPW')).Text;
636 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
637 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
640 procedure ProcEnterPassword();
644 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
646 NetClientIP
:= PromptIP
;
647 NetClientPort
:= PromptPort
;
648 PW
:= TGUIEdit(GetControl('edPW')).Text;
651 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
652 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
655 procedure ProcServerlist();
657 if not NetInitDone
then
659 if (not g_Net_Init()) then
661 g_Console_Add('NET: ERROR: Failed to init ENet!');
668 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
670 gState
:= STATE_SLIST
;
671 g_ActiveWindow
:= nil;
673 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
678 slReturnPressed
:= True;
679 if g_Net_Slist_Fetch(slCurrent
) then
681 if slCurrent
= nil then
682 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
685 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
688 procedure ProcStartCampaign();
694 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
696 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
697 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
704 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
707 procedure ProcSelectMap(Sender
: TGUIControl
);
711 wad
, map
, res
: String;
713 win
:= g_GUI_GetWindow('SelectMapMenu');
714 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
716 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
717 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
719 if (wad
= '') or (map
= '') then
720 begin // Ýòî íå êàðòà
721 TGUILabel(GetControl('lbMapName')).Text := '';
722 TGUILabel(GetControl('lbMapAuthor')).Text := '';
723 TGUILabel(GetControl('lbMapSize')).Text := '';
724 TGUIMemo(GetControl('meMapDescription')).SetText('');
725 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
726 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
732 a
:= g_Map_GetMapInfo(res
);
734 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
735 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
736 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
737 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
738 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
739 TGUILabel(win
.GetControl('lbMapScale')).Text :=
740 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
745 procedure ProcSelectWAD(Sender
: TGUIControl
);
750 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
752 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
754 with TGUIListBox(GetControl('lsMapRes')) do
760 list
:= g_Map_GetMapsList(wad
);
774 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
780 win
:= g_GUI_GetWindow('CampaignMenu');
781 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
783 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
787 TGUILabel(GetControl('lbWADName')).Text := '';
788 TGUILabel(GetControl('lbWADAuthor')).Text := '';
789 TGUIMemo(GetControl('meWADDescription')).SetText('');
792 a
:= g_Game_GetMegaWADInfo(wad
);
794 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
795 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
796 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
798 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
802 fn
:= g_ExtractWadName(a
.pic
);
804 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
806 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
811 procedure ProcChangeColor(Sender
: TGUIControl
);
815 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
816 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
817 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
818 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
819 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
820 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
822 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
823 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
824 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
825 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
826 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
827 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
830 procedure ProcSelectModel(Sender
: TGUIControl
);
835 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
836 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
837 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
839 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
840 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
841 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
843 ProcChangeColor(nil);
846 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
858 wad
:= TWADFile
.Create
;
859 if wad
.ReadFile(GameWAD
) then
860 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
865 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
867 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
868 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
869 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
870 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
872 if g_Texture_Get('FONT_STD', ID
) then
873 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
878 if cfglen
<> 0 then FreeMem(cfgdata
);
881 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
887 cfgdata
, fntdata
: Pointer;
888 cfglen
, fntlen
: Integer;
896 wad
:= TWADFile
.Create
;
897 if wad
.ReadFile(GameWAD
) then
899 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
900 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
906 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
907 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
908 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
910 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
911 FontID
:= e_CharFont_Create(spc
);
915 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
916 if chrwidth
= 0 then Continue
;
918 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
920 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
926 if cfglen
<> 0 then FreeMem(cfgdata
);
927 if fntlen
<> 0 then FreeMem(fntdata
);
930 procedure MenuLoadData();
932 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
934 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
935 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
936 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
937 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
938 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
939 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
940 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
941 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
942 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
943 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
944 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
945 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
946 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
947 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
948 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
949 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
950 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
951 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
952 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
953 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
954 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
955 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
956 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
957 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
959 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
960 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
961 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
962 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
963 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
964 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
965 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
968 procedure MenuFreeData();
970 e_CharFont_Remove(gMenuFont
);
971 e_CharFont_Remove(gMenuSmallFont
);
973 g_Texture_Delete('MAINMENU_MARKER1');
974 g_Texture_Delete('MAINMENU_MARKER2');
975 g_Texture_Delete('SCROLL_LEFT');
976 g_Texture_Delete('SCROLL_RIGHT');
977 g_Texture_Delete('SCROLL_MIDDLE');
978 g_Texture_Delete('SCROLL_MARKER');
979 g_Texture_Delete('EDIT_LEFT');
980 g_Texture_Delete('EDIT_RIGHT');
981 g_Texture_Delete('EDIT_MIDDLE');
982 g_Texture_Delete('BOX1');
983 g_Texture_Delete('BOX2');
984 g_Texture_Delete('BOX3');
985 g_Texture_Delete('BOX4');
986 g_Texture_Delete('BOX5');
987 g_Texture_Delete('BOX6');
988 g_Texture_Delete('BOX7');
989 g_Texture_Delete('BOX8');
990 g_Texture_Delete('BOX9');
991 g_Texture_Delete('BSCROLL_UP_A');
992 g_Texture_Delete('BSCROLL_UP_U');
993 g_Texture_Delete('BSCROLL_DOWN_A');
994 g_Texture_Delete('BSCROLL_DOWN_U');
995 g_Texture_Delete('BSCROLL_MIDDLE');
996 g_Texture_Delete('NOPIC');
998 g_Sound_Delete('MENU_SELECT');
999 g_Sound_Delete('MENU_OPEN');
1000 g_Sound_Delete('MENU_CLOSE');
1001 g_Sound_Delete('MENU_CHANGE');
1002 g_Sound_Delete('SCROLL_ADD');
1003 g_Sound_Delete('SCROLL_SUB');
1004 g_Sound_Delete('SOUND_PLAYER_FALL');
1007 procedure ProcAuthorsMenu();
1009 gMusic
.SetByName('MUSIC_INTERMUS');
1013 procedure ProcExitMenuKeyDown (yes
: Boolean);
1016 snd
: TPlayableSound
;
1021 g_Game_StopAllSounds(True);
1022 case (Random(18)) of
1023 0: s
:= 'SOUND_MONSTER_PAIN';
1024 1: s
:= 'SOUND_MONSTER_DIE_3';
1025 2: s
:= 'SOUND_MONSTER_SLOP';
1026 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1027 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1028 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1029 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1030 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1031 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1032 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1033 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1034 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1035 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1036 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1037 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1038 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1039 else s
:= 'SOUND_PLAYER_FALL';
1041 snd
:= TPlayableSound
.Create();
1042 res
:= snd
.SetByName(s
);
1043 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1047 while snd
.IsPlaying() do begin end;
1055 procedure ProcLoadMenu();
1060 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1064 procedure ProcSaveMenu();
1069 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1073 procedure ProcSaveGame(Sender
: TGUIControl
);
1077 if g_Game_IsNet
then Exit
;
1078 if g_Game_IsTestMap
then Exit
;
1079 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1080 g_Game_PauseAllSounds(True);
1081 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1083 g_ActiveWindow
:= nil;
1084 g_Game_Pause(False);
1087 procedure ProcLoadGame(Sender
: TGUIControl
);
1091 if g_Game_IsNet
then Exit
;
1092 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1093 if g_LoadGame(a
) then
1094 g_Game_PauseAllSounds(False)
1095 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1096 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1099 procedure ProcSingle1Player();
1101 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
1104 procedure ProcSingle2Players();
1106 g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
1109 procedure ProcSelectMapMenu();
1112 wad_lb
: TGUIFileListBox
;
1113 map_lb
: TGUIListBox
;
1116 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1117 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1118 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1120 if wad_lb
.SelectedItem() <> '' then
1121 map
:= map_lb
.SelectedItem()
1125 wad_lb
.UpdateFileList();
1128 if wad_lb
.SelectedItem() <> '' then
1131 map_lb
.SelectItem(map
);
1133 if map_lb
.SelectedItem() <> '' then
1137 g_GUI_ShowWindow('SelectMapMenu');
1140 procedure ProcSelectCampaignMenu();
1143 wad_lb
: TGUIFileListBox
;
1145 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1146 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1148 wad_lb
.UpdateFileList();
1150 if wad_lb
.SelectedItem() <> '' then
1151 ProcSelectCampaignWAD(nil);
1154 procedure ProcSetMap();
1156 wad
, map
, res
: String;
1158 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1160 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1161 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1164 if (wad
= '') or (map
= '') then
1167 res
:= wad
+':\'+map
;
1169 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1170 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1173 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1177 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1179 g_Sound_SetupAllVolumes(
1180 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1181 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1185 procedure ProcOptionsPlayersMIMenu();
1190 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1192 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1194 if a
= '' then Exit
;
1196 b
:= g_PlayerModel_GetInfo(a
);
1198 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1200 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1201 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1202 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1204 if b
.HaveWeapon
then
1205 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1207 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1210 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1213 procedure ProcOptionsPlayersAnim();
1217 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1222 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1225 Model
.GetCurrentAnimation
.Loop
:= True;
1226 Model
.GetCurrentAnimationMask
.Loop
:= True;
1230 procedure ProcOptionsPlayersWeap();
1234 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1239 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1243 procedure ProcOptionsPlayersRot();
1247 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1248 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1249 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1252 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1256 g_Options_SetDefault();
1262 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1264 if yes
then ReadOptions();
1268 procedure ProcAuthorsClose();
1270 gMusic
.SetByName('MUSIC_MENU');
1272 gState
:= STATE_MENU
;
1275 procedure ProcGMClose();
1277 g_Game_InGameMenu(False);
1280 procedure ProcGMShow();
1285 if (gGameSettings
.GameType
= GT_SINGLE
) and
1286 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1287 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1288 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1290 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1291 if g_Game_IsTestMap
then
1292 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1293 TGUIMainMenu(g_ActiveWindow
.GetControl(
1294 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1297 procedure ProcChangePlayers();
1299 TeamGame
, Spectator
, AddTwo
: Boolean;
1300 P1Team
{, P2Team}: Byte;
1301 bP2
: TGUITextButton
;
1303 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1304 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1305 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1306 P1Team
:= TEAM_NONE
;
1307 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1309 //P2Team := TEAM_NONE;
1310 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1312 TGUIMainMenu(g_ActiveWindow
.GetControl(
1313 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1314 TGUIMainMenu(g_ActiveWindow
.GetControl(
1315 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1316 TGUIMainMenu(g_ActiveWindow
.GetControl(
1317 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1319 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1320 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1321 bP2
.Enabled
:= AddTwo
and not Spectator
;
1323 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1325 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1326 if gPlayer2
= nil then
1327 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1329 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1331 TGUIMainMenu(g_ActiveWindow
.GetControl(
1332 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1335 procedure ProcJoinRed();
1337 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1339 if g_Game_IsServer
then
1341 if gPlayer1
= nil then
1342 g_Game_AddPlayer(TEAM_RED
)
1345 if gPlayer1
.Team
<> TEAM_RED
then
1347 gPlayer1
.SwitchTeam
;
1348 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1351 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1356 gPlayer1Settings
.Team
:= TEAM_RED
;
1357 MC_SEND_PlayerSettings
;
1358 if gPlayer1
= nil then
1359 g_Game_AddPlayer(TEAM_RED
);
1361 g_ActiveWindow
:= nil;
1362 g_Game_Pause(False);
1365 procedure ProcJoinBlue();
1367 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1369 if g_Game_IsServer
then
1371 if gPlayer1
= nil then
1372 g_Game_AddPlayer(TEAM_BLUE
)
1375 if gPlayer1
.Team
<> TEAM_BLUE
then
1377 gPlayer1
.SwitchTeam
;
1378 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1381 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1386 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1387 MC_SEND_PlayerSettings
;
1388 if gPlayer1
= nil then
1389 g_Game_AddPlayer(TEAM_BLUE
);
1391 g_ActiveWindow
:= nil;
1392 g_Game_Pause(False);
1395 procedure ProcJoinGame();
1397 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1399 if gPlayer1
= nil then
1401 g_ActiveWindow
:= nil;
1402 g_Game_Pause(False);
1405 procedure ProcSwitchP2();
1407 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1409 if gPlayer1
= nil then
1411 if gPlayer2
= nil then
1414 g_Game_RemovePlayer();
1415 g_ActiveWindow
:= nil;
1416 g_Game_Pause(False);
1419 procedure ProcSpectate();
1421 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1424 g_ActiveWindow
:= nil;
1425 g_Game_Pause(False);
1428 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1430 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1433 procedure ProcEndMenuKeyDown (yes
: Boolean);
1435 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1438 procedure ProcSetRussianLanguage();
1440 if gLanguage
<> LANGUAGE_RUSSIAN
then
1442 gLanguage
:= LANGUAGE_RUSSIAN
;
1443 gLanguageChange
:= True;
1444 gAskLanguage
:= False;
1446 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1448 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1453 procedure ProcSetEnglishLanguage();
1455 if gLanguage
<> LANGUAGE_ENGLISH
then
1457 gLanguage
:= LANGUAGE_ENGLISH
;
1458 gLanguageChange
:= True;
1459 gAskLanguage
:= False;
1461 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1463 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1468 procedure ReadGameSettings();
1472 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1474 with gGameSettings
do
1476 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1477 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1482 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1483 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1484 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1486 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1487 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1488 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1491 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1496 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1498 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1499 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1500 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1501 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1502 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1503 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1504 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1505 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1509 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1510 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1515 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1516 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1521 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1522 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1527 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1528 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1533 procedure ProcApplyGameSet();
1537 stat
: TPlayerStatArray
;
1539 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1541 if not g_Game_IsServer
then Exit
;
1543 with gGameSettings
do
1545 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1547 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1548 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1550 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1553 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1555 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1561 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1563 TimeLimit
:= Max(n
, b
);
1567 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1569 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1576 if GameMode
= GM_DM
then
1578 stat
:= g_Player_GetStats();
1580 for a
:= 0 to High(stat
) do
1581 if stat
[a
].Frags
> b
then
1585 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1587 GoalLimit
:= Max(n
, b
);
1591 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1593 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1594 if n
< 0 then n
:= 0;
1595 if n
> 255 then n
:= 255;
1601 stat
:= g_Player_GetStats();
1603 for a
:= 0 to High(stat
) do
1604 if stat
[a
].Lives
> b
then
1607 MaxLives
:= Max(n
, b
);
1611 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1613 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1616 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1617 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1621 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1622 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1626 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1627 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1633 if g_Game_IsNet
then MH_SEND_GameSettings
;
1636 procedure ProcVideoOptionsRes();
1642 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1644 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1645 IntToStr(gScreenWidth
) +
1646 ' x ' + IntToStr(gScreenHeight
) +
1647 ', ' + IntToStr(gBPP
) + ' bpp';
1649 with TGUIListBox(menu
.GetControl('lsResolution')) do
1651 list
:= GetDisplayModes(gBPP
, SR
);
1662 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1669 procedure ProcApplyVideoOptions();
1672 Fullscreen
: Boolean;
1673 SWidth
, SHeight
: Integer;
1676 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1678 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1679 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1681 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1683 if (SWidth
<> gScreenWidth
) or
1684 (SHeight
<> gScreenHeight
) or
1685 (Fullscreen
<> gFullscreen
) then
1687 gResolutionChange
:= True;
1688 gRC_Width
:= SWidth
;
1689 gRC_Height
:= SHeight
;
1690 gRC_FullScreen
:= Fullscreen
;
1691 gRC_Maximized
:= gWinMaximized
;
1694 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1698 procedure ProcSetFirstRussianLanguage();
1700 gLanguage
:= LANGUAGE_RUSSIAN
;
1701 gLanguageChange
:= True;
1702 gAskLanguage
:= False;
1704 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1707 procedure ProcSetFirstEnglishLanguage();
1709 gLanguage
:= LANGUAGE_ENGLISH
;
1710 gLanguageChange
:= True;
1711 gAskLanguage
:= False;
1713 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1716 procedure ProcRecallAddress();
1718 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1720 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1721 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1725 procedure CreateFirstLanguageMenu();
1729 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1731 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1733 Name
:= 'mmFirstLanguageMenu';
1734 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1735 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1738 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1739 Menu
.MainWindow
:= True;
1740 g_GUI_AddWindow(Menu
);
1743 procedure g_Menu_AskLanguage();
1745 CreateFirstLanguageMenu();
1746 g_GUI_ShowWindow('FirstLanguageMenu');
1749 procedure CreatePlayerOptionsMenu(s
: String);
1754 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1756 a
:= _lc
[I_MENU_PLAYER_1
]
1758 a
:= _lc
[I_MENU_PLAYER_2
];
1759 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1761 Name
:= 'mOptionsPlayers'+s
+'Menu';
1762 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1764 Name
:= 'ed'+s
+'Name';
1768 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1770 Name
:= 'sw'+s
+'Team';
1771 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1772 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1774 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1776 Name
:= 'ls'+s
+'Model';
1778 Items
:= g_PlayerModel_GetNames();
1779 OnChange
:= ProcSelectModel
;
1781 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1783 Name
:= 'sc'+s
+'Red';
1785 OnChange
:= ProcChangeColor
;
1787 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1789 Name
:= 'sc'+s
+'Green';
1791 OnChange
:= ProcChangeColor
;
1793 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1795 Name
:= 'sc'+s
+'Blue';
1797 OnChange
:= ProcChangeColor
;
1800 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1801 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1802 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1803 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1805 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1807 Name
:= 'mv'+s
+'Model';
1808 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1809 Y
:= GetControl('ls'+s
+'Model').Y
;
1812 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1813 g_GUI_AddWindow(Menu
);
1816 procedure CreateAllMenus();
1820 a
, cx
, _y
, i
: Integer;
1823 Menu
:= TGUIWindow
.Create('MainMenu');
1824 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1826 Name
:= 'mmMainMenu';
1827 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1828 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1829 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1830 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1831 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1832 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1834 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1836 Color
:= _RGB(255, 255, 255);
1837 X
:= gScreenWidth
-GetWidth
-8;
1838 Y
:= gScreenHeight
-GetHeight
-8;
1840 Menu
.DefControl
:= 'mmMainMenu';
1841 Menu
.MainWindow
:= True;
1842 g_GUI_AddWindow(Menu
);
1844 Menu
:= TGUIWindow
.Create('NewGameMenu');
1845 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1847 Name
:= 'mmNewGameMenu';
1848 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1849 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1850 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1851 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1853 Menu
.DefControl
:= 'mmNewGameMenu';
1854 g_GUI_AddWindow(Menu
);
1856 Menu
:= TGUIWindow
.Create('NetGameMenu');
1857 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1859 Name
:= 'mmNetGameMenu';
1860 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1861 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1863 Menu
.DefControl
:= 'mmNetGameMenu';
1864 g_GUI_AddWindow(Menu
);
1866 Menu
:= TGUIWindow
.Create('NetServerMenu');
1867 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1869 Name
:= 'mNetServerMenu';
1870 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1872 Name
:= 'edSrvName';
1873 OnlyDigits
:= False;
1876 Text := NetServerName
;
1878 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1880 Name
:= 'edSrvPassword';
1881 OnlyDigits
:= False;
1884 Text := NetPassword
;
1886 with AddEdit(_lc
[I_NET_PORT
]) do
1892 Text := IntToStr(NetPort
);
1894 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1896 Name
:= 'edMaxPlayers';
1900 Text := IntToStr(NetMaxClients
);
1902 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1904 Name
:= 'swUseMaster';
1905 AddItem(_lc
[I_MENU_YES
]);
1906 AddItem(_lc
[I_MENU_NO
]);
1907 if NetUseMaster
then
1913 with AddLabel(_lc
[I_MENU_MAP
]) do
1918 OnClick
:= @ProcSelectMapMenu
;
1920 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1922 Name
:= 'swGameMode';
1923 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1924 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1925 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1926 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1927 case g_Game_TextToMode(gnGameMode
) of
1929 GM_DM
: ItemIndex
:= 0;
1930 GM_TDM
: ItemIndex
:= 1;
1931 GM_CTF
: ItemIndex
:= 2;
1933 GM_COOP
: ItemIndex
:= 3;
1935 OnChange
:= ProcSwitchMonstersNet
;
1937 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1939 Name
:= 'edTimeLimit';
1943 if gnTimeLimit
> 0 then
1944 Text := IntToStr(gnTimeLimit
);
1946 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1948 Name
:= 'edGoalLimit';
1952 if gnGoalLimit
> 0 then
1953 Text := IntToStr(gnGoalLimit
);
1955 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1957 Name
:= 'edMaxLives';
1961 if gnMaxLives
> 0 then
1962 Text := IntToStr(gnMaxLives
);
1964 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
1966 Name
:= 'swPlayers';
1967 AddItem(_lc
[I_MENU_COUNT_NONE
]);
1968 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
1969 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
1970 ItemIndex
:= gnPlayers
;
1972 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
1974 Name
:= 'swTeamDamage';
1975 AddItem(_lc
[I_MENU_YES
]);
1976 AddItem(_lc
[I_MENU_NO
]);
1977 if gnTeamDamage
then
1982 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
1984 Name
:= 'swEnableExits';
1985 AddItem(_lc
[I_MENU_YES
]);
1986 AddItem(_lc
[I_MENU_NO
]);
1992 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
1994 Name
:= 'swWeaponStay';
1995 AddItem(_lc
[I_MENU_YES
]);
1996 AddItem(_lc
[I_MENU_NO
]);
1997 if gnWeaponStay
then
2002 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2004 Name
:= 'swMonsters';
2005 AddItem(_lc
[I_MENU_YES
]);
2006 AddItem(_lc
[I_MENU_NO
]);
2012 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2015 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2016 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2017 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2019 if gnBotsVS
= 'Players' then
2021 if gnBotsVS
= 'Monsters' then
2025 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2029 Menu
.DefControl
:= 'mNetServerMenu';
2030 g_GUI_AddWindow(Menu
);
2032 Menu
:= TGUIWindow
.Create('NetClientMenu');
2033 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2035 Name
:= 'mNetClientMenu';
2037 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2040 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2046 Text := 'localhost';
2048 with AddEdit(_lc
[I_NET_PORT
]) do
2056 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2059 OnlyDigits
:= False;
2066 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2070 Menu
.DefControl
:= 'mNetClientMenu';
2071 g_GUI_AddWindow(Menu
);
2073 Menu
:= TGUIWindow
.Create('LoadMenu');
2074 Menu
.OnShow
:= ProcLoadMenu
;
2075 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2077 Name
:= 'mmLoadMenu';
2082 Name
:= 'edSlot'+IntToStr(a
);
2085 OnEnter
:= ProcLoadGame
;
2088 Menu
.DefControl
:= 'mmLoadMenu';
2089 g_GUI_AddWindow(Menu
);
2091 Menu
:= TGUIWindow
.Create('SaveMenu');
2092 Menu
.OnShow
:= ProcSaveMenu
;
2093 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2095 Name
:= 'mmSaveMenu';
2100 Name
:= 'edSlot'+IntToStr(a
);
2103 OnChange
:= ProcSaveGame
;
2106 Menu
.DefControl
:= 'mmSaveMenu';
2107 g_GUI_AddWindow(Menu
);
2109 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2110 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2112 Name
:= 'mCustomGameMenu';
2113 with AddLabel(_lc
[I_MENU_MAP
]) do
2118 OnClick
:= @ProcSelectMapMenu
;
2120 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2122 Name
:= 'swGameMode';
2123 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2124 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2125 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2126 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2127 case g_Game_TextToMode(gcGameMode
) of
2129 GM_DM
: ItemIndex
:= 0;
2130 GM_TDM
: ItemIndex
:= 1;
2131 GM_CTF
: ItemIndex
:= 2;
2133 GM_COOP
: ItemIndex
:= 3;
2135 OnChange
:= ProcSwitchMonstersCustom
;
2137 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2139 Name
:= 'edTimeLimit';
2143 if gcTimeLimit
> 0 then
2144 Text := IntToStr(gcTimeLimit
);
2146 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2148 Name
:= 'edGoalLimit';
2152 if gcGoalLimit
> 0 then
2153 Text := IntToStr(gcGoalLimit
);
2155 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2157 Name
:= 'edMaxLives';
2161 if gcMaxLives
> 0 then
2162 Text := IntToStr(gcMaxLives
);
2164 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2166 Name
:= 'swPlayers';
2167 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2168 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2169 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2170 ItemIndex
:= gcPlayers
;
2172 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2174 Name
:= 'swTeamDamage';
2175 AddItem(_lc
[I_MENU_YES
]);
2176 AddItem(_lc
[I_MENU_NO
]);
2177 if gcTeamDamage
then
2182 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2184 Name
:= 'swEnableExits';
2185 AddItem(_lc
[I_MENU_YES
]);
2186 AddItem(_lc
[I_MENU_NO
]);
2192 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2194 Name
:= 'swWeaponStay';
2195 AddItem(_lc
[I_MENU_YES
]);
2196 AddItem(_lc
[I_MENU_NO
]);
2197 if gcWeaponStay
then
2202 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2204 Name
:= 'swMonsters';
2205 AddItem(_lc
[I_MENU_YES
]);
2206 AddItem(_lc
[I_MENU_NO
]);
2212 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2215 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2216 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2217 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2219 if gcBotsVS
= 'Players' then
2221 if gcBotsVS
= 'Monsters' then
2225 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2229 Menu
.DefControl
:= 'mCustomGameMenu';
2230 g_GUI_AddWindow(Menu
);
2232 Menu
:= TGUIWindow
.Create('CampaignMenu');
2233 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2235 Name
:= 'mCampaignMenu';
2244 with AddFileList('', 15, 4) do
2247 OnChange
:= ProcSelectCampaignWAD
;
2251 FileMask
:= '*.wad|*.pk3|*.zip';
2252 SetBase(MapsDir
+'megawads/');
2255 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2257 Name
:= 'lbWADName';
2261 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2263 Name
:= 'lbWADAuthor';
2267 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2268 with AddMemo('', 15, 3) do
2270 Name
:= 'meWADDescription';
2271 Color
:= MENU_ITEMSCTRL_COLOR
;
2273 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2275 Name
:= 'swPlayers';
2276 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2277 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2280 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2284 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2286 Name
:= 'mpWADImage';
2287 DefaultRes
:= 'NOPIC';
2288 X
:= GetControl('lsWAD').X
+4;
2289 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2292 Menu
.DefControl
:= 'mCampaignMenu';
2293 g_GUI_AddWindow(Menu
);
2295 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2296 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2298 Name
:= 'mSelectMapMenu';
2299 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2302 OnChange
:= ProcSelectWAD
;
2306 FileMask
:= '*.wad|*.pk3|*.zip';
2309 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2313 OnChange
:= ProcSelectMap
;
2316 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2318 Name
:= 'lbMapName';
2322 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2324 Name
:= 'lbMapAuthor';
2328 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2330 Name
:= 'lbMapSize';
2334 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2336 Name
:= 'meMapDescription';
2341 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2343 Name
:= 'mpMapPreview';
2344 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2345 Y
:= GetControl('lsMapWAD').Y
;
2347 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2349 Name
:= 'lbMapScale';
2352 Color
:= MENU_ITEMSCTRL_COLOR
;
2353 X
:= GetControl('lsMapWAD').X
+
2354 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2355 2 + MAPPREVIEW_WIDTH
*4;
2356 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2359 Menu
.OnClose
:= ProcSetMap
;
2360 Menu
.DefControl
:= 'mSelectMapMenu';
2361 g_GUI_AddWindow(Menu
);
2363 Menu
:= TGUIWindow
.Create('OptionsMenu');
2364 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2366 Name
:= 'mmOptionsMenu';
2367 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2368 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2369 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2370 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2371 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2372 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2374 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2375 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2377 Menu
.OnClose
:= ProcApplyOptions
;
2378 Menu
.DefControl
:= 'mmOptionsMenu';
2379 g_GUI_AddWindow(Menu
);
2381 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2382 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2383 g_GUI_AddWindow(Menu
);
2385 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2386 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2388 Name
:= 'mOptionsVideoMenu';
2389 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2390 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2396 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2399 AddItem(_lc
[I_MENU_YES
]);
2400 AddItem(_lc
[I_MENU_NO
]);
2402 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2404 Name
:= 'swTextureFilter';
2405 AddItem(_lc
[I_MENU_YES
]);
2406 AddItem(_lc
[I_MENU_NO
]);
2408 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2410 Name
:= 'swLegacyNPOT';
2411 AddItem(_lc
[I_MENU_NO
]);
2412 AddItem(_lc
[I_MENU_YES
]);
2415 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2418 Menu
.DefControl
:= 'mOptionsVideoMenu';
2419 g_GUI_AddWindow(Menu
);
2421 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2422 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2424 Name
:= 'mOptionsVideoResMenu';
2425 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2427 Name
:= 'lbCurrentRes';
2431 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2433 Name
:= 'lsResolution';
2436 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2438 Name
:= 'swFullScreen';
2439 AddItem(_lc
[I_MENU_YES
]);
2440 AddItem(_lc
[I_MENU_NO
]);
2443 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2446 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2447 g_GUI_AddWindow(Menu
);
2449 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2450 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2452 Name
:= 'mOptionsSoundMenu';
2453 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2455 Name
:= 'scMusicLevel';
2457 OnChange
:= ProcChangeSoundSettings
;
2459 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2461 Name
:= 'scSoundLevel';
2463 OnChange
:= ProcChangeSoundSettings
;
2465 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2467 Name
:= 'scMaxSimSounds';
2470 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2472 Name
:= 'swAnnouncer';
2473 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2474 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2475 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2476 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2478 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2479 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2481 Name
:= 'swSoundEffects';
2482 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2483 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2485 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2487 Name
:= 'swInactiveSounds';
2488 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2489 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2493 Menu
.DefControl
:= 'mOptionsSoundMenu';
2494 g_GUI_AddWindow(Menu
);
2496 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2497 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2499 Name
:= 'mOptionsGameMenu';
2500 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2502 Name
:= 'scParticlesCount';
2505 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2507 Name
:= 'swBloodCount';
2508 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2509 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2510 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2511 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2512 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2514 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2516 Name
:= 'scShellsMax';
2519 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2521 Name
:= 'scGibsMax';
2524 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2526 Name
:= 'scCorpsesMax';
2529 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2531 Name
:= 'swGibsCount';
2532 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2533 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2534 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2535 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2536 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2538 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2540 Name
:= 'swCorpseType';
2541 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2542 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2544 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2546 Name
:= 'swGibsType';
2547 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2548 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2550 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2552 Name
:= 'swBloodType';
2553 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2554 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2556 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2558 Name
:= 'swScreenFlash';
2559 AddItem(_lc
[I_MENU_NO
]);
2560 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2561 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2563 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2565 Name
:= 'swBackground';
2566 AddItem(_lc
[I_MENU_YES
]);
2567 AddItem(_lc
[I_MENU_NO
]);
2569 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2571 Name
:= 'swMessages';
2572 AddItem(_lc
[I_MENU_YES
]);
2573 AddItem(_lc
[I_MENU_NO
]);
2575 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2577 Name
:= 'swRevertPlayers';
2578 AddItem(_lc
[I_MENU_YES
]);
2579 AddItem(_lc
[I_MENU_NO
]);
2581 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2583 Name
:= 'swChatBubble';
2584 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2585 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2586 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2587 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2588 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2592 Menu
.DefControl
:= 'mOptionsGameMenu';
2593 g_GUI_AddWindow(Menu
);
2595 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2596 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2598 Name
:= 'mOptionsControlsMenu';
2599 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2600 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2601 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2602 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2603 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2605 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2606 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2607 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2608 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2609 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2610 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2612 if e_JoysticksAvailable
<> 0 then
2613 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2615 Menu
.DefControl
:= 'mOptionsControlsMenu';
2616 g_GUI_AddWindow(Menu
);
2618 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2619 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2621 Name
:= 'mOptionsControlsP1Menu';
2622 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2623 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2624 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2625 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2626 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2627 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2628 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2629 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2630 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2631 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2633 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2634 g_GUI_AddWindow(Menu
);
2636 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2637 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2639 Name
:= 'mOptionsControlsP1MenuWeapons';
2641 AddKeyRead(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2642 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2644 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2645 g_GUI_AddWindow(Menu
);
2647 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2648 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2650 Name
:= 'mOptionsControlsP2Menu';
2651 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2652 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2653 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2654 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2655 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2656 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2657 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2658 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2659 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2660 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2662 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2663 g_GUI_AddWindow(Menu
);
2665 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2666 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2668 Name
:= 'mOptionsControlsP2MenuWeapons';
2670 AddKeyRead(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2671 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2673 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2677 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2679 Name
:= 'mOptionsControlsJoystickMenu';
2680 for i
:= 0 to e_JoysticksAvailable
-1 do
2681 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2683 Name
:= 'scDeadzone' + IntToStr(i
);
2687 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2688 g_GUI_AddWindow(Menu
);
2690 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2691 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2693 Name
:= 'mOptionsPlayersMenu';
2694 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2695 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2697 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2698 g_GUI_AddWindow(Menu
);
2700 CreatePlayerOptionsMenu('P1');
2701 CreatePlayerOptionsMenu('P2');
2703 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2704 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2706 Name
:= 'mOptionsPlayersMIMenu';
2707 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2712 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2717 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2719 Name
:= 'meComment';
2722 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2723 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2726 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2730 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2731 g_GUI_AddWindow(Menu
);
2733 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2734 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2736 Name
:= 'mOptionsLanguageMenu';
2737 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2738 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2741 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2742 g_GUI_AddWindow(Menu
);
2744 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2745 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2746 g_GUI_AddWindow(Menu
);
2748 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2749 Menu
.BackTexture
:= 'INTER';
2750 Menu
.OnClose
:= ProcAuthorsClose
;
2754 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2756 Color
:= _RGB(255, 0, 0);
2757 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2759 _y
:= _y
+GetHeight();
2761 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2763 Color
:= _RGB(255, 0, 0);
2764 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2766 _y
:= _y
+GetHeight()+32;
2768 // ×òî äåëàë: Êòî äåëàë
2769 cx
:= gScreenWidth
div 2 - 320 + 64;
2770 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2772 Color
:= _RGB(255, 0, 0);
2777 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2779 Color
:= _RGB(255, 255, 255);
2784 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2786 Color
:= _RGB(255, 0, 0);
2791 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2793 Color
:= _RGB(255, 255, 255);
2798 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2800 Color
:= _RGB(255, 255, 255);
2805 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2807 Color
:= _RGB(255, 0, 0);
2812 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2814 Color
:= _RGB(255, 255, 255);
2819 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2821 Color
:= _RGB(255, 0, 0);
2826 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2828 Color
:= _RGB(255, 255, 255);
2831 _y
:= gScreenHeight
- 128;
2834 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2836 Color
:= _RGB(255, 0, 0);
2841 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2843 Color
:= _RGB(255, 255, 255);
2846 _y
:= _y
+GetHeight();
2848 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2850 Color
:= _RGB(255, 255, 255);
2853 _y
:= _y
+GetHeight();
2855 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2857 Color
:= _RGB(255, 255, 255);
2860 _y
:= gScreenHeight
- 32;
2862 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2864 Color
:= _RGB(255, 0, 0);
2865 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2868 g_GUI_AddWindow(Menu
);
2870 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2871 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2872 g_GUI_AddWindow(Menu
);
2874 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2875 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2877 Name
:= 'mmGameSingleMenu';
2878 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2879 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2880 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2881 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2882 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2883 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2885 Menu
.DefControl
:= 'mmGameSingleMenu';
2886 Menu
.MainWindow
:= True;
2887 Menu
.OnClose
:= ProcGMClose
;
2888 Menu
.OnShow
:= ProcGMShow
;
2889 g_GUI_AddWindow(Menu
);
2891 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2892 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2893 g_GUI_AddWindow(Menu
);
2895 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2896 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2897 g_GUI_AddWindow(Menu
);
2899 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2900 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2902 Name
:= 'mmGameCustomMenu';
2903 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2904 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2905 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2906 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2907 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2908 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2909 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2911 Menu
.DefControl
:= 'mmGameCustomMenu';
2912 Menu
.MainWindow
:= True;
2913 Menu
.OnClose
:= ProcGMClose
;
2914 Menu
.OnShow
:= ProcGMShow
;
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= TGUIWindow
.Create('GameServerMenu');
2918 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2920 Name
:= 'mmGameServerMenu';
2921 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2922 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2923 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2924 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2925 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2927 Menu
.DefControl
:= 'mmGameServerMenu';
2928 Menu
.MainWindow
:= True;
2929 Menu
.OnClose
:= ProcGMClose
;
2930 Menu
.OnShow
:= ProcGMShow
;
2931 g_GUI_AddWindow(Menu
);
2933 Menu
:= TGUIWindow
.Create('GameClientMenu');
2934 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2936 Name
:= 'mmGameClientMenu';
2937 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2938 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2939 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2941 Menu
.DefControl
:= 'mmGameClientMenu';
2942 Menu
.MainWindow
:= True;
2943 Menu
.OnClose
:= ProcGMClose
;
2944 Menu
.OnShow
:= ProcGMShow
;
2945 g_GUI_AddWindow(Menu
);
2947 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2948 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2950 Name
:= 'mClientPasswordMenu';
2951 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2959 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
2962 Menu
.DefControl
:= 'mClientPasswordMenu';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
2968 Name
:= 'mGameSetGameMenu';
2969 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2971 Name
:= 'swTeamDamage';
2972 AddItem(_lc
[I_MENU_YES
]);
2973 AddItem(_lc
[I_MENU_NO
]);
2976 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2978 Name
:= 'edTimeLimit';
2983 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2985 Name
:= 'edGoalLimit';
2990 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2992 Name
:= 'edMaxLives';
2997 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3000 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3001 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3002 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3008 Menu
.DefControl
:= 'mGameSetGameMenu';
3009 Menu
.OnClose
:= ProcApplyGameSet
;
3010 g_GUI_AddWindow(Menu
);
3012 Menu
:= TGUIWindow
.Create('TeamMenu');
3013 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3015 Name
:= 'mmTeamMenu';
3016 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3017 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3018 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3019 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3020 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3022 Menu
.DefControl
:= 'mmTeamMenu';
3023 Menu
.OnShow
:= ProcChangePlayers
;
3024 g_GUI_AddWindow(Menu
);
3027 procedure g_Menu_Show_SaveMenu();
3029 if g_Game_IsTestMap
then
3031 if gGameSettings
.GameType
= GT_SINGLE
then
3032 g_GUI_ShowWindow('GameSingleMenu')
3035 if g_Game_IsClient
then
3038 if g_Game_IsNet
then
3041 g_GUI_ShowWindow('GameCustomMenu');
3043 g_GUI_ShowWindow('SaveMenu');
3044 g_Sound_PlayEx('MENU_OPEN');
3047 procedure g_Menu_Show_LoadMenu();
3049 if gGameSettings
.GameType
= GT_SINGLE
then
3050 g_GUI_ShowWindow('GameSingleMenu')
3053 if g_Game_IsClient
then
3056 if g_Game_IsNet
then
3059 g_GUI_ShowWindow('GameCustomMenu');
3061 g_GUI_ShowWindow('LoadMenu');
3062 g_Sound_PlayEx('MENU_OPEN');
3065 procedure g_Menu_Show_GameSetGame();
3067 if gGameSettings
.GameType
= GT_SINGLE
then
3068 g_GUI_ShowWindow('GameSingleMenu')
3071 if g_Game_IsClient
then
3074 if g_Game_IsNet
then
3075 g_GUI_ShowWindow('GameServerMenu')
3077 g_GUI_ShowWindow('GameCustomMenu');
3080 g_GUI_ShowWindow('GameSetGameMenu');
3081 g_Sound_PlayEx('MENU_OPEN');
3084 procedure g_Menu_Show_OptionsVideo();
3086 if gGameSettings
.GameType
= GT_SINGLE
then
3087 g_GUI_ShowWindow('GameSingleMenu')
3090 if g_Game_IsClient
then
3091 g_GUI_ShowWindow('GameClientMenu')
3093 if g_Game_IsNet
then
3094 g_GUI_ShowWindow('GameServerMenu')
3096 g_GUI_ShowWindow('GameCustomMenu');
3099 g_GUI_ShowWindow('OptionsMenu');
3100 g_GUI_ShowWindow('OptionsVideoMenu');
3101 g_Sound_PlayEx('MENU_OPEN');
3104 procedure g_Menu_Show_OptionsSound();
3106 if gGameSettings
.GameType
= GT_SINGLE
then
3107 g_GUI_ShowWindow('GameSingleMenu')
3110 if g_Game_IsClient
then
3111 g_GUI_ShowWindow('GameClientMenu')
3113 if g_Game_IsNet
then
3114 g_GUI_ShowWindow('GameServerMenu')
3116 g_GUI_ShowWindow('GameCustomMenu');
3119 g_GUI_ShowWindow('OptionsMenu');
3120 g_GUI_ShowWindow('OptionsSoundMenu');
3121 g_Sound_PlayEx('MENU_OPEN');
3124 procedure g_Menu_Show_EndGameMenu();
3126 g_GUI_ShowWindow('EndGameMenu');
3127 g_Sound_PlayEx('MENU_OPEN');
3130 procedure g_Menu_Show_QuitGameMenu();
3132 g_GUI_ShowWindow('ExitMenu');
3133 g_Sound_PlayEx('MENU_OPEN');
3136 procedure g_Menu_Init();
3143 procedure g_Menu_Free();
3147 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3152 procedure g_Menu_Reset();
3156 g_GUI_SaveMenuPos();
3157 ex
:= g_GUI_Destroy();
3161 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3166 g_Game_SetDebugMode();
3168 g_GUI_LoadMenuPos();