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 {$INCLUDE ../nogl/noGLuses.inc}
46 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
, sdl2
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 if (ovs
<> gVSync
) then g_SetVSync(gVSync
);
123 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
124 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
126 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
128 g_Sound_SetupAllVolumes(
129 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
130 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
133 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
134 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
135 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
136 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
137 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
139 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
141 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
142 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
143 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
144 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
146 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
151 else gGibsCount
:= 48;
154 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
155 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
156 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
157 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
158 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
159 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
160 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
161 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
162 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
163 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
= 0;
164 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
170 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
171 g_Console_BindKey(g_Console_FindBind(1, '+scores'), '');
172 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
173 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
174 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
175 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores');
176 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
180 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
183 g_Console_BindKey(g_Console_FindBind(1, '+moveright'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+moveleft'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+lookup'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+lookdown'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+attack'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+jump'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+weapnext'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+weapprev'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+activate'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+strafe'), '');
193 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+moveright');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+moveleft');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+lookup');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+lookdown');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+attack');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+jump');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+weapnext');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+weapprev');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+activate');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+strafe');
204 g_Console_BindKey(g_Console_FindBind(2, '+moveright'), '');
205 g_Console_BindKey(g_Console_FindBind(2, '+moveleft'), '');
206 g_Console_BindKey(g_Console_FindBind(2, '+lookup'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+lookdown'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+attack'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+jump'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+weapnext'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+weapprev'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+activate'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+strafe'), '');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+moveright');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+moveleft');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+lookup');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+lookdown');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+attack');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+jump');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+weapnext');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+weapprev');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+strafe');
226 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
229 for i
:= WP_FIRST
to WP_LAST
do
231 g_Console_BindKey(g_Console_FindBind(1, 'weapon ' + IntToStr(i
+ 1)), '');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'weapon ' + IntToStr(i
+ 1));
233 g_Console_BindKey(g_Console_FindBind(2, 'weapon ' + IntToStr(i
+ 1)), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'weapon ' + IntToStr(i
+ 1));
238 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
241 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright'), '');
242 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft'), '');
243 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup'), '');
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe'), '');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe');
262 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe'), '');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe');
284 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
287 for i
:= WP_FIRST
to WP_LAST
do
289 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
291 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
296 if e_JoysticksAvailable
> 0 then
298 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
301 for i
:= 0 to e_JoysticksAvailable
-1 do
302 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
306 if g_touch_enabled
then
308 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
309 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
310 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
311 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
312 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
315 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
317 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
318 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
319 TEAM_RED
, TEAM_BLUE
);
321 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
323 gPlayer1Settings
.Model
:= Model
.Name
;
324 gPlayer1Settings
.Color
:= Model
.Color
;
327 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
329 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
330 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
331 TEAM_RED
, TEAM_BLUE
);
332 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
334 gPlayer2Settings
.Model
:= Model
.Name
;
335 gPlayer2Settings
.Color
:= Model
.Color
;
338 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
339 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
341 if g_Game_IsServer
then
343 if gPlayer1
<> nil then
345 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
346 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
347 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
348 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
350 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
353 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
356 if gPlayer2
<> nil then
358 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
359 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
360 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
361 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
363 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
368 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
370 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
373 procedure ReadOptions();
378 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
380 with TGUISwitch(menu
.GetControl('swBPP')) do
386 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
387 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
389 with TGUISwitch(menu
.GetControl('swVSync')) do
390 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
392 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
393 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
395 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
397 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
398 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
399 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
401 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
402 if gMuteWhenInactive
then
407 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
409 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
410 if gSoundEffectsDF
then
415 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
416 if gUseChatSounds
then
421 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
424 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+moveright');
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+moveleft');
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+lookup');
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+lookdown');
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+attack');
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+jump');
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+weapnext');
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+weapprev');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+activate');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+strafe');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+moveright');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+moveleft');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+lookup');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+lookdown');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+attack');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+jump');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2,'+weapnext');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+weapprev');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+activate');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+strafe');
447 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
450 for i
:= WP_FIRST
to WP_LAST
do
452 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'weapon ' + IntToStr(i
+ 1));
453 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'weapon ' + IntToStr(i
+ 1));
457 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
460 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright');
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2,'+p2_weapnext');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe');
483 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
486 for i
:= WP_FIRST
to WP_LAST
do
488 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
489 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
493 if e_JoysticksAvailable
> 0 then
495 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
498 for i
:= 0 to e_JoysticksAvailable
-1 do
499 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
503 if g_touch_enabled
then
505 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
506 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
507 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
508 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
509 with TGUISwitch(menu
.GetControl('swTouchFire')) do
510 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
511 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
517 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
518 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores');
519 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
520 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
523 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
525 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
526 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
527 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
528 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
529 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
531 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
534 with TGUISwitch(menu
.GetControl('swBloodType')) do
535 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
537 with TGUISwitch(menu
.GetControl('swCorpseType')) do
538 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
540 with TGUISwitch(menu
.GetControl('swGibsType')) do
541 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
543 with TGUISwitch(menu
.GetControl('swGibsCount')) do
552 with TGUISwitch(menu
.GetControl('swBackGround')) do
553 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
555 with TGUISwitch(menu
.GetControl('swMessages')) do
556 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
558 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
559 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
561 with TGUISwitch(menu
.GetControl('swChatBubble')) do
562 ItemIndex
:= gChatBubble
;
564 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
565 if gPlayerIndicator
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
569 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
571 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
572 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
574 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
575 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
577 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
578 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
579 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
581 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
583 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
584 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
586 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
587 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
589 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
590 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
591 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
593 ProcSelectModel(nil);
596 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
598 // don't turn off monsters in DM
600 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
601 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
602 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
604 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
607 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
608 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
609 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
610 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
614 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
616 // don't turn off monsters in DM
618 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
619 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
622 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
625 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
626 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
627 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
628 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
632 procedure ProcStartCustomGame();
638 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
640 Map
:= TGUILabel(GetControl('lbMap')).Text;
643 if not isWadPath(Map
) then
646 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
647 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
648 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
649 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
650 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
652 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
653 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
654 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
655 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
658 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
660 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
662 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
664 Options
:= Options
or GAME_OPTION_MONSTERS
;
665 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
667 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
669 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
670 gcBotsVS
:= 'Monsters';
673 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
674 gcBotsVS
:= 'Everybody';
677 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
678 gcBotsVS
:= 'Players';
685 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
687 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
688 gcMaxLives
, Options
, gcPlayers
);
692 procedure ProcStartNetGame();
698 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
700 Map
:= TGUILabel(GetControl('lbMap')).Text;
703 if not isWadPath(Map
) then
706 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
707 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
708 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
709 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
710 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
711 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
713 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
714 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
715 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
716 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
719 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
721 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
723 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
725 Options
:= Options
or GAME_OPTION_MONSTERS
;
726 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
728 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
730 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
731 gnBotsVS
:= 'Monsters';
734 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
735 gnBotsVS
:= 'Everybody';
738 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
739 gnBotsVS
:= 'Players';
744 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
745 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
746 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
747 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
748 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
751 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
752 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
754 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
755 Options
, gnPlayers
, 0, NetPort
);
758 procedure ProcConnectNetGame();
762 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
764 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
765 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
766 PW
:= TGUIEdit(GetControl('edPW')).Text;
769 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
770 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
773 procedure ProcEnterPassword();
777 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
779 NetClientIP
:= PromptIP
;
780 NetClientPort
:= PromptPort
;
781 PW
:= TGUIEdit(GetControl('edPW')).Text;
784 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
785 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
788 procedure ProcServerlist();
790 if not NetInitDone
then
792 if (not g_Net_Init()) then
794 g_Console_Add('NET: ERROR: Failed to init ENet!');
801 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
803 gState
:= STATE_SLIST
;
804 g_ActiveWindow
:= nil;
806 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
811 slReturnPressed
:= True;
812 if g_Net_Slist_Fetch(slCurrent
) then
814 if slCurrent
= nil then
815 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
818 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
819 g_Serverlist_GenerateTable(slCurrent
, slTable
);
822 procedure ProcStartCampaign();
828 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
830 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
831 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
838 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
841 procedure ProcSelectMap(Sender
: TGUIControl
);
845 wad
, map
, res
: String;
847 win
:= g_GUI_GetWindow('SelectMapMenu');
848 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
850 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
851 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
853 if (wad
= '') or (map
= '') then
854 begin // Ýòî íå êàðòà
855 TGUILabel(GetControl('lbMapName')).Text := '';
856 TGUILabel(GetControl('lbMapAuthor')).Text := '';
857 TGUILabel(GetControl('lbMapSize')).Text := '';
858 TGUIMemo(GetControl('meMapDescription')).SetText('');
859 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
860 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
866 a
:= g_Map_GetMapInfo(res
);
868 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
869 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
870 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
871 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
872 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
873 TGUILabel(win
.GetControl('lbMapScale')).Text :=
874 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
879 procedure ProcSelectWAD(Sender
: TGUIControl
);
884 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
886 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
888 with TGUIListBox(GetControl('lsMapRes')) do
894 list
:= g_Map_GetMapsList(wad
);
908 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
914 win
:= g_GUI_GetWindow('CampaignMenu');
915 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
917 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
921 TGUILabel(GetControl('lbWADName')).Text := '';
922 TGUILabel(GetControl('lbWADAuthor')).Text := '';
923 TGUIMemo(GetControl('meWADDescription')).SetText('');
926 a
:= g_Game_GetMegaWADInfo(wad
);
928 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
929 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
930 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
932 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
936 fn
:= g_ExtractWadName(a
.pic
);
938 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
940 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
945 procedure ProcChangeColor(Sender
: TGUIControl
);
949 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
950 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
951 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
952 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
953 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
954 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
956 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
957 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
958 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
959 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
960 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
961 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
964 procedure ProcSelectModel(Sender
: TGUIControl
);
969 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
970 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
971 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
973 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
974 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
975 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
977 ProcChangeColor(nil);
980 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
992 wad
:= TWADFile
.Create
;
993 if wad
.ReadFile(GameWAD
) then
994 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
999 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1001 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1002 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1003 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1004 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1006 if g_Texture_Get('FONT_STD', ID
) then
1007 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1012 if cfglen
<> 0 then FreeMem(cfgdata
);
1015 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1021 cfgdata
, fntdata
: Pointer;
1022 cfglen
, fntlen
: Integer;
1030 wad
:= TWADFile
.Create
;
1031 if wad
.ReadFile(GameWAD
) then
1033 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1034 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1040 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1041 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1042 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1044 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1045 FontID
:= e_CharFont_Create(spc
);
1047 for a
:= 0 to 255 do
1049 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1050 if chrwidth
= 0 then Continue
;
1052 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1054 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1060 if cfglen
<> 0 then FreeMem(cfgdata
);
1061 if fntlen
<> 0 then FreeMem(fntdata
);
1064 procedure MenuLoadData();
1066 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1068 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1069 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1070 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1071 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1072 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1073 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1074 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1075 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1076 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1077 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1078 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1079 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1080 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1081 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1082 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1083 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1084 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1085 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1086 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1087 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1088 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1089 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1090 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1091 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1093 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1094 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1095 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1096 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1097 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1098 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1099 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1102 procedure MenuFreeData();
1104 e_CharFont_Remove(gMenuFont
);
1105 e_CharFont_Remove(gMenuSmallFont
);
1107 g_Texture_Delete('MAINMENU_MARKER1');
1108 g_Texture_Delete('MAINMENU_MARKER2');
1109 g_Texture_Delete('SCROLL_LEFT');
1110 g_Texture_Delete('SCROLL_RIGHT');
1111 g_Texture_Delete('SCROLL_MIDDLE');
1112 g_Texture_Delete('SCROLL_MARKER');
1113 g_Texture_Delete('EDIT_LEFT');
1114 g_Texture_Delete('EDIT_RIGHT');
1115 g_Texture_Delete('EDIT_MIDDLE');
1116 g_Texture_Delete('BOX1');
1117 g_Texture_Delete('BOX2');
1118 g_Texture_Delete('BOX3');
1119 g_Texture_Delete('BOX4');
1120 g_Texture_Delete('BOX5');
1121 g_Texture_Delete('BOX6');
1122 g_Texture_Delete('BOX7');
1123 g_Texture_Delete('BOX8');
1124 g_Texture_Delete('BOX9');
1125 g_Texture_Delete('BSCROLL_UP_A');
1126 g_Texture_Delete('BSCROLL_UP_U');
1127 g_Texture_Delete('BSCROLL_DOWN_A');
1128 g_Texture_Delete('BSCROLL_DOWN_U');
1129 g_Texture_Delete('BSCROLL_MIDDLE');
1130 g_Texture_Delete('NOPIC');
1132 g_Sound_Delete('MENU_SELECT');
1133 g_Sound_Delete('MENU_OPEN');
1134 g_Sound_Delete('MENU_CLOSE');
1135 g_Sound_Delete('MENU_CHANGE');
1136 g_Sound_Delete('SCROLL_ADD');
1137 g_Sound_Delete('SCROLL_SUB');
1138 g_Sound_Delete('SOUND_PLAYER_FALL');
1141 procedure ProcAuthorsMenu();
1143 gMusic
.SetByName('MUSIC_INTERMUS');
1147 procedure ProcExitMenuKeyDown (yes
: Boolean);
1150 snd
: TPlayableSound
;
1155 g_Game_StopAllSounds(True);
1156 case (Random(18)) of
1157 0: s
:= 'SOUND_MONSTER_PAIN';
1158 1: s
:= 'SOUND_MONSTER_DIE_3';
1159 2: s
:= 'SOUND_MONSTER_SLOP';
1160 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1161 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1162 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1163 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1164 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1165 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1166 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1167 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1168 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1169 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1170 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1171 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1172 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1173 else s
:= 'SOUND_PLAYER_FALL';
1175 snd
:= TPlayableSound
.Create();
1176 res
:= snd
.SetByName(s
);
1177 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1181 while snd
.IsPlaying() do begin end;
1189 procedure ProcLoadMenu();
1196 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1197 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1198 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1202 procedure ProcSaveMenu();
1210 name
:= g_GetSaveName(a
, valid
);
1211 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1212 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1216 procedure ProcSaveGame(Sender
: TGUIControl
);
1220 if g_Game_IsNet
then Exit
;
1221 if g_Game_IsTestMap
then Exit
;
1222 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1223 g_Game_PauseAllSounds(True);
1224 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1226 g_ActiveWindow
:= nil;
1227 g_Game_Pause(False);
1230 procedure ProcLoadGame(Sender
: TGUIControl
);
1234 if g_Game_IsNet
then Exit
;
1235 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1236 if g_LoadGame(a
) then
1238 g_Game_PauseAllSounds(False)
1240 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1242 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1243 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1244 //g_ActiveWindow := nil;
1248 procedure ProcSingle1Player();
1250 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1253 procedure ProcSingle2Players();
1255 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1258 procedure ProcSelectMapMenu();
1261 wad_lb
: TGUIFileListBox
;
1262 map_lb
: TGUIListBox
;
1265 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1266 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1267 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1269 if wad_lb
.SelectedItem() <> '' then
1270 map
:= map_lb
.SelectedItem()
1274 wad_lb
.UpdateFileList();
1277 if wad_lb
.SelectedItem() <> '' then
1280 map_lb
.SelectItem(map
);
1282 if map_lb
.SelectedItem() <> '' then
1286 g_GUI_ShowWindow('SelectMapMenu');
1289 procedure ProcSelectCampaignMenu();
1292 wad_lb
: TGUIFileListBox
;
1294 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1295 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1297 wad_lb
.UpdateFileList();
1299 if wad_lb
.SelectedItem() <> '' then
1300 ProcSelectCampaignWAD(nil);
1303 procedure ProcSetMap();
1305 wad
, map
, res
: String;
1307 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1309 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1310 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1313 if (wad
= '') or (map
= '') then
1316 res
:= wad
+':\'+map
;
1318 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1319 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1322 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1326 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1328 g_Sound_SetupAllVolumes(
1329 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1330 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1334 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1338 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1339 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
1342 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1346 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1347 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1348 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1349 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1352 procedure ProcOptionsPlayersMIMenu();
1357 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1359 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1361 if a
= '' then Exit
;
1363 b
:= g_PlayerModel_GetInfo(a
);
1365 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1367 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1368 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1369 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1371 if b
.HaveWeapon
then
1372 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1374 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1377 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1380 procedure ProcOptionsPlayersAnim();
1384 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1389 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1392 Model
.GetCurrentAnimation
.Loop
:= True;
1393 Model
.GetCurrentAnimationMask
.Loop
:= True;
1397 procedure ProcOptionsPlayersWeap();
1401 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1406 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1410 procedure ProcOptionsPlayersRot();
1414 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1415 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1417 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1421 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1425 g_Options_SetDefault();
1431 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1433 if yes
then ReadOptions();
1437 procedure ProcAuthorsClose();
1439 gMusic
.SetByName('MUSIC_MENU');
1441 gState
:= STATE_MENU
;
1444 procedure ProcGMClose();
1446 g_Game_InGameMenu(False);
1449 procedure ProcGMShow();
1454 if (gGameSettings
.GameType
= GT_SINGLE
) and
1455 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1456 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1457 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1459 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1460 if g_Game_IsTestMap
then
1461 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1462 TGUIMainMenu(g_ActiveWindow
.GetControl(
1463 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1466 procedure ProcChangePlayers();
1468 TeamGame
, Spectator
, AddTwo
: Boolean;
1469 P1Team
{, P2Team}: Byte;
1470 bP2
: TGUITextButton
;
1472 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1473 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1474 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1475 P1Team
:= TEAM_NONE
;
1476 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1478 //P2Team := TEAM_NONE;
1479 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1481 TGUIMainMenu(g_ActiveWindow
.GetControl(
1482 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1483 TGUIMainMenu(g_ActiveWindow
.GetControl(
1484 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1485 TGUIMainMenu(g_ActiveWindow
.GetControl(
1486 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1488 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1489 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1490 bP2
.Enabled
:= AddTwo
and not Spectator
;
1492 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1494 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1495 if gPlayer2
= nil then
1496 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1498 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1500 TGUIMainMenu(g_ActiveWindow
.GetControl(
1501 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1504 procedure ProcJoinRed();
1506 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1508 if g_Game_IsServer
then
1510 if gPlayer1
= nil then
1511 g_Game_AddPlayer(TEAM_RED
)
1514 if gPlayer1
.Team
<> TEAM_RED
then
1516 gPlayer1
.SwitchTeam
;
1517 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1520 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1525 gPlayer1Settings
.Team
:= TEAM_RED
;
1526 MC_SEND_PlayerSettings
;
1527 if gPlayer1
= nil then
1528 g_Game_AddPlayer(TEAM_RED
);
1530 g_ActiveWindow
:= nil;
1531 g_Game_Pause(False);
1534 procedure ProcJoinBlue();
1536 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1538 if g_Game_IsServer
then
1540 if gPlayer1
= nil then
1541 g_Game_AddPlayer(TEAM_BLUE
)
1544 if gPlayer1
.Team
<> TEAM_BLUE
then
1546 gPlayer1
.SwitchTeam
;
1547 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1550 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1555 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1556 MC_SEND_PlayerSettings
;
1557 if gPlayer1
= nil then
1558 g_Game_AddPlayer(TEAM_BLUE
);
1560 g_ActiveWindow
:= nil;
1561 g_Game_Pause(False);
1564 procedure ProcJoinGame();
1566 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1568 if gPlayer1
= nil then
1570 g_ActiveWindow
:= nil;
1571 g_Game_Pause(False);
1574 procedure ProcSwitchP2();
1576 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1578 if gPlayer1
= nil then
1580 if gPlayer2
= nil then
1583 g_Game_RemovePlayer();
1584 g_ActiveWindow
:= nil;
1585 g_Game_Pause(False);
1588 procedure ProcSpectate();
1590 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1593 g_ActiveWindow
:= nil;
1594 g_Game_Pause(False);
1597 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1599 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1602 procedure ProcEndMenuKeyDown (yes
: Boolean);
1604 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1607 procedure ProcSetRussianLanguage();
1609 if gLanguage
<> LANGUAGE_RUSSIAN
then
1611 gLanguage
:= LANGUAGE_RUSSIAN
;
1612 gLanguageChange
:= True;
1613 gAskLanguage
:= False;
1615 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1617 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1622 procedure ProcSetEnglishLanguage();
1624 if gLanguage
<> LANGUAGE_ENGLISH
then
1626 gLanguage
:= LANGUAGE_ENGLISH
;
1627 gLanguageChange
:= True;
1628 gAskLanguage
:= False;
1630 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1632 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1637 procedure ReadGameSettings();
1641 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1643 with gGameSettings
do
1645 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1646 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1651 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1652 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1653 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1655 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1656 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1657 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1660 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1665 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1667 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1668 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1669 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1670 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1671 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1672 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1673 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1674 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1678 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1679 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1684 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1685 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1690 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1691 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1696 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1697 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1702 procedure ProcApplyGameSet();
1706 stat
: TPlayerStatArray
;
1708 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1710 if not g_Game_IsServer
then Exit
;
1712 with gGameSettings
do
1714 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1716 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1717 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1719 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1722 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1724 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1730 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1732 TimeLimit
:= Max(n
, b
);
1736 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1738 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1745 if GameMode
= GM_DM
then
1747 stat
:= g_Player_GetStats();
1749 for a
:= 0 to High(stat
) do
1750 if stat
[a
].Frags
> b
then
1754 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1756 GoalLimit
:= Max(n
, b
);
1760 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1762 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1763 if n
< 0 then n
:= 0;
1764 if n
> 255 then n
:= 255;
1770 stat
:= g_Player_GetStats();
1772 for a
:= 0 to High(stat
) do
1773 if stat
[a
].Lives
> b
then
1776 MaxLives
:= Max(n
, b
);
1780 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1782 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1785 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1786 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1790 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1791 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1795 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1796 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1802 if g_Game_IsNet
then MH_SEND_GameSettings
;
1805 procedure ProcVideoOptionsRes();
1811 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1813 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1814 IntToStr(gScreenWidth
) +
1815 ' x ' + IntToStr(gScreenHeight
) +
1816 ', ' + IntToStr(gBPP
) + ' bpp';
1818 with TGUIListBox(menu
.GetControl('lsResolution')) do
1820 list
:= GetDisplayModes(gBPP
, SR
);
1831 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1838 procedure ProcApplyVideoOptions();
1841 Fullscreen
: Boolean;
1842 SWidth
, SHeight
: Integer;
1845 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1847 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1848 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1850 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1852 if (SWidth
<> gScreenWidth
) or
1853 (SHeight
<> gScreenHeight
) or
1854 (Fullscreen
<> gFullscreen
) then
1856 gResolutionChange
:= True;
1857 gRC_Width
:= SWidth
;
1858 gRC_Height
:= SHeight
;
1859 gRC_FullScreen
:= Fullscreen
;
1860 gRC_Maximized
:= gWinMaximized
;
1863 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1867 procedure ProcSetFirstRussianLanguage();
1869 gLanguage
:= LANGUAGE_RUSSIAN
;
1870 gLanguageChange
:= True;
1871 gAskLanguage
:= False;
1873 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1876 procedure ProcSetFirstEnglishLanguage();
1878 gLanguage
:= LANGUAGE_ENGLISH
;
1879 gLanguageChange
:= True;
1880 gAskLanguage
:= False;
1882 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1885 procedure ProcRecallAddress();
1887 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1889 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1890 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1894 procedure CreateFirstLanguageMenu();
1898 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1900 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1902 Name
:= 'mmFirstLanguageMenu';
1903 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1904 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1907 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1908 Menu
.MainWindow
:= True;
1909 g_GUI_AddWindow(Menu
);
1912 procedure g_Menu_AskLanguage();
1914 CreateFirstLanguageMenu();
1915 g_GUI_ShowWindow('FirstLanguageMenu');
1918 procedure CreatePlayerOptionsMenu(s
: String);
1923 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1925 a
:= _lc
[I_MENU_PLAYER_1
]
1927 a
:= _lc
[I_MENU_PLAYER_2
];
1928 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1930 Name
:= 'mOptionsPlayers'+s
+'Menu';
1931 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1933 Name
:= 'ed'+s
+'Name';
1937 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1939 Name
:= 'sw'+s
+'Team';
1940 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1941 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1943 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1945 Name
:= 'ls'+s
+'Model';
1947 Items
:= g_PlayerModel_GetNames();
1948 OnChange
:= ProcSelectModel
;
1950 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1952 Name
:= 'sc'+s
+'Red';
1954 OnChange
:= ProcChangeColor
;
1956 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1958 Name
:= 'sc'+s
+'Green';
1960 OnChange
:= ProcChangeColor
;
1962 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1964 Name
:= 'sc'+s
+'Blue';
1966 OnChange
:= ProcChangeColor
;
1969 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1970 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1971 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1972 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1974 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1976 Name
:= 'mv'+s
+'Model';
1977 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1978 Y
:= GetControl('ls'+s
+'Model').Y
;
1981 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1982 g_GUI_AddWindow(Menu
);
1985 procedure CreateAllMenus();
1989 a
, cx
, _y
, i
: Integer;
1992 Menu
:= TGUIWindow
.Create('MainMenu');
1993 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1995 Name
:= 'mmMainMenu';
1996 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1997 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1998 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1999 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2000 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2001 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2003 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2005 Color
:= _RGB(255, 255, 255);
2006 X
:= gScreenWidth
-GetWidth
-8;
2007 Y
:= gScreenHeight
-GetHeight
-8;
2009 Menu
.DefControl
:= 'mmMainMenu';
2010 Menu
.MainWindow
:= True;
2011 g_GUI_AddWindow(Menu
);
2013 Menu
:= TGUIWindow
.Create('NewGameMenu');
2014 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
2016 Name
:= 'mmNewGameMenu';
2017 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2018 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2019 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2020 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2022 Menu
.DefControl
:= 'mmNewGameMenu';
2023 g_GUI_AddWindow(Menu
);
2025 Menu
:= TGUIWindow
.Create('NetGameMenu');
2026 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
2028 Name
:= 'mmNetGameMenu';
2029 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2030 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2032 Menu
.DefControl
:= 'mmNetGameMenu';
2033 g_GUI_AddWindow(Menu
);
2035 Menu
:= TGUIWindow
.Create('NetServerMenu');
2036 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2038 Name
:= 'mNetServerMenu';
2039 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2041 Name
:= 'edSrvName';
2042 OnlyDigits
:= False;
2045 Text := NetServerName
;
2047 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2049 Name
:= 'edSrvPassword';
2050 OnlyDigits
:= False;
2053 Text := NetPassword
;
2055 with AddEdit(_lc
[I_NET_PORT
]) do
2061 Text := IntToStr(NetPort
);
2063 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2065 Name
:= 'edMaxPlayers';
2069 Text := IntToStr(NetMaxClients
);
2071 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2073 Name
:= 'swUseMaster';
2074 AddItem(_lc
[I_MENU_YES
]);
2075 AddItem(_lc
[I_MENU_NO
]);
2076 if NetUseMaster
then
2082 with AddLabel(_lc
[I_MENU_MAP
]) do
2087 OnClick
:= @ProcSelectMapMenu
;
2089 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2091 Name
:= 'swGameMode';
2092 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2093 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2094 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2095 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2096 case g_Game_TextToMode(gnGameMode
) of
2098 GM_DM
: ItemIndex
:= 0;
2099 GM_TDM
: ItemIndex
:= 1;
2100 GM_CTF
: ItemIndex
:= 2;
2102 GM_COOP
: ItemIndex
:= 3;
2104 OnChange
:= ProcSwitchMonstersNet
;
2106 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2108 Name
:= 'edTimeLimit';
2112 if gnTimeLimit
> 0 then
2113 Text := IntToStr(gnTimeLimit
);
2115 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2117 Name
:= 'edGoalLimit';
2121 if gnGoalLimit
> 0 then
2122 Text := IntToStr(gnGoalLimit
);
2124 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2126 Name
:= 'edMaxLives';
2130 if gnMaxLives
> 0 then
2131 Text := IntToStr(gnMaxLives
);
2133 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2135 Name
:= 'swPlayers';
2136 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2137 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2138 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2139 ItemIndex
:= gnPlayers
;
2141 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2143 Name
:= 'swTeamDamage';
2144 AddItem(_lc
[I_MENU_YES
]);
2145 AddItem(_lc
[I_MENU_NO
]);
2146 if gnTeamDamage
then
2151 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2153 Name
:= 'swEnableExits';
2154 AddItem(_lc
[I_MENU_YES
]);
2155 AddItem(_lc
[I_MENU_NO
]);
2161 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2163 Name
:= 'swWeaponStay';
2164 AddItem(_lc
[I_MENU_YES
]);
2165 AddItem(_lc
[I_MENU_NO
]);
2166 if gnWeaponStay
then
2171 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2173 Name
:= 'swMonsters';
2174 AddItem(_lc
[I_MENU_YES
]);
2175 AddItem(_lc
[I_MENU_NO
]);
2181 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2184 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2185 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2186 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2188 if gnBotsVS
= 'Players' then
2190 if gnBotsVS
= 'Monsters' then
2194 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2198 Menu
.DefControl
:= 'mNetServerMenu';
2199 g_GUI_AddWindow(Menu
);
2201 Menu
:= TGUIWindow
.Create('NetClientMenu');
2202 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2204 Name
:= 'mNetClientMenu';
2206 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2209 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2215 Text := 'localhost';
2217 with AddEdit(_lc
[I_NET_PORT
]) do
2225 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2228 OnlyDigits
:= False;
2235 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2239 Menu
.DefControl
:= 'mNetClientMenu';
2240 g_GUI_AddWindow(Menu
);
2242 Menu
:= TGUIWindow
.Create('LoadMenu');
2243 Menu
.OnShow
:= ProcLoadMenu
;
2244 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2246 Name
:= 'mmLoadMenu';
2251 Name
:= 'edSlot'+IntToStr(a
);
2254 OnEnter
:= ProcLoadGame
;
2257 Menu
.DefControl
:= 'mmLoadMenu';
2258 g_GUI_AddWindow(Menu
);
2260 Menu
:= TGUIWindow
.Create('SaveMenu');
2261 Menu
.OnShow
:= ProcSaveMenu
;
2262 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2264 Name
:= 'mmSaveMenu';
2269 Name
:= 'edSlot'+IntToStr(a
);
2272 OnChange
:= ProcSaveGame
;
2275 Menu
.DefControl
:= 'mmSaveMenu';
2276 g_GUI_AddWindow(Menu
);
2278 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2279 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2281 Name
:= 'mCustomGameMenu';
2282 with AddLabel(_lc
[I_MENU_MAP
]) do
2287 OnClick
:= @ProcSelectMapMenu
;
2289 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2291 Name
:= 'swGameMode';
2292 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2293 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2294 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2295 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2296 case g_Game_TextToMode(gcGameMode
) of
2298 GM_DM
: ItemIndex
:= 0;
2299 GM_TDM
: ItemIndex
:= 1;
2300 GM_CTF
: ItemIndex
:= 2;
2302 GM_COOP
: ItemIndex
:= 3;
2304 OnChange
:= ProcSwitchMonstersCustom
;
2306 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2308 Name
:= 'edTimeLimit';
2312 if gcTimeLimit
> 0 then
2313 Text := IntToStr(gcTimeLimit
);
2315 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2317 Name
:= 'edGoalLimit';
2321 if gcGoalLimit
> 0 then
2322 Text := IntToStr(gcGoalLimit
);
2324 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2326 Name
:= 'edMaxLives';
2330 if gcMaxLives
> 0 then
2331 Text := IntToStr(gcMaxLives
);
2333 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2335 Name
:= 'swPlayers';
2336 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2337 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2338 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2339 ItemIndex
:= gcPlayers
;
2341 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2343 Name
:= 'swTeamDamage';
2344 AddItem(_lc
[I_MENU_YES
]);
2345 AddItem(_lc
[I_MENU_NO
]);
2346 if gcTeamDamage
then
2351 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2353 Name
:= 'swEnableExits';
2354 AddItem(_lc
[I_MENU_YES
]);
2355 AddItem(_lc
[I_MENU_NO
]);
2361 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2363 Name
:= 'swWeaponStay';
2364 AddItem(_lc
[I_MENU_YES
]);
2365 AddItem(_lc
[I_MENU_NO
]);
2366 if gcWeaponStay
then
2371 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2373 Name
:= 'swMonsters';
2374 AddItem(_lc
[I_MENU_YES
]);
2375 AddItem(_lc
[I_MENU_NO
]);
2381 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2384 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2385 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2386 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2388 if gcBotsVS
= 'Players' then
2390 if gcBotsVS
= 'Monsters' then
2394 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2398 Menu
.DefControl
:= 'mCustomGameMenu';
2399 g_GUI_AddWindow(Menu
);
2401 Menu
:= TGUIWindow
.Create('CampaignMenu');
2402 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2404 Name
:= 'mCampaignMenu';
2413 with AddFileList('', 15, 4) do
2416 OnChange
:= ProcSelectCampaignWAD
;
2420 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2421 SetBase(MapsDir
+'megawads/');
2424 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2426 Name
:= 'lbWADName';
2430 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2432 Name
:= 'lbWADAuthor';
2436 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2437 with AddMemo('', 15, 3) do
2439 Name
:= 'meWADDescription';
2440 Color
:= MENU_ITEMSCTRL_COLOR
;
2442 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2444 Name
:= 'swPlayers';
2445 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2446 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2449 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2453 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2455 Name
:= 'mpWADImage';
2456 DefaultRes
:= 'NOPIC';
2457 X
:= GetControl('lsWAD').X
+4;
2458 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2461 Menu
.DefControl
:= 'mCampaignMenu';
2462 g_GUI_AddWindow(Menu
);
2464 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2465 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2467 Name
:= 'mSelectMapMenu';
2468 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2471 OnChange
:= ProcSelectWAD
;
2475 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2478 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2482 OnChange
:= ProcSelectMap
;
2485 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2487 Name
:= 'lbMapName';
2491 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2493 Name
:= 'lbMapAuthor';
2497 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2499 Name
:= 'lbMapSize';
2503 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2505 Name
:= 'meMapDescription';
2510 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2512 Name
:= 'mpMapPreview';
2513 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2514 Y
:= GetControl('lsMapWAD').Y
;
2516 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2518 Name
:= 'lbMapScale';
2521 Color
:= MENU_ITEMSCTRL_COLOR
;
2522 X
:= GetControl('lsMapWAD').X
+
2523 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2524 2 + MAPPREVIEW_WIDTH
*4;
2525 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2528 Menu
.OnClose
:= ProcSetMap
;
2529 Menu
.DefControl
:= 'mSelectMapMenu';
2530 g_GUI_AddWindow(Menu
);
2532 Menu
:= TGUIWindow
.Create('OptionsMenu');
2533 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2535 Name
:= 'mmOptionsMenu';
2536 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2537 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2538 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2539 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2540 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2541 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2543 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2544 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2546 Menu
.OnClose
:= ProcApplyOptions
;
2547 Menu
.DefControl
:= 'mmOptionsMenu';
2548 g_GUI_AddWindow(Menu
);
2550 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2551 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2552 g_GUI_AddWindow(Menu
);
2554 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2555 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2557 Name
:= 'mOptionsVideoMenu';
2558 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2559 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2565 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2568 AddItem(_lc
[I_MENU_YES
]);
2569 AddItem(_lc
[I_MENU_NO
]);
2571 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2573 Name
:= 'swTextureFilter';
2574 AddItem(_lc
[I_MENU_YES
]);
2575 AddItem(_lc
[I_MENU_NO
]);
2577 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2579 Name
:= 'swLegacyNPOT';
2580 AddItem(_lc
[I_MENU_NO
]);
2581 AddItem(_lc
[I_MENU_YES
]);
2584 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2587 Menu
.DefControl
:= 'mOptionsVideoMenu';
2588 g_GUI_AddWindow(Menu
);
2590 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2591 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2593 Name
:= 'mOptionsVideoResMenu';
2594 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2596 Name
:= 'lbCurrentRes';
2600 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2602 Name
:= 'lsResolution';
2605 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2607 Name
:= 'swFullScreen';
2608 AddItem(_lc
[I_MENU_YES
]);
2609 AddItem(_lc
[I_MENU_NO
]);
2612 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2615 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2616 g_GUI_AddWindow(Menu
);
2618 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2619 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2621 Name
:= 'mOptionsSoundMenu';
2622 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2624 Name
:= 'scMusicLevel';
2626 OnChange
:= ProcChangeSoundSettings
;
2628 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2630 Name
:= 'scSoundLevel';
2632 OnChange
:= ProcChangeSoundSettings
;
2634 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2636 Name
:= 'scMaxSimSounds';
2639 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2641 Name
:= 'swAnnouncer';
2642 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2643 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2644 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2645 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2647 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2648 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2650 Name
:= 'swSoundEffects';
2651 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2652 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2654 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2655 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2657 Name
:= 'swChatSpeech';
2658 AddItem(_lc
[I_MENU_YES
]);
2659 AddItem(_lc
[I_MENU_NO
]);
2661 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2663 Name
:= 'swInactiveSounds';
2664 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2665 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2669 Menu
.DefControl
:= 'mOptionsSoundMenu';
2670 g_GUI_AddWindow(Menu
);
2672 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2673 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2675 Name
:= 'mOptionsGameMenu';
2676 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2678 Name
:= 'scParticlesCount';
2681 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2683 Name
:= 'swBloodCount';
2684 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2685 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2686 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2687 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2688 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2690 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2692 Name
:= 'scShellsMax';
2695 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2697 Name
:= 'scGibsMax';
2700 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2702 Name
:= 'scCorpsesMax';
2705 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2707 Name
:= 'swGibsCount';
2708 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2709 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2710 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2711 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2712 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2714 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2716 Name
:= 'swCorpseType';
2717 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2718 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2720 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2722 Name
:= 'swGibsType';
2723 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2724 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2726 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2728 Name
:= 'swBloodType';
2729 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2730 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2732 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2734 Name
:= 'swScreenFlash';
2735 AddItem(_lc
[I_MENU_NO
]);
2736 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2737 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2739 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2741 Name
:= 'swBackground';
2742 AddItem(_lc
[I_MENU_YES
]);
2743 AddItem(_lc
[I_MENU_NO
]);
2745 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2747 Name
:= 'swMessages';
2748 AddItem(_lc
[I_MENU_YES
]);
2749 AddItem(_lc
[I_MENU_NO
]);
2751 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2753 Name
:= 'swRevertPlayers';
2754 AddItem(_lc
[I_MENU_YES
]);
2755 AddItem(_lc
[I_MENU_NO
]);
2757 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2759 Name
:= 'swChatBubble';
2760 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2761 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2762 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2763 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2764 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2766 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2768 Name
:= 'swPlayerIndicator';
2769 AddItem(_lc
[I_MENU_YES
]);
2770 AddItem(_lc
[I_MENU_NO
]);
2772 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2774 Name
:= 'scScaleFactor';
2776 OnChange
:= ProcChangeGameSettings
;
2780 Menu
.DefControl
:= 'mOptionsGameMenu';
2781 g_GUI_AddWindow(Menu
);
2783 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2784 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2786 Name
:= 'mOptionsControlsMenu';
2787 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2788 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2789 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2790 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2791 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2793 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2794 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2795 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2796 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2797 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2798 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2799 if e_JoysticksAvailable
<> 0 then
2802 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2804 if g_touch_enabled
then
2807 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2810 Menu
.DefControl
:= 'mOptionsControlsMenu';
2811 g_GUI_AddWindow(Menu
);
2813 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2814 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2816 Name
:= 'mOptionsControlsP1Menu';
2817 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2818 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2819 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2820 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2821 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2822 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2823 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2824 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2825 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2826 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2828 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2829 g_GUI_AddWindow(Menu
);
2831 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2832 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2834 Name
:= 'mOptionsControlsP1MenuWeapons';
2835 for i
:= WP_FIRST
to WP_LAST
do
2836 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2837 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2839 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2840 g_GUI_AddWindow(Menu
);
2842 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2843 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2845 Name
:= 'mOptionsControlsP2Menu';
2846 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2847 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2848 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2849 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2850 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2851 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2852 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2853 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2854 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2855 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2857 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2858 g_GUI_AddWindow(Menu
);
2860 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2861 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2863 Name
:= 'mOptionsControlsP2MenuWeapons';
2864 for i
:= WP_FIRST
to WP_LAST
do
2865 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2866 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2868 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2869 g_GUI_AddWindow(Menu
);
2871 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2872 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2874 Name
:= 'mOptionsControlsJoystickMenu';
2875 for i
:= 0 to e_JoysticksAvailable
-1 do
2876 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2878 Name
:= 'scDeadzone' + IntToStr(i
);
2882 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2883 g_GUI_AddWindow(Menu
);
2885 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2886 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2888 Name
:= 'mOptionsControlsTouchMenu';
2889 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2891 Name
:= 'swTouchAlt';
2892 AddItem(_lc
[I_MENU_NO
]);
2893 AddItem(_lc
[I_MENU_YES
]);
2894 OnChange
:= ProcChangeTouchSettings
;
2896 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2898 Name
:= 'scTouchSize';
2900 OnChange
:= ProcChangeTouchSettings
;
2902 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2904 Name
:= 'swTouchFire';
2905 AddItem(_lc
[I_MENU_NO
]);
2906 AddItem(_lc
[I_MENU_YES
]);
2908 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2910 Name
:= 'scTouchOffset';
2912 OnChange
:= ProcChangeTouchSettings
;
2915 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2916 g_GUI_AddWindow(Menu
);
2918 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2919 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2921 Name
:= 'mOptionsPlayersMenu';
2922 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2923 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2925 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2926 g_GUI_AddWindow(Menu
);
2928 CreatePlayerOptionsMenu('P1');
2929 CreatePlayerOptionsMenu('P2');
2931 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2932 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2934 Name
:= 'mOptionsPlayersMIMenu';
2935 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2940 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2945 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2947 Name
:= 'meComment';
2950 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2951 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2954 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2958 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2959 g_GUI_AddWindow(Menu
);
2961 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2962 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2964 Name
:= 'mOptionsLanguageMenu';
2965 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2966 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2969 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2970 g_GUI_AddWindow(Menu
);
2972 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2973 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2977 Menu
.BackTexture
:= 'INTER';
2978 Menu
.OnClose
:= ProcAuthorsClose
;
2982 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2984 Color
:= _RGB(255, 0, 0);
2985 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2987 _y
:= _y
+GetHeight();
2989 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2991 Color
:= _RGB(255, 0, 0);
2992 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2994 _y
:= _y
+GetHeight()+32;
2996 // ×òî äåëàë: Êòî äåëàë
2997 cx
:= gScreenWidth
div 2 - 320 + 64;
2998 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3000 Color
:= _RGB(255, 0, 0);
3005 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3007 Color
:= _RGB(255, 255, 255);
3012 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3014 Color
:= _RGB(255, 0, 0);
3019 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3021 Color
:= _RGB(255, 255, 255);
3026 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3028 Color
:= _RGB(255, 255, 255);
3033 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3035 Color
:= _RGB(255, 0, 0);
3040 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3042 Color
:= _RGB(255, 255, 255);
3047 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3049 Color
:= _RGB(255, 0, 0);
3054 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3056 Color
:= _RGB(255, 255, 255);
3059 _y
:= gScreenHeight
- 128;
3062 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3064 Color
:= _RGB(255, 0, 0);
3069 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3071 Color
:= _RGB(255, 255, 255);
3074 _y
:= _y
+GetHeight();
3076 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3078 Color
:= _RGB(255, 255, 255);
3081 _y
:= _y
+GetHeight();
3083 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3085 Color
:= _RGB(255, 255, 255);
3088 _y
:= gScreenHeight
- 32;
3090 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3092 Color
:= _RGB(255, 0, 0);
3093 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3096 g_GUI_AddWindow(Menu
);
3098 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3099 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3100 g_GUI_AddWindow(Menu
);
3102 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3103 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3105 Name
:= 'mmGameSingleMenu';
3106 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3107 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3108 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3109 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3110 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3111 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3113 Menu
.DefControl
:= 'mmGameSingleMenu';
3114 Menu
.MainWindow
:= True;
3115 Menu
.OnClose
:= ProcGMClose
;
3116 Menu
.OnShow
:= ProcGMShow
;
3117 g_GUI_AddWindow(Menu
);
3119 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3120 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3121 g_GUI_AddWindow(Menu
);
3123 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3124 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3125 g_GUI_AddWindow(Menu
);
3127 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3128 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3130 Name
:= 'mmGameCustomMenu';
3131 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3132 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3133 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3134 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3135 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3136 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3137 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3139 Menu
.DefControl
:= 'mmGameCustomMenu';
3140 Menu
.MainWindow
:= True;
3141 Menu
.OnClose
:= ProcGMClose
;
3142 Menu
.OnShow
:= ProcGMShow
;
3143 g_GUI_AddWindow(Menu
);
3145 Menu
:= TGUIWindow
.Create('GameServerMenu');
3146 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3148 Name
:= 'mmGameServerMenu';
3149 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3150 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3151 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3152 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3153 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3155 Menu
.DefControl
:= 'mmGameServerMenu';
3156 Menu
.MainWindow
:= True;
3157 Menu
.OnClose
:= ProcGMClose
;
3158 Menu
.OnShow
:= ProcGMShow
;
3159 g_GUI_AddWindow(Menu
);
3161 Menu
:= TGUIWindow
.Create('GameClientMenu');
3162 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3164 Name
:= 'mmGameClientMenu';
3165 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3166 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3167 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3169 Menu
.DefControl
:= 'mmGameClientMenu';
3170 Menu
.MainWindow
:= True;
3171 Menu
.OnClose
:= ProcGMClose
;
3172 Menu
.OnShow
:= ProcGMShow
;
3173 g_GUI_AddWindow(Menu
);
3175 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3176 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3178 Name
:= 'mClientPasswordMenu';
3179 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3187 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3190 Menu
.DefControl
:= 'mClientPasswordMenu';
3191 g_GUI_AddWindow(Menu
);
3193 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3194 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3196 Name
:= 'mGameSetGameMenu';
3197 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3199 Name
:= 'swTeamDamage';
3200 AddItem(_lc
[I_MENU_YES
]);
3201 AddItem(_lc
[I_MENU_NO
]);
3204 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3206 Name
:= 'edTimeLimit';
3211 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3213 Name
:= 'edGoalLimit';
3218 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3220 Name
:= 'edMaxLives';
3225 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3228 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3229 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3230 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3236 Menu
.DefControl
:= 'mGameSetGameMenu';
3237 Menu
.OnClose
:= ProcApplyGameSet
;
3238 g_GUI_AddWindow(Menu
);
3240 Menu
:= TGUIWindow
.Create('TeamMenu');
3241 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3243 Name
:= 'mmTeamMenu';
3244 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3245 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3246 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3247 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3248 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3250 Menu
.DefControl
:= 'mmTeamMenu';
3251 Menu
.OnShow
:= ProcChangePlayers
;
3252 g_GUI_AddWindow(Menu
);
3255 procedure g_Menu_Show_SaveMenu();
3257 if g_Game_IsTestMap
then
3259 if gGameSettings
.GameType
= GT_SINGLE
then
3260 g_GUI_ShowWindow('GameSingleMenu')
3263 if g_Game_IsClient
then
3266 if g_Game_IsNet
then
3269 g_GUI_ShowWindow('GameCustomMenu');
3271 g_GUI_ShowWindow('SaveMenu');
3272 g_Sound_PlayEx('MENU_OPEN');
3275 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3277 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3278 if gGameSettings
.GameType
= GT_SINGLE
then
3280 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3284 if g_Game_IsClient
then exit
;
3285 if g_Game_IsNet
then exit
;
3286 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3288 g_GUI_ShowWindow('LoadMenu');
3289 g_Sound_PlayEx('MENU_OPEN');
3292 procedure g_Menu_Show_GameSetGame();
3294 if gGameSettings
.GameType
= GT_SINGLE
then
3295 g_GUI_ShowWindow('GameSingleMenu')
3298 if g_Game_IsClient
then
3301 if g_Game_IsNet
then
3302 g_GUI_ShowWindow('GameServerMenu')
3304 g_GUI_ShowWindow('GameCustomMenu');
3307 g_GUI_ShowWindow('GameSetGameMenu');
3308 g_Sound_PlayEx('MENU_OPEN');
3311 procedure g_Menu_Show_OptionsVideo();
3313 if gGameSettings
.GameType
= GT_SINGLE
then
3314 g_GUI_ShowWindow('GameSingleMenu')
3317 if g_Game_IsClient
then
3318 g_GUI_ShowWindow('GameClientMenu')
3320 if g_Game_IsNet
then
3321 g_GUI_ShowWindow('GameServerMenu')
3323 g_GUI_ShowWindow('GameCustomMenu');
3326 g_GUI_ShowWindow('OptionsMenu');
3327 g_GUI_ShowWindow('OptionsVideoMenu');
3328 g_Sound_PlayEx('MENU_OPEN');
3331 procedure g_Menu_Show_OptionsSound();
3333 if gGameSettings
.GameType
= GT_SINGLE
then
3334 g_GUI_ShowWindow('GameSingleMenu')
3337 if g_Game_IsClient
then
3338 g_GUI_ShowWindow('GameClientMenu')
3340 if g_Game_IsNet
then
3341 g_GUI_ShowWindow('GameServerMenu')
3343 g_GUI_ShowWindow('GameCustomMenu');
3346 g_GUI_ShowWindow('OptionsMenu');
3347 g_GUI_ShowWindow('OptionsSoundMenu');
3348 g_Sound_PlayEx('MENU_OPEN');
3351 procedure g_Menu_Show_EndGameMenu();
3353 g_GUI_ShowWindow('EndGameMenu');
3354 g_Sound_PlayEx('MENU_OPEN');
3357 procedure g_Menu_Show_QuitGameMenu();
3359 g_GUI_ShowWindow('ExitMenu');
3360 g_Sound_PlayEx('MENU_OPEN');
3363 procedure g_Menu_Init();
3370 procedure g_Menu_Free();
3374 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3379 procedure g_Menu_Reset();
3383 g_GUI_SaveMenuPos();
3384 ex
:= g_GUI_Destroy();
3388 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3393 g_Game_SetDebugMode();
3395 g_GUI_LoadMenuPos();