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 {$IFDEF ENABLE_SHELLS}
51 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
52 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
53 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
54 MAPDEF
, Math
, g_saveload
,
56 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
57 utils
, wadreader
, g_system
, r_render
, r_game
;
60 type TYNCallback
= procedure (yes
:Boolean);
62 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
64 if win
.UserData
= nil then exit
;
66 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
67 IK_N
: TYNCallback(win
.UserData
)(false);
71 procedure YesButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(true);
77 procedure NoButtonCB (ctl
: TGUITextButton
);
79 if ctl
.UserData
= nil then exit
;
80 TYNCallback(ctl
.UserData
)(false);
83 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
87 //if length(Text) = 0 then exit;
88 Result
:= TGUIWindow
.Create(WinName
);
91 //OnKeyDownEx := @YNKeyDownProc;
92 //UserData := @ActionProc;
93 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
96 Name
:= '__temp_yes_no_menu:'+WinName
;
98 AddText(Text, MaxLen
);
99 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
100 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
102 DefControl
:= '__temp_yes_no_menu:'+WinName
;
108 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
109 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
111 procedure ProcApplyOptions();
116 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
118 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
123 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
145 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
147 {$IFDEF ENABLE_SHELLS}
148 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
151 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
153 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
156 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
161 else gGibsCount
:= 48;
165 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
166 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
167 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
168 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
169 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
170 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
171 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
172 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
173 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
174 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
175 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
176 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
178 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
179 g_dbg_scale
:= TempScale
+ 1;
182 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
186 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
188 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
189 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
190 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
191 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
192 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
193 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
196 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
201 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
202 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
203 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
204 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
205 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
206 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
207 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
208 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
222 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
223 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
224 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
225 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
226 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
227 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
228 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
229 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
245 for i
:= WP_FIRST
to WP_LAST
do
247 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
248 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
249 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
254 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
261 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
262 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
263 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
264 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
265 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
266 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
284 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
285 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
286 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
287 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
300 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
303 for i
:= WP_FIRST
to WP_LAST
do
305 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
307 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
312 if e_HasJoysticks
then
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
317 for i
:= 0 to e_MaxJoys
- 1 do
318 if e_JoystickAvailable
[i
] then
319 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
323 if g_touch_enabled
then
325 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
326 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
327 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
328 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
329 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
334 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
335 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
336 TEAM_RED
, TEAM_BLUE
);
338 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
340 gPlayer1Settings
.Model
:= Model
.GetName();
341 gPlayer1Settings
.Color
:= Model
.Color
;
344 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
346 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
347 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
348 TEAM_RED
, TEAM_BLUE
);
349 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
351 gPlayer2Settings
.Model
:= Model
.GetName();
352 gPlayer2Settings
.Color
:= Model
.Color
;
355 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
356 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
358 if g_Game_IsServer
then
360 if gPlayer1
<> nil then
362 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
363 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
364 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
365 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
367 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
370 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
373 if gPlayer2
<> nil then
375 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
376 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
377 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
378 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
380 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
385 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
387 g_Console_WriteGameConfig
;
390 procedure ReadOptions();
395 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
397 with TGUISwitch(menu
.GetControl('swBPP')) do
403 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
404 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
406 with TGUISwitch(menu
.GetControl('swVSync')) do
407 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
409 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
410 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
412 with TGUISwitch(menu
.GetControl('swInterp')) do
413 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
415 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
417 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
418 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
419 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
421 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
422 if gMuteWhenInactive
then
427 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
429 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
430 if gSoundEffectsDF
then
435 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
436 if gUseChatSounds
then
441 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
457 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
458 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
459 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
460 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
467 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
470 for i
:= WP_FIRST
to WP_LAST
do
472 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
473 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
477 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
503 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
506 for i
:= WP_FIRST
to WP_LAST
do
508 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
509 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
513 if e_HasJoysticks
then
515 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
518 for i
:= 0 to e_MaxJoys
- 1 do
519 if e_JoystickAvailable
[i
] then
520 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
524 if g_touch_enabled
then
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
527 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
528 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
529 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
530 with TGUISwitch(menu
.GetControl('swTouchFire')) do
531 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
532 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
535 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
538 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
539 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
540 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
541 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
544 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
547 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
549 {$IFDEF ENABLE_SHELLS}
550 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
553 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
555 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
556 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
558 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
561 with TGUISwitch(menu
.GetControl('swBloodType')) do
562 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
564 with TGUISwitch(menu
.GetControl('swCorpseType')) do
565 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
567 with TGUISwitch(menu
.GetControl('swGibsType')) do
568 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
571 with TGUISwitch(menu
.GetControl('swGibsCount')) do
583 with TGUISwitch(menu
.GetControl('swBackGround')) do
584 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
586 with TGUISwitch(menu
.GetControl('swMessages')) do
587 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
589 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
590 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
592 with TGUISwitch(menu
.GetControl('swChatBubble')) do
593 ItemIndex
:= gChatBubble
;
595 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
596 ItemIndex
:= gPlayerIndicator
;
598 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
599 ItemIndex
:= gPlayerIndicatorStyle
;
601 TempScale
:= Round(g_dbg_scale
- 1);
602 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
604 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
606 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
607 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
609 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
610 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
612 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
613 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
614 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
616 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
618 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
619 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
621 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
622 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
624 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
625 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
626 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
628 ProcSelectModel(nil);
631 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
633 // don't turn off monsters in DM
635 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
636 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
642 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
643 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
644 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
645 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
649 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
651 // don't turn off monsters in DM
653 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
654 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
655 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
657 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
660 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
661 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
662 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
663 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
667 function LatchGameOptions(const MenuName
: string): Byte;
673 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
675 Map
:= TGUILabel(GetControl('lbMap')).Text;
678 if not isWadPath(Map
) then
681 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
682 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
683 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
684 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
685 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
686 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
687 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
691 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
692 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
693 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
694 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
695 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
696 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
697 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
698 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
699 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
700 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
702 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
703 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
704 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
705 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
708 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
709 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
710 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
711 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
714 // TODO: get this crap out of here
715 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
716 gGameSettings
.WarmupTime
:= gsWarmupTime
;
717 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
721 procedure ProcStartCustomGame();
725 GameMode
:= LatchGameOptions('mCustomGameMenu');
726 if GameMode
= GM_NONE
then Exit
;
728 g_Console_WriteGameConfig
;
729 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
730 gsMaxLives
, gsGameFlags
, gsPlayers
);
734 procedure ProcStartNetGame();
738 GameMode
:= LatchGameOptions('mNetServerMenu');
739 if GameMode
= GM_NONE
then Exit
;
741 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
743 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
744 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
745 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
746 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
747 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
748 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
751 g_Console_WriteGameConfig
;
752 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
753 gsGameFlags
, gsPlayers
, 0, NetPort
);
756 procedure ProcConnectNetGame();
760 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
762 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
763 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
764 PW
:= TGUIEdit(GetControl('edPW')).Text;
767 g_Console_WriteGameConfig
;
768 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
771 procedure ProcEnterPassword();
775 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
777 NetClientIP
:= PromptIP
;
778 NetClientPort
:= PromptPort
;
779 PW
:= TGUIEdit(GetControl('edPW')).Text;
782 g_Console_WriteGameConfig
;
783 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
786 procedure ProcServerlist();
788 if not NetInitDone
then
790 if (not g_Net_Init()) then
792 g_Console_Add('NET: ERROR: Failed to init ENet!');
799 g_Net_Slist_Set(NetMasterList
);
801 gState
:= STATE_SLIST
;
802 g_ActiveWindow
:= nil;
804 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
809 slReturnPressed
:= True;
810 if g_Net_Slist_Fetch(slCurrent
) then
812 if slCurrent
= nil then
813 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
816 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
817 g_Serverlist_GenerateTable(slCurrent
, slTable
);
820 procedure ProcStartCampaign();
826 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
828 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
829 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
831 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
837 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
840 procedure ProcSelectMap(Sender
: TGUIControl
);
844 wad
, map
, res
: String;
846 win
:= g_GUI_GetWindow('SelectMapMenu');
847 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
849 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
850 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
852 if (wad
= '') or (map
= '') then
853 begin // Ýòî íå êàðòà
854 TGUILabel(GetControl('lbMapName')).Text := '';
855 TGUILabel(GetControl('lbMapAuthor')).Text := '';
856 TGUILabel(GetControl('lbMapSize')).Text := '';
857 TGUIMemo(GetControl('meMapDescription')).SetText('');
858 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
859 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
865 a
:= g_Map_GetMapInfo(res
);
867 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
868 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
869 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
870 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
871 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
872 TGUILabel(win
.GetControl('lbMapScale')).Text :=
873 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
878 procedure ProcSelectWAD(Sender
: TGUIControl
);
883 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
885 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
887 with TGUIListBox(GetControl('lsMapRes')) do
893 list
:= g_Map_GetMapsList(wad
);
907 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
913 win
:= g_GUI_GetWindow('CampaignMenu');
914 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
916 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
920 TGUILabel(GetControl('lbWADName')).Text := '';
921 TGUILabel(GetControl('lbWADAuthor')).Text := '';
922 TGUIMemo(GetControl('meWADDescription')).SetText('');
925 a
:= g_Game_GetMegaWADInfo(wad
);
927 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
928 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
929 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
931 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
935 fn
:= g_ExtractWadName(a
.pic
);
937 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
939 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
944 procedure ProcChangeColor(Sender
: TGUIControl
);
948 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
949 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
950 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
951 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
952 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
953 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
955 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
956 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
957 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
958 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
959 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
960 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
963 procedure ProcSelectModel(Sender
: TGUIControl
);
968 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
969 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
970 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
972 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
973 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
974 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
976 ProcChangeColor(nil);
979 procedure MenuLoadData();
981 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
983 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
984 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
985 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
986 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
987 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
988 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
989 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
990 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
991 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
992 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
993 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
994 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
995 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
996 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
997 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
998 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
999 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1000 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1001 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1002 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1003 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1004 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1005 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1006 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1007 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1009 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1010 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1011 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1012 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1013 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1014 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1015 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1018 procedure MenuFreeData();
1020 e_CharFont_Remove(gMenuFont
);
1021 e_CharFont_Remove(gMenuSmallFont
);
1023 g_Texture_Delete('MAINMENU_LOGO');
1024 g_Texture_Delete('MAINMENU_MARKER1');
1025 g_Texture_Delete('MAINMENU_MARKER2');
1026 g_Texture_Delete('SCROLL_LEFT');
1027 g_Texture_Delete('SCROLL_RIGHT');
1028 g_Texture_Delete('SCROLL_MIDDLE');
1029 g_Texture_Delete('SCROLL_MARKER');
1030 g_Texture_Delete('EDIT_LEFT');
1031 g_Texture_Delete('EDIT_RIGHT');
1032 g_Texture_Delete('EDIT_MIDDLE');
1033 g_Texture_Delete('BOX1');
1034 g_Texture_Delete('BOX2');
1035 g_Texture_Delete('BOX3');
1036 g_Texture_Delete('BOX4');
1037 g_Texture_Delete('BOX5');
1038 g_Texture_Delete('BOX6');
1039 g_Texture_Delete('BOX7');
1040 g_Texture_Delete('BOX8');
1041 g_Texture_Delete('BOX9');
1042 g_Texture_Delete('BSCROLL_UP_A');
1043 g_Texture_Delete('BSCROLL_UP_U');
1044 g_Texture_Delete('BSCROLL_DOWN_A');
1045 g_Texture_Delete('BSCROLL_DOWN_U');
1046 g_Texture_Delete('BSCROLL_MIDDLE');
1047 g_Texture_Delete('NOPIC');
1049 g_Sound_Delete('MENU_SELECT');
1050 g_Sound_Delete('MENU_OPEN');
1051 g_Sound_Delete('MENU_CLOSE');
1052 g_Sound_Delete('MENU_CHANGE');
1053 g_Sound_Delete('SCROLL_ADD');
1054 g_Sound_Delete('SCROLL_SUB');
1055 g_Sound_Delete('SOUND_PLAYER_FALL');
1058 procedure ProcAuthorsMenu();
1060 gMusic
.SetByName('MUSIC_INTERMUS');
1064 procedure ProcExitMenuKeyDown (yes
: Boolean);
1067 snd
: TPlayableSound
;
1072 g_Game_StopAllSounds(True);
1073 case (Random(18)) of
1074 0: s
:= 'SOUND_MONSTER_PAIN';
1075 1: s
:= 'SOUND_MONSTER_DIE_3';
1076 2: s
:= 'SOUND_MONSTER_SLOP';
1077 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1078 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1079 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1080 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1081 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1082 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1083 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1084 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1085 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1086 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1087 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1088 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1089 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1090 else s
:= 'SOUND_PLAYER_FALL';
1092 snd
:= TPlayableSound
.Create();
1093 res
:= snd
.SetByName(s
);
1094 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1098 while snd
.IsPlaying() do begin end;
1106 procedure ProcLoadMenu();
1113 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1114 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1115 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1119 procedure ProcSaveMenu();
1127 name
:= g_GetSaveName(a
, valid
);
1128 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1129 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1133 procedure ProcSaveGame(Sender
: TGUIControl
);
1137 if g_Game_IsNet
then Exit
;
1138 if g_Game_IsTestMap
then Exit
;
1139 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1140 g_Game_PauseAllSounds(True);
1141 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1143 g_ActiveWindow
:= nil;
1144 g_Game_Pause(False);
1147 procedure ProcLoadGame(Sender
: TGUIControl
);
1151 if g_Game_IsNet
then Exit
;
1152 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1153 if g_LoadGame(a
) then
1155 g_Game_PauseAllSounds(False)
1157 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1159 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1160 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1161 //g_ActiveWindow := nil;
1165 procedure ProcSinglePlayer (n
: Integer);
1166 var wad
, map
: AnsiString;
1169 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1170 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1171 if e_FindResource(AllMapDirs
, wad
) then
1173 wad
:= ExpandFileName(wad
);
1174 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1178 procedure ProcSingle1Player
;
1183 procedure ProcSingle2Players
;
1188 procedure ProcSelectMapMenu();
1191 wad_lb
: TGUIFileListBox
;
1192 map_lb
: TGUIListBox
;
1195 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1196 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1197 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1199 if wad_lb
.SelectedItem() <> '' then
1200 map
:= map_lb
.SelectedItem()
1204 wad_lb
.UpdateFileList();
1207 if wad_lb
.SelectedItem() <> '' then
1210 map_lb
.SelectItem(map
);
1212 if map_lb
.SelectedItem() <> '' then
1216 g_GUI_ShowWindow('SelectMapMenu');
1219 procedure ProcSelectCampaignMenu();
1222 wad_lb
: TGUIFileListBox
;
1224 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1225 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1227 wad_lb
.UpdateFileList();
1229 if wad_lb
.SelectedItem() <> '' then
1230 ProcSelectCampaignWAD(nil);
1233 procedure ProcSetMap();
1235 wad
, map
, res
: String;
1237 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1239 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1240 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1243 if (wad
= '') or (map
= '') then
1246 wad
:= e_FindWadRel(MapDirs
, WAD
);
1248 res
:= wad
+':\'+map
;
1250 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1251 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1254 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1258 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1260 g_Sound_SetupAllVolumes(
1261 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1262 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1266 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1270 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1271 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1273 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1274 g_dbg_scale
:= TempScale
+ 1;
1278 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1282 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1283 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1284 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1285 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1288 procedure ProcOptionsPlayersMIMenu();
1293 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1295 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1297 if a
= '' then Exit
;
1299 i
:= g_PlayerModel_GetIndex(a
);
1300 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1302 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1303 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1304 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1306 if PlayerModelsArray
[i
].HaveWeapon
then
1307 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1309 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1312 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1315 procedure ProcOptionsPlayersAnim();
1319 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1324 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1327 Model
.AnimState
.Loop
:= True;
1331 procedure ProcOptionsPlayersWeap();
1335 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1340 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1344 procedure ProcOptionsPlayersRot();
1348 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1349 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1351 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1355 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1359 g_Options_SetDefault();
1365 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1367 if yes
then ReadOptions();
1371 procedure ProcAuthorsClose();
1373 gMusic
.SetByName('MUSIC_MENU');
1375 gState
:= STATE_MENU
;
1378 procedure ProcGMClose();
1380 g_Game_InGameMenu(False);
1383 procedure ProcGMShow();
1388 if (gGameSettings
.GameType
= GT_SINGLE
) and
1389 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1390 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1391 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1393 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1394 if g_Game_IsTestMap
then
1395 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1396 TGUIMainMenu(g_ActiveWindow
.GetControl(
1397 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1400 procedure ProcChangePlayers();
1402 TeamGame
, Spectator
, AddTwo
: Boolean;
1403 P1Team
{, P2Team}: Byte;
1404 bP2
: TGUITextButton
;
1406 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1407 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1408 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1409 P1Team
:= TEAM_NONE
;
1410 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1412 //P2Team := TEAM_NONE;
1413 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1415 TGUIMainMenu(g_ActiveWindow
.GetControl(
1416 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1417 TGUIMainMenu(g_ActiveWindow
.GetControl(
1418 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1419 TGUIMainMenu(g_ActiveWindow
.GetControl(
1420 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1422 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1423 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1424 bP2
.Enabled
:= AddTwo
and not Spectator
;
1426 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1428 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1429 if gPlayer2
= nil then
1430 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1432 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1434 TGUIMainMenu(g_ActiveWindow
.GetControl(
1435 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1438 procedure ProcJoinRed();
1440 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1442 if g_Game_IsServer
then
1444 if gPlayer1
= nil then
1445 g_Game_AddPlayer(TEAM_RED
)
1448 if gPlayer1
.Team
<> TEAM_RED
then
1450 gPlayer1
.SwitchTeam
;
1451 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1454 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1459 gPlayer1Settings
.Team
:= TEAM_RED
;
1460 MC_SEND_PlayerSettings
;
1461 if gPlayer1
= nil then
1462 g_Game_AddPlayer(TEAM_RED
);
1464 g_ActiveWindow
:= nil;
1465 g_Game_Pause(False);
1468 procedure ProcJoinBlue();
1470 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1472 if g_Game_IsServer
then
1474 if gPlayer1
= nil then
1475 g_Game_AddPlayer(TEAM_BLUE
)
1478 if gPlayer1
.Team
<> TEAM_BLUE
then
1480 gPlayer1
.SwitchTeam
;
1481 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1484 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1489 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1490 MC_SEND_PlayerSettings
;
1491 if gPlayer1
= nil then
1492 g_Game_AddPlayer(TEAM_BLUE
);
1494 g_ActiveWindow
:= nil;
1495 g_Game_Pause(False);
1498 procedure ProcJoinGame();
1500 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1502 if gPlayer1
= nil then
1504 g_ActiveWindow
:= nil;
1505 g_Game_Pause(False);
1508 procedure ProcSwitchP2();
1510 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1512 if gPlayer1
= nil then
1514 if gPlayer2
= nil then
1517 g_Game_RemovePlayer();
1518 g_ActiveWindow
:= nil;
1519 g_Game_Pause(False);
1522 procedure ProcSpectate();
1524 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1527 g_ActiveWindow
:= nil;
1528 g_Game_Pause(False);
1531 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1533 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1536 procedure ProcEndMenuKeyDown (yes
: Boolean);
1538 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1541 procedure ProcSetRussianLanguage
;
1543 if gLanguage
<> LANGUAGE_RUSSIAN
then
1545 gLanguage
:= LANGUAGE_RUSSIAN
;
1546 gLanguageChange
:= True;
1547 gAskLanguage
:= False;
1552 procedure ProcSetEnglishLanguage
;
1554 if gLanguage
<> LANGUAGE_ENGLISH
then
1556 gLanguage
:= LANGUAGE_ENGLISH
;
1557 gLanguageChange
:= True;
1558 gAskLanguage
:= False;
1563 procedure ReadGameSettings();
1567 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1569 with gGameSettings
do
1571 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1572 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1576 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1577 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1579 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1581 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1585 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1586 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1591 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1592 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1593 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1595 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1596 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1597 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1600 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1605 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1607 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1608 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1609 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1611 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1612 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1616 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1617 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1619 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1620 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1621 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1622 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1623 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1624 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1625 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1629 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1630 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1631 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1632 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1633 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1638 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1639 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1644 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1645 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1650 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1651 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1656 procedure ProcApplyGameSet();
1660 stat
: TPlayerStatArray
;
1662 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1664 if not g_Game_IsServer
then Exit
;
1666 with gGameSettings
do
1668 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1670 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1671 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1673 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1676 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1678 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1679 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1680 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1681 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1682 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1686 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1688 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1689 Options
:= Options
or GAME_OPTION_DMKEYS
1691 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1694 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1696 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1702 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1704 TimeLimit
:= Max(n
, b
);
1708 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1710 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1717 if GameMode
= GM_DM
then
1719 stat
:= g_Player_GetStats();
1721 for a
:= 0 to High(stat
) do
1722 if stat
[a
].Frags
> b
then
1726 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1728 GoalLimit
:= Max(n
, b
);
1732 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1734 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1735 if n
< 0 then n
:= 0;
1736 if n
> 255 then n
:= 255;
1742 stat
:= g_Player_GetStats();
1744 for a
:= 0 to High(stat
) do
1745 if stat
[a
].Lives
> b
then
1748 MaxLives
:= Max(n
, b
);
1752 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1754 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1757 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1758 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1762 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1763 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1767 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1768 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1773 // don't forget to latch this shit
1774 gsGameFlags
:= Options
;
1775 gsMaxLives
:= MaxLives
;
1776 gsGoalLimit
:= GoalLimit
;
1777 gsTimeLimit
:= TimeLimit
;
1780 if g_Game_IsNet
then MH_SEND_GameSettings
;
1783 procedure ProcVideoOptionsRes();
1788 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1790 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1791 IntToStr(gWinSizeX
) +
1792 ' x ' + IntToStr(gWinSizeY
) +
1793 ', ' + IntToStr(gBPP
) + ' bpp';
1795 with TGUIListBox(menu
.GetControl('lsResolution')) do
1797 list
:= sys_GetDisplayModes(gBPP
);
1801 ItemIndex
:= Length(list
)
1809 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1815 TempResScale
:= Round(r_pixel_scale
- 1);
1816 with TGUISwitch(menu
.GetControl('swResFactor')) do
1817 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1820 procedure ProcApplyVideoOptions();
1823 Fullscreen
: Boolean;
1824 SWidth
, SHeight
: Integer;
1825 ScaleChanged
: Boolean;
1828 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1830 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1832 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1835 SWidth
:= gWinSizeX
;
1836 SHeight
:= gWinSizeY
;
1837 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1840 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1842 ScaleChanged
:= False;
1843 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1845 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1846 r_pixel_scale
:= TempResScale
+ 1;
1847 ScaleChanged
:= True;
1850 if (SWidth
<> gWinSizeX
) or
1851 (SHeight
<> gWinSizeY
) or
1852 (Fullscreen
<> gFullscreen
) or
1855 gResolutionChange
:= True;
1856 gRC_Width
:= SWidth
;
1857 gRC_Height
:= SHeight
;
1858 gRC_FullScreen
:= Fullscreen
;
1859 gRC_Maximized
:= gWinMaximized
;
1862 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1866 procedure ProcSetFirstRussianLanguage
;
1868 gLanguage
:= LANGUAGE_RUSSIAN
;
1869 gLanguageChange
:= True;
1870 gAskLanguage
:= False;
1873 procedure ProcSetFirstEnglishLanguage
;
1875 gLanguage
:= LANGUAGE_ENGLISH
;
1876 gLanguageChange
:= True;
1877 gAskLanguage
:= False;
1880 procedure ProcRecallAddress();
1882 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1884 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1885 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1889 procedure CreateFirstLanguageMenu();
1893 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1895 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1897 Name
:= 'mmFirstLanguageMenu';
1898 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1899 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1902 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1903 Menu
.MainWindow
:= True;
1904 g_GUI_AddWindow(Menu
);
1907 procedure g_Menu_AskLanguage();
1909 CreateFirstLanguageMenu();
1910 g_GUI_ShowWindow('FirstLanguageMenu');
1913 procedure CreatePlayerOptionsMenu(s
: String);
1918 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1920 a
:= _lc
[I_MENU_PLAYER_1
]
1922 a
:= _lc
[I_MENU_PLAYER_2
];
1923 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1925 Name
:= 'mOptionsPlayers'+s
+'Menu';
1926 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1928 Name
:= 'ed'+s
+'Name';
1932 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1934 Name
:= 'sw'+s
+'Team';
1935 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1936 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1938 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1940 Name
:= 'ls'+s
+'Model';
1942 Items
:= g_PlayerModel_GetNames();
1943 OnChange
:= ProcSelectModel
;
1945 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1947 Name
:= 'sc'+s
+'Red';
1949 OnChange
:= ProcChangeColor
;
1951 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1953 Name
:= 'sc'+s
+'Green';
1955 OnChange
:= ProcChangeColor
;
1957 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1959 Name
:= 'sc'+s
+'Blue';
1961 OnChange
:= ProcChangeColor
;
1964 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1965 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1966 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1967 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1969 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1971 Name
:= 'mv'+s
+'Model';
1972 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1973 Y
:= GetControl('ls'+s
+'Model').Y
;
1976 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1977 g_GUI_AddWindow(Menu
);
1980 procedure CreateAllMenus();
1984 a
, cx
, _y
, i
: Integer;
1987 Menu
:= TGUIWindow
.Create('MainMenu');
1988 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
1990 Name
:= 'mmMainMenu';
1991 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1992 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1993 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1994 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1995 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1996 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1998 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2000 Color
:= _RGB(255, 255, 255);
2001 X
:= gScreenWidth
-GetWidth
-8;
2002 Y
:= gScreenHeight
-GetHeight
-8;
2004 Menu
.DefControl
:= 'mmMainMenu';
2005 Menu
.MainWindow
:= True;
2006 g_GUI_AddWindow(Menu
);
2008 Menu
:= TGUIWindow
.Create('NewGameMenu');
2009 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2011 Name
:= 'mmNewGameMenu';
2012 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2013 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2014 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2015 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2017 Menu
.DefControl
:= 'mmNewGameMenu';
2018 g_GUI_AddWindow(Menu
);
2020 Menu
:= TGUIWindow
.Create('NetGameMenu');
2021 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2023 Name
:= 'mmNetGameMenu';
2024 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2025 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2027 Menu
.DefControl
:= 'mmNetGameMenu';
2028 g_GUI_AddWindow(Menu
);
2030 Menu
:= TGUIWindow
.Create('NetServerMenu');
2031 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2033 Name
:= 'mNetServerMenu';
2034 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2036 Name
:= 'edSrvName';
2037 OnlyDigits
:= False;
2040 Text := NetServerName
;
2042 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2044 Name
:= 'edSrvPassword';
2045 OnlyDigits
:= False;
2048 Text := NetPassword
;
2050 with AddEdit(_lc
[I_NET_PORT
]) do
2056 Text := IntToStr(NetPort
);
2058 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2060 Name
:= 'edMaxPlayers';
2064 Text := IntToStr(NetMaxClients
);
2066 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2068 Name
:= 'swUseMaster';
2069 AddItem(_lc
[I_MENU_YES
]);
2070 AddItem(_lc
[I_MENU_NO
]);
2071 if NetUseMaster
then
2077 with AddLabel(_lc
[I_MENU_MAP
]) do
2082 OnClick
:= @ProcSelectMapMenu
;
2084 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2086 Name
:= 'swGameMode';
2087 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2088 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2089 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2090 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2091 case g_Game_TextToMode(gsGameMode
) of
2093 GM_DM
: ItemIndex
:= 0;
2094 GM_TDM
: ItemIndex
:= 1;
2095 GM_CTF
: ItemIndex
:= 2;
2097 GM_COOP
: ItemIndex
:= 3;
2099 OnChange
:= ProcSwitchMonstersCustom
;
2101 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2103 Name
:= 'edTimeLimit';
2107 if gsTimeLimit
> 0 then
2108 Text := IntToStr(gsTimeLimit
);
2110 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2112 Name
:= 'edGoalLimit';
2116 if gsGoalLimit
> 0 then
2117 Text := IntToStr(gsGoalLimit
);
2119 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2121 Name
:= 'edMaxLives';
2125 if gsMaxLives
> 0 then
2126 Text := IntToStr(gsMaxLives
);
2128 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2130 Name
:= 'edItemRespawnTime';
2134 if gsItemRespawnTime
> 0 then
2135 Text := IntToStr(gsItemRespawnTime
);
2137 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2139 Name
:= 'swPlayers';
2140 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2141 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2142 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2143 ItemIndex
:= gsPlayers
;
2145 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2147 Name
:= 'swTeamDamage';
2148 AddItem(_lc
[I_MENU_YES
]);
2149 AddItem(_lc
[I_MENU_NO
]);
2150 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2155 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2157 Name
:= 'swTeamHit';
2158 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2159 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2160 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2161 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2162 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2164 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2166 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2171 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2173 Name
:= 'swDeathmatchKeys';
2174 AddItem(_lc
[I_MENU_YES
]);
2175 AddItem(_lc
[I_MENU_NO
]);
2176 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2181 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2183 Name
:= 'swEnableExits';
2184 AddItem(_lc
[I_MENU_YES
]);
2185 AddItem(_lc
[I_MENU_NO
]);
2186 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2191 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2193 Name
:= 'swWeaponStay';
2194 AddItem(_lc
[I_MENU_YES
]);
2195 AddItem(_lc
[I_MENU_NO
]);
2196 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2201 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2203 Name
:= 'swMonsters';
2204 AddItem(_lc
[I_MENU_YES
]);
2205 AddItem(_lc
[I_MENU_NO
]);
2206 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2211 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2214 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2215 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2216 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2218 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2220 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2224 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2228 Menu
.DefControl
:= 'mNetServerMenu';
2229 g_GUI_AddWindow(Menu
);
2231 Menu
:= TGUIWindow
.Create('NetClientMenu');
2232 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2234 Name
:= 'mNetClientMenu';
2236 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2239 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2245 Text := 'localhost';
2247 with AddEdit(_lc
[I_NET_PORT
]) do
2255 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2258 OnlyDigits
:= False;
2265 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2269 Menu
.DefControl
:= 'mNetClientMenu';
2270 g_GUI_AddWindow(Menu
);
2272 Menu
:= TGUIWindow
.Create('LoadMenu');
2273 Menu
.OnShow
:= ProcLoadMenu
;
2274 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2276 Name
:= 'mmLoadMenu';
2281 Name
:= 'edSlot'+IntToStr(a
);
2284 OnEnter
:= ProcLoadGame
;
2287 Menu
.DefControl
:= 'mmLoadMenu';
2288 g_GUI_AddWindow(Menu
);
2290 Menu
:= TGUIWindow
.Create('SaveMenu');
2291 Menu
.OnShow
:= ProcSaveMenu
;
2292 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2294 Name
:= 'mmSaveMenu';
2299 Name
:= 'edSlot'+IntToStr(a
);
2302 OnChange
:= ProcSaveGame
;
2305 Menu
.DefControl
:= 'mmSaveMenu';
2306 g_GUI_AddWindow(Menu
);
2308 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2309 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2311 Name
:= 'mCustomGameMenu';
2312 with AddLabel(_lc
[I_MENU_MAP
]) do
2317 OnClick
:= @ProcSelectMapMenu
;
2319 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2321 Name
:= 'swGameMode';
2322 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2323 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2324 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2325 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2326 case g_Game_TextToMode(gsGameMode
) of
2328 GM_DM
: ItemIndex
:= 0;
2329 GM_TDM
: ItemIndex
:= 1;
2330 GM_CTF
: ItemIndex
:= 2;
2332 GM_COOP
: ItemIndex
:= 3;
2334 OnChange
:= ProcSwitchMonstersCustom
;
2336 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2338 Name
:= 'edTimeLimit';
2342 if gsTimeLimit
> 0 then
2343 Text := IntToStr(gsTimeLimit
);
2345 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2347 Name
:= 'edGoalLimit';
2351 if gsGoalLimit
> 0 then
2352 Text := IntToStr(gsGoalLimit
);
2354 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2356 Name
:= 'edMaxLives';
2360 if gsMaxLives
> 0 then
2361 Text := IntToStr(gsMaxLives
);
2363 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2365 Name
:= 'edItemRespawnTime';
2369 if gsItemRespawnTime
> 0 then
2370 Text := IntToStr(gsItemRespawnTime
);
2372 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2374 Name
:= 'swPlayers';
2375 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2376 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2377 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2378 ItemIndex
:= gsPlayers
;
2380 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2382 Name
:= 'swTeamDamage';
2383 AddItem(_lc
[I_MENU_YES
]);
2384 AddItem(_lc
[I_MENU_NO
]);
2385 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2390 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2392 Name
:= 'swTeamHit';
2393 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2394 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2395 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2396 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2397 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2399 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2401 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2406 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2408 Name
:= 'swDeathmatchKeys';
2409 AddItem(_lc
[I_MENU_YES
]);
2410 AddItem(_lc
[I_MENU_NO
]);
2411 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2416 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2418 Name
:= 'swEnableExits';
2419 AddItem(_lc
[I_MENU_YES
]);
2420 AddItem(_lc
[I_MENU_NO
]);
2421 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2426 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2428 Name
:= 'swWeaponStay';
2429 AddItem(_lc
[I_MENU_YES
]);
2430 AddItem(_lc
[I_MENU_NO
]);
2431 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2436 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2438 Name
:= 'swMonsters';
2439 AddItem(_lc
[I_MENU_YES
]);
2440 AddItem(_lc
[I_MENU_NO
]);
2441 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2446 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2449 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2450 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2451 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2453 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2455 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2459 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2463 Menu
.DefControl
:= 'mCustomGameMenu';
2464 g_GUI_AddWindow(Menu
);
2466 Menu
:= TGUIWindow
.Create('CampaignMenu');
2467 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2469 Name
:= 'mCampaignMenu';
2478 with AddFileList('', 15, 4) do
2481 OnChange
:= ProcSelectCampaignWAD
;
2485 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2486 SetBase(MegawadDirs
);
2489 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2491 Name
:= 'lbWADName';
2495 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2497 Name
:= 'lbWADAuthor';
2501 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2502 with AddMemo('', 15, 3) do
2504 Name
:= 'meWADDescription';
2505 Color
:= MENU_ITEMSCTRL_COLOR
;
2507 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2509 Name
:= 'swPlayers';
2510 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2511 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2514 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2518 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2520 Name
:= 'mpWADImage';
2521 DefaultRes
:= 'NOPIC';
2522 X
:= GetControl('lsWAD').X
+4;
2523 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2526 Menu
.DefControl
:= 'mCampaignMenu';
2527 g_GUI_AddWindow(Menu
);
2529 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2530 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2532 Name
:= 'mSelectMapMenu';
2533 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2536 OnChange
:= ProcSelectWAD
;
2540 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2543 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2547 OnChange
:= ProcSelectMap
;
2550 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2552 Name
:= 'lbMapName';
2556 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2558 Name
:= 'lbMapAuthor';
2562 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2564 Name
:= 'lbMapSize';
2568 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2570 Name
:= 'meMapDescription';
2575 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2577 Name
:= 'mpMapPreview';
2578 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2579 Y
:= GetControl('lsMapWAD').Y
;
2581 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2583 Name
:= 'lbMapScale';
2586 Color
:= MENU_ITEMSCTRL_COLOR
;
2587 X
:= GetControl('lsMapWAD').X
+
2588 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2589 2 + MAPPREVIEW_WIDTH
*4;
2590 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2593 Menu
.OnClose
:= ProcSetMap
;
2594 Menu
.DefControl
:= 'mSelectMapMenu';
2595 g_GUI_AddWindow(Menu
);
2597 Menu
:= TGUIWindow
.Create('OptionsMenu');
2598 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2600 Name
:= 'mmOptionsMenu';
2601 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2602 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2603 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2604 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2605 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2606 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2608 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2609 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2611 Menu
.OnClose
:= ProcApplyOptions
;
2612 Menu
.DefControl
:= 'mmOptionsMenu';
2613 g_GUI_AddWindow(Menu
);
2615 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2616 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2617 g_GUI_AddWindow(Menu
);
2619 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2620 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2622 Name
:= 'mOptionsVideoMenu';
2623 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2624 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2630 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2633 AddItem(_lc
[I_MENU_YES
]);
2634 AddItem(_lc
[I_MENU_NO
]);
2636 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2638 Name
:= 'swTextureFilter';
2639 AddItem(_lc
[I_MENU_YES
]);
2640 AddItem(_lc
[I_MENU_NO
]);
2642 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2645 AddItem(_lc
[I_MENU_YES
]);
2646 AddItem(_lc
[I_MENU_NO
]);
2648 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2650 Name
:= 'swLegacyNPOT';
2651 AddItem(_lc
[I_MENU_NO
]);
2652 AddItem(_lc
[I_MENU_YES
]);
2655 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2658 Menu
.DefControl
:= 'mOptionsVideoMenu';
2659 g_GUI_AddWindow(Menu
);
2661 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2662 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2664 Name
:= 'mOptionsVideoResMenu';
2665 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2667 Name
:= 'lbCurrentRes';
2671 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2673 Name
:= 'lsResolution';
2676 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2678 Name
:= 'swFullScreen';
2679 AddItem(_lc
[I_MENU_YES
]);
2680 AddItem(_lc
[I_MENU_NO
]);
2682 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2684 Name
:= 'swResFactor';
2686 for i
:= 2 to gRC_Width
div 640 do
2687 AddItem(IntToStr(i
) + 'x');
2690 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2693 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2694 g_GUI_AddWindow(Menu
);
2696 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2697 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2699 Name
:= 'mOptionsSoundMenu';
2700 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2702 Name
:= 'scMusicLevel';
2704 OnChange
:= ProcChangeSoundSettings
;
2706 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2708 Name
:= 'scSoundLevel';
2710 OnChange
:= ProcChangeSoundSettings
;
2712 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2714 Name
:= 'scMaxSimSounds';
2717 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2719 Name
:= 'swAnnouncer';
2720 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2721 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2722 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2723 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2725 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2726 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2728 Name
:= 'swSoundEffects';
2729 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2730 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2732 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2733 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2735 Name
:= 'swChatSpeech';
2736 AddItem(_lc
[I_MENU_YES
]);
2737 AddItem(_lc
[I_MENU_NO
]);
2739 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2741 Name
:= 'swInactiveSounds';
2742 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2743 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2747 Menu
.DefControl
:= 'mOptionsSoundMenu';
2748 g_GUI_AddWindow(Menu
);
2750 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2751 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2753 Name
:= 'mOptionsGameMenu';
2754 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2756 Name
:= 'scParticlesCount';
2759 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2761 Name
:= 'swBloodCount';
2762 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2763 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2764 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2765 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2766 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2768 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2770 Name
:= 'scShellsMax';
2773 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2775 Name
:= 'scGibsMax';
2778 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2780 Name
:= 'scCorpsesMax';
2783 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2785 Name
:= 'swGibsCount';
2786 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2787 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2788 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2789 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2790 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2792 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2794 Name
:= 'swCorpseType';
2795 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2796 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2798 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2800 Name
:= 'swGibsType';
2801 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2802 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2804 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2806 Name
:= 'swBloodType';
2807 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2808 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2810 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2812 Name
:= 'swScreenFlash';
2813 AddItem(_lc
[I_MENU_NO
]);
2814 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2815 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2817 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2819 Name
:= 'swBackground';
2820 AddItem(_lc
[I_MENU_YES
]);
2821 AddItem(_lc
[I_MENU_NO
]);
2823 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2825 Name
:= 'swMessages';
2826 AddItem(_lc
[I_MENU_YES
]);
2827 AddItem(_lc
[I_MENU_NO
]);
2829 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2831 Name
:= 'swRevertPlayers';
2832 AddItem(_lc
[I_MENU_YES
]);
2833 AddItem(_lc
[I_MENU_NO
]);
2835 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2837 Name
:= 'swChatBubble';
2838 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2839 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2840 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2841 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2842 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2844 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2846 Name
:= 'swPlayerIndicator';
2847 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2848 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2849 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2851 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2853 Name
:= 'swPlayerIndicatorStyle';
2854 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2855 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2857 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2859 Name
:= 'scScaleFactor';
2861 OnChange
:= ProcChangeGameSettings
;
2865 Menu
.DefControl
:= 'mOptionsGameMenu';
2866 g_GUI_AddWindow(Menu
);
2868 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2869 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2871 Name
:= 'mOptionsControlsMenu';
2872 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2873 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2874 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2875 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2876 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2878 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2879 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2880 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2881 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2882 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2883 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2884 if e_HasJoysticks
then
2887 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2889 if g_touch_enabled
then
2892 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2895 Menu
.DefControl
:= 'mOptionsControlsMenu';
2896 g_GUI_AddWindow(Menu
);
2898 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2899 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2901 Name
:= 'mOptionsControlsP1Menu';
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2903 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2904 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2905 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2906 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2907 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2908 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2909 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2910 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2911 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2913 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2914 g_GUI_AddWindow(Menu
);
2916 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2917 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2919 Name
:= 'mOptionsControlsP1MenuWeapons';
2920 for i
:= WP_FIRST
to WP_LAST
do
2921 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2922 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2924 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2925 g_GUI_AddWindow(Menu
);
2927 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2928 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2930 Name
:= 'mOptionsControlsP2Menu';
2931 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2932 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2933 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2934 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2935 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2936 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2937 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2938 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2939 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2940 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2942 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2943 g_GUI_AddWindow(Menu
);
2945 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2946 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2948 Name
:= 'mOptionsControlsP2MenuWeapons';
2949 for i
:= WP_FIRST
to WP_LAST
do
2950 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2951 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2953 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2954 g_GUI_AddWindow(Menu
);
2956 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2957 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2959 Name
:= 'mOptionsControlsJoystickMenu';
2960 for i
:= 0 to e_MaxJoys
- 1 do
2961 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2963 Name
:= 'scDeadzone' + IntToStr(i
);
2967 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2968 g_GUI_AddWindow(Menu
);
2970 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2971 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2973 Name
:= 'mOptionsControlsTouchMenu';
2974 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2976 Name
:= 'swTouchAlt';
2977 AddItem(_lc
[I_MENU_NO
]);
2978 AddItem(_lc
[I_MENU_YES
]);
2979 OnChange
:= ProcChangeTouchSettings
;
2981 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2983 Name
:= 'scTouchSize';
2985 OnChange
:= ProcChangeTouchSettings
;
2987 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2989 Name
:= 'swTouchFire';
2990 AddItem(_lc
[I_MENU_NO
]);
2991 AddItem(_lc
[I_MENU_YES
]);
2993 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2995 Name
:= 'scTouchOffset';
2997 OnChange
:= ProcChangeTouchSettings
;
3000 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3001 g_GUI_AddWindow(Menu
);
3003 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3004 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3006 Name
:= 'mOptionsPlayersMenu';
3007 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3008 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3010 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3011 g_GUI_AddWindow(Menu
);
3013 CreatePlayerOptionsMenu('P1');
3014 CreatePlayerOptionsMenu('P2');
3016 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3017 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3019 Name
:= 'mOptionsPlayersMIMenu';
3020 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3025 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3030 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3032 Name
:= 'meComment';
3035 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3036 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3039 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3043 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3044 g_GUI_AddWindow(Menu
);
3046 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3047 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3049 Name
:= 'mOptionsLanguageMenu';
3050 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3051 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3054 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3055 g_GUI_AddWindow(Menu
);
3057 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3058 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3059 g_GUI_AddWindow(Menu
);
3061 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3062 Menu
.BackTexture
:= 'INTER';
3063 Menu
.OnClose
:= ProcAuthorsClose
;
3067 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3069 Color
:= _RGB(255, 0, 0);
3070 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3072 _y
:= _y
+GetHeight();
3074 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3076 Color
:= _RGB(255, 0, 0);
3077 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3079 _y
:= _y
+GetHeight()+32;
3081 // ×òî äåëàë: Êòî äåëàë
3082 cx
:= gScreenWidth
div 2 - 320 + 64;
3083 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3085 Color
:= _RGB(255, 0, 0);
3090 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3092 Color
:= _RGB(255, 255, 255);
3097 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3099 Color
:= _RGB(255, 0, 0);
3104 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3106 Color
:= _RGB(255, 255, 255);
3111 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3113 Color
:= _RGB(255, 255, 255);
3118 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3120 Color
:= _RGB(255, 0, 0);
3125 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3127 Color
:= _RGB(255, 255, 255);
3132 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3134 Color
:= _RGB(255, 0, 0);
3139 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3141 Color
:= _RGB(255, 255, 255);
3144 _y
:= gScreenHeight
- 128;
3147 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3149 Color
:= _RGB(255, 0, 0);
3154 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3156 Color
:= _RGB(255, 255, 255);
3159 _y
:= _y
+GetHeight();
3161 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3163 Color
:= _RGB(255, 255, 255);
3166 _y
:= _y
+GetHeight();
3168 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3170 Color
:= _RGB(255, 255, 255);
3173 _y
:= gScreenHeight
- 32;
3175 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3177 Color
:= _RGB(255, 0, 0);
3178 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3181 g_GUI_AddWindow(Menu
);
3183 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3184 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3185 g_GUI_AddWindow(Menu
);
3187 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3188 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3190 Name
:= 'mmGameSingleMenu';
3191 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3192 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3193 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3194 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3195 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3196 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3198 Menu
.DefControl
:= 'mmGameSingleMenu';
3199 Menu
.MainWindow
:= True;
3200 Menu
.OnClose
:= ProcGMClose
;
3201 Menu
.OnShow
:= ProcGMShow
;
3202 g_GUI_AddWindow(Menu
);
3204 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3205 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3206 g_GUI_AddWindow(Menu
);
3208 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3209 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3210 g_GUI_AddWindow(Menu
);
3212 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3213 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3215 Name
:= 'mmGameCustomMenu';
3216 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3217 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3218 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3219 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3220 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3221 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3222 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3224 Menu
.DefControl
:= 'mmGameCustomMenu';
3225 Menu
.MainWindow
:= True;
3226 Menu
.OnClose
:= ProcGMClose
;
3227 Menu
.OnShow
:= ProcGMShow
;
3228 g_GUI_AddWindow(Menu
);
3230 Menu
:= TGUIWindow
.Create('GameServerMenu');
3231 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3233 Name
:= 'mmGameServerMenu';
3234 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3235 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3236 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3237 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3238 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3240 Menu
.DefControl
:= 'mmGameServerMenu';
3241 Menu
.MainWindow
:= True;
3242 Menu
.OnClose
:= ProcGMClose
;
3243 Menu
.OnShow
:= ProcGMShow
;
3244 g_GUI_AddWindow(Menu
);
3246 Menu
:= TGUIWindow
.Create('GameClientMenu');
3247 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3249 Name
:= 'mmGameClientMenu';
3250 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3251 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3252 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3254 Menu
.DefControl
:= 'mmGameClientMenu';
3255 Menu
.MainWindow
:= True;
3256 Menu
.OnClose
:= ProcGMClose
;
3257 Menu
.OnShow
:= ProcGMShow
;
3258 g_GUI_AddWindow(Menu
);
3260 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3261 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3263 Name
:= 'mClientPasswordMenu';
3264 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3272 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3275 Menu
.DefControl
:= 'mClientPasswordMenu';
3276 g_GUI_AddWindow(Menu
);
3278 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3279 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3281 Name
:= 'mGameSetGameMenu';
3282 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3284 Name
:= 'swTeamDamage';
3285 AddItem(_lc
[I_MENU_YES
]);
3286 AddItem(_lc
[I_MENU_NO
]);
3289 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3291 Name
:= 'swTeamHit';
3292 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3293 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3294 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3295 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3298 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3300 Name
:= 'swDeathmatchKeys';
3301 AddItem(_lc
[I_MENU_YES
]);
3302 AddItem(_lc
[I_MENU_NO
]);
3305 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3307 Name
:= 'edTimeLimit';
3312 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3314 Name
:= 'edGoalLimit';
3319 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3321 Name
:= 'edMaxLives';
3326 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3329 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3330 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3331 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3337 Menu
.DefControl
:= 'mGameSetGameMenu';
3338 Menu
.OnClose
:= ProcApplyGameSet
;
3339 g_GUI_AddWindow(Menu
);
3341 Menu
:= TGUIWindow
.Create('TeamMenu');
3342 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3344 Name
:= 'mmTeamMenu';
3345 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3346 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3347 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3348 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3349 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3351 Menu
.DefControl
:= 'mmTeamMenu';
3352 Menu
.OnShow
:= ProcChangePlayers
;
3353 g_GUI_AddWindow(Menu
);
3356 procedure g_Menu_Show_SaveMenu();
3358 if g_Game_IsTestMap
then
3360 if gGameSettings
.GameType
= GT_SINGLE
then
3361 g_GUI_ShowWindow('GameSingleMenu')
3364 if g_Game_IsClient
then
3367 if g_Game_IsNet
then
3370 g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('SaveMenu');
3373 g_Sound_PlayEx('MENU_OPEN');
3376 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3378 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3379 if gGameSettings
.GameType
= GT_SINGLE
then
3381 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3385 if g_Game_IsClient
then exit
;
3386 if g_Game_IsNet
then exit
;
3387 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3389 g_GUI_ShowWindow('LoadMenu');
3390 g_Sound_PlayEx('MENU_OPEN');
3393 procedure g_Menu_Show_GameSetGame();
3395 if gGameSettings
.GameType
= GT_SINGLE
then
3396 g_GUI_ShowWindow('GameSingleMenu')
3399 if g_Game_IsClient
then
3402 if g_Game_IsNet
then
3403 g_GUI_ShowWindow('GameServerMenu')
3405 g_GUI_ShowWindow('GameCustomMenu');
3408 g_GUI_ShowWindow('GameSetGameMenu');
3409 g_Sound_PlayEx('MENU_OPEN');
3412 procedure g_Menu_Show_OptionsVideo();
3414 if gGameSettings
.GameType
= GT_SINGLE
then
3415 g_GUI_ShowWindow('GameSingleMenu')
3418 if g_Game_IsClient
then
3419 g_GUI_ShowWindow('GameClientMenu')
3421 if g_Game_IsNet
then
3422 g_GUI_ShowWindow('GameServerMenu')
3424 g_GUI_ShowWindow('GameCustomMenu');
3427 g_GUI_ShowWindow('OptionsMenu');
3428 g_GUI_ShowWindow('OptionsVideoMenu');
3429 g_Sound_PlayEx('MENU_OPEN');
3432 procedure g_Menu_Show_OptionsSound();
3434 if gGameSettings
.GameType
= GT_SINGLE
then
3435 g_GUI_ShowWindow('GameSingleMenu')
3438 if g_Game_IsClient
then
3439 g_GUI_ShowWindow('GameClientMenu')
3441 if g_Game_IsNet
then
3442 g_GUI_ShowWindow('GameServerMenu')
3444 g_GUI_ShowWindow('GameCustomMenu');
3447 g_GUI_ShowWindow('OptionsMenu');
3448 g_GUI_ShowWindow('OptionsSoundMenu');
3449 g_Sound_PlayEx('MENU_OPEN');
3452 procedure g_Menu_Show_EndGameMenu();
3454 g_GUI_ShowWindow('EndGameMenu');
3455 g_Sound_PlayEx('MENU_OPEN');
3458 procedure g_Menu_Show_QuitGameMenu();
3460 g_GUI_ShowWindow('ExitMenu');
3461 g_Sound_PlayEx('MENU_OPEN');
3464 procedure g_Menu_Init();
3470 procedure g_Menu_Free();
3475 procedure g_Menu_Reset();
3479 g_GUI_SaveMenuPos();
3480 ex
:= g_GUI_Destroy();
3484 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3489 g_Game_SetDebugMode();
3491 g_GUI_LoadMenuPos();