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 {$IFDEF ENABLE_CORPSES}
54 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
55 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
56 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
57 MAPDEF
, Math
, g_saveload
,
59 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
60 utils
, wadreader
, g_system
, r_render
, r_game
;
63 type TYNCallback
= procedure (yes
:Boolean);
65 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
67 if win
.UserData
= nil then exit
;
69 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
70 IK_N
: TYNCallback(win
.UserData
)(false);
74 procedure YesButtonCB (ctl
: TGUITextButton
);
76 if ctl
.UserData
= nil then exit
;
77 TYNCallback(ctl
.UserData
)(true);
80 procedure NoButtonCB (ctl
: TGUITextButton
);
82 if ctl
.UserData
= nil then exit
;
83 TYNCallback(ctl
.UserData
)(false);
86 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
90 //if length(Text) = 0 then exit;
91 Result
:= TGUIWindow
.Create(WinName
);
94 //OnKeyDownEx := @YNKeyDownProc;
95 //UserData := @ActionProc;
96 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
99 Name
:= '__temp_yes_no_menu:'+WinName
;
101 AddText(Text, MaxLen
);
102 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
103 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
105 DefControl
:= '__temp_yes_no_menu:'+WinName
;
111 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
112 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
114 procedure ProcApplyOptions();
119 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
121 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
126 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
128 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
129 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
130 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
132 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
134 g_Sound_SetupAllVolumes(
135 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
136 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
139 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
140 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
141 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
142 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
143 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
145 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
148 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
150 {$IFDEF ENABLE_SHELLS}
151 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
154 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
156 {$IFDEF ENABLE_CORPSES}
157 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
161 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
166 else gGibsCount
:= 48;
170 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
171 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
172 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
173 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
174 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
175 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
176 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
177 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
178 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
179 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
180 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
181 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
183 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
184 g_dbg_scale
:= TempScale
+ 1;
187 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
191 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
193 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
194 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
195 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
196 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
197 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
198 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
201 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
204 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
205 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
206 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
207 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
208 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
209 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
210 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
211 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
212 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
213 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
225 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
226 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
227 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
228 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
229 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
230 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
231 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
232 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
233 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
234 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
247 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
250 for i
:= WP_FIRST
to WP_LAST
do
252 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
254 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
259 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
262 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
269 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
270 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
271 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
284 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
285 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
286 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
287 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
288 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
289 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
290 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
291 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
292 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
301 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
302 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
308 for i
:= WP_FIRST
to WP_LAST
do
310 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
311 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
312 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
313 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
317 if e_HasJoysticks
then
319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
322 for i
:= 0 to e_MaxJoys
- 1 do
323 if e_JoystickAvailable
[i
] then
324 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
328 if g_touch_enabled
then
330 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
331 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
332 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
333 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
334 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
337 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
339 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
340 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
341 TEAM_RED
, TEAM_BLUE
);
343 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
345 gPlayer1Settings
.Model
:= Model
.GetName();
346 gPlayer1Settings
.Color
:= Model
.Color
;
349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
351 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
352 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
353 TEAM_RED
, TEAM_BLUE
);
354 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
356 gPlayer2Settings
.Model
:= Model
.GetName();
357 gPlayer2Settings
.Color
:= Model
.Color
;
360 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
361 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
363 if g_Game_IsServer
then
365 if gPlayer1
<> nil then
367 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
368 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
369 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
370 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
372 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
375 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
378 if gPlayer2
<> nil then
380 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
381 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
382 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
383 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
385 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
390 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
392 g_Console_WriteGameConfig
;
395 procedure ReadOptions();
400 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
402 with TGUISwitch(menu
.GetControl('swBPP')) do
408 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
409 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
411 with TGUISwitch(menu
.GetControl('swVSync')) do
412 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
414 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
415 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
417 with TGUISwitch(menu
.GetControl('swInterp')) do
418 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
420 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
422 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
423 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
424 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
426 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
427 if gMuteWhenInactive
then
432 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
434 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
435 if gSoundEffectsDF
then
440 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
441 if gUseChatSounds
then
446 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
457 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
458 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
460 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
472 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
475 for i
:= WP_FIRST
to WP_LAST
do
477 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
478 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
482 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
508 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
511 for i
:= WP_FIRST
to WP_LAST
do
513 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
514 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
518 if e_HasJoysticks
then
520 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
523 for i
:= 0 to e_MaxJoys
- 1 do
524 if e_JoystickAvailable
[i
] then
525 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
529 if g_touch_enabled
then
531 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
532 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
533 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
534 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
535 with TGUISwitch(menu
.GetControl('swTouchFire')) do
536 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
537 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
540 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
543 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
544 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
545 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
546 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
549 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
552 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
554 {$IFDEF ENABLE_SHELLS}
555 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
558 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
560 {$IFDEF ENABLE_CORPSES}
561 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
563 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
565 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
568 with TGUISwitch(menu
.GetControl('swBloodType')) do
569 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
571 with TGUISwitch(menu
.GetControl('swCorpseType')) do
572 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
574 with TGUISwitch(menu
.GetControl('swGibsType')) do
575 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
578 with TGUISwitch(menu
.GetControl('swGibsCount')) do
590 with TGUISwitch(menu
.GetControl('swBackGround')) do
591 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
593 with TGUISwitch(menu
.GetControl('swMessages')) do
594 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
596 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
597 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
599 with TGUISwitch(menu
.GetControl('swChatBubble')) do
600 ItemIndex
:= gChatBubble
;
602 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
603 ItemIndex
:= gPlayerIndicator
;
605 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
606 ItemIndex
:= gPlayerIndicatorStyle
;
608 TempScale
:= Round(g_dbg_scale
- 1);
609 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
611 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
613 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
614 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
616 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
617 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
619 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
620 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
621 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
623 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
625 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
626 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
628 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
629 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
631 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
632 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
633 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
635 ProcSelectModel(nil);
638 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
640 // don't turn off monsters in DM
642 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
643 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
644 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
646 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
649 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
650 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
651 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
652 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
656 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
658 // don't turn off monsters in DM
660 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
661 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
662 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
664 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
667 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
668 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
669 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
670 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
674 function LatchGameOptions(const MenuName
: string): Byte;
680 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
682 Map
:= TGUILabel(GetControl('lbMap')).Text;
685 if not isWadPath(Map
) then
688 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
689 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
690 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
691 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
692 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
693 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
694 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
698 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
699 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
700 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
701 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
702 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
703 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
704 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
705 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
706 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
707 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
709 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
710 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
711 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
712 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
715 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
716 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
717 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
718 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
721 // TODO: get this crap out of here
722 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
723 gGameSettings
.WarmupTime
:= gsWarmupTime
;
724 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
728 procedure ProcStartCustomGame();
732 GameMode
:= LatchGameOptions('mCustomGameMenu');
733 if GameMode
= GM_NONE
then Exit
;
735 g_Console_WriteGameConfig
;
736 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
737 gsMaxLives
, gsGameFlags
, gsPlayers
);
741 procedure ProcStartNetGame();
745 GameMode
:= LatchGameOptions('mNetServerMenu');
746 if GameMode
= GM_NONE
then Exit
;
748 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
750 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
751 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
752 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
753 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
754 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
755 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
758 g_Console_WriteGameConfig
;
759 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
760 gsGameFlags
, gsPlayers
, 0, NetPort
);
763 procedure ProcConnectNetGame();
767 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
769 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
770 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
771 PW
:= TGUIEdit(GetControl('edPW')).Text;
774 g_Console_WriteGameConfig
;
775 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
778 procedure ProcEnterPassword();
782 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
784 NetClientIP
:= PromptIP
;
785 NetClientPort
:= PromptPort
;
786 PW
:= TGUIEdit(GetControl('edPW')).Text;
789 g_Console_WriteGameConfig
;
790 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
793 procedure ProcServerlist();
795 if not NetInitDone
then
797 if (not g_Net_Init()) then
799 g_Console_Add('NET: ERROR: Failed to init ENet!');
806 g_Net_Slist_Set(NetMasterList
);
808 gState
:= STATE_SLIST
;
809 g_ActiveWindow
:= nil;
811 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
816 slReturnPressed
:= True;
817 if g_Net_Slist_Fetch(slCurrent
) then
819 if slCurrent
= nil then
820 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
823 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
824 g_Serverlist_GenerateTable(slCurrent
, slTable
);
827 procedure ProcStartCampaign();
833 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
835 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
836 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
838 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
844 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
847 procedure ProcSelectMap(Sender
: TGUIControl
);
851 wad
, map
, res
: String;
853 win
:= g_GUI_GetWindow('SelectMapMenu');
854 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
856 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
857 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
859 if (wad
= '') or (map
= '') then
860 begin // Ýòî íå êàðòà
861 TGUILabel(GetControl('lbMapName')).Text := '';
862 TGUILabel(GetControl('lbMapAuthor')).Text := '';
863 TGUILabel(GetControl('lbMapSize')).Text := '';
864 TGUIMemo(GetControl('meMapDescription')).SetText('');
865 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
866 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
872 a
:= g_Map_GetMapInfo(res
);
874 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
875 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
876 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
877 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
878 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
879 TGUILabel(win
.GetControl('lbMapScale')).Text :=
880 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
885 procedure ProcSelectWAD(Sender
: TGUIControl
);
890 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
892 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
894 with TGUIListBox(GetControl('lsMapRes')) do
900 list
:= g_Map_GetMapsList(wad
);
914 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
920 win
:= g_GUI_GetWindow('CampaignMenu');
921 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
923 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
927 TGUILabel(GetControl('lbWADName')).Text := '';
928 TGUILabel(GetControl('lbWADAuthor')).Text := '';
929 TGUIMemo(GetControl('meWADDescription')).SetText('');
932 a
:= g_Game_GetMegaWADInfo(wad
);
934 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
935 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
936 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
938 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
942 fn
:= g_ExtractWadName(a
.pic
);
944 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
946 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
951 procedure ProcChangeColor(Sender
: TGUIControl
);
955 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
956 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
957 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
958 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
959 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
960 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
962 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
963 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
964 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
965 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
966 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
967 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
970 procedure ProcSelectModel(Sender
: TGUIControl
);
975 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
976 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
977 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
979 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
980 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
981 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
983 ProcChangeColor(nil);
986 procedure MenuLoadData();
988 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
990 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
991 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
992 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
993 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
994 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
995 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
996 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
997 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
998 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
999 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1000 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1001 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1002 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1003 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1004 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1005 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1006 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1007 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1008 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1009 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1010 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1011 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1012 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1013 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1014 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1016 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1017 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1018 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1019 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1020 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1021 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1022 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1025 procedure MenuFreeData();
1027 e_CharFont_Remove(gMenuFont
);
1028 e_CharFont_Remove(gMenuSmallFont
);
1030 g_Texture_Delete('MAINMENU_LOGO');
1031 g_Texture_Delete('MAINMENU_MARKER1');
1032 g_Texture_Delete('MAINMENU_MARKER2');
1033 g_Texture_Delete('SCROLL_LEFT');
1034 g_Texture_Delete('SCROLL_RIGHT');
1035 g_Texture_Delete('SCROLL_MIDDLE');
1036 g_Texture_Delete('SCROLL_MARKER');
1037 g_Texture_Delete('EDIT_LEFT');
1038 g_Texture_Delete('EDIT_RIGHT');
1039 g_Texture_Delete('EDIT_MIDDLE');
1040 g_Texture_Delete('BOX1');
1041 g_Texture_Delete('BOX2');
1042 g_Texture_Delete('BOX3');
1043 g_Texture_Delete('BOX4');
1044 g_Texture_Delete('BOX5');
1045 g_Texture_Delete('BOX6');
1046 g_Texture_Delete('BOX7');
1047 g_Texture_Delete('BOX8');
1048 g_Texture_Delete('BOX9');
1049 g_Texture_Delete('BSCROLL_UP_A');
1050 g_Texture_Delete('BSCROLL_UP_U');
1051 g_Texture_Delete('BSCROLL_DOWN_A');
1052 g_Texture_Delete('BSCROLL_DOWN_U');
1053 g_Texture_Delete('BSCROLL_MIDDLE');
1054 g_Texture_Delete('NOPIC');
1056 g_Sound_Delete('MENU_SELECT');
1057 g_Sound_Delete('MENU_OPEN');
1058 g_Sound_Delete('MENU_CLOSE');
1059 g_Sound_Delete('MENU_CHANGE');
1060 g_Sound_Delete('SCROLL_ADD');
1061 g_Sound_Delete('SCROLL_SUB');
1062 g_Sound_Delete('SOUND_PLAYER_FALL');
1065 procedure ProcAuthorsMenu();
1067 gMusic
.SetByName('MUSIC_INTERMUS');
1071 procedure ProcExitMenuKeyDown (yes
: Boolean);
1074 snd
: TPlayableSound
;
1079 g_Game_StopAllSounds(True);
1080 case (Random(18)) of
1081 0: s
:= 'SOUND_MONSTER_PAIN';
1082 1: s
:= 'SOUND_MONSTER_DIE_3';
1083 2: s
:= 'SOUND_MONSTER_SLOP';
1084 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1085 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1086 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1087 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1088 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1089 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1090 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1091 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1092 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1093 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1094 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1095 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1096 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1097 else s
:= 'SOUND_PLAYER_FALL';
1099 snd
:= TPlayableSound
.Create();
1100 res
:= snd
.SetByName(s
);
1101 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1105 while snd
.IsPlaying() do begin end;
1113 procedure ProcLoadMenu();
1120 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1121 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1122 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1126 procedure ProcSaveMenu();
1134 name
:= g_GetSaveName(a
, valid
);
1135 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1136 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1140 procedure ProcSaveGame(Sender
: TGUIControl
);
1144 if g_Game_IsNet
then Exit
;
1145 if g_Game_IsTestMap
then Exit
;
1146 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1147 g_Game_PauseAllSounds(True);
1148 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1150 g_ActiveWindow
:= nil;
1151 g_Game_Pause(False);
1154 procedure ProcLoadGame(Sender
: TGUIControl
);
1158 if g_Game_IsNet
then Exit
;
1159 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1160 if g_LoadGame(a
) then
1162 g_Game_PauseAllSounds(False)
1164 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1166 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1167 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1168 //g_ActiveWindow := nil;
1172 procedure ProcSinglePlayer (n
: Integer);
1173 var wad
, map
: AnsiString;
1176 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1177 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1178 if e_FindResource(AllMapDirs
, wad
) then
1180 wad
:= ExpandFileName(wad
);
1181 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1185 procedure ProcSingle1Player
;
1190 procedure ProcSingle2Players
;
1195 procedure ProcSelectMapMenu();
1198 wad_lb
: TGUIFileListBox
;
1199 map_lb
: TGUIListBox
;
1202 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1203 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1204 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1206 if wad_lb
.SelectedItem() <> '' then
1207 map
:= map_lb
.SelectedItem()
1211 wad_lb
.UpdateFileList();
1214 if wad_lb
.SelectedItem() <> '' then
1217 map_lb
.SelectItem(map
);
1219 if map_lb
.SelectedItem() <> '' then
1223 g_GUI_ShowWindow('SelectMapMenu');
1226 procedure ProcSelectCampaignMenu();
1229 wad_lb
: TGUIFileListBox
;
1231 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1232 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1234 wad_lb
.UpdateFileList();
1236 if wad_lb
.SelectedItem() <> '' then
1237 ProcSelectCampaignWAD(nil);
1240 procedure ProcSetMap();
1242 wad
, map
, res
: String;
1244 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1246 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1247 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1250 if (wad
= '') or (map
= '') then
1253 wad
:= e_FindWadRel(MapDirs
, WAD
);
1255 res
:= wad
+':\'+map
;
1257 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1258 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1261 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1265 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1267 g_Sound_SetupAllVolumes(
1268 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1269 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1273 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1277 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1278 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1280 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1281 g_dbg_scale
:= TempScale
+ 1;
1285 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1289 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1290 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1291 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1292 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1295 procedure ProcOptionsPlayersMIMenu();
1300 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1302 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1304 if a
= '' then Exit
;
1306 i
:= g_PlayerModel_GetIndex(a
);
1307 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1309 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1310 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1311 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1313 if PlayerModelsArray
[i
].HaveWeapon
then
1314 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1316 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1319 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1322 procedure ProcOptionsPlayersAnim();
1326 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1331 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1334 Model
.AnimState
.Loop
:= True;
1338 procedure ProcOptionsPlayersWeap();
1342 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1347 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1351 procedure ProcOptionsPlayersRot();
1355 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1356 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1358 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1362 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1366 g_Options_SetDefault();
1372 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1374 if yes
then ReadOptions();
1378 procedure ProcAuthorsClose();
1380 gMusic
.SetByName('MUSIC_MENU');
1382 gState
:= STATE_MENU
;
1385 procedure ProcGMClose();
1387 g_Game_InGameMenu(False);
1390 procedure ProcGMShow();
1395 if (gGameSettings
.GameType
= GT_SINGLE
) and
1396 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1397 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1398 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1400 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1401 if g_Game_IsTestMap
then
1402 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1403 TGUIMainMenu(g_ActiveWindow
.GetControl(
1404 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1407 procedure ProcChangePlayers();
1409 TeamGame
, Spectator
, AddTwo
: Boolean;
1410 P1Team
{, P2Team}: Byte;
1411 bP2
: TGUITextButton
;
1413 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1414 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1415 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1416 P1Team
:= TEAM_NONE
;
1417 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1419 //P2Team := TEAM_NONE;
1420 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1422 TGUIMainMenu(g_ActiveWindow
.GetControl(
1423 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1424 TGUIMainMenu(g_ActiveWindow
.GetControl(
1425 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1426 TGUIMainMenu(g_ActiveWindow
.GetControl(
1427 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1429 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1430 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1431 bP2
.Enabled
:= AddTwo
and not Spectator
;
1433 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1435 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1436 if gPlayer2
= nil then
1437 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1439 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1441 TGUIMainMenu(g_ActiveWindow
.GetControl(
1442 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1445 procedure ProcJoinRed();
1447 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1449 if g_Game_IsServer
then
1451 if gPlayer1
= nil then
1452 g_Game_AddPlayer(TEAM_RED
)
1455 if gPlayer1
.Team
<> TEAM_RED
then
1457 gPlayer1
.SwitchTeam
;
1458 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1461 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1466 gPlayer1Settings
.Team
:= TEAM_RED
;
1467 MC_SEND_PlayerSettings
;
1468 if gPlayer1
= nil then
1469 g_Game_AddPlayer(TEAM_RED
);
1471 g_ActiveWindow
:= nil;
1472 g_Game_Pause(False);
1475 procedure ProcJoinBlue();
1477 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1479 if g_Game_IsServer
then
1481 if gPlayer1
= nil then
1482 g_Game_AddPlayer(TEAM_BLUE
)
1485 if gPlayer1
.Team
<> TEAM_BLUE
then
1487 gPlayer1
.SwitchTeam
;
1488 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1491 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1496 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1497 MC_SEND_PlayerSettings
;
1498 if gPlayer1
= nil then
1499 g_Game_AddPlayer(TEAM_BLUE
);
1501 g_ActiveWindow
:= nil;
1502 g_Game_Pause(False);
1505 procedure ProcJoinGame();
1507 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1509 if gPlayer1
= nil then
1511 g_ActiveWindow
:= nil;
1512 g_Game_Pause(False);
1515 procedure ProcSwitchP2();
1517 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1519 if gPlayer1
= nil then
1521 if gPlayer2
= nil then
1524 g_Game_RemovePlayer();
1525 g_ActiveWindow
:= nil;
1526 g_Game_Pause(False);
1529 procedure ProcSpectate();
1531 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1534 g_ActiveWindow
:= nil;
1535 g_Game_Pause(False);
1538 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1540 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1543 procedure ProcEndMenuKeyDown (yes
: Boolean);
1545 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1548 procedure ProcSetRussianLanguage
;
1550 if gLanguage
<> LANGUAGE_RUSSIAN
then
1552 gLanguage
:= LANGUAGE_RUSSIAN
;
1553 gLanguageChange
:= True;
1554 gAskLanguage
:= False;
1559 procedure ProcSetEnglishLanguage
;
1561 if gLanguage
<> LANGUAGE_ENGLISH
then
1563 gLanguage
:= LANGUAGE_ENGLISH
;
1564 gLanguageChange
:= True;
1565 gAskLanguage
:= False;
1570 procedure ReadGameSettings();
1574 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1576 with gGameSettings
do
1578 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1579 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1583 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1584 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1586 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1588 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1592 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1593 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1598 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1599 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1600 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1602 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1603 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1604 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1607 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1612 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1614 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1615 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1616 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1618 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1619 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1623 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1624 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1626 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1627 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1628 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1629 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1630 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1631 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1632 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1636 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1637 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1638 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1639 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1640 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1645 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1646 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1651 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1652 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1657 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1658 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1663 procedure ProcApplyGameSet();
1667 stat
: TPlayerStatArray
;
1669 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1671 if not g_Game_IsServer
then Exit
;
1673 with gGameSettings
do
1675 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1677 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1678 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1680 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1683 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1685 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1686 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1687 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1688 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1689 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1693 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1695 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1696 Options
:= Options
or GAME_OPTION_DMKEYS
1698 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1701 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1703 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1709 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1711 TimeLimit
:= Max(n
, b
);
1715 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1717 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1724 if GameMode
= GM_DM
then
1726 stat
:= g_Player_GetStats();
1728 for a
:= 0 to High(stat
) do
1729 if stat
[a
].Frags
> b
then
1733 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1735 GoalLimit
:= Max(n
, b
);
1739 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1741 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1742 if n
< 0 then n
:= 0;
1743 if n
> 255 then n
:= 255;
1749 stat
:= g_Player_GetStats();
1751 for a
:= 0 to High(stat
) do
1752 if stat
[a
].Lives
> b
then
1755 MaxLives
:= Max(n
, b
);
1759 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1761 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1764 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1765 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1769 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1770 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1774 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1775 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1780 // don't forget to latch this shit
1781 gsGameFlags
:= Options
;
1782 gsMaxLives
:= MaxLives
;
1783 gsGoalLimit
:= GoalLimit
;
1784 gsTimeLimit
:= TimeLimit
;
1787 if g_Game_IsNet
then MH_SEND_GameSettings
;
1790 procedure ProcVideoOptionsRes();
1795 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1797 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1798 IntToStr(gWinSizeX
) +
1799 ' x ' + IntToStr(gWinSizeY
) +
1800 ', ' + IntToStr(gBPP
) + ' bpp';
1802 with TGUIListBox(menu
.GetControl('lsResolution')) do
1804 list
:= sys_GetDisplayModes(gBPP
);
1808 ItemIndex
:= Length(list
)
1816 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1822 TempResScale
:= Round(r_pixel_scale
- 1);
1823 with TGUISwitch(menu
.GetControl('swResFactor')) do
1824 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1827 procedure ProcApplyVideoOptions();
1830 Fullscreen
: Boolean;
1831 SWidth
, SHeight
: Integer;
1832 ScaleChanged
: Boolean;
1835 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1837 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1839 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1842 SWidth
:= gWinSizeX
;
1843 SHeight
:= gWinSizeY
;
1844 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1847 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1849 ScaleChanged
:= False;
1850 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1852 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1853 r_pixel_scale
:= TempResScale
+ 1;
1854 ScaleChanged
:= True;
1857 if (SWidth
<> gWinSizeX
) or
1858 (SHeight
<> gWinSizeY
) or
1859 (Fullscreen
<> gFullscreen
) or
1862 gResolutionChange
:= True;
1863 gRC_Width
:= SWidth
;
1864 gRC_Height
:= SHeight
;
1865 gRC_FullScreen
:= Fullscreen
;
1866 gRC_Maximized
:= gWinMaximized
;
1869 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1873 procedure ProcSetFirstRussianLanguage
;
1875 gLanguage
:= LANGUAGE_RUSSIAN
;
1876 gLanguageChange
:= True;
1877 gAskLanguage
:= False;
1880 procedure ProcSetFirstEnglishLanguage
;
1882 gLanguage
:= LANGUAGE_ENGLISH
;
1883 gLanguageChange
:= True;
1884 gAskLanguage
:= False;
1887 procedure ProcRecallAddress();
1889 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1891 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1892 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1896 procedure CreateFirstLanguageMenu();
1900 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1902 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1904 Name
:= 'mmFirstLanguageMenu';
1905 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1906 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1909 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1910 Menu
.MainWindow
:= True;
1911 g_GUI_AddWindow(Menu
);
1914 procedure g_Menu_AskLanguage();
1916 CreateFirstLanguageMenu();
1917 g_GUI_ShowWindow('FirstLanguageMenu');
1920 procedure CreatePlayerOptionsMenu(s
: String);
1925 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1927 a
:= _lc
[I_MENU_PLAYER_1
]
1929 a
:= _lc
[I_MENU_PLAYER_2
];
1930 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1932 Name
:= 'mOptionsPlayers'+s
+'Menu';
1933 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1935 Name
:= 'ed'+s
+'Name';
1939 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1941 Name
:= 'sw'+s
+'Team';
1942 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1943 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1945 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1947 Name
:= 'ls'+s
+'Model';
1949 Items
:= g_PlayerModel_GetNames();
1950 OnChange
:= ProcSelectModel
;
1952 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1954 Name
:= 'sc'+s
+'Red';
1956 OnChange
:= ProcChangeColor
;
1958 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1960 Name
:= 'sc'+s
+'Green';
1962 OnChange
:= ProcChangeColor
;
1964 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1966 Name
:= 'sc'+s
+'Blue';
1968 OnChange
:= ProcChangeColor
;
1971 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1972 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1973 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1974 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1976 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1978 Name
:= 'mv'+s
+'Model';
1979 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1980 Y
:= GetControl('ls'+s
+'Model').Y
;
1983 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1984 g_GUI_AddWindow(Menu
);
1987 procedure CreateAllMenus();
1991 a
, cx
, _y
, i
: Integer;
1994 Menu
:= TGUIWindow
.Create('MainMenu');
1995 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
1997 Name
:= 'mmMainMenu';
1998 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1999 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2000 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2001 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2002 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2003 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2005 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2007 Color
:= _RGB(255, 255, 255);
2008 X
:= gScreenWidth
-GetWidth
-8;
2009 Y
:= gScreenHeight
-GetHeight
-8;
2011 Menu
.DefControl
:= 'mmMainMenu';
2012 Menu
.MainWindow
:= True;
2013 g_GUI_AddWindow(Menu
);
2015 Menu
:= TGUIWindow
.Create('NewGameMenu');
2016 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2018 Name
:= 'mmNewGameMenu';
2019 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2020 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2021 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2022 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2024 Menu
.DefControl
:= 'mmNewGameMenu';
2025 g_GUI_AddWindow(Menu
);
2027 Menu
:= TGUIWindow
.Create('NetGameMenu');
2028 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2030 Name
:= 'mmNetGameMenu';
2031 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2032 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2034 Menu
.DefControl
:= 'mmNetGameMenu';
2035 g_GUI_AddWindow(Menu
);
2037 Menu
:= TGUIWindow
.Create('NetServerMenu');
2038 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2040 Name
:= 'mNetServerMenu';
2041 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2043 Name
:= 'edSrvName';
2044 OnlyDigits
:= False;
2047 Text := NetServerName
;
2049 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2051 Name
:= 'edSrvPassword';
2052 OnlyDigits
:= False;
2055 Text := NetPassword
;
2057 with AddEdit(_lc
[I_NET_PORT
]) do
2063 Text := IntToStr(NetPort
);
2065 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2067 Name
:= 'edMaxPlayers';
2071 Text := IntToStr(NetMaxClients
);
2073 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2075 Name
:= 'swUseMaster';
2076 AddItem(_lc
[I_MENU_YES
]);
2077 AddItem(_lc
[I_MENU_NO
]);
2078 if NetUseMaster
then
2084 with AddLabel(_lc
[I_MENU_MAP
]) do
2089 OnClick
:= @ProcSelectMapMenu
;
2091 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2093 Name
:= 'swGameMode';
2094 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2095 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2096 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2097 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2098 case g_Game_TextToMode(gsGameMode
) of
2100 GM_DM
: ItemIndex
:= 0;
2101 GM_TDM
: ItemIndex
:= 1;
2102 GM_CTF
: ItemIndex
:= 2;
2104 GM_COOP
: ItemIndex
:= 3;
2106 OnChange
:= ProcSwitchMonstersCustom
;
2108 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2110 Name
:= 'edTimeLimit';
2114 if gsTimeLimit
> 0 then
2115 Text := IntToStr(gsTimeLimit
);
2117 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2119 Name
:= 'edGoalLimit';
2123 if gsGoalLimit
> 0 then
2124 Text := IntToStr(gsGoalLimit
);
2126 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2128 Name
:= 'edMaxLives';
2132 if gsMaxLives
> 0 then
2133 Text := IntToStr(gsMaxLives
);
2135 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2137 Name
:= 'edItemRespawnTime';
2141 if gsItemRespawnTime
> 0 then
2142 Text := IntToStr(gsItemRespawnTime
);
2144 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2146 Name
:= 'swPlayers';
2147 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2148 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2149 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2150 ItemIndex
:= gsPlayers
;
2152 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2154 Name
:= 'swTeamDamage';
2155 AddItem(_lc
[I_MENU_YES
]);
2156 AddItem(_lc
[I_MENU_NO
]);
2157 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2162 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2164 Name
:= 'swTeamHit';
2165 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2166 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2167 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2168 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2169 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2171 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2173 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2178 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2180 Name
:= 'swDeathmatchKeys';
2181 AddItem(_lc
[I_MENU_YES
]);
2182 AddItem(_lc
[I_MENU_NO
]);
2183 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2188 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2190 Name
:= 'swEnableExits';
2191 AddItem(_lc
[I_MENU_YES
]);
2192 AddItem(_lc
[I_MENU_NO
]);
2193 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2198 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2200 Name
:= 'swWeaponStay';
2201 AddItem(_lc
[I_MENU_YES
]);
2202 AddItem(_lc
[I_MENU_NO
]);
2203 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2208 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2210 Name
:= 'swMonsters';
2211 AddItem(_lc
[I_MENU_YES
]);
2212 AddItem(_lc
[I_MENU_NO
]);
2213 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2218 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2221 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2222 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2223 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2225 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2227 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2231 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2235 Menu
.DefControl
:= 'mNetServerMenu';
2236 g_GUI_AddWindow(Menu
);
2238 Menu
:= TGUIWindow
.Create('NetClientMenu');
2239 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2241 Name
:= 'mNetClientMenu';
2243 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2246 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2252 Text := 'localhost';
2254 with AddEdit(_lc
[I_NET_PORT
]) do
2262 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2265 OnlyDigits
:= False;
2272 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2276 Menu
.DefControl
:= 'mNetClientMenu';
2277 g_GUI_AddWindow(Menu
);
2279 Menu
:= TGUIWindow
.Create('LoadMenu');
2280 Menu
.OnShow
:= ProcLoadMenu
;
2281 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2283 Name
:= 'mmLoadMenu';
2288 Name
:= 'edSlot'+IntToStr(a
);
2291 OnEnter
:= ProcLoadGame
;
2294 Menu
.DefControl
:= 'mmLoadMenu';
2295 g_GUI_AddWindow(Menu
);
2297 Menu
:= TGUIWindow
.Create('SaveMenu');
2298 Menu
.OnShow
:= ProcSaveMenu
;
2299 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2301 Name
:= 'mmSaveMenu';
2306 Name
:= 'edSlot'+IntToStr(a
);
2309 OnChange
:= ProcSaveGame
;
2312 Menu
.DefControl
:= 'mmSaveMenu';
2313 g_GUI_AddWindow(Menu
);
2315 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2316 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2318 Name
:= 'mCustomGameMenu';
2319 with AddLabel(_lc
[I_MENU_MAP
]) do
2324 OnClick
:= @ProcSelectMapMenu
;
2326 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2328 Name
:= 'swGameMode';
2329 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2330 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2331 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2332 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2333 case g_Game_TextToMode(gsGameMode
) of
2335 GM_DM
: ItemIndex
:= 0;
2336 GM_TDM
: ItemIndex
:= 1;
2337 GM_CTF
: ItemIndex
:= 2;
2339 GM_COOP
: ItemIndex
:= 3;
2341 OnChange
:= ProcSwitchMonstersCustom
;
2343 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2345 Name
:= 'edTimeLimit';
2349 if gsTimeLimit
> 0 then
2350 Text := IntToStr(gsTimeLimit
);
2352 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2354 Name
:= 'edGoalLimit';
2358 if gsGoalLimit
> 0 then
2359 Text := IntToStr(gsGoalLimit
);
2361 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2363 Name
:= 'edMaxLives';
2367 if gsMaxLives
> 0 then
2368 Text := IntToStr(gsMaxLives
);
2370 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2372 Name
:= 'edItemRespawnTime';
2376 if gsItemRespawnTime
> 0 then
2377 Text := IntToStr(gsItemRespawnTime
);
2379 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2381 Name
:= 'swPlayers';
2382 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2383 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2384 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2385 ItemIndex
:= gsPlayers
;
2387 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2389 Name
:= 'swTeamDamage';
2390 AddItem(_lc
[I_MENU_YES
]);
2391 AddItem(_lc
[I_MENU_NO
]);
2392 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2397 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2399 Name
:= 'swTeamHit';
2400 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2401 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2402 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2403 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2404 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2406 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2408 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2413 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2415 Name
:= 'swDeathmatchKeys';
2416 AddItem(_lc
[I_MENU_YES
]);
2417 AddItem(_lc
[I_MENU_NO
]);
2418 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2423 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2425 Name
:= 'swEnableExits';
2426 AddItem(_lc
[I_MENU_YES
]);
2427 AddItem(_lc
[I_MENU_NO
]);
2428 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2433 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2435 Name
:= 'swWeaponStay';
2436 AddItem(_lc
[I_MENU_YES
]);
2437 AddItem(_lc
[I_MENU_NO
]);
2438 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2443 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2445 Name
:= 'swMonsters';
2446 AddItem(_lc
[I_MENU_YES
]);
2447 AddItem(_lc
[I_MENU_NO
]);
2448 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2453 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2456 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2457 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2458 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2460 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2462 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2466 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2470 Menu
.DefControl
:= 'mCustomGameMenu';
2471 g_GUI_AddWindow(Menu
);
2473 Menu
:= TGUIWindow
.Create('CampaignMenu');
2474 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2476 Name
:= 'mCampaignMenu';
2485 with AddFileList('', 15, 4) do
2488 OnChange
:= ProcSelectCampaignWAD
;
2492 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2493 SetBase(MegawadDirs
);
2496 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2498 Name
:= 'lbWADName';
2502 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2504 Name
:= 'lbWADAuthor';
2508 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2509 with AddMemo('', 15, 3) do
2511 Name
:= 'meWADDescription';
2512 Color
:= MENU_ITEMSCTRL_COLOR
;
2514 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2516 Name
:= 'swPlayers';
2517 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2518 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2521 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2525 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2527 Name
:= 'mpWADImage';
2528 DefaultRes
:= 'NOPIC';
2529 X
:= GetControl('lsWAD').X
+4;
2530 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2533 Menu
.DefControl
:= 'mCampaignMenu';
2534 g_GUI_AddWindow(Menu
);
2536 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2537 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2539 Name
:= 'mSelectMapMenu';
2540 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2543 OnChange
:= ProcSelectWAD
;
2547 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2550 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2554 OnChange
:= ProcSelectMap
;
2557 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2559 Name
:= 'lbMapName';
2563 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2565 Name
:= 'lbMapAuthor';
2569 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2571 Name
:= 'lbMapSize';
2575 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2577 Name
:= 'meMapDescription';
2582 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2584 Name
:= 'mpMapPreview';
2585 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2586 Y
:= GetControl('lsMapWAD').Y
;
2588 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2590 Name
:= 'lbMapScale';
2593 Color
:= MENU_ITEMSCTRL_COLOR
;
2594 X
:= GetControl('lsMapWAD').X
+
2595 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2596 2 + MAPPREVIEW_WIDTH
*4;
2597 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2600 Menu
.OnClose
:= ProcSetMap
;
2601 Menu
.DefControl
:= 'mSelectMapMenu';
2602 g_GUI_AddWindow(Menu
);
2604 Menu
:= TGUIWindow
.Create('OptionsMenu');
2605 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2607 Name
:= 'mmOptionsMenu';
2608 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2609 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2610 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2611 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2612 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2613 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2615 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2616 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2618 Menu
.OnClose
:= ProcApplyOptions
;
2619 Menu
.DefControl
:= 'mmOptionsMenu';
2620 g_GUI_AddWindow(Menu
);
2622 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2623 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2624 g_GUI_AddWindow(Menu
);
2626 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2627 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2629 Name
:= 'mOptionsVideoMenu';
2630 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2631 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2637 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2640 AddItem(_lc
[I_MENU_YES
]);
2641 AddItem(_lc
[I_MENU_NO
]);
2643 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2645 Name
:= 'swTextureFilter';
2646 AddItem(_lc
[I_MENU_YES
]);
2647 AddItem(_lc
[I_MENU_NO
]);
2649 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2652 AddItem(_lc
[I_MENU_YES
]);
2653 AddItem(_lc
[I_MENU_NO
]);
2655 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2657 Name
:= 'swLegacyNPOT';
2658 AddItem(_lc
[I_MENU_NO
]);
2659 AddItem(_lc
[I_MENU_YES
]);
2662 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2665 Menu
.DefControl
:= 'mOptionsVideoMenu';
2666 g_GUI_AddWindow(Menu
);
2668 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2669 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2671 Name
:= 'mOptionsVideoResMenu';
2672 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2674 Name
:= 'lbCurrentRes';
2678 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2680 Name
:= 'lsResolution';
2683 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2685 Name
:= 'swFullScreen';
2686 AddItem(_lc
[I_MENU_YES
]);
2687 AddItem(_lc
[I_MENU_NO
]);
2689 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2691 Name
:= 'swResFactor';
2693 for i
:= 2 to gRC_Width
div 640 do
2694 AddItem(IntToStr(i
) + 'x');
2697 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2700 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2701 g_GUI_AddWindow(Menu
);
2703 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2704 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2706 Name
:= 'mOptionsSoundMenu';
2707 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2709 Name
:= 'scMusicLevel';
2711 OnChange
:= ProcChangeSoundSettings
;
2713 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2715 Name
:= 'scSoundLevel';
2717 OnChange
:= ProcChangeSoundSettings
;
2719 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2721 Name
:= 'scMaxSimSounds';
2724 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2726 Name
:= 'swAnnouncer';
2727 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2728 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2729 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2730 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2732 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2733 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2735 Name
:= 'swSoundEffects';
2736 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2737 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2739 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2740 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2742 Name
:= 'swChatSpeech';
2743 AddItem(_lc
[I_MENU_YES
]);
2744 AddItem(_lc
[I_MENU_NO
]);
2746 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2748 Name
:= 'swInactiveSounds';
2749 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2750 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2754 Menu
.DefControl
:= 'mOptionsSoundMenu';
2755 g_GUI_AddWindow(Menu
);
2757 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2758 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2760 Name
:= 'mOptionsGameMenu';
2761 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2763 Name
:= 'scParticlesCount';
2766 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2768 Name
:= 'swBloodCount';
2769 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2770 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2771 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2772 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2773 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2775 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2777 Name
:= 'scShellsMax';
2780 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2782 Name
:= 'scGibsMax';
2785 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2787 Name
:= 'scCorpsesMax';
2790 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2792 Name
:= 'swGibsCount';
2793 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2794 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2795 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2796 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2797 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2799 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2801 Name
:= 'swCorpseType';
2802 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2803 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2805 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2807 Name
:= 'swGibsType';
2808 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2809 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2811 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2813 Name
:= 'swBloodType';
2814 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2815 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2817 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2819 Name
:= 'swScreenFlash';
2820 AddItem(_lc
[I_MENU_NO
]);
2821 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2822 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2824 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2826 Name
:= 'swBackground';
2827 AddItem(_lc
[I_MENU_YES
]);
2828 AddItem(_lc
[I_MENU_NO
]);
2830 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2832 Name
:= 'swMessages';
2833 AddItem(_lc
[I_MENU_YES
]);
2834 AddItem(_lc
[I_MENU_NO
]);
2836 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2838 Name
:= 'swRevertPlayers';
2839 AddItem(_lc
[I_MENU_YES
]);
2840 AddItem(_lc
[I_MENU_NO
]);
2842 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2844 Name
:= 'swChatBubble';
2845 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2846 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2847 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2848 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2849 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2851 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2853 Name
:= 'swPlayerIndicator';
2854 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2855 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2856 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2858 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2860 Name
:= 'swPlayerIndicatorStyle';
2861 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2862 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2864 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2866 Name
:= 'scScaleFactor';
2868 OnChange
:= ProcChangeGameSettings
;
2872 Menu
.DefControl
:= 'mOptionsGameMenu';
2873 g_GUI_AddWindow(Menu
);
2875 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2876 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2878 Name
:= 'mOptionsControlsMenu';
2879 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2880 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2881 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2882 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2883 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2885 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2886 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2887 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2888 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2889 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2890 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2891 if e_HasJoysticks
then
2894 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2896 if g_touch_enabled
then
2899 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2902 Menu
.DefControl
:= 'mOptionsControlsMenu';
2903 g_GUI_AddWindow(Menu
);
2905 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2906 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2908 Name
:= 'mOptionsControlsP1Menu';
2909 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2910 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2911 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2912 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2913 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2914 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2915 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2916 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2917 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2918 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2920 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2921 g_GUI_AddWindow(Menu
);
2923 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2924 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2926 Name
:= 'mOptionsControlsP1MenuWeapons';
2927 for i
:= WP_FIRST
to WP_LAST
do
2928 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2929 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2931 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2932 g_GUI_AddWindow(Menu
);
2934 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2935 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2937 Name
:= 'mOptionsControlsP2Menu';
2938 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2939 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2940 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2941 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2942 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2943 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2944 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2945 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2946 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2947 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2949 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2950 g_GUI_AddWindow(Menu
);
2952 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2953 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2955 Name
:= 'mOptionsControlsP2MenuWeapons';
2956 for i
:= WP_FIRST
to WP_LAST
do
2957 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2958 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2960 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2961 g_GUI_AddWindow(Menu
);
2963 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2964 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2966 Name
:= 'mOptionsControlsJoystickMenu';
2967 for i
:= 0 to e_MaxJoys
- 1 do
2968 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2970 Name
:= 'scDeadzone' + IntToStr(i
);
2974 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2978 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2980 Name
:= 'mOptionsControlsTouchMenu';
2981 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2983 Name
:= 'swTouchAlt';
2984 AddItem(_lc
[I_MENU_NO
]);
2985 AddItem(_lc
[I_MENU_YES
]);
2986 OnChange
:= ProcChangeTouchSettings
;
2988 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2990 Name
:= 'scTouchSize';
2992 OnChange
:= ProcChangeTouchSettings
;
2994 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2996 Name
:= 'swTouchFire';
2997 AddItem(_lc
[I_MENU_NO
]);
2998 AddItem(_lc
[I_MENU_YES
]);
3000 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3002 Name
:= 'scTouchOffset';
3004 OnChange
:= ProcChangeTouchSettings
;
3007 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3008 g_GUI_AddWindow(Menu
);
3010 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3011 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3013 Name
:= 'mOptionsPlayersMenu';
3014 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3015 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3017 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3018 g_GUI_AddWindow(Menu
);
3020 CreatePlayerOptionsMenu('P1');
3021 CreatePlayerOptionsMenu('P2');
3023 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3024 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3026 Name
:= 'mOptionsPlayersMIMenu';
3027 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3032 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3037 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3039 Name
:= 'meComment';
3042 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3043 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3046 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3050 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3051 g_GUI_AddWindow(Menu
);
3053 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3054 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3056 Name
:= 'mOptionsLanguageMenu';
3057 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3058 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3061 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3062 g_GUI_AddWindow(Menu
);
3064 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3065 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3066 g_GUI_AddWindow(Menu
);
3068 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3069 Menu
.BackTexture
:= 'INTER';
3070 Menu
.OnClose
:= ProcAuthorsClose
;
3074 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3076 Color
:= _RGB(255, 0, 0);
3077 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3079 _y
:= _y
+GetHeight();
3081 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3083 Color
:= _RGB(255, 0, 0);
3084 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3086 _y
:= _y
+GetHeight()+32;
3088 // ×òî äåëàë: Êòî äåëàë
3089 cx
:= gScreenWidth
div 2 - 320 + 64;
3090 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3092 Color
:= _RGB(255, 0, 0);
3097 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3099 Color
:= _RGB(255, 255, 255);
3104 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3106 Color
:= _RGB(255, 0, 0);
3111 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3113 Color
:= _RGB(255, 255, 255);
3118 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3120 Color
:= _RGB(255, 255, 255);
3125 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3127 Color
:= _RGB(255, 0, 0);
3132 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3134 Color
:= _RGB(255, 255, 255);
3139 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3141 Color
:= _RGB(255, 0, 0);
3146 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3148 Color
:= _RGB(255, 255, 255);
3151 _y
:= gScreenHeight
- 128;
3154 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3156 Color
:= _RGB(255, 0, 0);
3161 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3163 Color
:= _RGB(255, 255, 255);
3166 _y
:= _y
+GetHeight();
3168 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3170 Color
:= _RGB(255, 255, 255);
3173 _y
:= _y
+GetHeight();
3175 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3177 Color
:= _RGB(255, 255, 255);
3180 _y
:= gScreenHeight
- 32;
3182 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3184 Color
:= _RGB(255, 0, 0);
3185 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3188 g_GUI_AddWindow(Menu
);
3190 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3191 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3192 g_GUI_AddWindow(Menu
);
3194 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3195 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3197 Name
:= 'mmGameSingleMenu';
3198 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3199 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3200 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3201 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3202 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3203 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3205 Menu
.DefControl
:= 'mmGameSingleMenu';
3206 Menu
.MainWindow
:= True;
3207 Menu
.OnClose
:= ProcGMClose
;
3208 Menu
.OnShow
:= ProcGMShow
;
3209 g_GUI_AddWindow(Menu
);
3211 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3212 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3213 g_GUI_AddWindow(Menu
);
3215 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3216 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3217 g_GUI_AddWindow(Menu
);
3219 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3220 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3222 Name
:= 'mmGameCustomMenu';
3223 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3224 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3225 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3226 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3227 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3228 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3229 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3231 Menu
.DefControl
:= 'mmGameCustomMenu';
3232 Menu
.MainWindow
:= True;
3233 Menu
.OnClose
:= ProcGMClose
;
3234 Menu
.OnShow
:= ProcGMShow
;
3235 g_GUI_AddWindow(Menu
);
3237 Menu
:= TGUIWindow
.Create('GameServerMenu');
3238 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3240 Name
:= 'mmGameServerMenu';
3241 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3242 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3243 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3244 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3245 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3247 Menu
.DefControl
:= 'mmGameServerMenu';
3248 Menu
.MainWindow
:= True;
3249 Menu
.OnClose
:= ProcGMClose
;
3250 Menu
.OnShow
:= ProcGMShow
;
3251 g_GUI_AddWindow(Menu
);
3253 Menu
:= TGUIWindow
.Create('GameClientMenu');
3254 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3256 Name
:= 'mmGameClientMenu';
3257 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3258 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3259 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3261 Menu
.DefControl
:= 'mmGameClientMenu';
3262 Menu
.MainWindow
:= True;
3263 Menu
.OnClose
:= ProcGMClose
;
3264 Menu
.OnShow
:= ProcGMShow
;
3265 g_GUI_AddWindow(Menu
);
3267 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3268 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3270 Name
:= 'mClientPasswordMenu';
3271 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3279 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3282 Menu
.DefControl
:= 'mClientPasswordMenu';
3283 g_GUI_AddWindow(Menu
);
3285 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3286 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3288 Name
:= 'mGameSetGameMenu';
3289 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3291 Name
:= 'swTeamDamage';
3292 AddItem(_lc
[I_MENU_YES
]);
3293 AddItem(_lc
[I_MENU_NO
]);
3296 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3298 Name
:= 'swTeamHit';
3299 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3300 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3301 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3302 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3305 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3307 Name
:= 'swDeathmatchKeys';
3308 AddItem(_lc
[I_MENU_YES
]);
3309 AddItem(_lc
[I_MENU_NO
]);
3312 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3314 Name
:= 'edTimeLimit';
3319 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3321 Name
:= 'edGoalLimit';
3326 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3328 Name
:= 'edMaxLives';
3333 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3336 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3337 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3338 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3344 Menu
.DefControl
:= 'mGameSetGameMenu';
3345 Menu
.OnClose
:= ProcApplyGameSet
;
3346 g_GUI_AddWindow(Menu
);
3348 Menu
:= TGUIWindow
.Create('TeamMenu');
3349 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3351 Name
:= 'mmTeamMenu';
3352 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3353 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3354 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3355 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3356 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3358 Menu
.DefControl
:= 'mmTeamMenu';
3359 Menu
.OnShow
:= ProcChangePlayers
;
3360 g_GUI_AddWindow(Menu
);
3363 procedure g_Menu_Show_SaveMenu();
3365 if g_Game_IsTestMap
then
3367 if gGameSettings
.GameType
= GT_SINGLE
then
3368 g_GUI_ShowWindow('GameSingleMenu')
3371 if g_Game_IsClient
then
3374 if g_Game_IsNet
then
3377 g_GUI_ShowWindow('GameCustomMenu');
3379 g_GUI_ShowWindow('SaveMenu');
3380 g_Sound_PlayEx('MENU_OPEN');
3383 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3385 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3386 if gGameSettings
.GameType
= GT_SINGLE
then
3388 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3392 if g_Game_IsClient
then exit
;
3393 if g_Game_IsNet
then exit
;
3394 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3396 g_GUI_ShowWindow('LoadMenu');
3397 g_Sound_PlayEx('MENU_OPEN');
3400 procedure g_Menu_Show_GameSetGame();
3402 if gGameSettings
.GameType
= GT_SINGLE
then
3403 g_GUI_ShowWindow('GameSingleMenu')
3406 if g_Game_IsClient
then
3409 if g_Game_IsNet
then
3410 g_GUI_ShowWindow('GameServerMenu')
3412 g_GUI_ShowWindow('GameCustomMenu');
3415 g_GUI_ShowWindow('GameSetGameMenu');
3416 g_Sound_PlayEx('MENU_OPEN');
3419 procedure g_Menu_Show_OptionsVideo();
3421 if gGameSettings
.GameType
= GT_SINGLE
then
3422 g_GUI_ShowWindow('GameSingleMenu')
3425 if g_Game_IsClient
then
3426 g_GUI_ShowWindow('GameClientMenu')
3428 if g_Game_IsNet
then
3429 g_GUI_ShowWindow('GameServerMenu')
3431 g_GUI_ShowWindow('GameCustomMenu');
3434 g_GUI_ShowWindow('OptionsMenu');
3435 g_GUI_ShowWindow('OptionsVideoMenu');
3436 g_Sound_PlayEx('MENU_OPEN');
3439 procedure g_Menu_Show_OptionsSound();
3441 if gGameSettings
.GameType
= GT_SINGLE
then
3442 g_GUI_ShowWindow('GameSingleMenu')
3445 if g_Game_IsClient
then
3446 g_GUI_ShowWindow('GameClientMenu')
3448 if g_Game_IsNet
then
3449 g_GUI_ShowWindow('GameServerMenu')
3451 g_GUI_ShowWindow('GameCustomMenu');
3454 g_GUI_ShowWindow('OptionsMenu');
3455 g_GUI_ShowWindow('OptionsSoundMenu');
3456 g_Sound_PlayEx('MENU_OPEN');
3459 procedure g_Menu_Show_EndGameMenu();
3461 g_GUI_ShowWindow('EndGameMenu');
3462 g_Sound_PlayEx('MENU_OPEN');
3465 procedure g_Menu_Show_QuitGameMenu();
3467 g_GUI_ShowWindow('ExitMenu');
3468 g_Sound_PlayEx('MENU_OPEN');
3471 procedure g_Menu_Init();
3477 procedure g_Menu_Free();
3482 procedure g_Menu_Reset();
3486 g_GUI_SaveMenuPos();
3487 ex
:= g_GUI_Destroy();
3491 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3496 g_Game_SetDebugMode();
3498 g_GUI_LoadMenuPos();