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, '+p1_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
, '+p1_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, '+p1_moveright'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe'), '');
193 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe');
204 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright'), '');
205 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft'), '');
206 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe'), '');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_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, 'p1_weapon ' + IntToStr(i
+ 1)), '');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
233 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_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
);
371 g_Console_WriteConfig(GameDir
+ '/dfconfig.cfg');
374 procedure ReadOptions();
379 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
381 with TGUISwitch(menu
.GetControl('swBPP')) do
387 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
388 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
390 with TGUISwitch(menu
.GetControl('swVSync')) do
391 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
393 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
394 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
396 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
398 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
399 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
400 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
402 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
403 if gMuteWhenInactive
then
408 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
410 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
411 if gSoundEffectsDF
then
416 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
417 if gUseChatSounds
then
422 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
425 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright');
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft');
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup');
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown');
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack');
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump');
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2,'+p1_weapnext');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe');
448 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
451 for i
:= WP_FIRST
to WP_LAST
do
453 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
454 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
458 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2,'+p2_weapnext');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe');
484 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
487 for i
:= WP_FIRST
to WP_LAST
do
489 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
490 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
494 if e_JoysticksAvailable
> 0 then
496 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
499 for i
:= 0 to e_JoysticksAvailable
-1 do
500 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
504 if g_touch_enabled
then
506 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
507 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
508 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
509 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
510 with TGUISwitch(menu
.GetControl('swTouchFire')) do
511 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
512 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
515 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
518 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
519 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores');
520 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
521 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
524 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
526 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
527 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
528 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
529 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
530 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
532 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
535 with TGUISwitch(menu
.GetControl('swBloodType')) do
536 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
538 with TGUISwitch(menu
.GetControl('swCorpseType')) do
539 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
541 with TGUISwitch(menu
.GetControl('swGibsType')) do
542 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
544 with TGUISwitch(menu
.GetControl('swGibsCount')) do
553 with TGUISwitch(menu
.GetControl('swBackGround')) do
554 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
556 with TGUISwitch(menu
.GetControl('swMessages')) do
557 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
559 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
560 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
562 with TGUISwitch(menu
.GetControl('swChatBubble')) do
563 ItemIndex
:= gChatBubble
;
565 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
566 if gPlayerIndicator
then ItemIndex
:= 0 else ItemIndex
:= 1;
568 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
570 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
572 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
573 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
575 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
576 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
578 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
579 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
580 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
582 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
584 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
585 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
587 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
588 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
590 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
591 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
592 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
594 ProcSelectModel(nil);
597 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
599 // don't turn off monsters in DM
601 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
602 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
603 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
605 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
608 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
609 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
610 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
611 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
615 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
617 // don't turn off monsters in DM
619 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
620 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
626 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
627 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
628 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
629 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
633 procedure ProcStartCustomGame();
639 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
641 Map
:= TGUILabel(GetControl('lbMap')).Text;
644 if not isWadPath(Map
) then
647 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
648 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
649 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
650 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
651 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
653 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
654 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
655 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
656 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
659 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
661 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
663 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
665 Options
:= Options
or GAME_OPTION_MONSTERS
;
666 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
668 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
670 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
671 gcBotsVS
:= 'Monsters';
674 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
675 gcBotsVS
:= 'Everybody';
678 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
679 gcBotsVS
:= 'Players';
686 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
688 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
689 gcMaxLives
, Options
, gcPlayers
);
693 procedure ProcStartNetGame();
699 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
701 Map
:= TGUILabel(GetControl('lbMap')).Text;
704 if not isWadPath(Map
) then
707 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
708 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
709 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
710 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
711 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
712 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
714 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
715 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
716 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
717 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
720 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
722 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
724 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
726 Options
:= Options
or GAME_OPTION_MONSTERS
;
727 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
729 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
731 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
732 gnBotsVS
:= 'Monsters';
735 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
736 gnBotsVS
:= 'Everybody';
739 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
740 gnBotsVS
:= 'Players';
745 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
746 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
747 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
748 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
749 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
752 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
753 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
755 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
756 Options
, gnPlayers
, 0, NetPort
);
759 procedure ProcConnectNetGame();
763 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
765 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
766 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
767 PW
:= TGUIEdit(GetControl('edPW')).Text;
770 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
771 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
774 procedure ProcEnterPassword();
778 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
780 NetClientIP
:= PromptIP
;
781 NetClientPort
:= PromptPort
;
782 PW
:= TGUIEdit(GetControl('edPW')).Text;
785 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
786 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
789 procedure ProcServerlist();
791 if not NetInitDone
then
793 if (not g_Net_Init()) then
795 g_Console_Add('NET: ERROR: Failed to init ENet!');
802 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
804 gState
:= STATE_SLIST
;
805 g_ActiveWindow
:= nil;
807 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
812 slReturnPressed
:= True;
813 if g_Net_Slist_Fetch(slCurrent
) then
815 if slCurrent
= nil then
816 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
819 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
820 g_Serverlist_GenerateTable(slCurrent
, slTable
);
823 procedure ProcStartCampaign();
829 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
831 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
832 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
839 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
842 procedure ProcSelectMap(Sender
: TGUIControl
);
846 wad
, map
, res
: String;
848 win
:= g_GUI_GetWindow('SelectMapMenu');
849 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
851 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
852 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
854 if (wad
= '') or (map
= '') then
855 begin // Ýòî íå êàðòà
856 TGUILabel(GetControl('lbMapName')).Text := '';
857 TGUILabel(GetControl('lbMapAuthor')).Text := '';
858 TGUILabel(GetControl('lbMapSize')).Text := '';
859 TGUIMemo(GetControl('meMapDescription')).SetText('');
860 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
861 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
867 a
:= g_Map_GetMapInfo(res
);
869 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
870 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
871 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
872 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
873 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
874 TGUILabel(win
.GetControl('lbMapScale')).Text :=
875 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
880 procedure ProcSelectWAD(Sender
: TGUIControl
);
885 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
887 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
889 with TGUIListBox(GetControl('lsMapRes')) do
895 list
:= g_Map_GetMapsList(wad
);
909 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
915 win
:= g_GUI_GetWindow('CampaignMenu');
916 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
918 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
922 TGUILabel(GetControl('lbWADName')).Text := '';
923 TGUILabel(GetControl('lbWADAuthor')).Text := '';
924 TGUIMemo(GetControl('meWADDescription')).SetText('');
927 a
:= g_Game_GetMegaWADInfo(wad
);
929 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
930 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
931 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
933 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
937 fn
:= g_ExtractWadName(a
.pic
);
939 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
941 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
946 procedure ProcChangeColor(Sender
: TGUIControl
);
950 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
951 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
952 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
953 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
954 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
955 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
957 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
958 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
959 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
960 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
961 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
962 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
965 procedure ProcSelectModel(Sender
: TGUIControl
);
970 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
971 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
972 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
974 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
975 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
976 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
978 ProcChangeColor(nil);
981 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
993 wad
:= TWADFile
.Create
;
994 if wad
.ReadFile(GameWAD
) then
995 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1000 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1002 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1003 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1004 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1005 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1007 if g_Texture_Get('FONT_STD', ID
) then
1008 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1013 if cfglen
<> 0 then FreeMem(cfgdata
);
1016 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1022 cfgdata
, fntdata
: Pointer;
1023 cfglen
, fntlen
: Integer;
1031 wad
:= TWADFile
.Create
;
1032 if wad
.ReadFile(GameWAD
) then
1034 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1035 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1041 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1042 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1043 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1045 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1046 FontID
:= e_CharFont_Create(spc
);
1048 for a
:= 0 to 255 do
1050 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1051 if chrwidth
= 0 then Continue
;
1053 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1055 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1061 if cfglen
<> 0 then FreeMem(cfgdata
);
1062 if fntlen
<> 0 then FreeMem(fntdata
);
1065 procedure MenuLoadData();
1067 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1069 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1070 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1071 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1072 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1073 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1074 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1075 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1076 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1077 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1078 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1079 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1080 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1081 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1082 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1083 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1084 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1085 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1086 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1087 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1088 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1089 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1090 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1091 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1092 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1094 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1095 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1096 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1097 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1098 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1099 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1100 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1103 procedure MenuFreeData();
1105 e_CharFont_Remove(gMenuFont
);
1106 e_CharFont_Remove(gMenuSmallFont
);
1108 g_Texture_Delete('MAINMENU_MARKER1');
1109 g_Texture_Delete('MAINMENU_MARKER2');
1110 g_Texture_Delete('SCROLL_LEFT');
1111 g_Texture_Delete('SCROLL_RIGHT');
1112 g_Texture_Delete('SCROLL_MIDDLE');
1113 g_Texture_Delete('SCROLL_MARKER');
1114 g_Texture_Delete('EDIT_LEFT');
1115 g_Texture_Delete('EDIT_RIGHT');
1116 g_Texture_Delete('EDIT_MIDDLE');
1117 g_Texture_Delete('BOX1');
1118 g_Texture_Delete('BOX2');
1119 g_Texture_Delete('BOX3');
1120 g_Texture_Delete('BOX4');
1121 g_Texture_Delete('BOX5');
1122 g_Texture_Delete('BOX6');
1123 g_Texture_Delete('BOX7');
1124 g_Texture_Delete('BOX8');
1125 g_Texture_Delete('BOX9');
1126 g_Texture_Delete('BSCROLL_UP_A');
1127 g_Texture_Delete('BSCROLL_UP_U');
1128 g_Texture_Delete('BSCROLL_DOWN_A');
1129 g_Texture_Delete('BSCROLL_DOWN_U');
1130 g_Texture_Delete('BSCROLL_MIDDLE');
1131 g_Texture_Delete('NOPIC');
1133 g_Sound_Delete('MENU_SELECT');
1134 g_Sound_Delete('MENU_OPEN');
1135 g_Sound_Delete('MENU_CLOSE');
1136 g_Sound_Delete('MENU_CHANGE');
1137 g_Sound_Delete('SCROLL_ADD');
1138 g_Sound_Delete('SCROLL_SUB');
1139 g_Sound_Delete('SOUND_PLAYER_FALL');
1142 procedure ProcAuthorsMenu();
1144 gMusic
.SetByName('MUSIC_INTERMUS');
1148 procedure ProcExitMenuKeyDown (yes
: Boolean);
1151 snd
: TPlayableSound
;
1156 g_Game_StopAllSounds(True);
1157 case (Random(18)) of
1158 0: s
:= 'SOUND_MONSTER_PAIN';
1159 1: s
:= 'SOUND_MONSTER_DIE_3';
1160 2: s
:= 'SOUND_MONSTER_SLOP';
1161 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1162 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1163 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1164 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1165 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1166 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1167 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1168 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1169 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1170 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1171 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1172 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1173 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1174 else s
:= 'SOUND_PLAYER_FALL';
1176 snd
:= TPlayableSound
.Create();
1177 res
:= snd
.SetByName(s
);
1178 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1182 while snd
.IsPlaying() do begin end;
1190 procedure ProcLoadMenu();
1197 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1198 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1199 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1203 procedure ProcSaveMenu();
1211 name
:= g_GetSaveName(a
, valid
);
1212 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1213 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1217 procedure ProcSaveGame(Sender
: TGUIControl
);
1221 if g_Game_IsNet
then Exit
;
1222 if g_Game_IsTestMap
then Exit
;
1223 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1224 g_Game_PauseAllSounds(True);
1225 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1227 g_ActiveWindow
:= nil;
1228 g_Game_Pause(False);
1231 procedure ProcLoadGame(Sender
: TGUIControl
);
1235 if g_Game_IsNet
then Exit
;
1236 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1237 if g_LoadGame(a
) then
1239 g_Game_PauseAllSounds(False)
1241 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1243 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1244 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1245 //g_ActiveWindow := nil;
1249 procedure ProcSingle1Player();
1251 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1254 procedure ProcSingle2Players();
1256 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1259 procedure ProcSelectMapMenu();
1262 wad_lb
: TGUIFileListBox
;
1263 map_lb
: TGUIListBox
;
1266 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1267 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1268 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1270 if wad_lb
.SelectedItem() <> '' then
1271 map
:= map_lb
.SelectedItem()
1275 wad_lb
.UpdateFileList();
1278 if wad_lb
.SelectedItem() <> '' then
1281 map_lb
.SelectItem(map
);
1283 if map_lb
.SelectedItem() <> '' then
1287 g_GUI_ShowWindow('SelectMapMenu');
1290 procedure ProcSelectCampaignMenu();
1293 wad_lb
: TGUIFileListBox
;
1295 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1296 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1298 wad_lb
.UpdateFileList();
1300 if wad_lb
.SelectedItem() <> '' then
1301 ProcSelectCampaignWAD(nil);
1304 procedure ProcSetMap();
1306 wad
, map
, res
: String;
1308 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1310 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1311 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1314 if (wad
= '') or (map
= '') then
1317 res
:= wad
+':\'+map
;
1319 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1320 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1323 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1327 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1329 g_Sound_SetupAllVolumes(
1330 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1331 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1335 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1340 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
1343 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1347 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1348 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1349 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1350 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1353 procedure ProcOptionsPlayersMIMenu();
1358 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1360 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1362 if a
= '' then Exit
;
1364 b
:= g_PlayerModel_GetInfo(a
);
1366 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1368 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1369 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1370 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1372 if b
.HaveWeapon
then
1373 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1375 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1378 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1381 procedure ProcOptionsPlayersAnim();
1385 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1390 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1393 Model
.GetCurrentAnimation
.Loop
:= True;
1394 Model
.GetCurrentAnimationMask
.Loop
:= True;
1398 procedure ProcOptionsPlayersWeap();
1402 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1407 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1411 procedure ProcOptionsPlayersRot();
1415 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1416 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1418 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1422 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1426 g_Options_SetDefault();
1432 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1434 if yes
then ReadOptions();
1438 procedure ProcAuthorsClose();
1440 gMusic
.SetByName('MUSIC_MENU');
1442 gState
:= STATE_MENU
;
1445 procedure ProcGMClose();
1447 g_Game_InGameMenu(False);
1450 procedure ProcGMShow();
1455 if (gGameSettings
.GameType
= GT_SINGLE
) and
1456 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1457 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1458 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1460 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1461 if g_Game_IsTestMap
then
1462 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1463 TGUIMainMenu(g_ActiveWindow
.GetControl(
1464 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1467 procedure ProcChangePlayers();
1469 TeamGame
, Spectator
, AddTwo
: Boolean;
1470 P1Team
{, P2Team}: Byte;
1471 bP2
: TGUITextButton
;
1473 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1474 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1475 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1476 P1Team
:= TEAM_NONE
;
1477 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1479 //P2Team := TEAM_NONE;
1480 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1482 TGUIMainMenu(g_ActiveWindow
.GetControl(
1483 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1484 TGUIMainMenu(g_ActiveWindow
.GetControl(
1485 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1486 TGUIMainMenu(g_ActiveWindow
.GetControl(
1487 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1489 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1490 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1491 bP2
.Enabled
:= AddTwo
and not Spectator
;
1493 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1495 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1496 if gPlayer2
= nil then
1497 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1499 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1501 TGUIMainMenu(g_ActiveWindow
.GetControl(
1502 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1505 procedure ProcJoinRed();
1507 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1509 if g_Game_IsServer
then
1511 if gPlayer1
= nil then
1512 g_Game_AddPlayer(TEAM_RED
)
1515 if gPlayer1
.Team
<> TEAM_RED
then
1517 gPlayer1
.SwitchTeam
;
1518 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1521 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1526 gPlayer1Settings
.Team
:= TEAM_RED
;
1527 MC_SEND_PlayerSettings
;
1528 if gPlayer1
= nil then
1529 g_Game_AddPlayer(TEAM_RED
);
1531 g_ActiveWindow
:= nil;
1532 g_Game_Pause(False);
1535 procedure ProcJoinBlue();
1537 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1539 if g_Game_IsServer
then
1541 if gPlayer1
= nil then
1542 g_Game_AddPlayer(TEAM_BLUE
)
1545 if gPlayer1
.Team
<> TEAM_BLUE
then
1547 gPlayer1
.SwitchTeam
;
1548 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1551 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1556 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1557 MC_SEND_PlayerSettings
;
1558 if gPlayer1
= nil then
1559 g_Game_AddPlayer(TEAM_BLUE
);
1561 g_ActiveWindow
:= nil;
1562 g_Game_Pause(False);
1565 procedure ProcJoinGame();
1567 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1569 if gPlayer1
= nil then
1571 g_ActiveWindow
:= nil;
1572 g_Game_Pause(False);
1575 procedure ProcSwitchP2();
1577 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1579 if gPlayer1
= nil then
1581 if gPlayer2
= nil then
1584 g_Game_RemovePlayer();
1585 g_ActiveWindow
:= nil;
1586 g_Game_Pause(False);
1589 procedure ProcSpectate();
1591 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1594 g_ActiveWindow
:= nil;
1595 g_Game_Pause(False);
1598 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1600 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1603 procedure ProcEndMenuKeyDown (yes
: Boolean);
1605 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1608 procedure ProcSetRussianLanguage();
1610 if gLanguage
<> LANGUAGE_RUSSIAN
then
1612 gLanguage
:= LANGUAGE_RUSSIAN
;
1613 gLanguageChange
:= True;
1614 gAskLanguage
:= False;
1616 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1618 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1623 procedure ProcSetEnglishLanguage();
1625 if gLanguage
<> LANGUAGE_ENGLISH
then
1627 gLanguage
:= LANGUAGE_ENGLISH
;
1628 gLanguageChange
:= True;
1629 gAskLanguage
:= False;
1631 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1633 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1638 procedure ReadGameSettings();
1642 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1644 with gGameSettings
do
1646 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1647 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1652 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1653 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1654 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1656 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1657 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1658 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1661 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1666 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1668 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1669 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1670 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1671 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1672 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1673 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1674 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1675 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1679 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1680 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1685 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1686 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1691 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1692 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1697 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1698 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1703 procedure ProcApplyGameSet();
1707 stat
: TPlayerStatArray
;
1709 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1711 if not g_Game_IsServer
then Exit
;
1713 with gGameSettings
do
1715 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1717 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1718 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1720 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1723 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1725 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1731 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1733 TimeLimit
:= Max(n
, b
);
1737 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1739 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1746 if GameMode
= GM_DM
then
1748 stat
:= g_Player_GetStats();
1750 for a
:= 0 to High(stat
) do
1751 if stat
[a
].Frags
> b
then
1755 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1757 GoalLimit
:= Max(n
, b
);
1761 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1763 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1764 if n
< 0 then n
:= 0;
1765 if n
> 255 then n
:= 255;
1771 stat
:= g_Player_GetStats();
1773 for a
:= 0 to High(stat
) do
1774 if stat
[a
].Lives
> b
then
1777 MaxLives
:= Max(n
, b
);
1781 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1783 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1786 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1787 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1791 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1792 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1796 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1797 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1803 if g_Game_IsNet
then MH_SEND_GameSettings
;
1806 procedure ProcVideoOptionsRes();
1812 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1814 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1815 IntToStr(gScreenWidth
) +
1816 ' x ' + IntToStr(gScreenHeight
) +
1817 ', ' + IntToStr(gBPP
) + ' bpp';
1819 with TGUIListBox(menu
.GetControl('lsResolution')) do
1821 list
:= GetDisplayModes(gBPP
, SR
);
1832 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1839 procedure ProcApplyVideoOptions();
1842 Fullscreen
: Boolean;
1843 SWidth
, SHeight
: Integer;
1846 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1848 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1849 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1851 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1853 if (SWidth
<> gScreenWidth
) or
1854 (SHeight
<> gScreenHeight
) or
1855 (Fullscreen
<> gFullscreen
) then
1857 gResolutionChange
:= True;
1858 gRC_Width
:= SWidth
;
1859 gRC_Height
:= SHeight
;
1860 gRC_FullScreen
:= Fullscreen
;
1861 gRC_Maximized
:= gWinMaximized
;
1864 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1868 procedure ProcSetFirstRussianLanguage();
1870 gLanguage
:= LANGUAGE_RUSSIAN
;
1871 gLanguageChange
:= True;
1872 gAskLanguage
:= False;
1874 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1877 procedure ProcSetFirstEnglishLanguage();
1879 gLanguage
:= LANGUAGE_ENGLISH
;
1880 gLanguageChange
:= True;
1881 gAskLanguage
:= False;
1883 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1886 procedure ProcRecallAddress();
1888 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1890 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1891 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1895 procedure CreateFirstLanguageMenu();
1899 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1901 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1903 Name
:= 'mmFirstLanguageMenu';
1904 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1905 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1908 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1909 Menu
.MainWindow
:= True;
1910 g_GUI_AddWindow(Menu
);
1913 procedure g_Menu_AskLanguage();
1915 CreateFirstLanguageMenu();
1916 g_GUI_ShowWindow('FirstLanguageMenu');
1919 procedure CreatePlayerOptionsMenu(s
: String);
1924 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1926 a
:= _lc
[I_MENU_PLAYER_1
]
1928 a
:= _lc
[I_MENU_PLAYER_2
];
1929 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1931 Name
:= 'mOptionsPlayers'+s
+'Menu';
1932 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1934 Name
:= 'ed'+s
+'Name';
1938 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1940 Name
:= 'sw'+s
+'Team';
1941 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1942 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1944 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1946 Name
:= 'ls'+s
+'Model';
1948 Items
:= g_PlayerModel_GetNames();
1949 OnChange
:= ProcSelectModel
;
1951 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1953 Name
:= 'sc'+s
+'Red';
1955 OnChange
:= ProcChangeColor
;
1957 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1959 Name
:= 'sc'+s
+'Green';
1961 OnChange
:= ProcChangeColor
;
1963 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1965 Name
:= 'sc'+s
+'Blue';
1967 OnChange
:= ProcChangeColor
;
1970 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1971 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1972 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1973 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1975 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1977 Name
:= 'mv'+s
+'Model';
1978 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1979 Y
:= GetControl('ls'+s
+'Model').Y
;
1982 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1983 g_GUI_AddWindow(Menu
);
1986 procedure CreateAllMenus();
1990 a
, cx
, _y
, i
: Integer;
1993 Menu
:= TGUIWindow
.Create('MainMenu');
1994 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1996 Name
:= 'mmMainMenu';
1997 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1998 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1999 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2000 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2001 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2002 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2004 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2006 Color
:= _RGB(255, 255, 255);
2007 X
:= gScreenWidth
-GetWidth
-8;
2008 Y
:= gScreenHeight
-GetHeight
-8;
2010 Menu
.DefControl
:= 'mmMainMenu';
2011 Menu
.MainWindow
:= True;
2012 g_GUI_AddWindow(Menu
);
2014 Menu
:= TGUIWindow
.Create('NewGameMenu');
2015 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
2017 Name
:= 'mmNewGameMenu';
2018 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2019 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2020 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2021 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2023 Menu
.DefControl
:= 'mmNewGameMenu';
2024 g_GUI_AddWindow(Menu
);
2026 Menu
:= TGUIWindow
.Create('NetGameMenu');
2027 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
2029 Name
:= 'mmNetGameMenu';
2030 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2031 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2033 Menu
.DefControl
:= 'mmNetGameMenu';
2034 g_GUI_AddWindow(Menu
);
2036 Menu
:= TGUIWindow
.Create('NetServerMenu');
2037 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2039 Name
:= 'mNetServerMenu';
2040 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2042 Name
:= 'edSrvName';
2043 OnlyDigits
:= False;
2046 Text := NetServerName
;
2048 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2050 Name
:= 'edSrvPassword';
2051 OnlyDigits
:= False;
2054 Text := NetPassword
;
2056 with AddEdit(_lc
[I_NET_PORT
]) do
2062 Text := IntToStr(NetPort
);
2064 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2066 Name
:= 'edMaxPlayers';
2070 Text := IntToStr(NetMaxClients
);
2072 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2074 Name
:= 'swUseMaster';
2075 AddItem(_lc
[I_MENU_YES
]);
2076 AddItem(_lc
[I_MENU_NO
]);
2077 if NetUseMaster
then
2083 with AddLabel(_lc
[I_MENU_MAP
]) do
2088 OnClick
:= @ProcSelectMapMenu
;
2090 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2092 Name
:= 'swGameMode';
2093 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2094 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2095 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2096 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2097 case g_Game_TextToMode(gnGameMode
) of
2099 GM_DM
: ItemIndex
:= 0;
2100 GM_TDM
: ItemIndex
:= 1;
2101 GM_CTF
: ItemIndex
:= 2;
2103 GM_COOP
: ItemIndex
:= 3;
2105 OnChange
:= ProcSwitchMonstersNet
;
2107 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2109 Name
:= 'edTimeLimit';
2113 if gnTimeLimit
> 0 then
2114 Text := IntToStr(gnTimeLimit
);
2116 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2118 Name
:= 'edGoalLimit';
2122 if gnGoalLimit
> 0 then
2123 Text := IntToStr(gnGoalLimit
);
2125 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2127 Name
:= 'edMaxLives';
2131 if gnMaxLives
> 0 then
2132 Text := IntToStr(gnMaxLives
);
2134 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2136 Name
:= 'swPlayers';
2137 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2138 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2139 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2140 ItemIndex
:= gnPlayers
;
2142 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2144 Name
:= 'swTeamDamage';
2145 AddItem(_lc
[I_MENU_YES
]);
2146 AddItem(_lc
[I_MENU_NO
]);
2147 if gnTeamDamage
then
2152 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2154 Name
:= 'swEnableExits';
2155 AddItem(_lc
[I_MENU_YES
]);
2156 AddItem(_lc
[I_MENU_NO
]);
2162 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2164 Name
:= 'swWeaponStay';
2165 AddItem(_lc
[I_MENU_YES
]);
2166 AddItem(_lc
[I_MENU_NO
]);
2167 if gnWeaponStay
then
2172 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2174 Name
:= 'swMonsters';
2175 AddItem(_lc
[I_MENU_YES
]);
2176 AddItem(_lc
[I_MENU_NO
]);
2182 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2185 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2186 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2187 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2189 if gnBotsVS
= 'Players' then
2191 if gnBotsVS
= 'Monsters' then
2195 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2199 Menu
.DefControl
:= 'mNetServerMenu';
2200 g_GUI_AddWindow(Menu
);
2202 Menu
:= TGUIWindow
.Create('NetClientMenu');
2203 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2205 Name
:= 'mNetClientMenu';
2207 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2210 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2216 Text := 'localhost';
2218 with AddEdit(_lc
[I_NET_PORT
]) do
2226 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2229 OnlyDigits
:= False;
2236 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2240 Menu
.DefControl
:= 'mNetClientMenu';
2241 g_GUI_AddWindow(Menu
);
2243 Menu
:= TGUIWindow
.Create('LoadMenu');
2244 Menu
.OnShow
:= ProcLoadMenu
;
2245 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2247 Name
:= 'mmLoadMenu';
2252 Name
:= 'edSlot'+IntToStr(a
);
2255 OnEnter
:= ProcLoadGame
;
2258 Menu
.DefControl
:= 'mmLoadMenu';
2259 g_GUI_AddWindow(Menu
);
2261 Menu
:= TGUIWindow
.Create('SaveMenu');
2262 Menu
.OnShow
:= ProcSaveMenu
;
2263 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2265 Name
:= 'mmSaveMenu';
2270 Name
:= 'edSlot'+IntToStr(a
);
2273 OnChange
:= ProcSaveGame
;
2276 Menu
.DefControl
:= 'mmSaveMenu';
2277 g_GUI_AddWindow(Menu
);
2279 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2280 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2282 Name
:= 'mCustomGameMenu';
2283 with AddLabel(_lc
[I_MENU_MAP
]) do
2288 OnClick
:= @ProcSelectMapMenu
;
2290 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2292 Name
:= 'swGameMode';
2293 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2294 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2295 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2296 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2297 case g_Game_TextToMode(gcGameMode
) of
2299 GM_DM
: ItemIndex
:= 0;
2300 GM_TDM
: ItemIndex
:= 1;
2301 GM_CTF
: ItemIndex
:= 2;
2303 GM_COOP
: ItemIndex
:= 3;
2305 OnChange
:= ProcSwitchMonstersCustom
;
2307 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2309 Name
:= 'edTimeLimit';
2313 if gcTimeLimit
> 0 then
2314 Text := IntToStr(gcTimeLimit
);
2316 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2318 Name
:= 'edGoalLimit';
2322 if gcGoalLimit
> 0 then
2323 Text := IntToStr(gcGoalLimit
);
2325 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2327 Name
:= 'edMaxLives';
2331 if gcMaxLives
> 0 then
2332 Text := IntToStr(gcMaxLives
);
2334 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2336 Name
:= 'swPlayers';
2337 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2338 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2339 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2340 ItemIndex
:= gcPlayers
;
2342 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2344 Name
:= 'swTeamDamage';
2345 AddItem(_lc
[I_MENU_YES
]);
2346 AddItem(_lc
[I_MENU_NO
]);
2347 if gcTeamDamage
then
2352 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2354 Name
:= 'swEnableExits';
2355 AddItem(_lc
[I_MENU_YES
]);
2356 AddItem(_lc
[I_MENU_NO
]);
2362 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2364 Name
:= 'swWeaponStay';
2365 AddItem(_lc
[I_MENU_YES
]);
2366 AddItem(_lc
[I_MENU_NO
]);
2367 if gcWeaponStay
then
2372 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2374 Name
:= 'swMonsters';
2375 AddItem(_lc
[I_MENU_YES
]);
2376 AddItem(_lc
[I_MENU_NO
]);
2382 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2385 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2386 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2387 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2389 if gcBotsVS
= 'Players' then
2391 if gcBotsVS
= 'Monsters' then
2395 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2399 Menu
.DefControl
:= 'mCustomGameMenu';
2400 g_GUI_AddWindow(Menu
);
2402 Menu
:= TGUIWindow
.Create('CampaignMenu');
2403 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2405 Name
:= 'mCampaignMenu';
2414 with AddFileList('', 15, 4) do
2417 OnChange
:= ProcSelectCampaignWAD
;
2421 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2422 SetBase(MapsDir
+'megawads/');
2425 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2427 Name
:= 'lbWADName';
2431 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2433 Name
:= 'lbWADAuthor';
2437 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2438 with AddMemo('', 15, 3) do
2440 Name
:= 'meWADDescription';
2441 Color
:= MENU_ITEMSCTRL_COLOR
;
2443 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2445 Name
:= 'swPlayers';
2446 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2447 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2450 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2454 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2456 Name
:= 'mpWADImage';
2457 DefaultRes
:= 'NOPIC';
2458 X
:= GetControl('lsWAD').X
+4;
2459 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2462 Menu
.DefControl
:= 'mCampaignMenu';
2463 g_GUI_AddWindow(Menu
);
2465 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2466 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2468 Name
:= 'mSelectMapMenu';
2469 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2472 OnChange
:= ProcSelectWAD
;
2476 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2479 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2483 OnChange
:= ProcSelectMap
;
2486 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2488 Name
:= 'lbMapName';
2492 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2494 Name
:= 'lbMapAuthor';
2498 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2500 Name
:= 'lbMapSize';
2504 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2506 Name
:= 'meMapDescription';
2511 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2513 Name
:= 'mpMapPreview';
2514 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2515 Y
:= GetControl('lsMapWAD').Y
;
2517 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2519 Name
:= 'lbMapScale';
2522 Color
:= MENU_ITEMSCTRL_COLOR
;
2523 X
:= GetControl('lsMapWAD').X
+
2524 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2525 2 + MAPPREVIEW_WIDTH
*4;
2526 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2529 Menu
.OnClose
:= ProcSetMap
;
2530 Menu
.DefControl
:= 'mSelectMapMenu';
2531 g_GUI_AddWindow(Menu
);
2533 Menu
:= TGUIWindow
.Create('OptionsMenu');
2534 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2536 Name
:= 'mmOptionsMenu';
2537 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2538 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2539 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2540 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2541 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2542 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2544 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2545 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2547 Menu
.OnClose
:= ProcApplyOptions
;
2548 Menu
.DefControl
:= 'mmOptionsMenu';
2549 g_GUI_AddWindow(Menu
);
2551 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2552 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2553 g_GUI_AddWindow(Menu
);
2555 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2556 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2558 Name
:= 'mOptionsVideoMenu';
2559 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2560 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2566 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2569 AddItem(_lc
[I_MENU_YES
]);
2570 AddItem(_lc
[I_MENU_NO
]);
2572 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2574 Name
:= 'swTextureFilter';
2575 AddItem(_lc
[I_MENU_YES
]);
2576 AddItem(_lc
[I_MENU_NO
]);
2578 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2580 Name
:= 'swLegacyNPOT';
2581 AddItem(_lc
[I_MENU_NO
]);
2582 AddItem(_lc
[I_MENU_YES
]);
2585 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2588 Menu
.DefControl
:= 'mOptionsVideoMenu';
2589 g_GUI_AddWindow(Menu
);
2591 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2592 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2594 Name
:= 'mOptionsVideoResMenu';
2595 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2597 Name
:= 'lbCurrentRes';
2601 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2603 Name
:= 'lsResolution';
2606 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2608 Name
:= 'swFullScreen';
2609 AddItem(_lc
[I_MENU_YES
]);
2610 AddItem(_lc
[I_MENU_NO
]);
2613 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2616 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2617 g_GUI_AddWindow(Menu
);
2619 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2620 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2622 Name
:= 'mOptionsSoundMenu';
2623 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2625 Name
:= 'scMusicLevel';
2627 OnChange
:= ProcChangeSoundSettings
;
2629 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2631 Name
:= 'scSoundLevel';
2633 OnChange
:= ProcChangeSoundSettings
;
2635 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2637 Name
:= 'scMaxSimSounds';
2640 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2642 Name
:= 'swAnnouncer';
2643 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2644 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2645 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2646 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2648 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2649 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2651 Name
:= 'swSoundEffects';
2652 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2653 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2655 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2656 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2658 Name
:= 'swChatSpeech';
2659 AddItem(_lc
[I_MENU_YES
]);
2660 AddItem(_lc
[I_MENU_NO
]);
2662 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2664 Name
:= 'swInactiveSounds';
2665 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2666 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2670 Menu
.DefControl
:= 'mOptionsSoundMenu';
2671 g_GUI_AddWindow(Menu
);
2673 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2674 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2676 Name
:= 'mOptionsGameMenu';
2677 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2679 Name
:= 'scParticlesCount';
2682 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2684 Name
:= 'swBloodCount';
2685 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2686 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2687 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2688 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2689 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2691 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2693 Name
:= 'scShellsMax';
2696 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2698 Name
:= 'scGibsMax';
2701 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2703 Name
:= 'scCorpsesMax';
2706 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2708 Name
:= 'swGibsCount';
2709 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2710 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2711 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2712 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2713 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2715 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2717 Name
:= 'swCorpseType';
2718 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2719 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2721 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2723 Name
:= 'swGibsType';
2724 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2725 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2727 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2729 Name
:= 'swBloodType';
2730 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2731 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2733 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2735 Name
:= 'swScreenFlash';
2736 AddItem(_lc
[I_MENU_NO
]);
2737 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2738 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2740 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2742 Name
:= 'swBackground';
2743 AddItem(_lc
[I_MENU_YES
]);
2744 AddItem(_lc
[I_MENU_NO
]);
2746 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2748 Name
:= 'swMessages';
2749 AddItem(_lc
[I_MENU_YES
]);
2750 AddItem(_lc
[I_MENU_NO
]);
2752 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2754 Name
:= 'swRevertPlayers';
2755 AddItem(_lc
[I_MENU_YES
]);
2756 AddItem(_lc
[I_MENU_NO
]);
2758 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2760 Name
:= 'swChatBubble';
2761 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2762 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2763 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2764 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2765 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2767 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2769 Name
:= 'swPlayerIndicator';
2770 AddItem(_lc
[I_MENU_YES
]);
2771 AddItem(_lc
[I_MENU_NO
]);
2773 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2775 Name
:= 'scScaleFactor';
2777 OnChange
:= ProcChangeGameSettings
;
2781 Menu
.DefControl
:= 'mOptionsGameMenu';
2782 g_GUI_AddWindow(Menu
);
2784 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2785 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2787 Name
:= 'mOptionsControlsMenu';
2788 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2789 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2790 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2791 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2792 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2794 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2795 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2796 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2797 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2798 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2799 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2800 if e_JoysticksAvailable
<> 0 then
2803 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2805 if g_touch_enabled
then
2808 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2811 Menu
.DefControl
:= 'mOptionsControlsMenu';
2812 g_GUI_AddWindow(Menu
);
2814 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2815 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2817 Name
:= 'mOptionsControlsP1Menu';
2818 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2819 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2820 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2821 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2822 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2823 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2824 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2825 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2826 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2827 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2829 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2830 g_GUI_AddWindow(Menu
);
2832 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2833 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2835 Name
:= 'mOptionsControlsP1MenuWeapons';
2836 for i
:= WP_FIRST
to WP_LAST
do
2837 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2838 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2840 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2841 g_GUI_AddWindow(Menu
);
2843 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2844 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2846 Name
:= 'mOptionsControlsP2Menu';
2847 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2848 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2849 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2850 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2851 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2852 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2853 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2854 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2855 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2856 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2858 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2859 g_GUI_AddWindow(Menu
);
2861 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2862 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2864 Name
:= 'mOptionsControlsP2MenuWeapons';
2865 for i
:= WP_FIRST
to WP_LAST
do
2866 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2867 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2869 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2870 g_GUI_AddWindow(Menu
);
2872 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2873 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2875 Name
:= 'mOptionsControlsJoystickMenu';
2876 for i
:= 0 to e_JoysticksAvailable
-1 do
2877 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2879 Name
:= 'scDeadzone' + IntToStr(i
);
2883 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2884 g_GUI_AddWindow(Menu
);
2886 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2887 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2889 Name
:= 'mOptionsControlsTouchMenu';
2890 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2892 Name
:= 'swTouchAlt';
2893 AddItem(_lc
[I_MENU_NO
]);
2894 AddItem(_lc
[I_MENU_YES
]);
2895 OnChange
:= ProcChangeTouchSettings
;
2897 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2899 Name
:= 'scTouchSize';
2901 OnChange
:= ProcChangeTouchSettings
;
2903 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2905 Name
:= 'swTouchFire';
2906 AddItem(_lc
[I_MENU_NO
]);
2907 AddItem(_lc
[I_MENU_YES
]);
2909 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2911 Name
:= 'scTouchOffset';
2913 OnChange
:= ProcChangeTouchSettings
;
2916 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2917 g_GUI_AddWindow(Menu
);
2919 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2920 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2922 Name
:= 'mOptionsPlayersMenu';
2923 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2924 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2926 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2927 g_GUI_AddWindow(Menu
);
2929 CreatePlayerOptionsMenu('P1');
2930 CreatePlayerOptionsMenu('P2');
2932 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2933 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2935 Name
:= 'mOptionsPlayersMIMenu';
2936 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2941 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2946 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2948 Name
:= 'meComment';
2951 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2952 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2955 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2959 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2960 g_GUI_AddWindow(Menu
);
2962 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2963 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2965 Name
:= 'mOptionsLanguageMenu';
2966 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2967 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2970 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2974 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2978 Menu
.BackTexture
:= 'INTER';
2979 Menu
.OnClose
:= ProcAuthorsClose
;
2983 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2985 Color
:= _RGB(255, 0, 0);
2986 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2988 _y
:= _y
+GetHeight();
2990 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2992 Color
:= _RGB(255, 0, 0);
2993 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2995 _y
:= _y
+GetHeight()+32;
2997 // ×òî äåëàë: Êòî äåëàë
2998 cx
:= gScreenWidth
div 2 - 320 + 64;
2999 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3001 Color
:= _RGB(255, 0, 0);
3006 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3008 Color
:= _RGB(255, 255, 255);
3013 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3015 Color
:= _RGB(255, 0, 0);
3020 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3022 Color
:= _RGB(255, 255, 255);
3027 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3029 Color
:= _RGB(255, 255, 255);
3034 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3036 Color
:= _RGB(255, 0, 0);
3041 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3043 Color
:= _RGB(255, 255, 255);
3048 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3050 Color
:= _RGB(255, 0, 0);
3055 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3057 Color
:= _RGB(255, 255, 255);
3060 _y
:= gScreenHeight
- 128;
3063 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3065 Color
:= _RGB(255, 0, 0);
3070 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3072 Color
:= _RGB(255, 255, 255);
3075 _y
:= _y
+GetHeight();
3077 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3079 Color
:= _RGB(255, 255, 255);
3082 _y
:= _y
+GetHeight();
3084 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3086 Color
:= _RGB(255, 255, 255);
3089 _y
:= gScreenHeight
- 32;
3091 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3093 Color
:= _RGB(255, 0, 0);
3094 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3097 g_GUI_AddWindow(Menu
);
3099 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3100 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3101 g_GUI_AddWindow(Menu
);
3103 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3104 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3106 Name
:= 'mmGameSingleMenu';
3107 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3108 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3109 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3110 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3111 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3112 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3114 Menu
.DefControl
:= 'mmGameSingleMenu';
3115 Menu
.MainWindow
:= True;
3116 Menu
.OnClose
:= ProcGMClose
;
3117 Menu
.OnShow
:= ProcGMShow
;
3118 g_GUI_AddWindow(Menu
);
3120 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3121 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3125 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3129 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3131 Name
:= 'mmGameCustomMenu';
3132 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3133 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3134 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3135 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3136 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3137 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3138 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3140 Menu
.DefControl
:= 'mmGameCustomMenu';
3141 Menu
.MainWindow
:= True;
3142 Menu
.OnClose
:= ProcGMClose
;
3143 Menu
.OnShow
:= ProcGMShow
;
3144 g_GUI_AddWindow(Menu
);
3146 Menu
:= TGUIWindow
.Create('GameServerMenu');
3147 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3149 Name
:= 'mmGameServerMenu';
3150 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3151 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3152 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3153 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3154 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3156 Menu
.DefControl
:= 'mmGameServerMenu';
3157 Menu
.MainWindow
:= True;
3158 Menu
.OnClose
:= ProcGMClose
;
3159 Menu
.OnShow
:= ProcGMShow
;
3160 g_GUI_AddWindow(Menu
);
3162 Menu
:= TGUIWindow
.Create('GameClientMenu');
3163 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3165 Name
:= 'mmGameClientMenu';
3166 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3167 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3168 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3170 Menu
.DefControl
:= 'mmGameClientMenu';
3171 Menu
.MainWindow
:= True;
3172 Menu
.OnClose
:= ProcGMClose
;
3173 Menu
.OnShow
:= ProcGMShow
;
3174 g_GUI_AddWindow(Menu
);
3176 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3177 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3179 Name
:= 'mClientPasswordMenu';
3180 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3188 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3191 Menu
.DefControl
:= 'mClientPasswordMenu';
3192 g_GUI_AddWindow(Menu
);
3194 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3195 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3197 Name
:= 'mGameSetGameMenu';
3198 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3200 Name
:= 'swTeamDamage';
3201 AddItem(_lc
[I_MENU_YES
]);
3202 AddItem(_lc
[I_MENU_NO
]);
3205 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3207 Name
:= 'edTimeLimit';
3212 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3214 Name
:= 'edGoalLimit';
3219 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3221 Name
:= 'edMaxLives';
3226 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3229 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3230 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3231 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3237 Menu
.DefControl
:= 'mGameSetGameMenu';
3238 Menu
.OnClose
:= ProcApplyGameSet
;
3239 g_GUI_AddWindow(Menu
);
3241 Menu
:= TGUIWindow
.Create('TeamMenu');
3242 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3244 Name
:= 'mmTeamMenu';
3245 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3246 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3247 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3248 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3249 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3251 Menu
.DefControl
:= 'mmTeamMenu';
3252 Menu
.OnShow
:= ProcChangePlayers
;
3253 g_GUI_AddWindow(Menu
);
3256 procedure g_Menu_Show_SaveMenu();
3258 if g_Game_IsTestMap
then
3260 if gGameSettings
.GameType
= GT_SINGLE
then
3261 g_GUI_ShowWindow('GameSingleMenu')
3264 if g_Game_IsClient
then
3267 if g_Game_IsNet
then
3270 g_GUI_ShowWindow('GameCustomMenu');
3272 g_GUI_ShowWindow('SaveMenu');
3273 g_Sound_PlayEx('MENU_OPEN');
3276 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3278 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3279 if gGameSettings
.GameType
= GT_SINGLE
then
3281 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3285 if g_Game_IsClient
then exit
;
3286 if g_Game_IsNet
then exit
;
3287 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3289 g_GUI_ShowWindow('LoadMenu');
3290 g_Sound_PlayEx('MENU_OPEN');
3293 procedure g_Menu_Show_GameSetGame();
3295 if gGameSettings
.GameType
= GT_SINGLE
then
3296 g_GUI_ShowWindow('GameSingleMenu')
3299 if g_Game_IsClient
then
3302 if g_Game_IsNet
then
3303 g_GUI_ShowWindow('GameServerMenu')
3305 g_GUI_ShowWindow('GameCustomMenu');
3308 g_GUI_ShowWindow('GameSetGameMenu');
3309 g_Sound_PlayEx('MENU_OPEN');
3312 procedure g_Menu_Show_OptionsVideo();
3314 if gGameSettings
.GameType
= GT_SINGLE
then
3315 g_GUI_ShowWindow('GameSingleMenu')
3318 if g_Game_IsClient
then
3319 g_GUI_ShowWindow('GameClientMenu')
3321 if g_Game_IsNet
then
3322 g_GUI_ShowWindow('GameServerMenu')
3324 g_GUI_ShowWindow('GameCustomMenu');
3327 g_GUI_ShowWindow('OptionsMenu');
3328 g_GUI_ShowWindow('OptionsVideoMenu');
3329 g_Sound_PlayEx('MENU_OPEN');
3332 procedure g_Menu_Show_OptionsSound();
3334 if gGameSettings
.GameType
= GT_SINGLE
then
3335 g_GUI_ShowWindow('GameSingleMenu')
3338 if g_Game_IsClient
then
3339 g_GUI_ShowWindow('GameClientMenu')
3341 if g_Game_IsNet
then
3342 g_GUI_ShowWindow('GameServerMenu')
3344 g_GUI_ShowWindow('GameCustomMenu');
3347 g_GUI_ShowWindow('OptionsMenu');
3348 g_GUI_ShowWindow('OptionsSoundMenu');
3349 g_Sound_PlayEx('MENU_OPEN');
3352 procedure g_Menu_Show_EndGameMenu();
3354 g_GUI_ShowWindow('EndGameMenu');
3355 g_Sound_PlayEx('MENU_OPEN');
3358 procedure g_Menu_Show_QuitGameMenu();
3360 g_GUI_ShowWindow('ExitMenu');
3361 g_Sound_PlayEx('MENU_OPEN');
3364 procedure g_Menu_Init();
3371 procedure g_Menu_Free();
3375 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3380 procedure g_Menu_Reset();
3384 g_GUI_SaveMenuPos();
3385 ex
:= g_GUI_Destroy();
3389 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3394 g_Game_SetDebugMode();
3396 g_GUI_LoadMenuPos();