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();
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
510 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
511 if TGUISwitch(GetControl('swGameMode')).GetText
<> _lc
[I_MENU_GAME_TYPE_CTF
] then
512 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
514 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
516 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
517 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
518 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
519 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
523 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
525 // don't turn off monsters in DM
526 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
527 if TGUISwitch(GetControl('swGameMode')).GetText
<> _lc
[I_MENU_GAME_TYPE_CTF
] then
528 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 0
530 TGUISwitch(GetControl('swMonsters')).ItemIndex
:= 1;
532 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
533 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
534 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
535 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
539 procedure ProcStartCustomGame();
545 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
547 Map
:= TGUILabel(GetControl('lbMap')).Text;
550 if Pos(':\', Map
) = 0 then
553 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
554 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
555 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
556 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
557 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
559 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
560 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
561 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
562 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
565 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
567 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
569 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
571 Options
:= Options
or GAME_OPTION_MONSTERS
;
572 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
574 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
576 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
577 gcBotsVS
:= 'Monsters';
580 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
581 gcBotsVS
:= 'Everybody';
584 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
585 gcBotsVS
:= 'Players';
592 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
594 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
595 gcMaxLives
, Options
, gcPlayers
);
599 procedure ProcStartNetGame();
605 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
607 Map
:= TGUILabel(GetControl('lbMap')).Text;
610 if Pos(':\', Map
) = 0 then
613 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
614 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
615 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
616 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
617 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
618 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
620 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
621 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
622 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
623 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
626 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
628 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
630 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
632 Options
:= Options
or GAME_OPTION_MONSTERS
;
633 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
635 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
637 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
638 gnBotsVS
:= 'Monsters';
641 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
642 gnBotsVS
:= 'Everybody';
645 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
646 gnBotsVS
:= 'Players';
651 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
652 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
653 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
654 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
655 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
658 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
659 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
661 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
662 Options
, gnPlayers
, 0, NetPort
);
665 procedure ProcConnectNetGame();
669 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
671 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
672 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
673 PW
:= TGUIEdit(GetControl('edPW')).Text;
676 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
677 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
680 procedure ProcEnterPassword();
684 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
686 NetClientIP
:= PromptIP
;
687 NetClientPort
:= PromptPort
;
688 PW
:= TGUIEdit(GetControl('edPW')).Text;
691 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
692 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
695 procedure ProcServerlist();
697 if not NetInitDone
then
699 if (not g_Net_Init()) then
701 g_Console_Add('NET: ERROR: Failed to init ENet!');
708 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
710 gState
:= STATE_SLIST
;
711 g_ActiveWindow
:= nil;
713 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
718 slReturnPressed
:= True;
719 if g_Net_Slist_Fetch(slCurrent
) then
721 if slCurrent
= nil then
722 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
725 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
728 procedure ProcStartCampaign();
734 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
736 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
737 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
744 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
747 procedure ProcSelectMap(Sender
: TGUIControl
);
751 wad
, map
, res
: String;
753 win
:= g_GUI_GetWindow('SelectMapMenu');
754 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
756 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
757 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
759 if (wad
= '') or (map
= '') then
760 begin // Ýòî íå êàðòà
761 TGUILabel(GetControl('lbMapName')).Text := '';
762 TGUILabel(GetControl('lbMapAuthor')).Text := '';
763 TGUILabel(GetControl('lbMapSize')).Text := '';
764 TGUIMemo(GetControl('meMapDescription')).SetText('');
765 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
766 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
772 a
:= g_Map_GetMapInfo(res
);
774 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
775 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
776 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
777 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
778 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
779 TGUILabel(win
.GetControl('lbMapScale')).Text :=
780 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
785 procedure ProcSelectWAD(Sender
: TGUIControl
);
790 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
792 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
794 with TGUIListBox(GetControl('lsMapRes')) do
800 list
:= g_Map_GetMapsList(wad
);
814 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
820 win
:= g_GUI_GetWindow('CampaignMenu');
821 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
823 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
827 TGUILabel(GetControl('lbWADName')).Text := '';
828 TGUILabel(GetControl('lbWADAuthor')).Text := '';
829 TGUIMemo(GetControl('meWADDescription')).SetText('');
832 a
:= g_Game_GetMegaWADInfo(wad
);
834 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
835 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
836 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
838 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
842 fn
:= g_ExtractWadName(a
.pic
);
844 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
846 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
851 procedure ProcChangeColor(Sender
: TGUIControl
);
855 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
856 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
857 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
858 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
859 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
860 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
862 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
863 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
864 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
865 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
866 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
867 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
870 procedure ProcSelectModel(Sender
: TGUIControl
);
875 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
876 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
877 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
879 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
880 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
881 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
883 ProcChangeColor(nil);
886 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
898 wad
:= TWADFile
.Create
;
899 if wad
.ReadFile(GameWAD
) then
900 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
905 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
907 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
908 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
909 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
910 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
912 if g_Texture_Get('FONT_STD', ID
) then
913 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
918 if cfglen
<> 0 then FreeMem(cfgdata
);
921 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
927 cfgdata
, fntdata
: Pointer;
928 cfglen
, fntlen
: Integer;
936 wad
:= TWADFile
.Create
;
937 if wad
.ReadFile(GameWAD
) then
939 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
940 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
946 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
947 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
948 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
950 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
951 FontID
:= e_CharFont_Create(spc
);
955 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
956 if chrwidth
= 0 then Continue
;
958 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
960 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
966 if cfglen
<> 0 then FreeMem(cfgdata
);
967 if fntlen
<> 0 then FreeMem(fntdata
);
970 procedure MenuLoadData();
972 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
974 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
975 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
976 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
977 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
978 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
979 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
980 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
981 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
982 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
983 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
984 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
985 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
986 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
987 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
988 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
989 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
990 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
991 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
992 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
993 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
994 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
995 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
996 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
997 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
999 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1000 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1001 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1002 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1003 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1004 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1005 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1008 procedure MenuFreeData();
1010 e_CharFont_Remove(gMenuFont
);
1011 e_CharFont_Remove(gMenuSmallFont
);
1013 g_Texture_Delete('MAINMENU_MARKER1');
1014 g_Texture_Delete('MAINMENU_MARKER2');
1015 g_Texture_Delete('SCROLL_LEFT');
1016 g_Texture_Delete('SCROLL_RIGHT');
1017 g_Texture_Delete('SCROLL_MIDDLE');
1018 g_Texture_Delete('SCROLL_MARKER');
1019 g_Texture_Delete('EDIT_LEFT');
1020 g_Texture_Delete('EDIT_RIGHT');
1021 g_Texture_Delete('EDIT_MIDDLE');
1022 g_Texture_Delete('BOX1');
1023 g_Texture_Delete('BOX2');
1024 g_Texture_Delete('BOX3');
1025 g_Texture_Delete('BOX4');
1026 g_Texture_Delete('BOX5');
1027 g_Texture_Delete('BOX6');
1028 g_Texture_Delete('BOX7');
1029 g_Texture_Delete('BOX8');
1030 g_Texture_Delete('BOX9');
1031 g_Texture_Delete('BSCROLL_UP_A');
1032 g_Texture_Delete('BSCROLL_UP_U');
1033 g_Texture_Delete('BSCROLL_DOWN_A');
1034 g_Texture_Delete('BSCROLL_DOWN_U');
1035 g_Texture_Delete('BSCROLL_MIDDLE');
1036 g_Texture_Delete('NOPIC');
1038 g_Sound_Delete('MENU_SELECT');
1039 g_Sound_Delete('MENU_OPEN');
1040 g_Sound_Delete('MENU_CLOSE');
1041 g_Sound_Delete('MENU_CHANGE');
1042 g_Sound_Delete('SCROLL_ADD');
1043 g_Sound_Delete('SCROLL_SUB');
1044 g_Sound_Delete('SOUND_PLAYER_FALL');
1047 procedure ProcAuthorsMenu();
1049 gMusic
.SetByName('MUSIC_INTERMUS');
1053 procedure ProcExitMenuKeyDown (yes
: Boolean);
1056 snd
: TPlayableSound
;
1061 g_Game_StopAllSounds(True);
1062 case (Random(18)) of
1063 0: s
:= 'SOUND_MONSTER_PAIN';
1064 1: s
:= 'SOUND_MONSTER_DIE_3';
1065 2: s
:= 'SOUND_MONSTER_SLOP';
1066 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1067 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1068 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1069 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1070 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1071 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1072 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1073 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1074 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1075 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1076 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1077 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1078 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1079 else s
:= 'SOUND_PLAYER_FALL';
1081 snd
:= TPlayableSound
.Create();
1082 res
:= snd
.SetByName(s
);
1083 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1087 while snd
.IsPlaying() do begin end;
1095 procedure ProcLoadMenu();
1100 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1104 procedure ProcSaveMenu();
1109 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1113 procedure ProcSaveGame(Sender
: TGUIControl
);
1117 if g_Game_IsNet
then Exit
;
1118 if g_Game_IsTestMap
then Exit
;
1119 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1120 g_Game_PauseAllSounds(True);
1121 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1123 g_ActiveWindow
:= nil;
1124 g_Game_Pause(False);
1127 procedure ProcLoadGame(Sender
: TGUIControl
);
1131 if g_Game_IsNet
then Exit
;
1132 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1133 if g_LoadGame(a
) then
1134 g_Game_PauseAllSounds(False)
1135 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1136 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1139 procedure ProcSingle1Player();
1141 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1144 procedure ProcSingle2Players();
1146 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1149 procedure ProcSelectMapMenu();
1152 wad_lb
: TGUIFileListBox
;
1153 map_lb
: TGUIListBox
;
1156 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1157 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1158 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1160 if wad_lb
.SelectedItem() <> '' then
1161 map
:= map_lb
.SelectedItem()
1165 wad_lb
.UpdateFileList();
1168 if wad_lb
.SelectedItem() <> '' then
1171 map_lb
.SelectItem(map
);
1173 if map_lb
.SelectedItem() <> '' then
1177 g_GUI_ShowWindow('SelectMapMenu');
1180 procedure ProcSelectCampaignMenu();
1183 wad_lb
: TGUIFileListBox
;
1185 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1186 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1188 wad_lb
.UpdateFileList();
1190 if wad_lb
.SelectedItem() <> '' then
1191 ProcSelectCampaignWAD(nil);
1194 procedure ProcSetMap();
1196 wad
, map
, res
: String;
1198 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1200 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1201 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1204 if (wad
= '') or (map
= '') then
1207 res
:= wad
+':\'+map
;
1209 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1210 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1213 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1217 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1219 g_Sound_SetupAllVolumes(
1220 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1221 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1225 procedure ProcOptionsPlayersMIMenu();
1230 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1232 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1234 if a
= '' then Exit
;
1236 b
:= g_PlayerModel_GetInfo(a
);
1238 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1240 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1241 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1242 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1244 if b
.HaveWeapon
then
1245 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1247 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1250 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1253 procedure ProcOptionsPlayersAnim();
1257 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1262 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1265 Model
.GetCurrentAnimation
.Loop
:= True;
1266 Model
.GetCurrentAnimationMask
.Loop
:= True;
1270 procedure ProcOptionsPlayersWeap();
1274 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1279 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1283 procedure ProcOptionsPlayersRot();
1287 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1288 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1289 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1292 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1296 g_Options_SetDefault();
1302 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1304 if yes
then ReadOptions();
1308 procedure ProcAuthorsClose();
1310 gMusic
.SetByName('MUSIC_MENU');
1312 gState
:= STATE_MENU
;
1315 procedure ProcGMClose();
1317 g_Game_InGameMenu(False);
1320 procedure ProcGMShow();
1325 if (gGameSettings
.GameType
= GT_SINGLE
) and
1326 ((gPlayer1
= nil) or (not gPlayer1
.Live
)) and
1327 ((gPlayer2
= nil) or (not gPlayer2
.Live
)) then
1328 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1330 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1331 if g_Game_IsTestMap
then
1332 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1333 TGUIMainMenu(g_ActiveWindow
.GetControl(
1334 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1337 procedure ProcChangePlayers();
1339 TeamGame
, Spectator
, AddTwo
: Boolean;
1340 P1Team
{, P2Team}: Byte;
1341 bP2
: TGUITextButton
;
1343 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1344 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1345 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1346 P1Team
:= TEAM_NONE
;
1347 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1349 //P2Team := TEAM_NONE;
1350 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1352 TGUIMainMenu(g_ActiveWindow
.GetControl(
1353 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1354 TGUIMainMenu(g_ActiveWindow
.GetControl(
1355 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1356 TGUIMainMenu(g_ActiveWindow
.GetControl(
1357 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1359 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1360 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1361 bP2
.Enabled
:= AddTwo
and not Spectator
;
1363 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1365 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1366 if gPlayer2
= nil then
1367 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1369 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1371 TGUIMainMenu(g_ActiveWindow
.GetControl(
1372 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1375 procedure ProcJoinRed();
1377 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1379 if g_Game_IsServer
then
1381 if gPlayer1
= nil then
1382 g_Game_AddPlayer(TEAM_RED
)
1385 if gPlayer1
.Team
<> TEAM_RED
then
1387 gPlayer1
.SwitchTeam
;
1388 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1391 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1396 gPlayer1Settings
.Team
:= TEAM_RED
;
1397 MC_SEND_PlayerSettings
;
1398 if gPlayer1
= nil then
1399 g_Game_AddPlayer(TEAM_RED
);
1401 g_ActiveWindow
:= nil;
1402 g_Game_Pause(False);
1405 procedure ProcJoinBlue();
1407 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1409 if g_Game_IsServer
then
1411 if gPlayer1
= nil then
1412 g_Game_AddPlayer(TEAM_BLUE
)
1415 if gPlayer1
.Team
<> TEAM_BLUE
then
1417 gPlayer1
.SwitchTeam
;
1418 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1421 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1426 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1427 MC_SEND_PlayerSettings
;
1428 if gPlayer1
= nil then
1429 g_Game_AddPlayer(TEAM_BLUE
);
1431 g_ActiveWindow
:= nil;
1432 g_Game_Pause(False);
1435 procedure ProcJoinGame();
1437 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1439 if gPlayer1
= nil then
1441 g_ActiveWindow
:= nil;
1442 g_Game_Pause(False);
1445 procedure ProcSwitchP2();
1447 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1449 if gPlayer1
= nil then
1451 if gPlayer2
= nil then
1454 g_Game_RemovePlayer();
1455 g_ActiveWindow
:= nil;
1456 g_Game_Pause(False);
1459 procedure ProcSpectate();
1461 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1464 g_ActiveWindow
:= nil;
1465 g_Game_Pause(False);
1468 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1470 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1473 procedure ProcEndMenuKeyDown (yes
: Boolean);
1475 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1478 procedure ProcSetRussianLanguage();
1480 if gLanguage
<> LANGUAGE_RUSSIAN
then
1482 gLanguage
:= LANGUAGE_RUSSIAN
;
1483 gLanguageChange
:= True;
1484 gAskLanguage
:= False;
1486 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1488 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1493 procedure ProcSetEnglishLanguage();
1495 if gLanguage
<> LANGUAGE_ENGLISH
then
1497 gLanguage
:= LANGUAGE_ENGLISH
;
1498 gLanguageChange
:= True;
1499 gAskLanguage
:= False;
1501 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1503 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1508 procedure ReadGameSettings();
1512 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1514 with gGameSettings
do
1516 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1517 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1522 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1523 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1524 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1526 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1527 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1528 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1531 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1536 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1538 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1539 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1540 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1541 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1542 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1543 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1544 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1545 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1549 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1550 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1555 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1556 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1561 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1562 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1567 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1568 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1573 procedure ProcApplyGameSet();
1577 stat
: TPlayerStatArray
;
1579 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1581 if not g_Game_IsServer
then Exit
;
1583 with gGameSettings
do
1585 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1587 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1588 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1590 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1593 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1595 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1601 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1603 TimeLimit
:= Max(n
, b
);
1607 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1609 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1616 if GameMode
= GM_DM
then
1618 stat
:= g_Player_GetStats();
1620 for a
:= 0 to High(stat
) do
1621 if stat
[a
].Frags
> b
then
1625 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1627 GoalLimit
:= Max(n
, b
);
1631 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1633 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1634 if n
< 0 then n
:= 0;
1635 if n
> 255 then n
:= 255;
1641 stat
:= g_Player_GetStats();
1643 for a
:= 0 to High(stat
) do
1644 if stat
[a
].Lives
> b
then
1647 MaxLives
:= Max(n
, b
);
1651 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1653 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1656 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1657 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1661 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1662 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1666 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1667 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1673 if g_Game_IsNet
then MH_SEND_GameSettings
;
1676 procedure ProcVideoOptionsRes();
1682 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1684 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1685 IntToStr(gScreenWidth
) +
1686 ' x ' + IntToStr(gScreenHeight
) +
1687 ', ' + IntToStr(gBPP
) + ' bpp';
1689 with TGUIListBox(menu
.GetControl('lsResolution')) do
1691 list
:= GetDisplayModes(gBPP
, SR
);
1702 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1709 procedure ProcApplyVideoOptions();
1712 Fullscreen
: Boolean;
1713 SWidth
, SHeight
: Integer;
1716 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1718 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1719 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1721 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1723 if (SWidth
<> gScreenWidth
) or
1724 (SHeight
<> gScreenHeight
) or
1725 (Fullscreen
<> gFullscreen
) then
1727 gResolutionChange
:= True;
1728 gRC_Width
:= SWidth
;
1729 gRC_Height
:= SHeight
;
1730 gRC_FullScreen
:= Fullscreen
;
1731 gRC_Maximized
:= gWinMaximized
;
1734 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1738 procedure ProcSetFirstRussianLanguage();
1740 gLanguage
:= LANGUAGE_RUSSIAN
;
1741 gLanguageChange
:= True;
1742 gAskLanguage
:= False;
1744 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1747 procedure ProcSetFirstEnglishLanguage();
1749 gLanguage
:= LANGUAGE_ENGLISH
;
1750 gLanguageChange
:= True;
1751 gAskLanguage
:= False;
1753 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1756 procedure ProcRecallAddress();
1758 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1760 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1761 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1765 procedure CreateFirstLanguageMenu();
1769 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1771 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1773 Name
:= 'mmFirstLanguageMenu';
1774 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1775 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1778 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1779 Menu
.MainWindow
:= True;
1780 g_GUI_AddWindow(Menu
);
1783 procedure g_Menu_AskLanguage();
1785 CreateFirstLanguageMenu();
1786 g_GUI_ShowWindow('FirstLanguageMenu');
1789 procedure CreatePlayerOptionsMenu(s
: String);
1794 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1796 a
:= _lc
[I_MENU_PLAYER_1
]
1798 a
:= _lc
[I_MENU_PLAYER_2
];
1799 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1801 Name
:= 'mOptionsPlayers'+s
+'Menu';
1802 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1804 Name
:= 'ed'+s
+'Name';
1808 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1810 Name
:= 'sw'+s
+'Team';
1811 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1812 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1814 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1816 Name
:= 'ls'+s
+'Model';
1818 Items
:= g_PlayerModel_GetNames();
1819 OnChange
:= ProcSelectModel
;
1821 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1823 Name
:= 'sc'+s
+'Red';
1825 OnChange
:= ProcChangeColor
;
1827 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1829 Name
:= 'sc'+s
+'Green';
1831 OnChange
:= ProcChangeColor
;
1833 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1835 Name
:= 'sc'+s
+'Blue';
1837 OnChange
:= ProcChangeColor
;
1840 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1841 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1842 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1843 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1845 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1847 Name
:= 'mv'+s
+'Model';
1848 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1849 Y
:= GetControl('ls'+s
+'Model').Y
;
1852 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1853 g_GUI_AddWindow(Menu
);
1856 procedure CreateAllMenus();
1860 a
, cx
, _y
, i
: Integer;
1863 Menu
:= TGUIWindow
.Create('MainMenu');
1864 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1866 Name
:= 'mmMainMenu';
1867 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1868 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1869 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1870 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1871 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1872 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1874 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1876 Color
:= _RGB(255, 255, 255);
1877 X
:= gScreenWidth
-GetWidth
-8;
1878 Y
:= gScreenHeight
-GetHeight
-8;
1880 Menu
.DefControl
:= 'mmMainMenu';
1881 Menu
.MainWindow
:= True;
1882 g_GUI_AddWindow(Menu
);
1884 Menu
:= TGUIWindow
.Create('NewGameMenu');
1885 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1887 Name
:= 'mmNewGameMenu';
1888 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1889 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1890 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1891 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1893 Menu
.DefControl
:= 'mmNewGameMenu';
1894 g_GUI_AddWindow(Menu
);
1896 Menu
:= TGUIWindow
.Create('NetGameMenu');
1897 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1899 Name
:= 'mmNetGameMenu';
1900 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1901 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1903 Menu
.DefControl
:= 'mmNetGameMenu';
1904 g_GUI_AddWindow(Menu
);
1906 Menu
:= TGUIWindow
.Create('NetServerMenu');
1907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1909 Name
:= 'mNetServerMenu';
1910 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1912 Name
:= 'edSrvName';
1913 OnlyDigits
:= False;
1916 Text := NetServerName
;
1918 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1920 Name
:= 'edSrvPassword';
1921 OnlyDigits
:= False;
1924 Text := NetPassword
;
1926 with AddEdit(_lc
[I_NET_PORT
]) do
1932 Text := IntToStr(NetPort
);
1934 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1936 Name
:= 'edMaxPlayers';
1940 Text := IntToStr(NetMaxClients
);
1942 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1944 Name
:= 'swUseMaster';
1945 AddItem(_lc
[I_MENU_YES
]);
1946 AddItem(_lc
[I_MENU_NO
]);
1947 if NetUseMaster
then
1953 with AddLabel(_lc
[I_MENU_MAP
]) do
1958 OnClick
:= @ProcSelectMapMenu
;
1960 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1962 Name
:= 'swGameMode';
1963 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1964 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1965 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1966 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1967 case g_Game_TextToMode(gnGameMode
) of
1969 GM_DM
: ItemIndex
:= 0;
1970 GM_TDM
: ItemIndex
:= 1;
1971 GM_CTF
: ItemIndex
:= 2;
1973 GM_COOP
: ItemIndex
:= 3;
1975 OnChange
:= ProcSwitchMonstersNet
;
1977 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1979 Name
:= 'edTimeLimit';
1983 if gnTimeLimit
> 0 then
1984 Text := IntToStr(gnTimeLimit
);
1986 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1988 Name
:= 'edGoalLimit';
1992 if gnGoalLimit
> 0 then
1993 Text := IntToStr(gnGoalLimit
);
1995 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
1997 Name
:= 'edMaxLives';
2001 if gnMaxLives
> 0 then
2002 Text := IntToStr(gnMaxLives
);
2004 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2006 Name
:= 'swPlayers';
2007 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2008 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2009 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2010 ItemIndex
:= gnPlayers
;
2012 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2014 Name
:= 'swTeamDamage';
2015 AddItem(_lc
[I_MENU_YES
]);
2016 AddItem(_lc
[I_MENU_NO
]);
2017 if gnTeamDamage
then
2022 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2024 Name
:= 'swEnableExits';
2025 AddItem(_lc
[I_MENU_YES
]);
2026 AddItem(_lc
[I_MENU_NO
]);
2032 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2034 Name
:= 'swWeaponStay';
2035 AddItem(_lc
[I_MENU_YES
]);
2036 AddItem(_lc
[I_MENU_NO
]);
2037 if gnWeaponStay
then
2042 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2044 Name
:= 'swMonsters';
2045 AddItem(_lc
[I_MENU_YES
]);
2046 AddItem(_lc
[I_MENU_NO
]);
2052 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2055 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2056 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2057 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2059 if gnBotsVS
= 'Players' then
2061 if gnBotsVS
= 'Monsters' then
2065 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2069 Menu
.DefControl
:= 'mNetServerMenu';
2070 g_GUI_AddWindow(Menu
);
2072 Menu
:= TGUIWindow
.Create('NetClientMenu');
2073 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2075 Name
:= 'mNetClientMenu';
2077 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2080 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2086 Text := 'localhost';
2088 with AddEdit(_lc
[I_NET_PORT
]) do
2096 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2099 OnlyDigits
:= False;
2106 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2110 Menu
.DefControl
:= 'mNetClientMenu';
2111 g_GUI_AddWindow(Menu
);
2113 Menu
:= TGUIWindow
.Create('LoadMenu');
2114 Menu
.OnShow
:= ProcLoadMenu
;
2115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2117 Name
:= 'mmLoadMenu';
2122 Name
:= 'edSlot'+IntToStr(a
);
2125 OnEnter
:= ProcLoadGame
;
2128 Menu
.DefControl
:= 'mmLoadMenu';
2129 g_GUI_AddWindow(Menu
);
2131 Menu
:= TGUIWindow
.Create('SaveMenu');
2132 Menu
.OnShow
:= ProcSaveMenu
;
2133 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2135 Name
:= 'mmSaveMenu';
2140 Name
:= 'edSlot'+IntToStr(a
);
2143 OnChange
:= ProcSaveGame
;
2146 Menu
.DefControl
:= 'mmSaveMenu';
2147 g_GUI_AddWindow(Menu
);
2149 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2150 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2152 Name
:= 'mCustomGameMenu';
2153 with AddLabel(_lc
[I_MENU_MAP
]) do
2158 OnClick
:= @ProcSelectMapMenu
;
2160 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2162 Name
:= 'swGameMode';
2163 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2164 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2165 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2166 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2167 case g_Game_TextToMode(gcGameMode
) of
2169 GM_DM
: ItemIndex
:= 0;
2170 GM_TDM
: ItemIndex
:= 1;
2171 GM_CTF
: ItemIndex
:= 2;
2173 GM_COOP
: ItemIndex
:= 3;
2175 OnChange
:= ProcSwitchMonstersCustom
;
2177 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2179 Name
:= 'edTimeLimit';
2183 if gcTimeLimit
> 0 then
2184 Text := IntToStr(gcTimeLimit
);
2186 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2188 Name
:= 'edGoalLimit';
2192 if gcGoalLimit
> 0 then
2193 Text := IntToStr(gcGoalLimit
);
2195 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2197 Name
:= 'edMaxLives';
2201 if gcMaxLives
> 0 then
2202 Text := IntToStr(gcMaxLives
);
2204 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2206 Name
:= 'swPlayers';
2207 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2208 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2209 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2210 ItemIndex
:= gcPlayers
;
2212 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2214 Name
:= 'swTeamDamage';
2215 AddItem(_lc
[I_MENU_YES
]);
2216 AddItem(_lc
[I_MENU_NO
]);
2217 if gcTeamDamage
then
2222 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2224 Name
:= 'swEnableExits';
2225 AddItem(_lc
[I_MENU_YES
]);
2226 AddItem(_lc
[I_MENU_NO
]);
2232 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2234 Name
:= 'swWeaponStay';
2235 AddItem(_lc
[I_MENU_YES
]);
2236 AddItem(_lc
[I_MENU_NO
]);
2237 if gcWeaponStay
then
2242 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2244 Name
:= 'swMonsters';
2245 AddItem(_lc
[I_MENU_YES
]);
2246 AddItem(_lc
[I_MENU_NO
]);
2252 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2255 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2256 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2257 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2259 if gcBotsVS
= 'Players' then
2261 if gcBotsVS
= 'Monsters' then
2265 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2269 Menu
.DefControl
:= 'mCustomGameMenu';
2270 g_GUI_AddWindow(Menu
);
2272 Menu
:= TGUIWindow
.Create('CampaignMenu');
2273 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2275 Name
:= 'mCampaignMenu';
2284 with AddFileList('', 15, 4) do
2287 OnChange
:= ProcSelectCampaignWAD
;
2291 FileMask
:= '*.wad|*.pk3|*.zip';
2292 SetBase(MapsDir
+'megawads/');
2295 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2297 Name
:= 'lbWADName';
2301 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2303 Name
:= 'lbWADAuthor';
2307 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2308 with AddMemo('', 15, 3) do
2310 Name
:= 'meWADDescription';
2311 Color
:= MENU_ITEMSCTRL_COLOR
;
2313 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2315 Name
:= 'swPlayers';
2316 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2317 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2320 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2324 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2326 Name
:= 'mpWADImage';
2327 DefaultRes
:= 'NOPIC';
2328 X
:= GetControl('lsWAD').X
+4;
2329 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2332 Menu
.DefControl
:= 'mCampaignMenu';
2333 g_GUI_AddWindow(Menu
);
2335 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2336 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2338 Name
:= 'mSelectMapMenu';
2339 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2342 OnChange
:= ProcSelectWAD
;
2346 FileMask
:= '*.wad|*.pk3|*.zip';
2349 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2353 OnChange
:= ProcSelectMap
;
2356 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2358 Name
:= 'lbMapName';
2362 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2364 Name
:= 'lbMapAuthor';
2368 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2370 Name
:= 'lbMapSize';
2374 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2376 Name
:= 'meMapDescription';
2381 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2383 Name
:= 'mpMapPreview';
2384 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2385 Y
:= GetControl('lsMapWAD').Y
;
2387 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2389 Name
:= 'lbMapScale';
2392 Color
:= MENU_ITEMSCTRL_COLOR
;
2393 X
:= GetControl('lsMapWAD').X
+
2394 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2395 2 + MAPPREVIEW_WIDTH
*4;
2396 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2399 Menu
.OnClose
:= ProcSetMap
;
2400 Menu
.DefControl
:= 'mSelectMapMenu';
2401 g_GUI_AddWindow(Menu
);
2403 Menu
:= TGUIWindow
.Create('OptionsMenu');
2404 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2406 Name
:= 'mmOptionsMenu';
2407 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2408 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2409 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2410 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2411 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2412 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2414 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2415 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2417 Menu
.OnClose
:= ProcApplyOptions
;
2418 Menu
.DefControl
:= 'mmOptionsMenu';
2419 g_GUI_AddWindow(Menu
);
2421 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2422 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2423 g_GUI_AddWindow(Menu
);
2425 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2426 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2428 Name
:= 'mOptionsVideoMenu';
2429 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2430 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2436 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2439 AddItem(_lc
[I_MENU_YES
]);
2440 AddItem(_lc
[I_MENU_NO
]);
2442 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2444 Name
:= 'swTextureFilter';
2445 AddItem(_lc
[I_MENU_YES
]);
2446 AddItem(_lc
[I_MENU_NO
]);
2448 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2450 Name
:= 'swLegacyNPOT';
2451 AddItem(_lc
[I_MENU_NO
]);
2452 AddItem(_lc
[I_MENU_YES
]);
2455 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2458 Menu
.DefControl
:= 'mOptionsVideoMenu';
2459 g_GUI_AddWindow(Menu
);
2461 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2462 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2464 Name
:= 'mOptionsVideoResMenu';
2465 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2467 Name
:= 'lbCurrentRes';
2471 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2473 Name
:= 'lsResolution';
2476 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2478 Name
:= 'swFullScreen';
2479 AddItem(_lc
[I_MENU_YES
]);
2480 AddItem(_lc
[I_MENU_NO
]);
2483 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2486 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2487 g_GUI_AddWindow(Menu
);
2489 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2490 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2492 Name
:= 'mOptionsSoundMenu';
2493 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2495 Name
:= 'scMusicLevel';
2497 OnChange
:= ProcChangeSoundSettings
;
2499 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2501 Name
:= 'scSoundLevel';
2503 OnChange
:= ProcChangeSoundSettings
;
2505 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2507 Name
:= 'scMaxSimSounds';
2510 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2512 Name
:= 'swAnnouncer';
2513 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2514 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2515 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2516 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2518 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2519 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2521 Name
:= 'swSoundEffects';
2522 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2523 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2525 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2527 Name
:= 'swInactiveSounds';
2528 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2529 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2533 Menu
.DefControl
:= 'mOptionsSoundMenu';
2534 g_GUI_AddWindow(Menu
);
2536 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2537 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2539 Name
:= 'mOptionsGameMenu';
2540 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2542 Name
:= 'scParticlesCount';
2545 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2547 Name
:= 'swBloodCount';
2548 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2549 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2550 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2551 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2552 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2554 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2556 Name
:= 'scShellsMax';
2559 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2561 Name
:= 'scGibsMax';
2564 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2566 Name
:= 'scCorpsesMax';
2569 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2571 Name
:= 'swGibsCount';
2572 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2573 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2574 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2575 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2576 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2578 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2580 Name
:= 'swCorpseType';
2581 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2582 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2584 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2586 Name
:= 'swGibsType';
2587 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2588 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2590 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2592 Name
:= 'swBloodType';
2593 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2594 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2596 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2598 Name
:= 'swScreenFlash';
2599 AddItem(_lc
[I_MENU_NO
]);
2600 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2601 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2603 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2605 Name
:= 'swBackground';
2606 AddItem(_lc
[I_MENU_YES
]);
2607 AddItem(_lc
[I_MENU_NO
]);
2609 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2611 Name
:= 'swMessages';
2612 AddItem(_lc
[I_MENU_YES
]);
2613 AddItem(_lc
[I_MENU_NO
]);
2615 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2617 Name
:= 'swRevertPlayers';
2618 AddItem(_lc
[I_MENU_YES
]);
2619 AddItem(_lc
[I_MENU_NO
]);
2621 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2623 Name
:= 'swChatBubble';
2624 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2625 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2626 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2627 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2628 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2632 Menu
.DefControl
:= 'mOptionsGameMenu';
2633 g_GUI_AddWindow(Menu
);
2635 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2636 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2638 Name
:= 'mOptionsControlsMenu';
2639 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2640 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2641 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2642 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2643 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2645 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2646 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2647 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2648 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2649 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2650 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2652 if e_JoysticksAvailable
<> 0 then
2653 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2655 Menu
.DefControl
:= 'mOptionsControlsMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2659 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2661 Name
:= 'mOptionsControlsP1Menu';
2662 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2663 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2664 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2665 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2666 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2667 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2668 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2669 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2670 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2671 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2673 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2677 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2679 Name
:= 'mOptionsControlsP1MenuWeapons';
2680 for i
:= WP_FIRST
to WP_LAST
do
2681 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2682 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2684 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2685 g_GUI_AddWindow(Menu
);
2687 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2688 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2690 Name
:= 'mOptionsControlsP2Menu';
2691 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2692 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2693 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2694 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2695 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2696 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2697 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2698 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2699 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2700 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2702 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2703 g_GUI_AddWindow(Menu
);
2705 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2706 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2708 Name
:= 'mOptionsControlsP2MenuWeapons';
2709 for i
:= WP_FIRST
to WP_LAST
do
2710 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2711 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2713 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2714 g_GUI_AddWindow(Menu
);
2716 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2717 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2719 Name
:= 'mOptionsControlsJoystickMenu';
2720 for i
:= 0 to e_JoysticksAvailable
-1 do
2721 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2723 Name
:= 'scDeadzone' + IntToStr(i
);
2727 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2728 g_GUI_AddWindow(Menu
);
2730 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2731 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2733 Name
:= 'mOptionsPlayersMenu';
2734 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2735 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2737 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2738 g_GUI_AddWindow(Menu
);
2740 CreatePlayerOptionsMenu('P1');
2741 CreatePlayerOptionsMenu('P2');
2743 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2744 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2746 Name
:= 'mOptionsPlayersMIMenu';
2747 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2752 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2757 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2759 Name
:= 'meComment';
2762 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2763 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2766 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2770 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2771 g_GUI_AddWindow(Menu
);
2773 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2774 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2776 Name
:= 'mOptionsLanguageMenu';
2777 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2778 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2781 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2782 g_GUI_AddWindow(Menu
);
2784 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2785 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2786 g_GUI_AddWindow(Menu
);
2788 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2789 Menu
.BackTexture
:= 'INTER';
2790 Menu
.OnClose
:= ProcAuthorsClose
;
2794 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2796 Color
:= _RGB(255, 0, 0);
2797 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2799 _y
:= _y
+GetHeight();
2801 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2803 Color
:= _RGB(255, 0, 0);
2804 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2806 _y
:= _y
+GetHeight()+32;
2808 // ×òî äåëàë: Êòî äåëàë
2809 cx
:= gScreenWidth
div 2 - 320 + 64;
2810 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2812 Color
:= _RGB(255, 0, 0);
2817 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2819 Color
:= _RGB(255, 255, 255);
2824 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2826 Color
:= _RGB(255, 0, 0);
2831 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2833 Color
:= _RGB(255, 255, 255);
2838 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2840 Color
:= _RGB(255, 255, 255);
2845 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2847 Color
:= _RGB(255, 0, 0);
2852 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2854 Color
:= _RGB(255, 255, 255);
2859 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2861 Color
:= _RGB(255, 0, 0);
2866 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2868 Color
:= _RGB(255, 255, 255);
2871 _y
:= gScreenHeight
- 128;
2874 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2876 Color
:= _RGB(255, 0, 0);
2881 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2883 Color
:= _RGB(255, 255, 255);
2886 _y
:= _y
+GetHeight();
2888 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2890 Color
:= _RGB(255, 255, 255);
2893 _y
:= _y
+GetHeight();
2895 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2897 Color
:= _RGB(255, 255, 255);
2900 _y
:= gScreenHeight
- 32;
2902 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2904 Color
:= _RGB(255, 0, 0);
2905 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2908 g_GUI_AddWindow(Menu
);
2910 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2911 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2912 g_GUI_AddWindow(Menu
);
2914 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2915 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2917 Name
:= 'mmGameSingleMenu';
2918 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2919 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2920 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2921 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2922 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2923 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2925 Menu
.DefControl
:= 'mmGameSingleMenu';
2926 Menu
.MainWindow
:= True;
2927 Menu
.OnClose
:= ProcGMClose
;
2928 Menu
.OnShow
:= ProcGMShow
;
2929 g_GUI_AddWindow(Menu
);
2931 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2932 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2933 g_GUI_AddWindow(Menu
);
2935 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2936 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2937 g_GUI_AddWindow(Menu
);
2939 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2940 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2942 Name
:= 'mmGameCustomMenu';
2943 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2944 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2945 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2946 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2947 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2948 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2949 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2951 Menu
.DefControl
:= 'mmGameCustomMenu';
2952 Menu
.MainWindow
:= True;
2953 Menu
.OnClose
:= ProcGMClose
;
2954 Menu
.OnShow
:= ProcGMShow
;
2955 g_GUI_AddWindow(Menu
);
2957 Menu
:= TGUIWindow
.Create('GameServerMenu');
2958 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2960 Name
:= 'mmGameServerMenu';
2961 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2962 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2963 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2964 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2965 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2967 Menu
.DefControl
:= 'mmGameServerMenu';
2968 Menu
.MainWindow
:= True;
2969 Menu
.OnClose
:= ProcGMClose
;
2970 Menu
.OnShow
:= ProcGMShow
;
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= TGUIWindow
.Create('GameClientMenu');
2974 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2976 Name
:= 'mmGameClientMenu';
2977 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2978 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2979 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2981 Menu
.DefControl
:= 'mmGameClientMenu';
2982 Menu
.MainWindow
:= True;
2983 Menu
.OnClose
:= ProcGMClose
;
2984 Menu
.OnShow
:= ProcGMShow
;
2985 g_GUI_AddWindow(Menu
);
2987 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2988 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2990 Name
:= 'mClientPasswordMenu';
2991 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2999 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3002 Menu
.DefControl
:= 'mClientPasswordMenu';
3003 g_GUI_AddWindow(Menu
);
3005 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3006 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3008 Name
:= 'mGameSetGameMenu';
3009 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3011 Name
:= 'swTeamDamage';
3012 AddItem(_lc
[I_MENU_YES
]);
3013 AddItem(_lc
[I_MENU_NO
]);
3016 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3018 Name
:= 'edTimeLimit';
3023 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3025 Name
:= 'edGoalLimit';
3030 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3032 Name
:= 'edMaxLives';
3037 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3040 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3041 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3042 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3048 Menu
.DefControl
:= 'mGameSetGameMenu';
3049 Menu
.OnClose
:= ProcApplyGameSet
;
3050 g_GUI_AddWindow(Menu
);
3052 Menu
:= TGUIWindow
.Create('TeamMenu');
3053 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3055 Name
:= 'mmTeamMenu';
3056 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3057 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3058 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3059 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3060 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3062 Menu
.DefControl
:= 'mmTeamMenu';
3063 Menu
.OnShow
:= ProcChangePlayers
;
3064 g_GUI_AddWindow(Menu
);
3067 procedure g_Menu_Show_SaveMenu();
3069 if g_Game_IsTestMap
then
3071 if gGameSettings
.GameType
= GT_SINGLE
then
3072 g_GUI_ShowWindow('GameSingleMenu')
3075 if g_Game_IsClient
then
3078 if g_Game_IsNet
then
3081 g_GUI_ShowWindow('GameCustomMenu');
3083 g_GUI_ShowWindow('SaveMenu');
3084 g_Sound_PlayEx('MENU_OPEN');
3087 procedure g_Menu_Show_LoadMenu();
3089 if gGameSettings
.GameType
= GT_SINGLE
then
3090 g_GUI_ShowWindow('GameSingleMenu')
3093 if g_Game_IsClient
then
3096 if g_Game_IsNet
then
3099 g_GUI_ShowWindow('GameCustomMenu');
3101 g_GUI_ShowWindow('LoadMenu');
3102 g_Sound_PlayEx('MENU_OPEN');
3105 procedure g_Menu_Show_GameSetGame();
3107 if gGameSettings
.GameType
= GT_SINGLE
then
3108 g_GUI_ShowWindow('GameSingleMenu')
3111 if g_Game_IsClient
then
3114 if g_Game_IsNet
then
3115 g_GUI_ShowWindow('GameServerMenu')
3117 g_GUI_ShowWindow('GameCustomMenu');
3120 g_GUI_ShowWindow('GameSetGameMenu');
3121 g_Sound_PlayEx('MENU_OPEN');
3124 procedure g_Menu_Show_OptionsVideo();
3126 if gGameSettings
.GameType
= GT_SINGLE
then
3127 g_GUI_ShowWindow('GameSingleMenu')
3130 if g_Game_IsClient
then
3131 g_GUI_ShowWindow('GameClientMenu')
3133 if g_Game_IsNet
then
3134 g_GUI_ShowWindow('GameServerMenu')
3136 g_GUI_ShowWindow('GameCustomMenu');
3139 g_GUI_ShowWindow('OptionsMenu');
3140 g_GUI_ShowWindow('OptionsVideoMenu');
3141 g_Sound_PlayEx('MENU_OPEN');
3144 procedure g_Menu_Show_OptionsSound();
3146 if gGameSettings
.GameType
= GT_SINGLE
then
3147 g_GUI_ShowWindow('GameSingleMenu')
3150 if g_Game_IsClient
then
3151 g_GUI_ShowWindow('GameClientMenu')
3153 if g_Game_IsNet
then
3154 g_GUI_ShowWindow('GameServerMenu')
3156 g_GUI_ShowWindow('GameCustomMenu');
3159 g_GUI_ShowWindow('OptionsMenu');
3160 g_GUI_ShowWindow('OptionsSoundMenu');
3161 g_Sound_PlayEx('MENU_OPEN');
3164 procedure g_Menu_Show_EndGameMenu();
3166 g_GUI_ShowWindow('EndGameMenu');
3167 g_Sound_PlayEx('MENU_OPEN');
3170 procedure g_Menu_Show_QuitGameMenu();
3172 g_GUI_ShowWindow('ExitMenu');
3173 g_Sound_PlayEx('MENU_OPEN');
3176 procedure g_Menu_Init();
3183 procedure g_Menu_Free();
3187 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3192 procedure g_Menu_Reset();
3196 g_GUI_SaveMenuPos();
3197 ex
:= g_GUI_Destroy();
3201 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3206 g_Game_SetDebugMode();
3208 g_GUI_LoadMenuPos();