1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
45 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
46 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, Math
, g_saveload
,
49 e_texture
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
54 type TYNCallback
= procedure (yes
:Boolean);
56 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
58 if win
.UserData
= nil then exit
;
60 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
61 IK_N
: TYNCallback(win
.UserData
)(false);
65 procedure YesButtonCB (ctl
: TGUITextButton
);
67 if ctl
.UserData
= nil then exit
;
68 TYNCallback(ctl
.UserData
)(true);
71 procedure NoButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(false);
77 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
81 //if length(Text) = 0 then exit;
82 Result
:= TGUIWindow
.Create(WinName
);
85 //OnKeyDownEx := @YNKeyDownProc;
86 //UserData := @ActionProc;
87 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
90 Name
:= '__temp_yes_no_menu:'+WinName
;
92 AddText(Text, MaxLen
);
93 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
94 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
96 DefControl
:= '__temp_yes_no_menu:'+WinName
;
102 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
103 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
105 procedure ProcApplyOptions();
110 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
112 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
116 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
117 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
118 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
120 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
122 g_Sound_SetupAllVolumes(
123 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
124 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
127 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
128 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
129 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
130 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
133 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
135 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
136 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
137 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
138 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
140 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
145 else gGibsCount
:= 48;
148 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
149 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
150 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
151 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
152 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
153 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
154 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
155 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
156 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
158 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
160 with menu
, gGameControls
.GameControls
do
162 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
163 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
164 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
165 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
168 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
169 with menu
, gGameControls
.P1Control
do
171 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
172 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
173 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
174 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
175 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
176 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
177 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
178 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
179 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
180 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
182 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
183 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
184 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
185 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
186 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
187 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
188 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
189 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
190 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
191 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
194 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
195 with menu
, gGameControls
.P1Control
do
197 for i
:= WP_FIRST
to WP_LAST
do
199 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
200 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
204 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
205 with menu
, gGameControls
.P2Control
do
207 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
208 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
209 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
210 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
211 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
212 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
213 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
214 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
215 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
216 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
218 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
219 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
220 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
221 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
222 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
223 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
224 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
225 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
226 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
227 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
230 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
231 with menu
, gGameControls
.P2Control
do
233 for i
:= WP_FIRST
to WP_LAST
do
235 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
236 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
240 if e_JoysticksAvailable
> 0 then
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
245 for i
:= 0 to e_JoysticksAvailable
-1 do
246 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
250 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
252 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
253 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
254 TEAM_RED
, TEAM_BLUE
);
256 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
258 gPlayer1Settings
.Model
:= Model
.Name
;
259 gPlayer1Settings
.Color
:= Model
.Color
;
262 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
264 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
265 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
266 TEAM_RED
, TEAM_BLUE
);
267 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
269 gPlayer2Settings
.Model
:= Model
.Name
;
270 gPlayer2Settings
.Color
:= Model
.Color
;
273 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
274 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
276 if g_Game_IsServer
then
278 if gPlayer1
<> nil then
280 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
281 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
282 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
283 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
285 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
288 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
291 if gPlayer2
<> nil then
293 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
294 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
295 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
296 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
298 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
303 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
305 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
308 procedure ReadOptions();
313 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
315 with TGUISwitch(menu
.GetControl('swBPP')) do
321 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
322 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
324 with TGUISwitch(menu
.GetControl('swVSync')) do
325 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
327 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
328 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
330 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
332 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
333 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
334 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
336 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
337 if gMuteWhenInactive
then
342 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
344 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
345 if gSoundEffectsDF
then
350 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
351 if gUseChatSounds
then
356 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
357 with menu
, gGameControls
.P1Control
do
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
361 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
362 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
373 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
374 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
375 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
376 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
377 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
378 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
379 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
382 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
383 with menu
, gGameControls
.P1Control
do
385 for i
:= WP_FIRST
to WP_LAST
do
387 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
388 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
392 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
393 with menu
, gGameControls
.P2Control
do
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
397 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
398 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
409 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
410 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
411 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
412 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
413 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
414 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
415 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
418 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
419 with menu
, gGameControls
.P2Control
do
421 for i
:= WP_FIRST
to WP_LAST
do
423 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
424 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
428 if e_JoysticksAvailable
> 0 then
430 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
433 for i
:= 0 to e_JoysticksAvailable
-1 do
434 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
438 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
439 with menu
, gGameControls
.GameControls
do
441 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
442 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
443 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
444 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
447 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
449 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
450 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
451 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
452 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
453 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
455 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
458 with TGUISwitch(menu
.GetControl('swBloodType')) do
459 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
461 with TGUISwitch(menu
.GetControl('swCorpseType')) do
462 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
464 with TGUISwitch(menu
.GetControl('swGibsType')) do
465 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
467 with TGUISwitch(menu
.GetControl('swGibsCount')) do
476 with TGUISwitch(menu
.GetControl('swBackGround')) do
477 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
479 with TGUISwitch(menu
.GetControl('swMessages')) do
480 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
482 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
483 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
485 with TGUISwitch(menu
.GetControl('swChatBubble')) do
486 ItemIndex
:= gChatBubble
;
488 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
490 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
491 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
493 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
494 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
496 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
497 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
498 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
500 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
502 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
503 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
505 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
506 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
508 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
509 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
510 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
512 ProcSelectModel(nil);
515 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
517 // don't turn off monsters in DM
519 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
520 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
521 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
523 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
526 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
527 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
528 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
529 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
533 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
535 // don't turn off monsters in DM
537 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
538 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
539 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
541 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
544 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
545 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
546 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
547 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
551 procedure ProcStartCustomGame();
557 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
559 Map
:= TGUILabel(GetControl('lbMap')).Text;
562 if not isWadPath(Map
) then
565 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
566 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
567 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
568 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
569 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
571 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
572 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
573 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
574 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
577 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
579 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
581 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
583 Options
:= Options
or GAME_OPTION_MONSTERS
;
584 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
586 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
588 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
589 gcBotsVS
:= 'Monsters';
592 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
593 gcBotsVS
:= 'Everybody';
596 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
597 gcBotsVS
:= 'Players';
604 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
606 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
607 gcMaxLives
, Options
, gcPlayers
);
611 procedure ProcStartNetGame();
617 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
619 Map
:= TGUILabel(GetControl('lbMap')).Text;
622 if not isWadPath(Map
) then
625 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
626 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
627 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
628 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
629 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
630 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
632 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
633 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
634 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
635 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
638 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
640 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
642 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
644 Options
:= Options
or GAME_OPTION_MONSTERS
;
645 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
647 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
649 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
650 gnBotsVS
:= 'Monsters';
653 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
654 gnBotsVS
:= 'Everybody';
657 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
658 gnBotsVS
:= 'Players';
663 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
664 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
665 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
666 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
667 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
670 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
671 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
673 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
674 Options
, gnPlayers
, 0, NetPort
);
677 procedure ProcConnectNetGame();
681 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
683 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
684 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
685 PW
:= TGUIEdit(GetControl('edPW')).Text;
688 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
689 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
692 procedure ProcEnterPassword();
696 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
698 NetClientIP
:= PromptIP
;
699 NetClientPort
:= PromptPort
;
700 PW
:= TGUIEdit(GetControl('edPW')).Text;
703 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
704 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
707 procedure ProcServerlist();
709 if not NetInitDone
then
711 if (not g_Net_Init()) then
713 g_Console_Add('NET: ERROR: Failed to init ENet!');
720 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
722 gState
:= STATE_SLIST
;
723 g_ActiveWindow
:= nil;
725 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
730 slReturnPressed
:= True;
731 if g_Net_Slist_Fetch(slCurrent
) then
733 if slCurrent
= nil then
734 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
737 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
740 procedure ProcStartCampaign();
746 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
748 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
749 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
756 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
759 procedure ProcSelectMap(Sender
: TGUIControl
);
763 wad
, map
, res
: String;
765 win
:= g_GUI_GetWindow('SelectMapMenu');
766 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
768 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
769 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
771 if (wad
= '') or (map
= '') then
772 begin // Ýòî íå êàðòà
773 TGUILabel(GetControl('lbMapName')).Text := '';
774 TGUILabel(GetControl('lbMapAuthor')).Text := '';
775 TGUILabel(GetControl('lbMapSize')).Text := '';
776 TGUIMemo(GetControl('meMapDescription')).SetText('');
777 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
778 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
784 a
:= g_Map_GetMapInfo(res
);
786 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
787 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
788 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
789 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
790 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
791 TGUILabel(win
.GetControl('lbMapScale')).Text :=
792 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
797 procedure ProcSelectWAD(Sender
: TGUIControl
);
802 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
804 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
806 with TGUIListBox(GetControl('lsMapRes')) do
812 list
:= g_Map_GetMapsList(wad
);
826 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
832 win
:= g_GUI_GetWindow('CampaignMenu');
833 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
835 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
839 TGUILabel(GetControl('lbWADName')).Text := '';
840 TGUILabel(GetControl('lbWADAuthor')).Text := '';
841 TGUIMemo(GetControl('meWADDescription')).SetText('');
844 a
:= g_Game_GetMegaWADInfo(wad
);
846 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
847 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
848 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
850 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
854 fn
:= g_ExtractWadName(a
.pic
);
856 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
858 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
863 procedure ProcChangeColor(Sender
: TGUIControl
);
867 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
868 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
869 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
870 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
871 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
872 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
874 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
875 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
876 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
877 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
878 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
879 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
882 procedure ProcSelectModel(Sender
: TGUIControl
);
887 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
888 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
889 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
891 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
892 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
893 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
895 ProcChangeColor(nil);
898 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
910 wad
:= TWADFile
.Create
;
911 if wad
.ReadFile(GameWAD
) then
912 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
917 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
919 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
920 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
921 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
922 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
924 if g_Texture_Get('FONT_STD', ID
) then
925 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
930 if cfglen
<> 0 then FreeMem(cfgdata
);
933 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
939 cfgdata
, fntdata
: Pointer;
940 cfglen
, fntlen
: Integer;
948 wad
:= TWADFile
.Create
;
949 if wad
.ReadFile(GameWAD
) then
951 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
952 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
958 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
959 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
960 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
962 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
963 FontID
:= e_CharFont_Create(spc
);
967 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
968 if chrwidth
= 0 then Continue
;
970 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
972 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
978 if cfglen
<> 0 then FreeMem(cfgdata
);
979 if fntlen
<> 0 then FreeMem(fntdata
);
982 procedure MenuLoadData();
984 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
986 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
987 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
988 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
989 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
990 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
991 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
992 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
993 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
994 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
995 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
996 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
997 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
998 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
999 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1000 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1001 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1002 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1003 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1004 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1005 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1006 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1007 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1008 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1009 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1011 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1012 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1013 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1014 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1015 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1016 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1017 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1020 procedure MenuFreeData();
1022 e_CharFont_Remove(gMenuFont
);
1023 e_CharFont_Remove(gMenuSmallFont
);
1025 g_Texture_Delete('MAINMENU_MARKER1');
1026 g_Texture_Delete('MAINMENU_MARKER2');
1027 g_Texture_Delete('SCROLL_LEFT');
1028 g_Texture_Delete('SCROLL_RIGHT');
1029 g_Texture_Delete('SCROLL_MIDDLE');
1030 g_Texture_Delete('SCROLL_MARKER');
1031 g_Texture_Delete('EDIT_LEFT');
1032 g_Texture_Delete('EDIT_RIGHT');
1033 g_Texture_Delete('EDIT_MIDDLE');
1034 g_Texture_Delete('BOX1');
1035 g_Texture_Delete('BOX2');
1036 g_Texture_Delete('BOX3');
1037 g_Texture_Delete('BOX4');
1038 g_Texture_Delete('BOX5');
1039 g_Texture_Delete('BOX6');
1040 g_Texture_Delete('BOX7');
1041 g_Texture_Delete('BOX8');
1042 g_Texture_Delete('BOX9');
1043 g_Texture_Delete('BSCROLL_UP_A');
1044 g_Texture_Delete('BSCROLL_UP_U');
1045 g_Texture_Delete('BSCROLL_DOWN_A');
1046 g_Texture_Delete('BSCROLL_DOWN_U');
1047 g_Texture_Delete('BSCROLL_MIDDLE');
1048 g_Texture_Delete('NOPIC');
1050 g_Sound_Delete('MENU_SELECT');
1051 g_Sound_Delete('MENU_OPEN');
1052 g_Sound_Delete('MENU_CLOSE');
1053 g_Sound_Delete('MENU_CHANGE');
1054 g_Sound_Delete('SCROLL_ADD');
1055 g_Sound_Delete('SCROLL_SUB');
1056 g_Sound_Delete('SOUND_PLAYER_FALL');
1059 procedure ProcAuthorsMenu();
1061 gMusic
.SetByName('MUSIC_INTERMUS');
1065 procedure ProcExitMenuKeyDown (yes
: Boolean);
1068 snd
: TPlayableSound
;
1073 g_Game_StopAllSounds(True);
1074 case (Random(18)) of
1075 0: s
:= 'SOUND_MONSTER_PAIN';
1076 1: s
:= 'SOUND_MONSTER_DIE_3';
1077 2: s
:= 'SOUND_MONSTER_SLOP';
1078 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1079 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1080 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1081 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1082 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1083 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1084 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1085 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1086 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1087 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1088 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1089 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1090 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1091 else s
:= 'SOUND_PLAYER_FALL';
1093 snd
:= TPlayableSound
.Create();
1094 res
:= snd
.SetByName(s
);
1095 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1099 while snd
.IsPlaying() do begin end;
1107 procedure ProcLoadMenu();
1114 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1115 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1116 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1120 procedure ProcSaveMenu();
1128 name
:= g_GetSaveName(a
, valid
);
1129 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1130 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1134 procedure ProcSaveGame(Sender
: TGUIControl
);
1138 if g_Game_IsNet
then Exit
;
1139 if g_Game_IsTestMap
then Exit
;
1140 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1141 g_Game_PauseAllSounds(True);
1142 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1144 g_ActiveWindow
:= nil;
1145 g_Game_Pause(False);
1148 procedure ProcLoadGame(Sender
: TGUIControl
);
1152 if g_Game_IsNet
then Exit
;
1153 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1154 if g_LoadGame(a
) then
1156 g_Game_PauseAllSounds(False)
1158 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1160 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1161 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1162 //g_ActiveWindow := nil;
1166 procedure ProcSingle1Player();
1168 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1171 procedure ProcSingle2Players();
1173 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1176 procedure ProcSelectMapMenu();
1179 wad_lb
: TGUIFileListBox
;
1180 map_lb
: TGUIListBox
;
1183 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1184 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1185 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1187 if wad_lb
.SelectedItem() <> '' then
1188 map
:= map_lb
.SelectedItem()
1192 wad_lb
.UpdateFileList();
1195 if wad_lb
.SelectedItem() <> '' then
1198 map_lb
.SelectItem(map
);
1200 if map_lb
.SelectedItem() <> '' then
1204 g_GUI_ShowWindow('SelectMapMenu');
1207 procedure ProcSelectCampaignMenu();
1210 wad_lb
: TGUIFileListBox
;
1212 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1213 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1215 wad_lb
.UpdateFileList();
1217 if wad_lb
.SelectedItem() <> '' then
1218 ProcSelectCampaignWAD(nil);
1221 procedure ProcSetMap();
1223 wad
, map
, res
: String;
1225 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1227 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1228 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1231 if (wad
= '') or (map
= '') then
1234 res
:= wad
+':\'+map
;
1236 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1237 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1240 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1244 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1246 g_Sound_SetupAllVolumes(
1247 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1248 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1252 procedure ProcOptionsPlayersMIMenu();
1257 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1259 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1261 if a
= '' then Exit
;
1263 b
:= g_PlayerModel_GetInfo(a
);
1265 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1267 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1268 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1269 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1271 if b
.HaveWeapon
then
1272 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1274 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1277 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1280 procedure ProcOptionsPlayersAnim();
1284 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1289 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1292 Model
.GetCurrentAnimation
.Loop
:= True;
1293 Model
.GetCurrentAnimationMask
.Loop
:= True;
1297 procedure ProcOptionsPlayersWeap();
1301 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1306 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1310 procedure ProcOptionsPlayersRot();
1314 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1315 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1317 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1321 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1325 g_Options_SetDefault();
1331 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1333 if yes
then ReadOptions();
1337 procedure ProcAuthorsClose();
1339 gMusic
.SetByName('MUSIC_MENU');
1341 gState
:= STATE_MENU
;
1344 procedure ProcGMClose();
1346 g_Game_InGameMenu(False);
1349 procedure ProcGMShow();
1354 if (gGameSettings
.GameType
= GT_SINGLE
) and
1355 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1356 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1357 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1359 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1360 if g_Game_IsTestMap
then
1361 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1362 TGUIMainMenu(g_ActiveWindow
.GetControl(
1363 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1366 procedure ProcChangePlayers();
1368 TeamGame
, Spectator
, AddTwo
: Boolean;
1369 P1Team
{, P2Team}: Byte;
1370 bP2
: TGUITextButton
;
1372 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1373 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1374 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1375 P1Team
:= TEAM_NONE
;
1376 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1378 //P2Team := TEAM_NONE;
1379 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1381 TGUIMainMenu(g_ActiveWindow
.GetControl(
1382 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1383 TGUIMainMenu(g_ActiveWindow
.GetControl(
1384 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1385 TGUIMainMenu(g_ActiveWindow
.GetControl(
1386 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1388 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1389 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1390 bP2
.Enabled
:= AddTwo
and not Spectator
;
1392 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1394 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1395 if gPlayer2
= nil then
1396 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1398 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1400 TGUIMainMenu(g_ActiveWindow
.GetControl(
1401 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1404 procedure ProcJoinRed();
1406 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1408 if g_Game_IsServer
then
1410 if gPlayer1
= nil then
1411 g_Game_AddPlayer(TEAM_RED
)
1414 if gPlayer1
.Team
<> TEAM_RED
then
1416 gPlayer1
.SwitchTeam
;
1417 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1420 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1425 gPlayer1Settings
.Team
:= TEAM_RED
;
1426 MC_SEND_PlayerSettings
;
1427 if gPlayer1
= nil then
1428 g_Game_AddPlayer(TEAM_RED
);
1430 g_ActiveWindow
:= nil;
1431 g_Game_Pause(False);
1434 procedure ProcJoinBlue();
1436 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1438 if g_Game_IsServer
then
1440 if gPlayer1
= nil then
1441 g_Game_AddPlayer(TEAM_BLUE
)
1444 if gPlayer1
.Team
<> TEAM_BLUE
then
1446 gPlayer1
.SwitchTeam
;
1447 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1450 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1455 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1456 MC_SEND_PlayerSettings
;
1457 if gPlayer1
= nil then
1458 g_Game_AddPlayer(TEAM_BLUE
);
1460 g_ActiveWindow
:= nil;
1461 g_Game_Pause(False);
1464 procedure ProcJoinGame();
1466 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1468 if gPlayer1
= nil then
1470 g_ActiveWindow
:= nil;
1471 g_Game_Pause(False);
1474 procedure ProcSwitchP2();
1476 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1478 if gPlayer1
= nil then
1480 if gPlayer2
= nil then
1483 g_Game_RemovePlayer();
1484 g_ActiveWindow
:= nil;
1485 g_Game_Pause(False);
1488 procedure ProcSpectate();
1490 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1493 g_ActiveWindow
:= nil;
1494 g_Game_Pause(False);
1497 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1499 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1502 procedure ProcEndMenuKeyDown (yes
: Boolean);
1504 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1507 procedure ProcSetRussianLanguage();
1509 if gLanguage
<> LANGUAGE_RUSSIAN
then
1511 gLanguage
:= LANGUAGE_RUSSIAN
;
1512 gLanguageChange
:= True;
1513 gAskLanguage
:= False;
1515 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1517 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1522 procedure ProcSetEnglishLanguage();
1524 if gLanguage
<> LANGUAGE_ENGLISH
then
1526 gLanguage
:= LANGUAGE_ENGLISH
;
1527 gLanguageChange
:= True;
1528 gAskLanguage
:= False;
1530 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1532 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1537 procedure ReadGameSettings();
1541 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1543 with gGameSettings
do
1545 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1546 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1551 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1552 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1553 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1555 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1556 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1557 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1560 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1565 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1567 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1568 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1569 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1570 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1571 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1572 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1573 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1574 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1578 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1579 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1584 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1585 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1590 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1591 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1596 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1597 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1602 procedure ProcApplyGameSet();
1606 stat
: TPlayerStatArray
;
1608 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1610 if not g_Game_IsServer
then Exit
;
1612 with gGameSettings
do
1614 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1616 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1617 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1619 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1622 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1624 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1630 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1632 TimeLimit
:= Max(n
, b
);
1636 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1638 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1645 if GameMode
= GM_DM
then
1647 stat
:= g_Player_GetStats();
1649 for a
:= 0 to High(stat
) do
1650 if stat
[a
].Frags
> b
then
1654 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1656 GoalLimit
:= Max(n
, b
);
1660 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1662 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1663 if n
< 0 then n
:= 0;
1664 if n
> 255 then n
:= 255;
1670 stat
:= g_Player_GetStats();
1672 for a
:= 0 to High(stat
) do
1673 if stat
[a
].Lives
> b
then
1676 MaxLives
:= Max(n
, b
);
1680 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1682 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1685 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1686 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1690 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1691 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1695 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1696 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1702 if g_Game_IsNet
then MH_SEND_GameSettings
;
1705 procedure ProcVideoOptionsRes();
1711 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1713 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1714 IntToStr(gScreenWidth
) +
1715 ' x ' + IntToStr(gScreenHeight
) +
1716 ', ' + IntToStr(gBPP
) + ' bpp';
1718 with TGUIListBox(menu
.GetControl('lsResolution')) do
1720 list
:= GetDisplayModes(gBPP
, SR
);
1731 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1738 procedure ProcApplyVideoOptions();
1741 Fullscreen
: Boolean;
1742 SWidth
, SHeight
: Integer;
1745 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1747 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1748 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1750 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1752 if (SWidth
<> gScreenWidth
) or
1753 (SHeight
<> gScreenHeight
) or
1754 (Fullscreen
<> gFullscreen
) then
1756 gResolutionChange
:= True;
1757 gRC_Width
:= SWidth
;
1758 gRC_Height
:= SHeight
;
1759 gRC_FullScreen
:= Fullscreen
;
1760 gRC_Maximized
:= gWinMaximized
;
1763 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1767 procedure ProcSetFirstRussianLanguage();
1769 gLanguage
:= LANGUAGE_RUSSIAN
;
1770 gLanguageChange
:= True;
1771 gAskLanguage
:= False;
1773 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1776 procedure ProcSetFirstEnglishLanguage();
1778 gLanguage
:= LANGUAGE_ENGLISH
;
1779 gLanguageChange
:= True;
1780 gAskLanguage
:= False;
1782 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1785 procedure ProcRecallAddress();
1787 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1789 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1790 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1794 procedure CreateFirstLanguageMenu();
1798 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1800 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1802 Name
:= 'mmFirstLanguageMenu';
1803 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1804 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1807 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1808 Menu
.MainWindow
:= True;
1809 g_GUI_AddWindow(Menu
);
1812 procedure g_Menu_AskLanguage();
1814 CreateFirstLanguageMenu();
1815 g_GUI_ShowWindow('FirstLanguageMenu');
1818 procedure CreatePlayerOptionsMenu(s
: String);
1823 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1825 a
:= _lc
[I_MENU_PLAYER_1
]
1827 a
:= _lc
[I_MENU_PLAYER_2
];
1828 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1830 Name
:= 'mOptionsPlayers'+s
+'Menu';
1831 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1833 Name
:= 'ed'+s
+'Name';
1837 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1839 Name
:= 'sw'+s
+'Team';
1840 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1841 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1843 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1845 Name
:= 'ls'+s
+'Model';
1847 Items
:= g_PlayerModel_GetNames();
1848 OnChange
:= ProcSelectModel
;
1850 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1852 Name
:= 'sc'+s
+'Red';
1854 OnChange
:= ProcChangeColor
;
1856 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1858 Name
:= 'sc'+s
+'Green';
1860 OnChange
:= ProcChangeColor
;
1862 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1864 Name
:= 'sc'+s
+'Blue';
1866 OnChange
:= ProcChangeColor
;
1869 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1870 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1871 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1872 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1874 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1876 Name
:= 'mv'+s
+'Model';
1877 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1878 Y
:= GetControl('ls'+s
+'Model').Y
;
1881 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1882 g_GUI_AddWindow(Menu
);
1885 procedure CreateAllMenus();
1889 a
, cx
, _y
, i
: Integer;
1892 Menu
:= TGUIWindow
.Create('MainMenu');
1893 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1895 Name
:= 'mmMainMenu';
1896 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1897 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1898 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1899 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1900 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1901 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1903 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1905 Color
:= _RGB(255, 255, 255);
1906 X
:= gScreenWidth
-GetWidth
-8;
1907 Y
:= gScreenHeight
-GetHeight
-8;
1909 Menu
.DefControl
:= 'mmMainMenu';
1910 Menu
.MainWindow
:= True;
1911 g_GUI_AddWindow(Menu
);
1913 Menu
:= TGUIWindow
.Create('NewGameMenu');
1914 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1916 Name
:= 'mmNewGameMenu';
1917 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1918 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1919 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1920 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1922 Menu
.DefControl
:= 'mmNewGameMenu';
1923 g_GUI_AddWindow(Menu
);
1925 Menu
:= TGUIWindow
.Create('NetGameMenu');
1926 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1928 Name
:= 'mmNetGameMenu';
1929 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1930 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1932 Menu
.DefControl
:= 'mmNetGameMenu';
1933 g_GUI_AddWindow(Menu
);
1935 Menu
:= TGUIWindow
.Create('NetServerMenu');
1936 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1938 Name
:= 'mNetServerMenu';
1939 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1941 Name
:= 'edSrvName';
1942 OnlyDigits
:= False;
1945 Text := NetServerName
;
1947 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1949 Name
:= 'edSrvPassword';
1950 OnlyDigits
:= False;
1953 Text := NetPassword
;
1955 with AddEdit(_lc
[I_NET_PORT
]) do
1961 Text := IntToStr(NetPort
);
1963 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1965 Name
:= 'edMaxPlayers';
1969 Text := IntToStr(NetMaxClients
);
1971 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1973 Name
:= 'swUseMaster';
1974 AddItem(_lc
[I_MENU_YES
]);
1975 AddItem(_lc
[I_MENU_NO
]);
1976 if NetUseMaster
then
1982 with AddLabel(_lc
[I_MENU_MAP
]) do
1987 OnClick
:= @ProcSelectMapMenu
;
1989 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1991 Name
:= 'swGameMode';
1992 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1993 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1994 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1995 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1996 case g_Game_TextToMode(gnGameMode
) of
1998 GM_DM
: ItemIndex
:= 0;
1999 GM_TDM
: ItemIndex
:= 1;
2000 GM_CTF
: ItemIndex
:= 2;
2002 GM_COOP
: ItemIndex
:= 3;
2004 OnChange
:= ProcSwitchMonstersNet
;
2006 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2008 Name
:= 'edTimeLimit';
2012 if gnTimeLimit
> 0 then
2013 Text := IntToStr(gnTimeLimit
);
2015 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2017 Name
:= 'edGoalLimit';
2021 if gnGoalLimit
> 0 then
2022 Text := IntToStr(gnGoalLimit
);
2024 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2026 Name
:= 'edMaxLives';
2030 if gnMaxLives
> 0 then
2031 Text := IntToStr(gnMaxLives
);
2033 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2035 Name
:= 'swPlayers';
2036 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2037 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2038 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2039 ItemIndex
:= gnPlayers
;
2041 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2043 Name
:= 'swTeamDamage';
2044 AddItem(_lc
[I_MENU_YES
]);
2045 AddItem(_lc
[I_MENU_NO
]);
2046 if gnTeamDamage
then
2051 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2053 Name
:= 'swEnableExits';
2054 AddItem(_lc
[I_MENU_YES
]);
2055 AddItem(_lc
[I_MENU_NO
]);
2061 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2063 Name
:= 'swWeaponStay';
2064 AddItem(_lc
[I_MENU_YES
]);
2065 AddItem(_lc
[I_MENU_NO
]);
2066 if gnWeaponStay
then
2071 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2073 Name
:= 'swMonsters';
2074 AddItem(_lc
[I_MENU_YES
]);
2075 AddItem(_lc
[I_MENU_NO
]);
2081 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2084 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2085 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2086 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2088 if gnBotsVS
= 'Players' then
2090 if gnBotsVS
= 'Monsters' then
2094 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2098 Menu
.DefControl
:= 'mNetServerMenu';
2099 g_GUI_AddWindow(Menu
);
2101 Menu
:= TGUIWindow
.Create('NetClientMenu');
2102 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2104 Name
:= 'mNetClientMenu';
2106 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2109 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2115 Text := 'localhost';
2117 with AddEdit(_lc
[I_NET_PORT
]) do
2125 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2128 OnlyDigits
:= False;
2135 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2139 Menu
.DefControl
:= 'mNetClientMenu';
2140 g_GUI_AddWindow(Menu
);
2142 Menu
:= TGUIWindow
.Create('LoadMenu');
2143 Menu
.OnShow
:= ProcLoadMenu
;
2144 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2146 Name
:= 'mmLoadMenu';
2151 Name
:= 'edSlot'+IntToStr(a
);
2154 OnEnter
:= ProcLoadGame
;
2157 Menu
.DefControl
:= 'mmLoadMenu';
2158 g_GUI_AddWindow(Menu
);
2160 Menu
:= TGUIWindow
.Create('SaveMenu');
2161 Menu
.OnShow
:= ProcSaveMenu
;
2162 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2164 Name
:= 'mmSaveMenu';
2169 Name
:= 'edSlot'+IntToStr(a
);
2172 OnChange
:= ProcSaveGame
;
2175 Menu
.DefControl
:= 'mmSaveMenu';
2176 g_GUI_AddWindow(Menu
);
2178 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2179 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2181 Name
:= 'mCustomGameMenu';
2182 with AddLabel(_lc
[I_MENU_MAP
]) do
2187 OnClick
:= @ProcSelectMapMenu
;
2189 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2191 Name
:= 'swGameMode';
2192 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2193 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2194 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2195 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2196 case g_Game_TextToMode(gcGameMode
) of
2198 GM_DM
: ItemIndex
:= 0;
2199 GM_TDM
: ItemIndex
:= 1;
2200 GM_CTF
: ItemIndex
:= 2;
2202 GM_COOP
: ItemIndex
:= 3;
2204 OnChange
:= ProcSwitchMonstersCustom
;
2206 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2208 Name
:= 'edTimeLimit';
2212 if gcTimeLimit
> 0 then
2213 Text := IntToStr(gcTimeLimit
);
2215 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2217 Name
:= 'edGoalLimit';
2221 if gcGoalLimit
> 0 then
2222 Text := IntToStr(gcGoalLimit
);
2224 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2226 Name
:= 'edMaxLives';
2230 if gcMaxLives
> 0 then
2231 Text := IntToStr(gcMaxLives
);
2233 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2235 Name
:= 'swPlayers';
2236 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2237 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2238 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2239 ItemIndex
:= gcPlayers
;
2241 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2243 Name
:= 'swTeamDamage';
2244 AddItem(_lc
[I_MENU_YES
]);
2245 AddItem(_lc
[I_MENU_NO
]);
2246 if gcTeamDamage
then
2251 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2253 Name
:= 'swEnableExits';
2254 AddItem(_lc
[I_MENU_YES
]);
2255 AddItem(_lc
[I_MENU_NO
]);
2261 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2263 Name
:= 'swWeaponStay';
2264 AddItem(_lc
[I_MENU_YES
]);
2265 AddItem(_lc
[I_MENU_NO
]);
2266 if gcWeaponStay
then
2271 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2273 Name
:= 'swMonsters';
2274 AddItem(_lc
[I_MENU_YES
]);
2275 AddItem(_lc
[I_MENU_NO
]);
2281 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2284 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2285 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2286 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2288 if gcBotsVS
= 'Players' then
2290 if gcBotsVS
= 'Monsters' then
2294 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2298 Menu
.DefControl
:= 'mCustomGameMenu';
2299 g_GUI_AddWindow(Menu
);
2301 Menu
:= TGUIWindow
.Create('CampaignMenu');
2302 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2304 Name
:= 'mCampaignMenu';
2313 with AddFileList('', 15, 4) do
2316 OnChange
:= ProcSelectCampaignWAD
;
2320 FileMask
:= '*.wad|*.pk3|*.zip';
2321 SetBase(MapsDir
+'megawads/');
2324 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2326 Name
:= 'lbWADName';
2330 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2332 Name
:= 'lbWADAuthor';
2336 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2337 with AddMemo('', 15, 3) do
2339 Name
:= 'meWADDescription';
2340 Color
:= MENU_ITEMSCTRL_COLOR
;
2342 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2344 Name
:= 'swPlayers';
2345 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2346 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2349 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2353 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2355 Name
:= 'mpWADImage';
2356 DefaultRes
:= 'NOPIC';
2357 X
:= GetControl('lsWAD').X
+4;
2358 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2361 Menu
.DefControl
:= 'mCampaignMenu';
2362 g_GUI_AddWindow(Menu
);
2364 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2365 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2367 Name
:= 'mSelectMapMenu';
2368 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2371 OnChange
:= ProcSelectWAD
;
2375 FileMask
:= '*.wad|*.pk3|*.zip';
2378 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2382 OnChange
:= ProcSelectMap
;
2385 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2387 Name
:= 'lbMapName';
2391 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2393 Name
:= 'lbMapAuthor';
2397 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2399 Name
:= 'lbMapSize';
2403 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2405 Name
:= 'meMapDescription';
2410 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2412 Name
:= 'mpMapPreview';
2413 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2414 Y
:= GetControl('lsMapWAD').Y
;
2416 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2418 Name
:= 'lbMapScale';
2421 Color
:= MENU_ITEMSCTRL_COLOR
;
2422 X
:= GetControl('lsMapWAD').X
+
2423 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2424 2 + MAPPREVIEW_WIDTH
*4;
2425 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2428 Menu
.OnClose
:= ProcSetMap
;
2429 Menu
.DefControl
:= 'mSelectMapMenu';
2430 g_GUI_AddWindow(Menu
);
2432 Menu
:= TGUIWindow
.Create('OptionsMenu');
2433 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2435 Name
:= 'mmOptionsMenu';
2436 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2437 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2438 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2439 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2440 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2441 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2443 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2444 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2446 Menu
.OnClose
:= ProcApplyOptions
;
2447 Menu
.DefControl
:= 'mmOptionsMenu';
2448 g_GUI_AddWindow(Menu
);
2450 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2451 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2452 g_GUI_AddWindow(Menu
);
2454 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2455 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2457 Name
:= 'mOptionsVideoMenu';
2458 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2459 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2465 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2468 AddItem(_lc
[I_MENU_YES
]);
2469 AddItem(_lc
[I_MENU_NO
]);
2471 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2473 Name
:= 'swTextureFilter';
2474 AddItem(_lc
[I_MENU_YES
]);
2475 AddItem(_lc
[I_MENU_NO
]);
2477 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2479 Name
:= 'swLegacyNPOT';
2480 AddItem(_lc
[I_MENU_NO
]);
2481 AddItem(_lc
[I_MENU_YES
]);
2484 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2487 Menu
.DefControl
:= 'mOptionsVideoMenu';
2488 g_GUI_AddWindow(Menu
);
2490 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2491 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2493 Name
:= 'mOptionsVideoResMenu';
2494 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2496 Name
:= 'lbCurrentRes';
2500 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2502 Name
:= 'lsResolution';
2505 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2507 Name
:= 'swFullScreen';
2508 AddItem(_lc
[I_MENU_YES
]);
2509 AddItem(_lc
[I_MENU_NO
]);
2512 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2515 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2516 g_GUI_AddWindow(Menu
);
2518 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2519 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2521 Name
:= 'mOptionsSoundMenu';
2522 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2524 Name
:= 'scMusicLevel';
2526 OnChange
:= ProcChangeSoundSettings
;
2528 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2530 Name
:= 'scSoundLevel';
2532 OnChange
:= ProcChangeSoundSettings
;
2534 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2536 Name
:= 'scMaxSimSounds';
2539 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2541 Name
:= 'swAnnouncer';
2542 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2543 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2544 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2545 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2547 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2548 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2550 Name
:= 'swSoundEffects';
2551 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2552 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2554 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2555 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2557 Name
:= 'swChatSpeech';
2558 AddItem(_lc
[I_MENU_YES
]);
2559 AddItem(_lc
[I_MENU_NO
]);
2561 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2563 Name
:= 'swInactiveSounds';
2564 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2565 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2569 Menu
.DefControl
:= 'mOptionsSoundMenu';
2570 g_GUI_AddWindow(Menu
);
2572 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2573 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2575 Name
:= 'mOptionsGameMenu';
2576 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2578 Name
:= 'scParticlesCount';
2581 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2583 Name
:= 'swBloodCount';
2584 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2585 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2586 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2587 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2588 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2590 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2592 Name
:= 'scShellsMax';
2595 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2597 Name
:= 'scGibsMax';
2600 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2602 Name
:= 'scCorpsesMax';
2605 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2607 Name
:= 'swGibsCount';
2608 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2609 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2610 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2611 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2612 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2614 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2616 Name
:= 'swCorpseType';
2617 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2618 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2620 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2622 Name
:= 'swGibsType';
2623 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2624 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2626 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2628 Name
:= 'swBloodType';
2629 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2630 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2632 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2634 Name
:= 'swScreenFlash';
2635 AddItem(_lc
[I_MENU_NO
]);
2636 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2637 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2639 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2641 Name
:= 'swBackground';
2642 AddItem(_lc
[I_MENU_YES
]);
2643 AddItem(_lc
[I_MENU_NO
]);
2645 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2647 Name
:= 'swMessages';
2648 AddItem(_lc
[I_MENU_YES
]);
2649 AddItem(_lc
[I_MENU_NO
]);
2651 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2653 Name
:= 'swRevertPlayers';
2654 AddItem(_lc
[I_MENU_YES
]);
2655 AddItem(_lc
[I_MENU_NO
]);
2657 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2659 Name
:= 'swChatBubble';
2660 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2661 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2662 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2663 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2664 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2668 Menu
.DefControl
:= 'mOptionsGameMenu';
2669 g_GUI_AddWindow(Menu
);
2671 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2672 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2674 Name
:= 'mOptionsControlsMenu';
2675 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2676 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2677 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2678 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2679 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2681 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2682 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2683 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2684 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2685 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2686 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2688 if e_JoysticksAvailable
<> 0 then
2689 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2691 Menu
.DefControl
:= 'mOptionsControlsMenu';
2692 g_GUI_AddWindow(Menu
);
2694 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2695 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2697 Name
:= 'mOptionsControlsP1Menu';
2698 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2699 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2700 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2701 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2702 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2703 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2704 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2705 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2706 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2707 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2709 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2710 g_GUI_AddWindow(Menu
);
2712 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2713 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2715 Name
:= 'mOptionsControlsP1MenuWeapons';
2716 for i
:= WP_FIRST
to WP_LAST
do
2717 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2718 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2720 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2721 g_GUI_AddWindow(Menu
);
2723 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2724 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2726 Name
:= 'mOptionsControlsP2Menu';
2727 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2728 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2729 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2730 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2731 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2732 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2733 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2734 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2735 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2736 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2738 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2739 g_GUI_AddWindow(Menu
);
2741 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2742 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2744 Name
:= 'mOptionsControlsP2MenuWeapons';
2745 for i
:= WP_FIRST
to WP_LAST
do
2746 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2747 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2749 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2750 g_GUI_AddWindow(Menu
);
2752 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2753 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2755 Name
:= 'mOptionsControlsJoystickMenu';
2756 for i
:= 0 to e_JoysticksAvailable
-1 do
2757 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2759 Name
:= 'scDeadzone' + IntToStr(i
);
2763 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2764 g_GUI_AddWindow(Menu
);
2766 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2767 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2769 Name
:= 'mOptionsPlayersMenu';
2770 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2771 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2773 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2774 g_GUI_AddWindow(Menu
);
2776 CreatePlayerOptionsMenu('P1');
2777 CreatePlayerOptionsMenu('P2');
2779 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2780 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2782 Name
:= 'mOptionsPlayersMIMenu';
2783 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2788 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2793 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2795 Name
:= 'meComment';
2798 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2799 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2802 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2806 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2807 g_GUI_AddWindow(Menu
);
2809 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2810 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2812 Name
:= 'mOptionsLanguageMenu';
2813 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2814 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2817 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2818 g_GUI_AddWindow(Menu
);
2820 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2821 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2822 g_GUI_AddWindow(Menu
);
2824 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2825 Menu
.BackTexture
:= 'INTER';
2826 Menu
.OnClose
:= ProcAuthorsClose
;
2830 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2832 Color
:= _RGB(255, 0, 0);
2833 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2835 _y
:= _y
+GetHeight();
2837 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2839 Color
:= _RGB(255, 0, 0);
2840 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2842 _y
:= _y
+GetHeight()+32;
2844 // ×òî äåëàë: Êòî äåëàë
2845 cx
:= gScreenWidth
div 2 - 320 + 64;
2846 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2848 Color
:= _RGB(255, 0, 0);
2853 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2855 Color
:= _RGB(255, 255, 255);
2860 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2862 Color
:= _RGB(255, 0, 0);
2867 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2869 Color
:= _RGB(255, 255, 255);
2874 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2876 Color
:= _RGB(255, 255, 255);
2881 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2883 Color
:= _RGB(255, 0, 0);
2888 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2890 Color
:= _RGB(255, 255, 255);
2895 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2897 Color
:= _RGB(255, 0, 0);
2902 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2904 Color
:= _RGB(255, 255, 255);
2907 _y
:= gScreenHeight
- 128;
2910 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2912 Color
:= _RGB(255, 0, 0);
2917 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2919 Color
:= _RGB(255, 255, 255);
2922 _y
:= _y
+GetHeight();
2924 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2926 Color
:= _RGB(255, 255, 255);
2929 _y
:= _y
+GetHeight();
2931 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2933 Color
:= _RGB(255, 255, 255);
2936 _y
:= gScreenHeight
- 32;
2938 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2940 Color
:= _RGB(255, 0, 0);
2941 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2944 g_GUI_AddWindow(Menu
);
2946 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2947 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2948 g_GUI_AddWindow(Menu
);
2950 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2951 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2953 Name
:= 'mmGameSingleMenu';
2954 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2955 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2956 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2957 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2958 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2959 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2961 Menu
.DefControl
:= 'mmGameSingleMenu';
2962 Menu
.MainWindow
:= True;
2963 Menu
.OnClose
:= ProcGMClose
;
2964 Menu
.OnShow
:= ProcGMShow
;
2965 g_GUI_AddWindow(Menu
);
2967 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2968 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2969 g_GUI_AddWindow(Menu
);
2971 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2972 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2973 g_GUI_AddWindow(Menu
);
2975 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2976 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2978 Name
:= 'mmGameCustomMenu';
2979 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2980 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2981 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2982 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2983 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2984 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2985 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2987 Menu
.DefControl
:= 'mmGameCustomMenu';
2988 Menu
.MainWindow
:= True;
2989 Menu
.OnClose
:= ProcGMClose
;
2990 Menu
.OnShow
:= ProcGMShow
;
2991 g_GUI_AddWindow(Menu
);
2993 Menu
:= TGUIWindow
.Create('GameServerMenu');
2994 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2996 Name
:= 'mmGameServerMenu';
2997 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2998 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2999 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3000 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3001 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3003 Menu
.DefControl
:= 'mmGameServerMenu';
3004 Menu
.MainWindow
:= True;
3005 Menu
.OnClose
:= ProcGMClose
;
3006 Menu
.OnShow
:= ProcGMShow
;
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('GameClientMenu');
3010 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3012 Name
:= 'mmGameClientMenu';
3013 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3014 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3015 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3017 Menu
.DefControl
:= 'mmGameClientMenu';
3018 Menu
.MainWindow
:= True;
3019 Menu
.OnClose
:= ProcGMClose
;
3020 Menu
.OnShow
:= ProcGMShow
;
3021 g_GUI_AddWindow(Menu
);
3023 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3024 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3026 Name
:= 'mClientPasswordMenu';
3027 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3035 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3038 Menu
.DefControl
:= 'mClientPasswordMenu';
3039 g_GUI_AddWindow(Menu
);
3041 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3042 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3044 Name
:= 'mGameSetGameMenu';
3045 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3047 Name
:= 'swTeamDamage';
3048 AddItem(_lc
[I_MENU_YES
]);
3049 AddItem(_lc
[I_MENU_NO
]);
3052 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3054 Name
:= 'edTimeLimit';
3059 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3061 Name
:= 'edGoalLimit';
3066 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3068 Name
:= 'edMaxLives';
3073 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3076 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3077 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3078 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3084 Menu
.DefControl
:= 'mGameSetGameMenu';
3085 Menu
.OnClose
:= ProcApplyGameSet
;
3086 g_GUI_AddWindow(Menu
);
3088 Menu
:= TGUIWindow
.Create('TeamMenu');
3089 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3091 Name
:= 'mmTeamMenu';
3092 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3093 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3094 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3095 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3096 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3098 Menu
.DefControl
:= 'mmTeamMenu';
3099 Menu
.OnShow
:= ProcChangePlayers
;
3100 g_GUI_AddWindow(Menu
);
3103 procedure g_Menu_Show_SaveMenu();
3105 if g_Game_IsTestMap
then
3107 if gGameSettings
.GameType
= GT_SINGLE
then
3108 g_GUI_ShowWindow('GameSingleMenu')
3111 if g_Game_IsClient
then
3114 if g_Game_IsNet
then
3117 g_GUI_ShowWindow('GameCustomMenu');
3119 g_GUI_ShowWindow('SaveMenu');
3120 g_Sound_PlayEx('MENU_OPEN');
3123 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3125 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3126 if gGameSettings
.GameType
= GT_SINGLE
then
3128 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3132 if g_Game_IsClient
then exit
;
3133 if g_Game_IsNet
then exit
;
3134 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3136 g_GUI_ShowWindow('LoadMenu');
3137 g_Sound_PlayEx('MENU_OPEN');
3140 procedure g_Menu_Show_GameSetGame();
3142 if gGameSettings
.GameType
= GT_SINGLE
then
3143 g_GUI_ShowWindow('GameSingleMenu')
3146 if g_Game_IsClient
then
3149 if g_Game_IsNet
then
3150 g_GUI_ShowWindow('GameServerMenu')
3152 g_GUI_ShowWindow('GameCustomMenu');
3155 g_GUI_ShowWindow('GameSetGameMenu');
3156 g_Sound_PlayEx('MENU_OPEN');
3159 procedure g_Menu_Show_OptionsVideo();
3161 if gGameSettings
.GameType
= GT_SINGLE
then
3162 g_GUI_ShowWindow('GameSingleMenu')
3165 if g_Game_IsClient
then
3166 g_GUI_ShowWindow('GameClientMenu')
3168 if g_Game_IsNet
then
3169 g_GUI_ShowWindow('GameServerMenu')
3171 g_GUI_ShowWindow('GameCustomMenu');
3174 g_GUI_ShowWindow('OptionsMenu');
3175 g_GUI_ShowWindow('OptionsVideoMenu');
3176 g_Sound_PlayEx('MENU_OPEN');
3179 procedure g_Menu_Show_OptionsSound();
3181 if gGameSettings
.GameType
= GT_SINGLE
then
3182 g_GUI_ShowWindow('GameSingleMenu')
3185 if g_Game_IsClient
then
3186 g_GUI_ShowWindow('GameClientMenu')
3188 if g_Game_IsNet
then
3189 g_GUI_ShowWindow('GameServerMenu')
3191 g_GUI_ShowWindow('GameCustomMenu');
3194 g_GUI_ShowWindow('OptionsMenu');
3195 g_GUI_ShowWindow('OptionsSoundMenu');
3196 g_Sound_PlayEx('MENU_OPEN');
3199 procedure g_Menu_Show_EndGameMenu();
3201 g_GUI_ShowWindow('EndGameMenu');
3202 g_Sound_PlayEx('MENU_OPEN');
3205 procedure g_Menu_Show_QuitGameMenu();
3207 g_GUI_ShowWindow('ExitMenu');
3208 g_Sound_PlayEx('MENU_OPEN');
3211 procedure g_Menu_Init();
3218 procedure g_Menu_Free();
3222 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3227 procedure g_Menu_Reset();
3231 g_GUI_SaveMenuPos();
3232 ex
:= g_GUI_Destroy();
3236 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3241 g_Game_SetDebugMode();
3243 g_GUI_LoadMenuPos();