1 (* Copyright (C) DooM 2D:Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
45 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
46 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, wadreader
, Math
, g_saveload
,
49 e_texture
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
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;
132 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
134 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
135 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
136 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
137 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
139 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
144 else gGibsCount
:= 48;
147 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
148 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
149 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
150 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
151 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
152 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
153 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
154 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
155 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
157 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
159 with menu
, gGameControls
.GameControls
do
161 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
162 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
163 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
164 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
167 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
168 with menu
, gGameControls
.P1Control
do
170 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
171 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
172 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
173 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
174 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
175 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
176 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
177 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
178 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
179 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
181 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
182 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
183 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
184 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
185 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
186 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
187 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
188 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
189 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
190 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
193 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
194 with menu
, gGameControls
.P1Control
do
196 for i
:= WP_FIRST
to WP_LAST
do
198 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
199 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
203 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
204 with menu
, gGameControls
.P2Control
do
206 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
207 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
208 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
209 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
210 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
211 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
212 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
213 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
214 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
215 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
217 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
218 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
219 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
220 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
221 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
222 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
223 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
224 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
225 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
226 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
229 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
230 with menu
, gGameControls
.P2Control
do
232 for i
:= WP_FIRST
to WP_LAST
do
234 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
235 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
239 if e_JoysticksAvailable
> 0 then
241 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
244 for i
:= 0 to e_JoysticksAvailable
-1 do
245 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
249 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
251 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
252 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
253 TEAM_RED
, TEAM_BLUE
);
255 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
257 gPlayer1Settings
.Model
:= Model
.Name
;
258 gPlayer1Settings
.Color
:= Model
.Color
;
261 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
263 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
264 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
265 TEAM_RED
, TEAM_BLUE
);
266 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
268 gPlayer2Settings
.Model
:= Model
.Name
;
269 gPlayer2Settings
.Color
:= Model
.Color
;
272 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
273 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
275 if g_Game_IsServer
then
277 if gPlayer1
<> nil then
279 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
280 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
281 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
282 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
284 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
287 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
290 if gPlayer2
<> nil then
292 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
293 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
294 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
295 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
297 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
302 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
304 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
307 procedure ReadOptions();
312 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
314 with TGUISwitch(menu
.GetControl('swBPP')) do
320 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
321 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
323 with TGUISwitch(menu
.GetControl('swVSync')) do
324 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
326 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
327 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
329 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
331 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
332 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
333 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
335 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
336 if gMuteWhenInactive
then
341 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
343 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
344 if gSoundEffectsDF
then
349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
350 with menu
, gGameControls
.P1Control
do
352 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
353 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
354 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
355 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
356 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
357 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
358 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
361 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
375 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
376 with menu
, gGameControls
.P1Control
do
378 for i
:= WP_FIRST
to WP_LAST
do
380 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
381 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
386 with menu
, gGameControls
.P2Control
do
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
397 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
412 with menu
, gGameControls
.P2Control
do
414 for i
:= WP_FIRST
to WP_LAST
do
416 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
417 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
421 if e_JoysticksAvailable
> 0 then
423 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
426 for i
:= 0 to e_JoysticksAvailable
-1 do
427 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
431 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
432 with menu
, gGameControls
.GameControls
do
434 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
435 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
436 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
437 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
440 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
442 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
443 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
444 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
445 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
446 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
448 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
451 with TGUISwitch(menu
.GetControl('swBloodType')) do
452 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
454 with TGUISwitch(menu
.GetControl('swCorpseType')) do
455 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
457 with TGUISwitch(menu
.GetControl('swGibsType')) do
458 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
460 with TGUISwitch(menu
.GetControl('swGibsCount')) do
469 with TGUISwitch(menu
.GetControl('swBackGround')) do
470 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
472 with TGUISwitch(menu
.GetControl('swMessages')) do
473 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
475 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
476 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
478 with TGUISwitch(menu
.GetControl('swChatBubble')) do
479 ItemIndex
:= gChatBubble
;
481 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
483 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
484 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
486 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
487 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
489 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
490 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
491 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
493 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
495 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
496 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
498 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
499 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
501 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
502 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
503 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
505 ProcSelectModel(nil);
508 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
510 // don't turn off monsters in DM
512 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
513 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
514 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
516 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
519 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
520 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
521 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
522 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
526 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
528 // don't turn off monsters in DM
530 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
531 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
532 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
534 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
537 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
538 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
539 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
540 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
544 procedure ProcStartCustomGame();
550 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
552 Map
:= TGUILabel(GetControl('lbMap')).Text;
555 if not isWadPath(Map
) then
558 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
559 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
560 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
561 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
562 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
564 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
565 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
566 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
567 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
570 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
572 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
574 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
576 Options
:= Options
or GAME_OPTION_MONSTERS
;
577 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
579 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
581 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
582 gcBotsVS
:= 'Monsters';
585 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
586 gcBotsVS
:= 'Everybody';
589 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
590 gcBotsVS
:= 'Players';
597 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
599 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
600 gcMaxLives
, Options
, gcPlayers
);
604 procedure ProcStartNetGame();
610 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
612 Map
:= TGUILabel(GetControl('lbMap')).Text;
615 if not isWadPath(Map
) then
618 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
619 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
620 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
621 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
622 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
623 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
625 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
626 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
627 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
628 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
631 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
633 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
635 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
637 Options
:= Options
or GAME_OPTION_MONSTERS
;
638 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
640 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
642 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
643 gnBotsVS
:= 'Monsters';
646 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
647 gnBotsVS
:= 'Everybody';
650 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
651 gnBotsVS
:= 'Players';
656 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
657 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
658 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
659 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
660 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
663 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
664 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
666 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
667 Options
, gnPlayers
, 0, NetPort
);
670 procedure ProcConnectNetGame();
674 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
676 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
677 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
678 PW
:= TGUIEdit(GetControl('edPW')).Text;
681 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
682 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
685 procedure ProcEnterPassword();
689 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
691 NetClientIP
:= PromptIP
;
692 NetClientPort
:= PromptPort
;
693 PW
:= TGUIEdit(GetControl('edPW')).Text;
696 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
697 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
700 procedure ProcServerlist();
702 if not NetInitDone
then
704 if (not g_Net_Init()) then
706 g_Console_Add('NET: ERROR: Failed to init ENet!');
713 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
715 gState
:= STATE_SLIST
;
716 g_ActiveWindow
:= nil;
718 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
723 slReturnPressed
:= True;
724 if g_Net_Slist_Fetch(slCurrent
) then
726 if slCurrent
= nil then
727 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
730 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
733 procedure ProcStartCampaign();
739 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
741 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
742 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
749 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
752 procedure ProcSelectMap(Sender
: TGUIControl
);
756 wad
, map
, res
: String;
758 win
:= g_GUI_GetWindow('SelectMapMenu');
759 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
761 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
762 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
764 if (wad
= '') or (map
= '') then
765 begin // Ýòî íå êàðòà
766 TGUILabel(GetControl('lbMapName')).Text := '';
767 TGUILabel(GetControl('lbMapAuthor')).Text := '';
768 TGUILabel(GetControl('lbMapSize')).Text := '';
769 TGUIMemo(GetControl('meMapDescription')).SetText('');
770 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
771 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
777 a
:= g_Map_GetMapInfo(res
);
779 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
780 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
781 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
782 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
783 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
784 TGUILabel(win
.GetControl('lbMapScale')).Text :=
785 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
790 procedure ProcSelectWAD(Sender
: TGUIControl
);
795 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
797 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
799 with TGUIListBox(GetControl('lsMapRes')) do
805 list
:= g_Map_GetMapsList(wad
);
819 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
825 win
:= g_GUI_GetWindow('CampaignMenu');
826 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
828 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
832 TGUILabel(GetControl('lbWADName')).Text := '';
833 TGUILabel(GetControl('lbWADAuthor')).Text := '';
834 TGUIMemo(GetControl('meWADDescription')).SetText('');
837 a
:= g_Game_GetMegaWADInfo(wad
);
839 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
840 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
841 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
843 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
847 fn
:= g_ExtractWadName(a
.pic
);
849 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
851 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
856 procedure ProcChangeColor(Sender
: TGUIControl
);
860 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
861 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
862 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
863 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
864 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
865 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
867 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
868 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
869 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
870 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
871 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
872 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
875 procedure ProcSelectModel(Sender
: TGUIControl
);
880 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
881 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
882 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
884 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
885 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
886 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
888 ProcChangeColor(nil);
891 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
903 wad
:= TWADFile
.Create
;
904 if wad
.ReadFile(GameWAD
) then
905 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
910 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
912 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
913 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
914 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
915 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
917 if g_Texture_Get('FONT_STD', ID
) then
918 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
923 if cfglen
<> 0 then FreeMem(cfgdata
);
926 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
932 cfgdata
, fntdata
: Pointer;
933 cfglen
, fntlen
: Integer;
941 wad
:= TWADFile
.Create
;
942 if wad
.ReadFile(GameWAD
) then
944 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
945 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
951 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
952 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
953 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
955 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
956 FontID
:= e_CharFont_Create(spc
);
960 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
961 if chrwidth
= 0 then Continue
;
963 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
965 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
971 if cfglen
<> 0 then FreeMem(cfgdata
);
972 if fntlen
<> 0 then FreeMem(fntdata
);
975 procedure MenuLoadData();
977 e_WriteLog('Loading menu data...', MSG_NOTIFY
);
979 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
980 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
981 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
982 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
983 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
984 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
985 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
986 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
987 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
988 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
989 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
990 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
991 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
992 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
993 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
994 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
995 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
996 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
997 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
998 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
999 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1000 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1001 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1002 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1004 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1005 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1006 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1007 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1008 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1009 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1010 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1013 procedure MenuFreeData();
1015 e_CharFont_Remove(gMenuFont
);
1016 e_CharFont_Remove(gMenuSmallFont
);
1018 g_Texture_Delete('MAINMENU_MARKER1');
1019 g_Texture_Delete('MAINMENU_MARKER2');
1020 g_Texture_Delete('SCROLL_LEFT');
1021 g_Texture_Delete('SCROLL_RIGHT');
1022 g_Texture_Delete('SCROLL_MIDDLE');
1023 g_Texture_Delete('SCROLL_MARKER');
1024 g_Texture_Delete('EDIT_LEFT');
1025 g_Texture_Delete('EDIT_RIGHT');
1026 g_Texture_Delete('EDIT_MIDDLE');
1027 g_Texture_Delete('BOX1');
1028 g_Texture_Delete('BOX2');
1029 g_Texture_Delete('BOX3');
1030 g_Texture_Delete('BOX4');
1031 g_Texture_Delete('BOX5');
1032 g_Texture_Delete('BOX6');
1033 g_Texture_Delete('BOX7');
1034 g_Texture_Delete('BOX8');
1035 g_Texture_Delete('BOX9');
1036 g_Texture_Delete('BSCROLL_UP_A');
1037 g_Texture_Delete('BSCROLL_UP_U');
1038 g_Texture_Delete('BSCROLL_DOWN_A');
1039 g_Texture_Delete('BSCROLL_DOWN_U');
1040 g_Texture_Delete('BSCROLL_MIDDLE');
1041 g_Texture_Delete('NOPIC');
1043 g_Sound_Delete('MENU_SELECT');
1044 g_Sound_Delete('MENU_OPEN');
1045 g_Sound_Delete('MENU_CLOSE');
1046 g_Sound_Delete('MENU_CHANGE');
1047 g_Sound_Delete('SCROLL_ADD');
1048 g_Sound_Delete('SCROLL_SUB');
1049 g_Sound_Delete('SOUND_PLAYER_FALL');
1052 procedure ProcAuthorsMenu();
1054 gMusic
.SetByName('MUSIC_INTERMUS');
1058 procedure ProcExitMenuKeyDown (yes
: Boolean);
1061 snd
: TPlayableSound
;
1066 g_Game_StopAllSounds(True);
1067 case (Random(18)) of
1068 0: s
:= 'SOUND_MONSTER_PAIN';
1069 1: s
:= 'SOUND_MONSTER_DIE_3';
1070 2: s
:= 'SOUND_MONSTER_SLOP';
1071 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1072 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1073 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1074 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1075 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1076 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1077 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1078 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1079 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1080 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1081 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1082 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1083 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1084 else s
:= 'SOUND_PLAYER_FALL';
1086 snd
:= TPlayableSound
.Create();
1087 res
:= snd
.SetByName(s
);
1088 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1092 while snd
.IsPlaying() do begin end;
1100 procedure ProcLoadMenu();
1105 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1109 procedure ProcSaveMenu();
1114 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text :=
1118 procedure ProcSaveGame(Sender
: TGUIControl
);
1122 if g_Game_IsNet
then Exit
;
1123 if g_Game_IsTestMap
then Exit
;
1124 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1125 g_Game_PauseAllSounds(True);
1126 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1128 g_ActiveWindow
:= nil;
1129 g_Game_Pause(False);
1132 procedure ProcLoadGame(Sender
: TGUIControl
);
1136 if g_Game_IsNet
then Exit
;
1137 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1138 if g_LoadGame(a
) then
1139 g_Game_PauseAllSounds(False)
1140 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1141 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1144 procedure ProcSingle1Player();
1146 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1149 procedure ProcSingle2Players();
1151 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1154 procedure ProcSelectMapMenu();
1157 wad_lb
: TGUIFileListBox
;
1158 map_lb
: TGUIListBox
;
1161 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1162 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1163 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1165 if wad_lb
.SelectedItem() <> '' then
1166 map
:= map_lb
.SelectedItem()
1170 wad_lb
.UpdateFileList();
1173 if wad_lb
.SelectedItem() <> '' then
1176 map_lb
.SelectItem(map
);
1178 if map_lb
.SelectedItem() <> '' then
1182 g_GUI_ShowWindow('SelectMapMenu');
1185 procedure ProcSelectCampaignMenu();
1188 wad_lb
: TGUIFileListBox
;
1190 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1191 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1193 wad_lb
.UpdateFileList();
1195 if wad_lb
.SelectedItem() <> '' then
1196 ProcSelectCampaignWAD(nil);
1199 procedure ProcSetMap();
1201 wad
, map
, res
: String;
1203 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1205 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1206 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1209 if (wad
= '') or (map
= '') then
1212 res
:= wad
+':\'+map
;
1214 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1215 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1218 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1222 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1224 g_Sound_SetupAllVolumes(
1225 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1226 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1230 procedure ProcOptionsPlayersMIMenu();
1235 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1237 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1239 if a
= '' then Exit
;
1241 b
:= g_PlayerModel_GetInfo(a
);
1243 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1245 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1246 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1247 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1249 if b
.HaveWeapon
then
1250 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1252 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1255 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1258 procedure ProcOptionsPlayersAnim();
1262 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1267 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1270 Model
.GetCurrentAnimation
.Loop
:= True;
1271 Model
.GetCurrentAnimationMask
.Loop
:= True;
1275 procedure ProcOptionsPlayersWeap();
1279 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1284 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1288 procedure ProcOptionsPlayersRot();
1292 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1293 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1294 if Direction
= D_LEFT
then Direction
:= D_RIGHT
else Direction
:= D_LEFT
;
1297 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1301 g_Options_SetDefault();
1307 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1309 if yes
then ReadOptions();
1313 procedure ProcAuthorsClose();
1315 gMusic
.SetByName('MUSIC_MENU');
1317 gState
:= STATE_MENU
;
1320 procedure ProcGMClose();
1322 g_Game_InGameMenu(False);
1325 procedure ProcGMShow();
1330 if (gGameSettings
.GameType
= GT_SINGLE
) and
1331 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1332 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1333 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1335 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1336 if g_Game_IsTestMap
then
1337 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1338 TGUIMainMenu(g_ActiveWindow
.GetControl(
1339 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1342 procedure ProcChangePlayers();
1344 TeamGame
, Spectator
, AddTwo
: Boolean;
1345 P1Team
{, P2Team}: Byte;
1346 bP2
: TGUITextButton
;
1348 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1349 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1350 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1351 P1Team
:= TEAM_NONE
;
1352 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1354 //P2Team := TEAM_NONE;
1355 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1357 TGUIMainMenu(g_ActiveWindow
.GetControl(
1358 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1359 TGUIMainMenu(g_ActiveWindow
.GetControl(
1360 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1361 TGUIMainMenu(g_ActiveWindow
.GetControl(
1362 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1364 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1365 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1366 bP2
.Enabled
:= AddTwo
and not Spectator
;
1368 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1370 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1371 if gPlayer2
= nil then
1372 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1374 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1376 TGUIMainMenu(g_ActiveWindow
.GetControl(
1377 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1380 procedure ProcJoinRed();
1382 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1384 if g_Game_IsServer
then
1386 if gPlayer1
= nil then
1387 g_Game_AddPlayer(TEAM_RED
)
1390 if gPlayer1
.Team
<> TEAM_RED
then
1392 gPlayer1
.SwitchTeam
;
1393 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1396 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1401 gPlayer1Settings
.Team
:= TEAM_RED
;
1402 MC_SEND_PlayerSettings
;
1403 if gPlayer1
= nil then
1404 g_Game_AddPlayer(TEAM_RED
);
1406 g_ActiveWindow
:= nil;
1407 g_Game_Pause(False);
1410 procedure ProcJoinBlue();
1412 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1414 if g_Game_IsServer
then
1416 if gPlayer1
= nil then
1417 g_Game_AddPlayer(TEAM_BLUE
)
1420 if gPlayer1
.Team
<> TEAM_BLUE
then
1422 gPlayer1
.SwitchTeam
;
1423 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1426 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1431 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1432 MC_SEND_PlayerSettings
;
1433 if gPlayer1
= nil then
1434 g_Game_AddPlayer(TEAM_BLUE
);
1436 g_ActiveWindow
:= nil;
1437 g_Game_Pause(False);
1440 procedure ProcJoinGame();
1442 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1444 if gPlayer1
= nil then
1446 g_ActiveWindow
:= nil;
1447 g_Game_Pause(False);
1450 procedure ProcSwitchP2();
1452 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1454 if gPlayer1
= nil then
1456 if gPlayer2
= nil then
1459 g_Game_RemovePlayer();
1460 g_ActiveWindow
:= nil;
1461 g_Game_Pause(False);
1464 procedure ProcSpectate();
1466 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1469 g_ActiveWindow
:= nil;
1470 g_Game_Pause(False);
1473 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1475 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1478 procedure ProcEndMenuKeyDown (yes
: Boolean);
1480 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1483 procedure ProcSetRussianLanguage();
1485 if gLanguage
<> LANGUAGE_RUSSIAN
then
1487 gLanguage
:= LANGUAGE_RUSSIAN
;
1488 gLanguageChange
:= True;
1489 gAskLanguage
:= False;
1491 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1493 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1498 procedure ProcSetEnglishLanguage();
1500 if gLanguage
<> LANGUAGE_ENGLISH
then
1502 gLanguage
:= LANGUAGE_ENGLISH
;
1503 gLanguageChange
:= True;
1504 gAskLanguage
:= False;
1506 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1508 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1513 procedure ReadGameSettings();
1517 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1519 with gGameSettings
do
1521 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1522 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1527 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1528 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1529 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1531 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1532 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1533 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1536 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1541 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1543 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1544 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1545 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1546 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1547 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1548 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1549 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1550 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1554 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1555 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1560 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1561 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1566 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1567 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1572 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1573 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1578 procedure ProcApplyGameSet();
1582 stat
: TPlayerStatArray
;
1584 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1586 if not g_Game_IsServer
then Exit
;
1588 with gGameSettings
do
1590 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1592 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1593 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1595 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1598 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1600 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1606 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1608 TimeLimit
:= Max(n
, b
);
1612 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1614 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1621 if GameMode
= GM_DM
then
1623 stat
:= g_Player_GetStats();
1625 for a
:= 0 to High(stat
) do
1626 if stat
[a
].Frags
> b
then
1630 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1632 GoalLimit
:= Max(n
, b
);
1636 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1638 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1639 if n
< 0 then n
:= 0;
1640 if n
> 255 then n
:= 255;
1646 stat
:= g_Player_GetStats();
1648 for a
:= 0 to High(stat
) do
1649 if stat
[a
].Lives
> b
then
1652 MaxLives
:= Max(n
, b
);
1656 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1658 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1661 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1662 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1666 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1667 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1671 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1672 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1678 if g_Game_IsNet
then MH_SEND_GameSettings
;
1681 procedure ProcVideoOptionsRes();
1687 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1689 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1690 IntToStr(gScreenWidth
) +
1691 ' x ' + IntToStr(gScreenHeight
) +
1692 ', ' + IntToStr(gBPP
) + ' bpp';
1694 with TGUIListBox(menu
.GetControl('lsResolution')) do
1696 list
:= GetDisplayModes(gBPP
, SR
);
1707 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1714 procedure ProcApplyVideoOptions();
1717 Fullscreen
: Boolean;
1718 SWidth
, SHeight
: Integer;
1721 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1723 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1724 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1726 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1728 if (SWidth
<> gScreenWidth
) or
1729 (SHeight
<> gScreenHeight
) or
1730 (Fullscreen
<> gFullscreen
) then
1732 gResolutionChange
:= True;
1733 gRC_Width
:= SWidth
;
1734 gRC_Height
:= SHeight
;
1735 gRC_FullScreen
:= Fullscreen
;
1736 gRC_Maximized
:= gWinMaximized
;
1739 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1743 procedure ProcSetFirstRussianLanguage();
1745 gLanguage
:= LANGUAGE_RUSSIAN
;
1746 gLanguageChange
:= True;
1747 gAskLanguage
:= False;
1749 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1752 procedure ProcSetFirstEnglishLanguage();
1754 gLanguage
:= LANGUAGE_ENGLISH
;
1755 gLanguageChange
:= True;
1756 gAskLanguage
:= False;
1758 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1761 procedure ProcRecallAddress();
1763 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1765 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1766 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1770 procedure CreateFirstLanguageMenu();
1774 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1776 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1778 Name
:= 'mmFirstLanguageMenu';
1779 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1780 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1783 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1784 Menu
.MainWindow
:= True;
1785 g_GUI_AddWindow(Menu
);
1788 procedure g_Menu_AskLanguage();
1790 CreateFirstLanguageMenu();
1791 g_GUI_ShowWindow('FirstLanguageMenu');
1794 procedure CreatePlayerOptionsMenu(s
: String);
1799 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1801 a
:= _lc
[I_MENU_PLAYER_1
]
1803 a
:= _lc
[I_MENU_PLAYER_2
];
1804 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1806 Name
:= 'mOptionsPlayers'+s
+'Menu';
1807 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1809 Name
:= 'ed'+s
+'Name';
1813 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1815 Name
:= 'sw'+s
+'Team';
1816 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1817 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1819 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1821 Name
:= 'ls'+s
+'Model';
1823 Items
:= g_PlayerModel_GetNames();
1824 OnChange
:= ProcSelectModel
;
1826 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1828 Name
:= 'sc'+s
+'Red';
1830 OnChange
:= ProcChangeColor
;
1832 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1834 Name
:= 'sc'+s
+'Green';
1836 OnChange
:= ProcChangeColor
;
1838 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1840 Name
:= 'sc'+s
+'Blue';
1842 OnChange
:= ProcChangeColor
;
1845 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1846 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1847 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1848 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1850 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1852 Name
:= 'mv'+s
+'Model';
1853 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1854 Y
:= GetControl('ls'+s
+'Model').Y
;
1857 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1858 g_GUI_AddWindow(Menu
);
1861 procedure CreateAllMenus();
1865 a
, cx
, _y
, i
: Integer;
1868 Menu
:= TGUIWindow
.Create('MainMenu');
1869 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1871 Name
:= 'mmMainMenu';
1872 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1873 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1874 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1875 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1876 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1877 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1879 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1881 Color
:= _RGB(255, 255, 255);
1882 X
:= gScreenWidth
-GetWidth
-8;
1883 Y
:= gScreenHeight
-GetHeight
-8;
1885 Menu
.DefControl
:= 'mmMainMenu';
1886 Menu
.MainWindow
:= True;
1887 g_GUI_AddWindow(Menu
);
1889 Menu
:= TGUIWindow
.Create('NewGameMenu');
1890 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1892 Name
:= 'mmNewGameMenu';
1893 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1894 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1895 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1896 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1898 Menu
.DefControl
:= 'mmNewGameMenu';
1899 g_GUI_AddWindow(Menu
);
1901 Menu
:= TGUIWindow
.Create('NetGameMenu');
1902 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1904 Name
:= 'mmNetGameMenu';
1905 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1906 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1908 Menu
.DefControl
:= 'mmNetGameMenu';
1909 g_GUI_AddWindow(Menu
);
1911 Menu
:= TGUIWindow
.Create('NetServerMenu');
1912 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1914 Name
:= 'mNetServerMenu';
1915 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1917 Name
:= 'edSrvName';
1918 OnlyDigits
:= False;
1921 Text := NetServerName
;
1923 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1925 Name
:= 'edSrvPassword';
1926 OnlyDigits
:= False;
1929 Text := NetPassword
;
1931 with AddEdit(_lc
[I_NET_PORT
]) do
1937 Text := IntToStr(NetPort
);
1939 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1941 Name
:= 'edMaxPlayers';
1945 Text := IntToStr(NetMaxClients
);
1947 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1949 Name
:= 'swUseMaster';
1950 AddItem(_lc
[I_MENU_YES
]);
1951 AddItem(_lc
[I_MENU_NO
]);
1952 if NetUseMaster
then
1958 with AddLabel(_lc
[I_MENU_MAP
]) do
1963 OnClick
:= @ProcSelectMapMenu
;
1965 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1967 Name
:= 'swGameMode';
1968 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1969 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1970 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1971 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1972 case g_Game_TextToMode(gnGameMode
) of
1974 GM_DM
: ItemIndex
:= 0;
1975 GM_TDM
: ItemIndex
:= 1;
1976 GM_CTF
: ItemIndex
:= 2;
1978 GM_COOP
: ItemIndex
:= 3;
1980 OnChange
:= ProcSwitchMonstersNet
;
1982 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1984 Name
:= 'edTimeLimit';
1988 if gnTimeLimit
> 0 then
1989 Text := IntToStr(gnTimeLimit
);
1991 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
1993 Name
:= 'edGoalLimit';
1997 if gnGoalLimit
> 0 then
1998 Text := IntToStr(gnGoalLimit
);
2000 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2002 Name
:= 'edMaxLives';
2006 if gnMaxLives
> 0 then
2007 Text := IntToStr(gnMaxLives
);
2009 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2011 Name
:= 'swPlayers';
2012 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2013 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2014 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2015 ItemIndex
:= gnPlayers
;
2017 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2019 Name
:= 'swTeamDamage';
2020 AddItem(_lc
[I_MENU_YES
]);
2021 AddItem(_lc
[I_MENU_NO
]);
2022 if gnTeamDamage
then
2027 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2029 Name
:= 'swEnableExits';
2030 AddItem(_lc
[I_MENU_YES
]);
2031 AddItem(_lc
[I_MENU_NO
]);
2037 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2039 Name
:= 'swWeaponStay';
2040 AddItem(_lc
[I_MENU_YES
]);
2041 AddItem(_lc
[I_MENU_NO
]);
2042 if gnWeaponStay
then
2047 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2049 Name
:= 'swMonsters';
2050 AddItem(_lc
[I_MENU_YES
]);
2051 AddItem(_lc
[I_MENU_NO
]);
2057 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2060 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2061 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2062 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2064 if gnBotsVS
= 'Players' then
2066 if gnBotsVS
= 'Monsters' then
2070 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2074 Menu
.DefControl
:= 'mNetServerMenu';
2075 g_GUI_AddWindow(Menu
);
2077 Menu
:= TGUIWindow
.Create('NetClientMenu');
2078 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2080 Name
:= 'mNetClientMenu';
2082 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2085 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2091 Text := 'localhost';
2093 with AddEdit(_lc
[I_NET_PORT
]) do
2101 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2104 OnlyDigits
:= False;
2111 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2115 Menu
.DefControl
:= 'mNetClientMenu';
2116 g_GUI_AddWindow(Menu
);
2118 Menu
:= TGUIWindow
.Create('LoadMenu');
2119 Menu
.OnShow
:= ProcLoadMenu
;
2120 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2122 Name
:= 'mmLoadMenu';
2127 Name
:= 'edSlot'+IntToStr(a
);
2130 OnEnter
:= ProcLoadGame
;
2133 Menu
.DefControl
:= 'mmLoadMenu';
2134 g_GUI_AddWindow(Menu
);
2136 Menu
:= TGUIWindow
.Create('SaveMenu');
2137 Menu
.OnShow
:= ProcSaveMenu
;
2138 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2140 Name
:= 'mmSaveMenu';
2145 Name
:= 'edSlot'+IntToStr(a
);
2148 OnChange
:= ProcSaveGame
;
2151 Menu
.DefControl
:= 'mmSaveMenu';
2152 g_GUI_AddWindow(Menu
);
2154 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2155 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2157 Name
:= 'mCustomGameMenu';
2158 with AddLabel(_lc
[I_MENU_MAP
]) do
2163 OnClick
:= @ProcSelectMapMenu
;
2165 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2167 Name
:= 'swGameMode';
2168 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2169 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2170 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2171 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2172 case g_Game_TextToMode(gcGameMode
) of
2174 GM_DM
: ItemIndex
:= 0;
2175 GM_TDM
: ItemIndex
:= 1;
2176 GM_CTF
: ItemIndex
:= 2;
2178 GM_COOP
: ItemIndex
:= 3;
2180 OnChange
:= ProcSwitchMonstersCustom
;
2182 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2184 Name
:= 'edTimeLimit';
2188 if gcTimeLimit
> 0 then
2189 Text := IntToStr(gcTimeLimit
);
2191 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2193 Name
:= 'edGoalLimit';
2197 if gcGoalLimit
> 0 then
2198 Text := IntToStr(gcGoalLimit
);
2200 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2202 Name
:= 'edMaxLives';
2206 if gcMaxLives
> 0 then
2207 Text := IntToStr(gcMaxLives
);
2209 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2211 Name
:= 'swPlayers';
2212 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2213 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2214 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2215 ItemIndex
:= gcPlayers
;
2217 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2219 Name
:= 'swTeamDamage';
2220 AddItem(_lc
[I_MENU_YES
]);
2221 AddItem(_lc
[I_MENU_NO
]);
2222 if gcTeamDamage
then
2227 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2229 Name
:= 'swEnableExits';
2230 AddItem(_lc
[I_MENU_YES
]);
2231 AddItem(_lc
[I_MENU_NO
]);
2237 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2239 Name
:= 'swWeaponStay';
2240 AddItem(_lc
[I_MENU_YES
]);
2241 AddItem(_lc
[I_MENU_NO
]);
2242 if gcWeaponStay
then
2247 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2249 Name
:= 'swMonsters';
2250 AddItem(_lc
[I_MENU_YES
]);
2251 AddItem(_lc
[I_MENU_NO
]);
2257 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2260 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2261 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2262 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2264 if gcBotsVS
= 'Players' then
2266 if gcBotsVS
= 'Monsters' then
2270 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2274 Menu
.DefControl
:= 'mCustomGameMenu';
2275 g_GUI_AddWindow(Menu
);
2277 Menu
:= TGUIWindow
.Create('CampaignMenu');
2278 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2280 Name
:= 'mCampaignMenu';
2289 with AddFileList('', 15, 4) do
2292 OnChange
:= ProcSelectCampaignWAD
;
2296 FileMask
:= '*.wad|*.pk3|*.zip';
2297 SetBase(MapsDir
+'megawads/');
2300 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2302 Name
:= 'lbWADName';
2306 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2308 Name
:= 'lbWADAuthor';
2312 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2313 with AddMemo('', 15, 3) do
2315 Name
:= 'meWADDescription';
2316 Color
:= MENU_ITEMSCTRL_COLOR
;
2318 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2320 Name
:= 'swPlayers';
2321 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2322 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2325 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2329 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2331 Name
:= 'mpWADImage';
2332 DefaultRes
:= 'NOPIC';
2333 X
:= GetControl('lsWAD').X
+4;
2334 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2337 Menu
.DefControl
:= 'mCampaignMenu';
2338 g_GUI_AddWindow(Menu
);
2340 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2341 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2343 Name
:= 'mSelectMapMenu';
2344 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2347 OnChange
:= ProcSelectWAD
;
2351 FileMask
:= '*.wad|*.pk3|*.zip';
2354 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2358 OnChange
:= ProcSelectMap
;
2361 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2363 Name
:= 'lbMapName';
2367 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2369 Name
:= 'lbMapAuthor';
2373 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2375 Name
:= 'lbMapSize';
2379 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2381 Name
:= 'meMapDescription';
2386 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2388 Name
:= 'mpMapPreview';
2389 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2390 Y
:= GetControl('lsMapWAD').Y
;
2392 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2394 Name
:= 'lbMapScale';
2397 Color
:= MENU_ITEMSCTRL_COLOR
;
2398 X
:= GetControl('lsMapWAD').X
+
2399 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2400 2 + MAPPREVIEW_WIDTH
*4;
2401 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2404 Menu
.OnClose
:= ProcSetMap
;
2405 Menu
.DefControl
:= 'mSelectMapMenu';
2406 g_GUI_AddWindow(Menu
);
2408 Menu
:= TGUIWindow
.Create('OptionsMenu');
2409 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2411 Name
:= 'mmOptionsMenu';
2412 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2413 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2414 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2415 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2416 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2417 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2419 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2420 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2422 Menu
.OnClose
:= ProcApplyOptions
;
2423 Menu
.DefControl
:= 'mmOptionsMenu';
2424 g_GUI_AddWindow(Menu
);
2426 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2427 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2428 g_GUI_AddWindow(Menu
);
2430 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2431 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2433 Name
:= 'mOptionsVideoMenu';
2434 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2435 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2441 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2444 AddItem(_lc
[I_MENU_YES
]);
2445 AddItem(_lc
[I_MENU_NO
]);
2447 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2449 Name
:= 'swTextureFilter';
2450 AddItem(_lc
[I_MENU_YES
]);
2451 AddItem(_lc
[I_MENU_NO
]);
2453 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2455 Name
:= 'swLegacyNPOT';
2456 AddItem(_lc
[I_MENU_NO
]);
2457 AddItem(_lc
[I_MENU_YES
]);
2460 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2463 Menu
.DefControl
:= 'mOptionsVideoMenu';
2464 g_GUI_AddWindow(Menu
);
2466 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2467 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2469 Name
:= 'mOptionsVideoResMenu';
2470 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2472 Name
:= 'lbCurrentRes';
2476 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2478 Name
:= 'lsResolution';
2481 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2483 Name
:= 'swFullScreen';
2484 AddItem(_lc
[I_MENU_YES
]);
2485 AddItem(_lc
[I_MENU_NO
]);
2488 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2491 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2492 g_GUI_AddWindow(Menu
);
2494 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2495 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2497 Name
:= 'mOptionsSoundMenu';
2498 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2500 Name
:= 'scMusicLevel';
2502 OnChange
:= ProcChangeSoundSettings
;
2504 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2506 Name
:= 'scSoundLevel';
2508 OnChange
:= ProcChangeSoundSettings
;
2510 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2512 Name
:= 'scMaxSimSounds';
2515 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2517 Name
:= 'swAnnouncer';
2518 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2519 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2520 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2521 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2523 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2524 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2526 Name
:= 'swSoundEffects';
2527 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2528 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2530 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2532 Name
:= 'swInactiveSounds';
2533 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2534 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2538 Menu
.DefControl
:= 'mOptionsSoundMenu';
2539 g_GUI_AddWindow(Menu
);
2541 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2542 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2544 Name
:= 'mOptionsGameMenu';
2545 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2547 Name
:= 'scParticlesCount';
2550 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2552 Name
:= 'swBloodCount';
2553 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2554 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2555 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2556 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2557 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2559 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2561 Name
:= 'scShellsMax';
2564 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2566 Name
:= 'scGibsMax';
2569 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2571 Name
:= 'scCorpsesMax';
2574 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2576 Name
:= 'swGibsCount';
2577 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2578 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2579 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2580 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2581 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2583 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2585 Name
:= 'swCorpseType';
2586 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2587 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2589 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2591 Name
:= 'swGibsType';
2592 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2593 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2595 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2597 Name
:= 'swBloodType';
2598 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2599 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2601 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2603 Name
:= 'swScreenFlash';
2604 AddItem(_lc
[I_MENU_NO
]);
2605 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2606 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2608 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2610 Name
:= 'swBackground';
2611 AddItem(_lc
[I_MENU_YES
]);
2612 AddItem(_lc
[I_MENU_NO
]);
2614 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2616 Name
:= 'swMessages';
2617 AddItem(_lc
[I_MENU_YES
]);
2618 AddItem(_lc
[I_MENU_NO
]);
2620 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2622 Name
:= 'swRevertPlayers';
2623 AddItem(_lc
[I_MENU_YES
]);
2624 AddItem(_lc
[I_MENU_NO
]);
2626 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2628 Name
:= 'swChatBubble';
2629 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2630 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2631 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2632 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2633 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2637 Menu
.DefControl
:= 'mOptionsGameMenu';
2638 g_GUI_AddWindow(Menu
);
2640 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2641 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2643 Name
:= 'mOptionsControlsMenu';
2644 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2645 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2646 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2647 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2648 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2650 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2651 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2652 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2653 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2654 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2655 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2657 if e_JoysticksAvailable
<> 0 then
2658 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2660 Menu
.DefControl
:= 'mOptionsControlsMenu';
2661 g_GUI_AddWindow(Menu
);
2663 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2664 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2666 Name
:= 'mOptionsControlsP1Menu';
2667 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2668 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2669 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2670 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2671 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2672 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2673 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2674 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2675 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2676 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2678 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2679 g_GUI_AddWindow(Menu
);
2681 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2682 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2684 Name
:= 'mOptionsControlsP1MenuWeapons';
2685 for i
:= WP_FIRST
to WP_LAST
do
2686 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2687 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2689 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2690 g_GUI_AddWindow(Menu
);
2692 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2693 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2695 Name
:= 'mOptionsControlsP2Menu';
2696 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2697 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2698 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2699 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2700 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2701 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2702 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2703 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2704 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2705 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2707 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2708 g_GUI_AddWindow(Menu
);
2710 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2711 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2713 Name
:= 'mOptionsControlsP2MenuWeapons';
2714 for i
:= WP_FIRST
to WP_LAST
do
2715 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2716 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2718 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2719 g_GUI_AddWindow(Menu
);
2721 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2722 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2724 Name
:= 'mOptionsControlsJoystickMenu';
2725 for i
:= 0 to e_JoysticksAvailable
-1 do
2726 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2728 Name
:= 'scDeadzone' + IntToStr(i
);
2732 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2733 g_GUI_AddWindow(Menu
);
2735 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2736 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2738 Name
:= 'mOptionsPlayersMenu';
2739 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2740 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2742 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2743 g_GUI_AddWindow(Menu
);
2745 CreatePlayerOptionsMenu('P1');
2746 CreatePlayerOptionsMenu('P2');
2748 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2749 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2751 Name
:= 'mOptionsPlayersMIMenu';
2752 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2757 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2762 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2764 Name
:= 'meComment';
2767 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2768 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2771 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2775 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2776 g_GUI_AddWindow(Menu
);
2778 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2779 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2781 Name
:= 'mOptionsLanguageMenu';
2782 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2783 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2786 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2787 g_GUI_AddWindow(Menu
);
2789 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2790 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2791 g_GUI_AddWindow(Menu
);
2793 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2794 Menu
.BackTexture
:= 'INTER';
2795 Menu
.OnClose
:= ProcAuthorsClose
;
2799 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2801 Color
:= _RGB(255, 0, 0);
2802 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2804 _y
:= _y
+GetHeight();
2806 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2808 Color
:= _RGB(255, 0, 0);
2809 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2811 _y
:= _y
+GetHeight()+32;
2813 // ×òî äåëàë: Êòî äåëàë
2814 cx
:= gScreenWidth
div 2 - 320 + 64;
2815 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2817 Color
:= _RGB(255, 0, 0);
2822 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2824 Color
:= _RGB(255, 255, 255);
2829 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2831 Color
:= _RGB(255, 0, 0);
2836 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2838 Color
:= _RGB(255, 255, 255);
2843 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2845 Color
:= _RGB(255, 255, 255);
2850 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2852 Color
:= _RGB(255, 0, 0);
2857 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2859 Color
:= _RGB(255, 255, 255);
2864 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2866 Color
:= _RGB(255, 0, 0);
2871 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2873 Color
:= _RGB(255, 255, 255);
2876 _y
:= gScreenHeight
- 128;
2879 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2881 Color
:= _RGB(255, 0, 0);
2886 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2888 Color
:= _RGB(255, 255, 255);
2891 _y
:= _y
+GetHeight();
2893 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2895 Color
:= _RGB(255, 255, 255);
2898 _y
:= _y
+GetHeight();
2900 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2902 Color
:= _RGB(255, 255, 255);
2905 _y
:= gScreenHeight
- 32;
2907 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2909 Color
:= _RGB(255, 0, 0);
2910 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2913 g_GUI_AddWindow(Menu
);
2915 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2916 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2917 g_GUI_AddWindow(Menu
);
2919 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2920 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2922 Name
:= 'mmGameSingleMenu';
2923 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2924 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2925 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2926 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2927 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2928 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2930 Menu
.DefControl
:= 'mmGameSingleMenu';
2931 Menu
.MainWindow
:= True;
2932 Menu
.OnClose
:= ProcGMClose
;
2933 Menu
.OnShow
:= ProcGMShow
;
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2937 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2938 g_GUI_AddWindow(Menu
);
2940 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2941 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2942 g_GUI_AddWindow(Menu
);
2944 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2945 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2947 Name
:= 'mmGameCustomMenu';
2948 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2949 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2950 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2951 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2952 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2953 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2954 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2956 Menu
.DefControl
:= 'mmGameCustomMenu';
2957 Menu
.MainWindow
:= True;
2958 Menu
.OnClose
:= ProcGMClose
;
2959 Menu
.OnShow
:= ProcGMShow
;
2960 g_GUI_AddWindow(Menu
);
2962 Menu
:= TGUIWindow
.Create('GameServerMenu');
2963 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2965 Name
:= 'mmGameServerMenu';
2966 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2967 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2968 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2969 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2970 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2972 Menu
.DefControl
:= 'mmGameServerMenu';
2973 Menu
.MainWindow
:= True;
2974 Menu
.OnClose
:= ProcGMClose
;
2975 Menu
.OnShow
:= ProcGMShow
;
2976 g_GUI_AddWindow(Menu
);
2978 Menu
:= TGUIWindow
.Create('GameClientMenu');
2979 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2981 Name
:= 'mmGameClientMenu';
2982 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2983 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2984 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2986 Menu
.DefControl
:= 'mmGameClientMenu';
2987 Menu
.MainWindow
:= True;
2988 Menu
.OnClose
:= ProcGMClose
;
2989 Menu
.OnShow
:= ProcGMShow
;
2990 g_GUI_AddWindow(Menu
);
2992 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
2993 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
2995 Name
:= 'mClientPasswordMenu';
2996 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3004 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3007 Menu
.DefControl
:= 'mClientPasswordMenu';
3008 g_GUI_AddWindow(Menu
);
3010 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3011 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3013 Name
:= 'mGameSetGameMenu';
3014 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3016 Name
:= 'swTeamDamage';
3017 AddItem(_lc
[I_MENU_YES
]);
3018 AddItem(_lc
[I_MENU_NO
]);
3021 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3023 Name
:= 'edTimeLimit';
3028 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3030 Name
:= 'edGoalLimit';
3035 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3037 Name
:= 'edMaxLives';
3042 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3045 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3046 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3047 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3053 Menu
.DefControl
:= 'mGameSetGameMenu';
3054 Menu
.OnClose
:= ProcApplyGameSet
;
3055 g_GUI_AddWindow(Menu
);
3057 Menu
:= TGUIWindow
.Create('TeamMenu');
3058 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3060 Name
:= 'mmTeamMenu';
3061 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3062 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3063 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3064 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3065 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3067 Menu
.DefControl
:= 'mmTeamMenu';
3068 Menu
.OnShow
:= ProcChangePlayers
;
3069 g_GUI_AddWindow(Menu
);
3072 procedure g_Menu_Show_SaveMenu();
3074 if g_Game_IsTestMap
then
3076 if gGameSettings
.GameType
= GT_SINGLE
then
3077 g_GUI_ShowWindow('GameSingleMenu')
3080 if g_Game_IsClient
then
3083 if g_Game_IsNet
then
3086 g_GUI_ShowWindow('GameCustomMenu');
3088 g_GUI_ShowWindow('SaveMenu');
3089 g_Sound_PlayEx('MENU_OPEN');
3092 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3094 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3095 if gGameSettings
.GameType
= GT_SINGLE
then
3097 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3101 if g_Game_IsClient
then exit
;
3102 if g_Game_IsNet
then exit
;
3103 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3105 g_GUI_ShowWindow('LoadMenu');
3106 g_Sound_PlayEx('MENU_OPEN');
3109 procedure g_Menu_Show_GameSetGame();
3111 if gGameSettings
.GameType
= GT_SINGLE
then
3112 g_GUI_ShowWindow('GameSingleMenu')
3115 if g_Game_IsClient
then
3118 if g_Game_IsNet
then
3119 g_GUI_ShowWindow('GameServerMenu')
3121 g_GUI_ShowWindow('GameCustomMenu');
3124 g_GUI_ShowWindow('GameSetGameMenu');
3125 g_Sound_PlayEx('MENU_OPEN');
3128 procedure g_Menu_Show_OptionsVideo();
3130 if gGameSettings
.GameType
= GT_SINGLE
then
3131 g_GUI_ShowWindow('GameSingleMenu')
3134 if g_Game_IsClient
then
3135 g_GUI_ShowWindow('GameClientMenu')
3137 if g_Game_IsNet
then
3138 g_GUI_ShowWindow('GameServerMenu')
3140 g_GUI_ShowWindow('GameCustomMenu');
3143 g_GUI_ShowWindow('OptionsMenu');
3144 g_GUI_ShowWindow('OptionsVideoMenu');
3145 g_Sound_PlayEx('MENU_OPEN');
3148 procedure g_Menu_Show_OptionsSound();
3150 if gGameSettings
.GameType
= GT_SINGLE
then
3151 g_GUI_ShowWindow('GameSingleMenu')
3154 if g_Game_IsClient
then
3155 g_GUI_ShowWindow('GameClientMenu')
3157 if g_Game_IsNet
then
3158 g_GUI_ShowWindow('GameServerMenu')
3160 g_GUI_ShowWindow('GameCustomMenu');
3163 g_GUI_ShowWindow('OptionsMenu');
3164 g_GUI_ShowWindow('OptionsSoundMenu');
3165 g_Sound_PlayEx('MENU_OPEN');
3168 procedure g_Menu_Show_EndGameMenu();
3170 g_GUI_ShowWindow('EndGameMenu');
3171 g_Sound_PlayEx('MENU_OPEN');
3174 procedure g_Menu_Show_QuitGameMenu();
3176 g_GUI_ShowWindow('ExitMenu');
3177 g_Sound_PlayEx('MENU_OPEN');
3180 procedure g_Menu_Init();
3187 procedure g_Menu_Free();
3191 e_WriteLog('Releasing menu data...', MSG_NOTIFY
);
3196 procedure g_Menu_Reset();
3200 g_GUI_SaveMenuPos();
3201 ex
:= g_GUI_Destroy();
3205 e_WriteLog('Recreating menu...', MSG_NOTIFY
);
3210 g_Game_SetDebugMode();
3212 g_GUI_LoadMenuPos();