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, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
48 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
49 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
50 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
51 MAPDEF
, Math
, g_saveload
,
53 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
54 utils
, wadreader
, g_system
, r_render
, r_game
;
57 type TYNCallback
= procedure (yes
:Boolean);
59 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
61 if win
.UserData
= nil then exit
;
63 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
64 IK_N
: TYNCallback(win
.UserData
)(false);
68 procedure YesButtonCB (ctl
: TGUITextButton
);
70 if ctl
.UserData
= nil then exit
;
71 TYNCallback(ctl
.UserData
)(true);
74 procedure NoButtonCB (ctl
: TGUITextButton
);
76 if ctl
.UserData
= nil then exit
;
77 TYNCallback(ctl
.UserData
)(false);
80 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
84 //if length(Text) = 0 then exit;
85 Result
:= TGUIWindow
.Create(WinName
);
88 //OnKeyDownEx := @YNKeyDownProc;
89 //UserData := @ActionProc;
90 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
93 Name
:= '__temp_yes_no_menu:'+WinName
;
95 AddText(Text, MaxLen
);
96 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
97 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
99 DefControl
:= '__temp_yes_no_menu:'+WinName
;
105 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
106 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
108 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
123 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
124 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).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'));
142 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
148 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
151 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
156 else gGibsCount
:= 48;
160 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
161 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
162 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
163 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
164 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
165 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
166 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
167 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
168 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
169 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
170 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
171 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
173 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
174 g_dbg_scale
:= TempScale
+ 1;
177 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
181 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
182 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
183 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
184 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
186 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
187 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
188 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
191 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
201 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
202 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
203 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
222 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
223 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
224 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
237 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
240 for i
:= WP_FIRST
to WP_LAST
do
242 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
244 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
249 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
261 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
295 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
298 for i
:= WP_FIRST
to WP_LAST
do
300 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
302 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
307 if e_HasJoysticks
then
309 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
312 for i
:= 0 to e_MaxJoys
- 1 do
313 if e_JoystickAvailable
[i
] then
314 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
318 if g_touch_enabled
then
320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
321 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
322 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
323 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
324 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
327 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
329 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
330 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
331 TEAM_RED
, TEAM_BLUE
);
333 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
335 gPlayer1Settings
.Model
:= Model
.GetName();
336 gPlayer1Settings
.Color
:= Model
.Color
;
339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
341 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
342 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
343 TEAM_RED
, TEAM_BLUE
);
344 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
346 gPlayer2Settings
.Model
:= Model
.GetName();
347 gPlayer2Settings
.Color
:= Model
.Color
;
350 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
351 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
353 if g_Game_IsServer
then
355 if gPlayer1
<> nil then
357 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
358 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
359 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
360 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
362 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
365 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
368 if gPlayer2
<> nil then
370 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
371 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
372 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
373 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
375 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
380 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
382 g_Console_WriteGameConfig
;
385 procedure ReadOptions();
390 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
392 with TGUISwitch(menu
.GetControl('swBPP')) do
398 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
399 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
401 with TGUISwitch(menu
.GetControl('swVSync')) do
402 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
404 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
405 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
407 with TGUISwitch(menu
.GetControl('swInterp')) do
408 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
410 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
412 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
413 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
414 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
416 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
417 if gMuteWhenInactive
then
422 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
424 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
425 if gSoundEffectsDF
then
430 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
431 if gUseChatSounds
then
436 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
457 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
458 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
459 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
462 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
465 for i
:= WP_FIRST
to WP_LAST
do
467 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
468 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
472 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
498 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
501 for i
:= WP_FIRST
to WP_LAST
do
503 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
504 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
508 if e_HasJoysticks
then
510 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
513 for i
:= 0 to e_MaxJoys
- 1 do
514 if e_JoystickAvailable
[i
] then
515 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
519 if g_touch_enabled
then
521 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
522 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
523 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
524 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
525 with TGUISwitch(menu
.GetControl('swTouchFire')) do
526 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
527 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
530 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
533 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
534 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
535 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
536 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
539 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
542 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
544 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
546 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
548 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
549 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
551 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
554 with TGUISwitch(menu
.GetControl('swBloodType')) do
555 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
557 with TGUISwitch(menu
.GetControl('swCorpseType')) do
558 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
560 with TGUISwitch(menu
.GetControl('swGibsType')) do
561 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
564 with TGUISwitch(menu
.GetControl('swGibsCount')) do
576 with TGUISwitch(menu
.GetControl('swBackGround')) do
577 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
579 with TGUISwitch(menu
.GetControl('swMessages')) do
580 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
582 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
583 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
585 with TGUISwitch(menu
.GetControl('swChatBubble')) do
586 ItemIndex
:= gChatBubble
;
588 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
589 ItemIndex
:= gPlayerIndicator
;
591 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
592 ItemIndex
:= gPlayerIndicatorStyle
;
594 TempScale
:= Round(g_dbg_scale
- 1);
595 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
599 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
600 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
602 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
603 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
605 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
606 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
607 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
609 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
611 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
612 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
614 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
615 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
617 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
618 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
619 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
621 ProcSelectModel(nil);
624 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
626 // don't turn off monsters in DM
628 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
629 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
630 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
632 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
635 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
637 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
642 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
644 // don't turn off monsters in DM
646 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
647 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
648 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
650 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
653 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
654 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
655 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
656 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
660 function LatchGameOptions(const MenuName
: string): Byte;
666 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
668 Map
:= TGUILabel(GetControl('lbMap')).Text;
671 if not isWadPath(Map
) then
674 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
675 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
676 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
677 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
678 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
679 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
680 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
684 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
685 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
686 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
687 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
688 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
689 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
690 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
691 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
692 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
693 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
695 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
696 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
697 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
698 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
701 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
702 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
703 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
704 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
707 // TODO: get this crap out of here
708 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
709 gGameSettings
.WarmupTime
:= gsWarmupTime
;
710 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
714 procedure ProcStartCustomGame();
718 GameMode
:= LatchGameOptions('mCustomGameMenu');
719 if GameMode
= GM_NONE
then Exit
;
721 g_Console_WriteGameConfig
;
722 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
723 gsMaxLives
, gsGameFlags
, gsPlayers
);
727 procedure ProcStartNetGame();
731 GameMode
:= LatchGameOptions('mNetServerMenu');
732 if GameMode
= GM_NONE
then Exit
;
734 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
736 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
737 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
738 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
739 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
740 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
741 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
744 g_Console_WriteGameConfig
;
745 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
746 gsGameFlags
, gsPlayers
, 0, NetPort
);
749 procedure ProcConnectNetGame();
753 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
755 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
756 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
757 PW
:= TGUIEdit(GetControl('edPW')).Text;
760 g_Console_WriteGameConfig
;
761 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
764 procedure ProcEnterPassword();
768 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
770 NetClientIP
:= PromptIP
;
771 NetClientPort
:= PromptPort
;
772 PW
:= TGUIEdit(GetControl('edPW')).Text;
775 g_Console_WriteGameConfig
;
776 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
779 procedure ProcServerlist();
781 if not NetInitDone
then
783 if (not g_Net_Init()) then
785 g_Console_Add('NET: ERROR: Failed to init ENet!');
792 g_Net_Slist_Set(NetMasterList
);
794 gState
:= STATE_SLIST
;
795 g_ActiveWindow
:= nil;
797 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
802 slReturnPressed
:= True;
803 if g_Net_Slist_Fetch(slCurrent
) then
805 if slCurrent
= nil then
806 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
809 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
810 g_Serverlist_GenerateTable(slCurrent
, slTable
);
813 procedure ProcStartCampaign();
819 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
821 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
822 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
824 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
830 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
833 procedure ProcSelectMap(Sender
: TGUIControl
);
837 wad
, map
, res
: String;
839 win
:= g_GUI_GetWindow('SelectMapMenu');
840 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
842 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
843 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
845 if (wad
= '') or (map
= '') then
846 begin // Ýòî íå êàðòà
847 TGUILabel(GetControl('lbMapName')).Text := '';
848 TGUILabel(GetControl('lbMapAuthor')).Text := '';
849 TGUILabel(GetControl('lbMapSize')).Text := '';
850 TGUIMemo(GetControl('meMapDescription')).SetText('');
851 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
852 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
858 a
:= g_Map_GetMapInfo(res
);
860 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
861 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
862 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
863 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
864 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
865 TGUILabel(win
.GetControl('lbMapScale')).Text :=
866 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
871 procedure ProcSelectWAD(Sender
: TGUIControl
);
876 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
878 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
880 with TGUIListBox(GetControl('lsMapRes')) do
886 list
:= g_Map_GetMapsList(wad
);
900 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
906 win
:= g_GUI_GetWindow('CampaignMenu');
907 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
909 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
913 TGUILabel(GetControl('lbWADName')).Text := '';
914 TGUILabel(GetControl('lbWADAuthor')).Text := '';
915 TGUIMemo(GetControl('meWADDescription')).SetText('');
918 a
:= g_Game_GetMegaWADInfo(wad
);
920 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
921 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
922 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
924 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
928 fn
:= g_ExtractWadName(a
.pic
);
930 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
932 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
937 procedure ProcChangeColor(Sender
: TGUIControl
);
941 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
942 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
943 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
944 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
945 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
946 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
948 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
949 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
950 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
951 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
952 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
953 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
956 procedure ProcSelectModel(Sender
: TGUIControl
);
961 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
962 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
963 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
965 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
966 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
967 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
969 ProcChangeColor(nil);
972 procedure MenuLoadData();
974 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
976 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
977 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
978 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
979 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
980 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
981 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
982 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
983 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
984 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
985 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
986 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
987 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
988 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
989 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
990 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
991 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
992 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
993 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
994 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
995 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
996 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
997 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
998 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
999 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1000 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1002 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1003 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1004 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1005 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1006 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1007 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1008 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1011 procedure MenuFreeData();
1013 e_CharFont_Remove(gMenuFont
);
1014 e_CharFont_Remove(gMenuSmallFont
);
1016 g_Texture_Delete('MAINMENU_LOGO');
1017 g_Texture_Delete('MAINMENU_MARKER1');
1018 g_Texture_Delete('MAINMENU_MARKER2');
1019 g_Texture_Delete('SCROLL_LEFT');
1020 g_Texture_Delete('SCROLL_RIGHT');
1021 g_Texture_Delete('SCROLL_MIDDLE');
1022 g_Texture_Delete('SCROLL_MARKER');
1023 g_Texture_Delete('EDIT_LEFT');
1024 g_Texture_Delete('EDIT_RIGHT');
1025 g_Texture_Delete('EDIT_MIDDLE');
1026 g_Texture_Delete('BOX1');
1027 g_Texture_Delete('BOX2');
1028 g_Texture_Delete('BOX3');
1029 g_Texture_Delete('BOX4');
1030 g_Texture_Delete('BOX5');
1031 g_Texture_Delete('BOX6');
1032 g_Texture_Delete('BOX7');
1033 g_Texture_Delete('BOX8');
1034 g_Texture_Delete('BOX9');
1035 g_Texture_Delete('BSCROLL_UP_A');
1036 g_Texture_Delete('BSCROLL_UP_U');
1037 g_Texture_Delete('BSCROLL_DOWN_A');
1038 g_Texture_Delete('BSCROLL_DOWN_U');
1039 g_Texture_Delete('BSCROLL_MIDDLE');
1040 g_Texture_Delete('NOPIC');
1042 g_Sound_Delete('MENU_SELECT');
1043 g_Sound_Delete('MENU_OPEN');
1044 g_Sound_Delete('MENU_CLOSE');
1045 g_Sound_Delete('MENU_CHANGE');
1046 g_Sound_Delete('SCROLL_ADD');
1047 g_Sound_Delete('SCROLL_SUB');
1048 g_Sound_Delete('SOUND_PLAYER_FALL');
1051 procedure ProcAuthorsMenu();
1053 gMusic
.SetByName('MUSIC_INTERMUS');
1057 procedure ProcExitMenuKeyDown (yes
: Boolean);
1060 snd
: TPlayableSound
;
1065 g_Game_StopAllSounds(True);
1066 case (Random(18)) of
1067 0: s
:= 'SOUND_MONSTER_PAIN';
1068 1: s
:= 'SOUND_MONSTER_DIE_3';
1069 2: s
:= 'SOUND_MONSTER_SLOP';
1070 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1071 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1072 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1073 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1074 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1075 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1076 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1077 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1078 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1079 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1080 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1081 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1082 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1083 else s
:= 'SOUND_PLAYER_FALL';
1085 snd
:= TPlayableSound
.Create();
1086 res
:= snd
.SetByName(s
);
1087 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1091 while snd
.IsPlaying() do begin end;
1099 procedure ProcLoadMenu();
1106 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1107 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1108 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1112 procedure ProcSaveMenu();
1120 name
:= g_GetSaveName(a
, valid
);
1121 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1122 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1126 procedure ProcSaveGame(Sender
: TGUIControl
);
1130 if g_Game_IsNet
then Exit
;
1131 if g_Game_IsTestMap
then Exit
;
1132 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1133 g_Game_PauseAllSounds(True);
1134 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1136 g_ActiveWindow
:= nil;
1137 g_Game_Pause(False);
1140 procedure ProcLoadGame(Sender
: TGUIControl
);
1144 if g_Game_IsNet
then Exit
;
1145 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1146 if g_LoadGame(a
) then
1148 g_Game_PauseAllSounds(False)
1150 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1152 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1153 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1154 //g_ActiveWindow := nil;
1158 procedure ProcSinglePlayer (n
: Integer);
1159 var wad
, map
: AnsiString;
1162 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1163 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1164 if e_FindResource(AllMapDirs
, wad
) then
1166 wad
:= ExpandFileName(wad
);
1167 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1171 procedure ProcSingle1Player
;
1176 procedure ProcSingle2Players
;
1181 procedure ProcSelectMapMenu();
1184 wad_lb
: TGUIFileListBox
;
1185 map_lb
: TGUIListBox
;
1188 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1189 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1190 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1192 if wad_lb
.SelectedItem() <> '' then
1193 map
:= map_lb
.SelectedItem()
1197 wad_lb
.UpdateFileList();
1200 if wad_lb
.SelectedItem() <> '' then
1203 map_lb
.SelectItem(map
);
1205 if map_lb
.SelectedItem() <> '' then
1209 g_GUI_ShowWindow('SelectMapMenu');
1212 procedure ProcSelectCampaignMenu();
1215 wad_lb
: TGUIFileListBox
;
1217 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1218 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1220 wad_lb
.UpdateFileList();
1222 if wad_lb
.SelectedItem() <> '' then
1223 ProcSelectCampaignWAD(nil);
1226 procedure ProcSetMap();
1228 wad
, map
, res
: String;
1230 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1232 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1233 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1236 if (wad
= '') or (map
= '') then
1239 wad
:= e_FindWadRel(MapDirs
, WAD
);
1241 res
:= wad
+':\'+map
;
1243 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1244 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1247 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1251 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1253 g_Sound_SetupAllVolumes(
1254 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1255 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1259 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1263 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1264 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1266 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1267 g_dbg_scale
:= TempScale
+ 1;
1271 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1275 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1276 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1277 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1278 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1281 procedure ProcOptionsPlayersMIMenu();
1286 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1288 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1290 if a
= '' then Exit
;
1292 i
:= g_PlayerModel_GetIndex(a
);
1293 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1295 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1296 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1297 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1299 if PlayerModelsArray
[i
].HaveWeapon
then
1300 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1302 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1305 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1308 procedure ProcOptionsPlayersAnim();
1312 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1317 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1320 Model
.AnimState
.Loop
:= True;
1324 procedure ProcOptionsPlayersWeap();
1328 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1333 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1337 procedure ProcOptionsPlayersRot();
1341 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1342 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1344 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1348 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1352 g_Options_SetDefault();
1358 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1360 if yes
then ReadOptions();
1364 procedure ProcAuthorsClose();
1366 gMusic
.SetByName('MUSIC_MENU');
1368 gState
:= STATE_MENU
;
1371 procedure ProcGMClose();
1373 g_Game_InGameMenu(False);
1376 procedure ProcGMShow();
1381 if (gGameSettings
.GameType
= GT_SINGLE
) and
1382 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1383 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1384 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1386 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1387 if g_Game_IsTestMap
then
1388 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1389 TGUIMainMenu(g_ActiveWindow
.GetControl(
1390 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1393 procedure ProcChangePlayers();
1395 TeamGame
, Spectator
, AddTwo
: Boolean;
1396 P1Team
{, P2Team}: Byte;
1397 bP2
: TGUITextButton
;
1399 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1400 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1401 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1402 P1Team
:= TEAM_NONE
;
1403 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1405 //P2Team := TEAM_NONE;
1406 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1408 TGUIMainMenu(g_ActiveWindow
.GetControl(
1409 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1410 TGUIMainMenu(g_ActiveWindow
.GetControl(
1411 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1412 TGUIMainMenu(g_ActiveWindow
.GetControl(
1413 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1415 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1416 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1417 bP2
.Enabled
:= AddTwo
and not Spectator
;
1419 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1421 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1422 if gPlayer2
= nil then
1423 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1425 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1427 TGUIMainMenu(g_ActiveWindow
.GetControl(
1428 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1431 procedure ProcJoinRed();
1433 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1435 if g_Game_IsServer
then
1437 if gPlayer1
= nil then
1438 g_Game_AddPlayer(TEAM_RED
)
1441 if gPlayer1
.Team
<> TEAM_RED
then
1443 gPlayer1
.SwitchTeam
;
1444 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1447 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1452 gPlayer1Settings
.Team
:= TEAM_RED
;
1453 MC_SEND_PlayerSettings
;
1454 if gPlayer1
= nil then
1455 g_Game_AddPlayer(TEAM_RED
);
1457 g_ActiveWindow
:= nil;
1458 g_Game_Pause(False);
1461 procedure ProcJoinBlue();
1463 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1465 if g_Game_IsServer
then
1467 if gPlayer1
= nil then
1468 g_Game_AddPlayer(TEAM_BLUE
)
1471 if gPlayer1
.Team
<> TEAM_BLUE
then
1473 gPlayer1
.SwitchTeam
;
1474 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1477 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1482 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1483 MC_SEND_PlayerSettings
;
1484 if gPlayer1
= nil then
1485 g_Game_AddPlayer(TEAM_BLUE
);
1487 g_ActiveWindow
:= nil;
1488 g_Game_Pause(False);
1491 procedure ProcJoinGame();
1493 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1495 if gPlayer1
= nil then
1497 g_ActiveWindow
:= nil;
1498 g_Game_Pause(False);
1501 procedure ProcSwitchP2();
1503 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1505 if gPlayer1
= nil then
1507 if gPlayer2
= nil then
1510 g_Game_RemovePlayer();
1511 g_ActiveWindow
:= nil;
1512 g_Game_Pause(False);
1515 procedure ProcSpectate();
1517 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1520 g_ActiveWindow
:= nil;
1521 g_Game_Pause(False);
1524 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1526 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1529 procedure ProcEndMenuKeyDown (yes
: Boolean);
1531 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1534 procedure ProcSetRussianLanguage
;
1536 if gLanguage
<> LANGUAGE_RUSSIAN
then
1538 gLanguage
:= LANGUAGE_RUSSIAN
;
1539 gLanguageChange
:= True;
1540 gAskLanguage
:= False;
1545 procedure ProcSetEnglishLanguage
;
1547 if gLanguage
<> LANGUAGE_ENGLISH
then
1549 gLanguage
:= LANGUAGE_ENGLISH
;
1550 gLanguageChange
:= True;
1551 gAskLanguage
:= False;
1556 procedure ReadGameSettings();
1560 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1562 with gGameSettings
do
1564 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1565 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1569 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1570 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1572 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1574 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1578 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1579 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1584 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1585 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1586 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1588 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1589 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1590 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1593 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1598 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1600 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1601 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1602 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1604 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1605 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1609 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1610 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1612 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1613 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1614 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1615 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1616 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1617 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1618 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1622 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1623 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1624 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1625 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1626 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1631 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1632 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1637 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1638 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1643 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1644 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1649 procedure ProcApplyGameSet();
1653 stat
: TPlayerStatArray
;
1655 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1657 if not g_Game_IsServer
then Exit
;
1659 with gGameSettings
do
1661 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1663 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1664 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1666 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1669 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1671 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1672 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1673 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1674 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1675 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1679 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1681 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1682 Options
:= Options
or GAME_OPTION_DMKEYS
1684 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1687 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1689 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1695 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1697 TimeLimit
:= Max(n
, b
);
1701 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1703 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1710 if GameMode
= GM_DM
then
1712 stat
:= g_Player_GetStats();
1714 for a
:= 0 to High(stat
) do
1715 if stat
[a
].Frags
> b
then
1719 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1721 GoalLimit
:= Max(n
, b
);
1725 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1727 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1728 if n
< 0 then n
:= 0;
1729 if n
> 255 then n
:= 255;
1735 stat
:= g_Player_GetStats();
1737 for a
:= 0 to High(stat
) do
1738 if stat
[a
].Lives
> b
then
1741 MaxLives
:= Max(n
, b
);
1745 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1747 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1750 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1751 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1755 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1756 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1760 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1761 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1766 // don't forget to latch this shit
1767 gsGameFlags
:= Options
;
1768 gsMaxLives
:= MaxLives
;
1769 gsGoalLimit
:= GoalLimit
;
1770 gsTimeLimit
:= TimeLimit
;
1773 if g_Game_IsNet
then MH_SEND_GameSettings
;
1776 procedure ProcVideoOptionsRes();
1781 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1783 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1784 IntToStr(gWinSizeX
) +
1785 ' x ' + IntToStr(gWinSizeY
) +
1786 ', ' + IntToStr(gBPP
) + ' bpp';
1788 with TGUIListBox(menu
.GetControl('lsResolution')) do
1790 list
:= sys_GetDisplayModes(gBPP
);
1794 ItemIndex
:= Length(list
)
1802 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1808 TempResScale
:= Round(r_pixel_scale
- 1);
1809 with TGUISwitch(menu
.GetControl('swResFactor')) do
1810 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1813 procedure ProcApplyVideoOptions();
1816 Fullscreen
: Boolean;
1817 SWidth
, SHeight
: Integer;
1818 ScaleChanged
: Boolean;
1821 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1823 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1825 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1828 SWidth
:= gWinSizeX
;
1829 SHeight
:= gWinSizeY
;
1830 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1833 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1835 ScaleChanged
:= False;
1836 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1838 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1839 r_pixel_scale
:= TempResScale
+ 1;
1840 ScaleChanged
:= True;
1843 if (SWidth
<> gWinSizeX
) or
1844 (SHeight
<> gWinSizeY
) or
1845 (Fullscreen
<> gFullscreen
) or
1848 gResolutionChange
:= True;
1849 gRC_Width
:= SWidth
;
1850 gRC_Height
:= SHeight
;
1851 gRC_FullScreen
:= Fullscreen
;
1852 gRC_Maximized
:= gWinMaximized
;
1855 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1859 procedure ProcSetFirstRussianLanguage
;
1861 gLanguage
:= LANGUAGE_RUSSIAN
;
1862 gLanguageChange
:= True;
1863 gAskLanguage
:= False;
1866 procedure ProcSetFirstEnglishLanguage
;
1868 gLanguage
:= LANGUAGE_ENGLISH
;
1869 gLanguageChange
:= True;
1870 gAskLanguage
:= False;
1873 procedure ProcRecallAddress();
1875 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1877 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1878 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1882 procedure CreateFirstLanguageMenu();
1886 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1888 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1890 Name
:= 'mmFirstLanguageMenu';
1891 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1892 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1895 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1896 Menu
.MainWindow
:= True;
1897 g_GUI_AddWindow(Menu
);
1900 procedure g_Menu_AskLanguage();
1902 CreateFirstLanguageMenu();
1903 g_GUI_ShowWindow('FirstLanguageMenu');
1906 procedure CreatePlayerOptionsMenu(s
: String);
1911 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1913 a
:= _lc
[I_MENU_PLAYER_1
]
1915 a
:= _lc
[I_MENU_PLAYER_2
];
1916 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1918 Name
:= 'mOptionsPlayers'+s
+'Menu';
1919 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1921 Name
:= 'ed'+s
+'Name';
1925 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1927 Name
:= 'sw'+s
+'Team';
1928 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1929 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1931 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1933 Name
:= 'ls'+s
+'Model';
1935 Items
:= g_PlayerModel_GetNames();
1936 OnChange
:= ProcSelectModel
;
1938 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1940 Name
:= 'sc'+s
+'Red';
1942 OnChange
:= ProcChangeColor
;
1944 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1946 Name
:= 'sc'+s
+'Green';
1948 OnChange
:= ProcChangeColor
;
1950 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1952 Name
:= 'sc'+s
+'Blue';
1954 OnChange
:= ProcChangeColor
;
1957 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1958 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1959 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1960 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1962 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1964 Name
:= 'mv'+s
+'Model';
1965 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1966 Y
:= GetControl('ls'+s
+'Model').Y
;
1969 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1970 g_GUI_AddWindow(Menu
);
1973 procedure CreateAllMenus();
1977 a
, cx
, _y
, i
: Integer;
1980 Menu
:= TGUIWindow
.Create('MainMenu');
1981 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
1983 Name
:= 'mmMainMenu';
1984 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1985 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1986 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1987 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1988 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1989 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1991 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1993 Color
:= _RGB(255, 255, 255);
1994 X
:= gScreenWidth
-GetWidth
-8;
1995 Y
:= gScreenHeight
-GetHeight
-8;
1997 Menu
.DefControl
:= 'mmMainMenu';
1998 Menu
.MainWindow
:= True;
1999 g_GUI_AddWindow(Menu
);
2001 Menu
:= TGUIWindow
.Create('NewGameMenu');
2002 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2004 Name
:= 'mmNewGameMenu';
2005 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2006 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2007 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2008 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2010 Menu
.DefControl
:= 'mmNewGameMenu';
2011 g_GUI_AddWindow(Menu
);
2013 Menu
:= TGUIWindow
.Create('NetGameMenu');
2014 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2016 Name
:= 'mmNetGameMenu';
2017 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2018 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2020 Menu
.DefControl
:= 'mmNetGameMenu';
2021 g_GUI_AddWindow(Menu
);
2023 Menu
:= TGUIWindow
.Create('NetServerMenu');
2024 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2026 Name
:= 'mNetServerMenu';
2027 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2029 Name
:= 'edSrvName';
2030 OnlyDigits
:= False;
2033 Text := NetServerName
;
2035 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2037 Name
:= 'edSrvPassword';
2038 OnlyDigits
:= False;
2041 Text := NetPassword
;
2043 with AddEdit(_lc
[I_NET_PORT
]) do
2049 Text := IntToStr(NetPort
);
2051 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2053 Name
:= 'edMaxPlayers';
2057 Text := IntToStr(NetMaxClients
);
2059 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2061 Name
:= 'swUseMaster';
2062 AddItem(_lc
[I_MENU_YES
]);
2063 AddItem(_lc
[I_MENU_NO
]);
2064 if NetUseMaster
then
2070 with AddLabel(_lc
[I_MENU_MAP
]) do
2075 OnClick
:= @ProcSelectMapMenu
;
2077 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2079 Name
:= 'swGameMode';
2080 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2081 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2082 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2083 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2084 case g_Game_TextToMode(gsGameMode
) of
2086 GM_DM
: ItemIndex
:= 0;
2087 GM_TDM
: ItemIndex
:= 1;
2088 GM_CTF
: ItemIndex
:= 2;
2090 GM_COOP
: ItemIndex
:= 3;
2092 OnChange
:= ProcSwitchMonstersCustom
;
2094 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2096 Name
:= 'edTimeLimit';
2100 if gsTimeLimit
> 0 then
2101 Text := IntToStr(gsTimeLimit
);
2103 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2105 Name
:= 'edGoalLimit';
2109 if gsGoalLimit
> 0 then
2110 Text := IntToStr(gsGoalLimit
);
2112 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2114 Name
:= 'edMaxLives';
2118 if gsMaxLives
> 0 then
2119 Text := IntToStr(gsMaxLives
);
2121 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2123 Name
:= 'edItemRespawnTime';
2127 if gsItemRespawnTime
> 0 then
2128 Text := IntToStr(gsItemRespawnTime
);
2130 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2132 Name
:= 'swPlayers';
2133 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2134 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2135 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2136 ItemIndex
:= gsPlayers
;
2138 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2140 Name
:= 'swTeamDamage';
2141 AddItem(_lc
[I_MENU_YES
]);
2142 AddItem(_lc
[I_MENU_NO
]);
2143 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2148 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2150 Name
:= 'swTeamHit';
2151 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2152 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2153 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2154 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2155 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2157 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2159 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2164 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2166 Name
:= 'swDeathmatchKeys';
2167 AddItem(_lc
[I_MENU_YES
]);
2168 AddItem(_lc
[I_MENU_NO
]);
2169 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2174 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2176 Name
:= 'swEnableExits';
2177 AddItem(_lc
[I_MENU_YES
]);
2178 AddItem(_lc
[I_MENU_NO
]);
2179 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2184 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2186 Name
:= 'swWeaponStay';
2187 AddItem(_lc
[I_MENU_YES
]);
2188 AddItem(_lc
[I_MENU_NO
]);
2189 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2194 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2196 Name
:= 'swMonsters';
2197 AddItem(_lc
[I_MENU_YES
]);
2198 AddItem(_lc
[I_MENU_NO
]);
2199 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2204 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2207 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2208 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2209 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2211 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2213 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2217 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2221 Menu
.DefControl
:= 'mNetServerMenu';
2222 g_GUI_AddWindow(Menu
);
2224 Menu
:= TGUIWindow
.Create('NetClientMenu');
2225 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2227 Name
:= 'mNetClientMenu';
2229 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2232 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2238 Text := 'localhost';
2240 with AddEdit(_lc
[I_NET_PORT
]) do
2248 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2251 OnlyDigits
:= False;
2258 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2262 Menu
.DefControl
:= 'mNetClientMenu';
2263 g_GUI_AddWindow(Menu
);
2265 Menu
:= TGUIWindow
.Create('LoadMenu');
2266 Menu
.OnShow
:= ProcLoadMenu
;
2267 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2269 Name
:= 'mmLoadMenu';
2274 Name
:= 'edSlot'+IntToStr(a
);
2277 OnEnter
:= ProcLoadGame
;
2280 Menu
.DefControl
:= 'mmLoadMenu';
2281 g_GUI_AddWindow(Menu
);
2283 Menu
:= TGUIWindow
.Create('SaveMenu');
2284 Menu
.OnShow
:= ProcSaveMenu
;
2285 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2287 Name
:= 'mmSaveMenu';
2292 Name
:= 'edSlot'+IntToStr(a
);
2295 OnChange
:= ProcSaveGame
;
2298 Menu
.DefControl
:= 'mmSaveMenu';
2299 g_GUI_AddWindow(Menu
);
2301 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2302 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2304 Name
:= 'mCustomGameMenu';
2305 with AddLabel(_lc
[I_MENU_MAP
]) do
2310 OnClick
:= @ProcSelectMapMenu
;
2312 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2314 Name
:= 'swGameMode';
2315 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2316 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2317 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2318 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2319 case g_Game_TextToMode(gsGameMode
) of
2321 GM_DM
: ItemIndex
:= 0;
2322 GM_TDM
: ItemIndex
:= 1;
2323 GM_CTF
: ItemIndex
:= 2;
2325 GM_COOP
: ItemIndex
:= 3;
2327 OnChange
:= ProcSwitchMonstersCustom
;
2329 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2331 Name
:= 'edTimeLimit';
2335 if gsTimeLimit
> 0 then
2336 Text := IntToStr(gsTimeLimit
);
2338 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2340 Name
:= 'edGoalLimit';
2344 if gsGoalLimit
> 0 then
2345 Text := IntToStr(gsGoalLimit
);
2347 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2349 Name
:= 'edMaxLives';
2353 if gsMaxLives
> 0 then
2354 Text := IntToStr(gsMaxLives
);
2356 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2358 Name
:= 'edItemRespawnTime';
2362 if gsItemRespawnTime
> 0 then
2363 Text := IntToStr(gsItemRespawnTime
);
2365 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2367 Name
:= 'swPlayers';
2368 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2369 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2370 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2371 ItemIndex
:= gsPlayers
;
2373 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2375 Name
:= 'swTeamDamage';
2376 AddItem(_lc
[I_MENU_YES
]);
2377 AddItem(_lc
[I_MENU_NO
]);
2378 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2383 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2385 Name
:= 'swTeamHit';
2386 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2387 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2388 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2389 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2390 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2392 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2394 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2399 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2401 Name
:= 'swDeathmatchKeys';
2402 AddItem(_lc
[I_MENU_YES
]);
2403 AddItem(_lc
[I_MENU_NO
]);
2404 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2409 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2411 Name
:= 'swEnableExits';
2412 AddItem(_lc
[I_MENU_YES
]);
2413 AddItem(_lc
[I_MENU_NO
]);
2414 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2419 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2421 Name
:= 'swWeaponStay';
2422 AddItem(_lc
[I_MENU_YES
]);
2423 AddItem(_lc
[I_MENU_NO
]);
2424 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2429 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2431 Name
:= 'swMonsters';
2432 AddItem(_lc
[I_MENU_YES
]);
2433 AddItem(_lc
[I_MENU_NO
]);
2434 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2439 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2442 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2443 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2444 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2446 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2448 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2452 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2456 Menu
.DefControl
:= 'mCustomGameMenu';
2457 g_GUI_AddWindow(Menu
);
2459 Menu
:= TGUIWindow
.Create('CampaignMenu');
2460 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2462 Name
:= 'mCampaignMenu';
2471 with AddFileList('', 15, 4) do
2474 OnChange
:= ProcSelectCampaignWAD
;
2478 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2479 SetBase(MegawadDirs
);
2482 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2484 Name
:= 'lbWADName';
2488 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2490 Name
:= 'lbWADAuthor';
2494 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2495 with AddMemo('', 15, 3) do
2497 Name
:= 'meWADDescription';
2498 Color
:= MENU_ITEMSCTRL_COLOR
;
2500 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2502 Name
:= 'swPlayers';
2503 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2504 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2507 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2511 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2513 Name
:= 'mpWADImage';
2514 DefaultRes
:= 'NOPIC';
2515 X
:= GetControl('lsWAD').X
+4;
2516 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2519 Menu
.DefControl
:= 'mCampaignMenu';
2520 g_GUI_AddWindow(Menu
);
2522 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2523 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2525 Name
:= 'mSelectMapMenu';
2526 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2529 OnChange
:= ProcSelectWAD
;
2533 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2536 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2540 OnChange
:= ProcSelectMap
;
2543 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2545 Name
:= 'lbMapName';
2549 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2551 Name
:= 'lbMapAuthor';
2555 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2557 Name
:= 'lbMapSize';
2561 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2563 Name
:= 'meMapDescription';
2568 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2570 Name
:= 'mpMapPreview';
2571 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2572 Y
:= GetControl('lsMapWAD').Y
;
2574 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2576 Name
:= 'lbMapScale';
2579 Color
:= MENU_ITEMSCTRL_COLOR
;
2580 X
:= GetControl('lsMapWAD').X
+
2581 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2582 2 + MAPPREVIEW_WIDTH
*4;
2583 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2586 Menu
.OnClose
:= ProcSetMap
;
2587 Menu
.DefControl
:= 'mSelectMapMenu';
2588 g_GUI_AddWindow(Menu
);
2590 Menu
:= TGUIWindow
.Create('OptionsMenu');
2591 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2593 Name
:= 'mmOptionsMenu';
2594 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2595 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2596 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2597 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2598 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2599 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2601 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2602 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2604 Menu
.OnClose
:= ProcApplyOptions
;
2605 Menu
.DefControl
:= 'mmOptionsMenu';
2606 g_GUI_AddWindow(Menu
);
2608 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2609 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2610 g_GUI_AddWindow(Menu
);
2612 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2613 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2615 Name
:= 'mOptionsVideoMenu';
2616 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2617 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2623 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2626 AddItem(_lc
[I_MENU_YES
]);
2627 AddItem(_lc
[I_MENU_NO
]);
2629 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2631 Name
:= 'swTextureFilter';
2632 AddItem(_lc
[I_MENU_YES
]);
2633 AddItem(_lc
[I_MENU_NO
]);
2635 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2638 AddItem(_lc
[I_MENU_YES
]);
2639 AddItem(_lc
[I_MENU_NO
]);
2641 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2643 Name
:= 'swLegacyNPOT';
2644 AddItem(_lc
[I_MENU_NO
]);
2645 AddItem(_lc
[I_MENU_YES
]);
2648 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2651 Menu
.DefControl
:= 'mOptionsVideoMenu';
2652 g_GUI_AddWindow(Menu
);
2654 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2655 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2657 Name
:= 'mOptionsVideoResMenu';
2658 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2660 Name
:= 'lbCurrentRes';
2664 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2666 Name
:= 'lsResolution';
2669 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2671 Name
:= 'swFullScreen';
2672 AddItem(_lc
[I_MENU_YES
]);
2673 AddItem(_lc
[I_MENU_NO
]);
2675 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2677 Name
:= 'swResFactor';
2679 for i
:= 2 to gRC_Width
div 640 do
2680 AddItem(IntToStr(i
) + 'x');
2683 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2686 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2687 g_GUI_AddWindow(Menu
);
2689 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2690 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2692 Name
:= 'mOptionsSoundMenu';
2693 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2695 Name
:= 'scMusicLevel';
2697 OnChange
:= ProcChangeSoundSettings
;
2699 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2701 Name
:= 'scSoundLevel';
2703 OnChange
:= ProcChangeSoundSettings
;
2705 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2707 Name
:= 'scMaxSimSounds';
2710 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2712 Name
:= 'swAnnouncer';
2713 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2714 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2715 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2716 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2718 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2719 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2721 Name
:= 'swSoundEffects';
2722 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2723 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2725 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2726 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2728 Name
:= 'swChatSpeech';
2729 AddItem(_lc
[I_MENU_YES
]);
2730 AddItem(_lc
[I_MENU_NO
]);
2732 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2734 Name
:= 'swInactiveSounds';
2735 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2736 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2740 Menu
.DefControl
:= 'mOptionsSoundMenu';
2741 g_GUI_AddWindow(Menu
);
2743 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2744 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2746 Name
:= 'mOptionsGameMenu';
2747 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2749 Name
:= 'scParticlesCount';
2752 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2754 Name
:= 'swBloodCount';
2755 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2756 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2757 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2758 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2759 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2761 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2763 Name
:= 'scShellsMax';
2766 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2768 Name
:= 'scGibsMax';
2771 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2773 Name
:= 'scCorpsesMax';
2776 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2778 Name
:= 'swGibsCount';
2779 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2780 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2781 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2782 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2783 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2785 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2787 Name
:= 'swCorpseType';
2788 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2789 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2791 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2793 Name
:= 'swGibsType';
2794 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2795 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2797 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2799 Name
:= 'swBloodType';
2800 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2801 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2803 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2805 Name
:= 'swScreenFlash';
2806 AddItem(_lc
[I_MENU_NO
]);
2807 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2808 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2810 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2812 Name
:= 'swBackground';
2813 AddItem(_lc
[I_MENU_YES
]);
2814 AddItem(_lc
[I_MENU_NO
]);
2816 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2818 Name
:= 'swMessages';
2819 AddItem(_lc
[I_MENU_YES
]);
2820 AddItem(_lc
[I_MENU_NO
]);
2822 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2824 Name
:= 'swRevertPlayers';
2825 AddItem(_lc
[I_MENU_YES
]);
2826 AddItem(_lc
[I_MENU_NO
]);
2828 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2830 Name
:= 'swChatBubble';
2831 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2832 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2833 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2834 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2835 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2837 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2839 Name
:= 'swPlayerIndicator';
2840 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2841 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2842 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2844 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2846 Name
:= 'swPlayerIndicatorStyle';
2847 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2848 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2850 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2852 Name
:= 'scScaleFactor';
2854 OnChange
:= ProcChangeGameSettings
;
2858 Menu
.DefControl
:= 'mOptionsGameMenu';
2859 g_GUI_AddWindow(Menu
);
2861 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2862 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2864 Name
:= 'mOptionsControlsMenu';
2865 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2866 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2867 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2868 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2869 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2871 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2872 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2873 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2874 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2875 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2876 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2877 if e_HasJoysticks
then
2880 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2882 if g_touch_enabled
then
2885 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2888 Menu
.DefControl
:= 'mOptionsControlsMenu';
2889 g_GUI_AddWindow(Menu
);
2891 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2892 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2894 Name
:= 'mOptionsControlsP1Menu';
2895 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2903 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2904 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2906 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2907 g_GUI_AddWindow(Menu
);
2909 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2910 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2912 Name
:= 'mOptionsControlsP1MenuWeapons';
2913 for i
:= WP_FIRST
to WP_LAST
do
2914 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2915 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2917 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2918 g_GUI_AddWindow(Menu
);
2920 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2921 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2923 Name
:= 'mOptionsControlsP2Menu';
2924 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2925 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2926 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2927 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2928 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2929 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2930 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2931 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2932 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2933 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2935 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2936 g_GUI_AddWindow(Menu
);
2938 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2939 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2941 Name
:= 'mOptionsControlsP2MenuWeapons';
2942 for i
:= WP_FIRST
to WP_LAST
do
2943 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2944 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2946 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2947 g_GUI_AddWindow(Menu
);
2949 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2950 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2952 Name
:= 'mOptionsControlsJoystickMenu';
2953 for i
:= 0 to e_MaxJoys
- 1 do
2954 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2956 Name
:= 'scDeadzone' + IntToStr(i
);
2960 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2961 g_GUI_AddWindow(Menu
);
2963 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2964 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2966 Name
:= 'mOptionsControlsTouchMenu';
2967 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2969 Name
:= 'swTouchAlt';
2970 AddItem(_lc
[I_MENU_NO
]);
2971 AddItem(_lc
[I_MENU_YES
]);
2972 OnChange
:= ProcChangeTouchSettings
;
2974 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2976 Name
:= 'scTouchSize';
2978 OnChange
:= ProcChangeTouchSettings
;
2980 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2982 Name
:= 'swTouchFire';
2983 AddItem(_lc
[I_MENU_NO
]);
2984 AddItem(_lc
[I_MENU_YES
]);
2986 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2988 Name
:= 'scTouchOffset';
2990 OnChange
:= ProcChangeTouchSettings
;
2993 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2994 g_GUI_AddWindow(Menu
);
2996 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2997 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2999 Name
:= 'mOptionsPlayersMenu';
3000 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3001 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3003 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3004 g_GUI_AddWindow(Menu
);
3006 CreatePlayerOptionsMenu('P1');
3007 CreatePlayerOptionsMenu('P2');
3009 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3012 Name
:= 'mOptionsPlayersMIMenu';
3013 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3018 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3023 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3025 Name
:= 'meComment';
3028 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3029 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3032 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3036 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3037 g_GUI_AddWindow(Menu
);
3039 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3040 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3042 Name
:= 'mOptionsLanguageMenu';
3043 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3044 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3047 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3048 g_GUI_AddWindow(Menu
);
3050 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3051 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3052 g_GUI_AddWindow(Menu
);
3054 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3055 Menu
.BackTexture
:= 'INTER';
3056 Menu
.OnClose
:= ProcAuthorsClose
;
3060 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3062 Color
:= _RGB(255, 0, 0);
3063 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3065 _y
:= _y
+GetHeight();
3067 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3069 Color
:= _RGB(255, 0, 0);
3070 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3072 _y
:= _y
+GetHeight()+32;
3074 // ×òî äåëàë: Êòî äåëàë
3075 cx
:= gScreenWidth
div 2 - 320 + 64;
3076 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3078 Color
:= _RGB(255, 0, 0);
3083 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3085 Color
:= _RGB(255, 255, 255);
3090 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3092 Color
:= _RGB(255, 0, 0);
3097 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3099 Color
:= _RGB(255, 255, 255);
3104 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3106 Color
:= _RGB(255, 255, 255);
3111 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3113 Color
:= _RGB(255, 0, 0);
3118 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3120 Color
:= _RGB(255, 255, 255);
3125 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3127 Color
:= _RGB(255, 0, 0);
3132 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3134 Color
:= _RGB(255, 255, 255);
3137 _y
:= gScreenHeight
- 128;
3140 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3142 Color
:= _RGB(255, 0, 0);
3147 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3149 Color
:= _RGB(255, 255, 255);
3152 _y
:= _y
+GetHeight();
3154 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3156 Color
:= _RGB(255, 255, 255);
3159 _y
:= _y
+GetHeight();
3161 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3163 Color
:= _RGB(255, 255, 255);
3166 _y
:= gScreenHeight
- 32;
3168 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3170 Color
:= _RGB(255, 0, 0);
3171 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3174 g_GUI_AddWindow(Menu
);
3176 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3177 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3178 g_GUI_AddWindow(Menu
);
3180 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3181 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3183 Name
:= 'mmGameSingleMenu';
3184 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3185 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3186 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3187 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3188 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3189 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3191 Menu
.DefControl
:= 'mmGameSingleMenu';
3192 Menu
.MainWindow
:= True;
3193 Menu
.OnClose
:= ProcGMClose
;
3194 Menu
.OnShow
:= ProcGMShow
;
3195 g_GUI_AddWindow(Menu
);
3197 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3198 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3199 g_GUI_AddWindow(Menu
);
3201 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3202 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3203 g_GUI_AddWindow(Menu
);
3205 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3206 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3208 Name
:= 'mmGameCustomMenu';
3209 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3210 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3211 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3212 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3213 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3214 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3215 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3217 Menu
.DefControl
:= 'mmGameCustomMenu';
3218 Menu
.MainWindow
:= True;
3219 Menu
.OnClose
:= ProcGMClose
;
3220 Menu
.OnShow
:= ProcGMShow
;
3221 g_GUI_AddWindow(Menu
);
3223 Menu
:= TGUIWindow
.Create('GameServerMenu');
3224 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3226 Name
:= 'mmGameServerMenu';
3227 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3228 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3229 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3230 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3231 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3233 Menu
.DefControl
:= 'mmGameServerMenu';
3234 Menu
.MainWindow
:= True;
3235 Menu
.OnClose
:= ProcGMClose
;
3236 Menu
.OnShow
:= ProcGMShow
;
3237 g_GUI_AddWindow(Menu
);
3239 Menu
:= TGUIWindow
.Create('GameClientMenu');
3240 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3242 Name
:= 'mmGameClientMenu';
3243 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3244 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3245 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3247 Menu
.DefControl
:= 'mmGameClientMenu';
3248 Menu
.MainWindow
:= True;
3249 Menu
.OnClose
:= ProcGMClose
;
3250 Menu
.OnShow
:= ProcGMShow
;
3251 g_GUI_AddWindow(Menu
);
3253 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3254 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3256 Name
:= 'mClientPasswordMenu';
3257 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3265 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3268 Menu
.DefControl
:= 'mClientPasswordMenu';
3269 g_GUI_AddWindow(Menu
);
3271 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3272 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3274 Name
:= 'mGameSetGameMenu';
3275 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3277 Name
:= 'swTeamDamage';
3278 AddItem(_lc
[I_MENU_YES
]);
3279 AddItem(_lc
[I_MENU_NO
]);
3282 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3284 Name
:= 'swTeamHit';
3285 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3286 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3287 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3288 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3291 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3293 Name
:= 'swDeathmatchKeys';
3294 AddItem(_lc
[I_MENU_YES
]);
3295 AddItem(_lc
[I_MENU_NO
]);
3298 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3300 Name
:= 'edTimeLimit';
3305 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3307 Name
:= 'edGoalLimit';
3312 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3314 Name
:= 'edMaxLives';
3319 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3322 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3323 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3324 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3330 Menu
.DefControl
:= 'mGameSetGameMenu';
3331 Menu
.OnClose
:= ProcApplyGameSet
;
3332 g_GUI_AddWindow(Menu
);
3334 Menu
:= TGUIWindow
.Create('TeamMenu');
3335 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3337 Name
:= 'mmTeamMenu';
3338 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3339 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3340 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3341 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3342 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3344 Menu
.DefControl
:= 'mmTeamMenu';
3345 Menu
.OnShow
:= ProcChangePlayers
;
3346 g_GUI_AddWindow(Menu
);
3349 procedure g_Menu_Show_SaveMenu();
3351 if g_Game_IsTestMap
then
3353 if gGameSettings
.GameType
= GT_SINGLE
then
3354 g_GUI_ShowWindow('GameSingleMenu')
3357 if g_Game_IsClient
then
3360 if g_Game_IsNet
then
3363 g_GUI_ShowWindow('GameCustomMenu');
3365 g_GUI_ShowWindow('SaveMenu');
3366 g_Sound_PlayEx('MENU_OPEN');
3369 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3371 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3372 if gGameSettings
.GameType
= GT_SINGLE
then
3374 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3378 if g_Game_IsClient
then exit
;
3379 if g_Game_IsNet
then exit
;
3380 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3382 g_GUI_ShowWindow('LoadMenu');
3383 g_Sound_PlayEx('MENU_OPEN');
3386 procedure g_Menu_Show_GameSetGame();
3388 if gGameSettings
.GameType
= GT_SINGLE
then
3389 g_GUI_ShowWindow('GameSingleMenu')
3392 if g_Game_IsClient
then
3395 if g_Game_IsNet
then
3396 g_GUI_ShowWindow('GameServerMenu')
3398 g_GUI_ShowWindow('GameCustomMenu');
3401 g_GUI_ShowWindow('GameSetGameMenu');
3402 g_Sound_PlayEx('MENU_OPEN');
3405 procedure g_Menu_Show_OptionsVideo();
3407 if gGameSettings
.GameType
= GT_SINGLE
then
3408 g_GUI_ShowWindow('GameSingleMenu')
3411 if g_Game_IsClient
then
3412 g_GUI_ShowWindow('GameClientMenu')
3414 if g_Game_IsNet
then
3415 g_GUI_ShowWindow('GameServerMenu')
3417 g_GUI_ShowWindow('GameCustomMenu');
3420 g_GUI_ShowWindow('OptionsMenu');
3421 g_GUI_ShowWindow('OptionsVideoMenu');
3422 g_Sound_PlayEx('MENU_OPEN');
3425 procedure g_Menu_Show_OptionsSound();
3427 if gGameSettings
.GameType
= GT_SINGLE
then
3428 g_GUI_ShowWindow('GameSingleMenu')
3431 if g_Game_IsClient
then
3432 g_GUI_ShowWindow('GameClientMenu')
3434 if g_Game_IsNet
then
3435 g_GUI_ShowWindow('GameServerMenu')
3437 g_GUI_ShowWindow('GameCustomMenu');
3440 g_GUI_ShowWindow('OptionsMenu');
3441 g_GUI_ShowWindow('OptionsSoundMenu');
3442 g_Sound_PlayEx('MENU_OPEN');
3445 procedure g_Menu_Show_EndGameMenu();
3447 g_GUI_ShowWindow('EndGameMenu');
3448 g_Sound_PlayEx('MENU_OPEN');
3451 procedure g_Menu_Show_QuitGameMenu();
3453 g_GUI_ShowWindow('ExitMenu');
3454 g_Sound_PlayEx('MENU_OPEN');
3457 procedure g_Menu_Init();
3463 procedure g_Menu_Free();
3468 procedure g_Menu_Reset();
3472 g_GUI_SaveMenuPos();
3473 ex
:= g_GUI_Destroy();
3477 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3482 g_Game_SetDebugMode();
3484 g_GUI_LoadMenuPos();