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;
45 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
46 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, Math
, g_saveload
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
51 utils
, wadreader
, g_system
, r_render
, r_game
;
54 type TYNCallback
= procedure (yes
:Boolean);
56 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
58 if win
.UserData
= nil then exit
;
60 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
61 IK_N
: TYNCallback(win
.UserData
)(false);
65 procedure YesButtonCB (ctl
: TGUITextButton
);
67 if ctl
.UserData
= nil then exit
;
68 TYNCallback(ctl
.UserData
)(true);
71 procedure NoButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(false);
77 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
81 //if length(Text) = 0 then exit;
82 Result
:= TGUIWindow
.Create(WinName
);
85 //OnKeyDownEx := @YNKeyDownProc;
86 //UserData := @ActionProc;
87 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
90 Name
:= '__temp_yes_no_menu:'+WinName
;
92 AddText(Text, MaxLen
);
93 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
94 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
96 DefControl
:= '__temp_yes_no_menu:'+WinName
;
102 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
103 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
105 procedure ProcApplyOptions();
110 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
112 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
117 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
119 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
120 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
121 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
123 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
125 g_Sound_SetupAllVolumes(
126 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
127 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
130 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
131 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
132 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
133 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
134 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
136 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
139 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
141 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
142 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
143 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
145 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
150 else gGibsCount
:= 48;
153 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
154 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
155 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
156 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
157 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
158 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
159 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
160 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
161 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
162 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
163 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
164 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
166 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
167 g_dbg_scale
:= TempScale
+ 1;
170 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
174 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
175 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
176 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
177 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
178 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
184 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
230 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
233 for i
:= WP_FIRST
to WP_LAST
do
235 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
237 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
288 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
291 for i
:= WP_FIRST
to WP_LAST
do
293 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
295 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
300 if e_HasJoysticks
then
302 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
305 for i
:= 0 to e_MaxJoys
- 1 do
306 if e_JoystickAvailable
[i
] then
307 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
311 if g_touch_enabled
then
313 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
314 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
315 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
316 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
317 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
322 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
323 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
324 TEAM_RED
, TEAM_BLUE
);
326 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
328 gPlayer1Settings
.Model
:= Model
.GetName();
329 gPlayer1Settings
.Color
:= Model
.Color
;
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
334 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
335 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
336 TEAM_RED
, TEAM_BLUE
);
337 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
339 gPlayer2Settings
.Model
:= Model
.GetName();
340 gPlayer2Settings
.Color
:= Model
.Color
;
343 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
344 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
346 if g_Game_IsServer
then
348 if gPlayer1
<> nil then
350 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
351 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
352 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
353 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
355 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
358 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
361 if gPlayer2
<> nil then
363 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
364 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
365 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
366 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
368 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
373 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
375 g_Console_WriteGameConfig
;
378 procedure ReadOptions();
383 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
385 with TGUISwitch(menu
.GetControl('swBPP')) do
391 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
392 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
394 with TGUISwitch(menu
.GetControl('swVSync')) do
395 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
397 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
398 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swInterp')) do
401 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
405 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
406 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
407 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
409 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
410 if gMuteWhenInactive
then
415 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
417 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
418 if gSoundEffectsDF
then
423 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
424 if gUseChatSounds
then
429 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
455 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
458 for i
:= WP_FIRST
to WP_LAST
do
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
461 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
465 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
491 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
494 for i
:= WP_FIRST
to WP_LAST
do
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
497 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
501 if e_HasJoysticks
then
503 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
506 for i
:= 0 to e_MaxJoys
- 1 do
507 if e_JoystickAvailable
[i
] then
508 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
512 if g_touch_enabled
then
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
515 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
516 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
517 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
518 with TGUISwitch(menu
.GetControl('swTouchFire')) do
519 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
523 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
532 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
535 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
537 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
538 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
539 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
540 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
542 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
545 with TGUISwitch(menu
.GetControl('swBloodType')) do
546 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
548 with TGUISwitch(menu
.GetControl('swCorpseType')) do
549 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
551 with TGUISwitch(menu
.GetControl('swGibsType')) do
552 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
554 with TGUISwitch(menu
.GetControl('swGibsCount')) do
563 with TGUISwitch(menu
.GetControl('swBackGround')) do
564 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
566 with TGUISwitch(menu
.GetControl('swMessages')) do
567 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
569 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
570 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
572 with TGUISwitch(menu
.GetControl('swChatBubble')) do
573 ItemIndex
:= gChatBubble
;
575 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
576 ItemIndex
:= gPlayerIndicator
;
578 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
579 ItemIndex
:= gPlayerIndicatorStyle
;
581 TempScale
:= Round(g_dbg_scale
- 1);
582 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
584 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
586 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
587 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
589 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
590 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
592 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
593 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
594 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
596 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
598 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
599 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
601 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
602 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
604 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
605 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
606 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
608 ProcSelectModel(nil);
611 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
613 // don't turn off monsters in DM
615 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
616 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
617 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
619 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
622 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
624 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
629 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
631 // don't turn off monsters in DM
633 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
634 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
635 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
640 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
641 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
642 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
643 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
647 function LatchGameOptions(const MenuName
: string): Byte;
653 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
655 Map
:= TGUILabel(GetControl('lbMap')).Text;
658 if not isWadPath(Map
) then
661 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
662 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
663 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
664 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
665 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
666 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
667 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
671 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
672 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
673 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
674 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
675 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
676 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
677 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
678 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
679 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
680 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
682 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
683 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
684 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
685 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
688 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
689 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
690 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
691 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
694 // TODO: get this crap out of here
695 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
696 gGameSettings
.WarmupTime
:= gsWarmupTime
;
697 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
701 procedure ProcStartCustomGame();
705 GameMode
:= LatchGameOptions('mCustomGameMenu');
706 if GameMode
= GM_NONE
then Exit
;
708 g_Console_WriteGameConfig
;
709 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
710 gsMaxLives
, gsGameFlags
, gsPlayers
);
714 procedure ProcStartNetGame();
718 GameMode
:= LatchGameOptions('mNetServerMenu');
719 if GameMode
= GM_NONE
then Exit
;
721 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
723 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
724 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
725 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
726 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
727 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
728 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
731 g_Console_WriteGameConfig
;
732 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
733 gsGameFlags
, gsPlayers
, 0, NetPort
);
736 procedure ProcConnectNetGame();
740 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
742 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
743 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
744 PW
:= TGUIEdit(GetControl('edPW')).Text;
747 g_Console_WriteGameConfig
;
748 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
751 procedure ProcEnterPassword();
755 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
757 NetClientIP
:= PromptIP
;
758 NetClientPort
:= PromptPort
;
759 PW
:= TGUIEdit(GetControl('edPW')).Text;
762 g_Console_WriteGameConfig
;
763 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
766 procedure ProcServerlist();
768 if not NetInitDone
then
770 if (not g_Net_Init()) then
772 g_Console_Add('NET: ERROR: Failed to init ENet!');
779 g_Net_Slist_Set(NetMasterList
);
781 gState
:= STATE_SLIST
;
782 g_ActiveWindow
:= nil;
784 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
789 slReturnPressed
:= True;
790 if g_Net_Slist_Fetch(slCurrent
) then
792 if slCurrent
= nil then
793 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
796 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
797 g_Serverlist_GenerateTable(slCurrent
, slTable
);
800 procedure ProcStartCampaign();
806 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
808 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
809 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
811 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
817 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
820 procedure ProcSelectMap(Sender
: TGUIControl
);
824 wad
, map
, res
: String;
826 win
:= g_GUI_GetWindow('SelectMapMenu');
827 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
829 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
830 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
832 if (wad
= '') or (map
= '') then
833 begin // Ýòî íå êàðòà
834 TGUILabel(GetControl('lbMapName')).Text := '';
835 TGUILabel(GetControl('lbMapAuthor')).Text := '';
836 TGUILabel(GetControl('lbMapSize')).Text := '';
837 TGUIMemo(GetControl('meMapDescription')).SetText('');
838 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
839 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
845 a
:= g_Map_GetMapInfo(res
);
847 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
848 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
849 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
850 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
851 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
852 TGUILabel(win
.GetControl('lbMapScale')).Text :=
853 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
858 procedure ProcSelectWAD(Sender
: TGUIControl
);
863 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
865 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
867 with TGUIListBox(GetControl('lsMapRes')) do
873 list
:= g_Map_GetMapsList(wad
);
887 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
893 win
:= g_GUI_GetWindow('CampaignMenu');
894 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
896 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
900 TGUILabel(GetControl('lbWADName')).Text := '';
901 TGUILabel(GetControl('lbWADAuthor')).Text := '';
902 TGUIMemo(GetControl('meWADDescription')).SetText('');
905 a
:= g_Game_GetMegaWADInfo(wad
);
907 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
908 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
909 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
911 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
915 fn
:= g_ExtractWadName(a
.pic
);
917 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
919 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
924 procedure ProcChangeColor(Sender
: TGUIControl
);
928 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
929 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
930 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
931 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
932 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
933 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
935 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
936 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
937 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
938 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
939 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
940 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
943 procedure ProcSelectModel(Sender
: TGUIControl
);
948 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
949 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
950 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
952 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
953 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
954 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
956 ProcChangeColor(nil);
959 procedure MenuLoadData();
961 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
963 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
964 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
965 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
966 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
967 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
968 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
969 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
970 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
971 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
972 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
973 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
974 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
975 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
976 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
977 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
978 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
979 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
980 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
981 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
982 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
983 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
984 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
985 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
986 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
987 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
989 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
990 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
991 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
992 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
993 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
994 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
995 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
998 procedure MenuFreeData();
1000 e_CharFont_Remove(gMenuFont
);
1001 e_CharFont_Remove(gMenuSmallFont
);
1003 g_Texture_Delete('MAINMENU_LOGO');
1004 g_Texture_Delete('MAINMENU_MARKER1');
1005 g_Texture_Delete('MAINMENU_MARKER2');
1006 g_Texture_Delete('SCROLL_LEFT');
1007 g_Texture_Delete('SCROLL_RIGHT');
1008 g_Texture_Delete('SCROLL_MIDDLE');
1009 g_Texture_Delete('SCROLL_MARKER');
1010 g_Texture_Delete('EDIT_LEFT');
1011 g_Texture_Delete('EDIT_RIGHT');
1012 g_Texture_Delete('EDIT_MIDDLE');
1013 g_Texture_Delete('BOX1');
1014 g_Texture_Delete('BOX2');
1015 g_Texture_Delete('BOX3');
1016 g_Texture_Delete('BOX4');
1017 g_Texture_Delete('BOX5');
1018 g_Texture_Delete('BOX6');
1019 g_Texture_Delete('BOX7');
1020 g_Texture_Delete('BOX8');
1021 g_Texture_Delete('BOX9');
1022 g_Texture_Delete('BSCROLL_UP_A');
1023 g_Texture_Delete('BSCROLL_UP_U');
1024 g_Texture_Delete('BSCROLL_DOWN_A');
1025 g_Texture_Delete('BSCROLL_DOWN_U');
1026 g_Texture_Delete('BSCROLL_MIDDLE');
1027 g_Texture_Delete('NOPIC');
1029 g_Sound_Delete('MENU_SELECT');
1030 g_Sound_Delete('MENU_OPEN');
1031 g_Sound_Delete('MENU_CLOSE');
1032 g_Sound_Delete('MENU_CHANGE');
1033 g_Sound_Delete('SCROLL_ADD');
1034 g_Sound_Delete('SCROLL_SUB');
1035 g_Sound_Delete('SOUND_PLAYER_FALL');
1038 procedure ProcAuthorsMenu();
1040 gMusic
.SetByName('MUSIC_INTERMUS');
1044 procedure ProcExitMenuKeyDown (yes
: Boolean);
1047 snd
: TPlayableSound
;
1052 g_Game_StopAllSounds(True);
1053 case (Random(18)) of
1054 0: s
:= 'SOUND_MONSTER_PAIN';
1055 1: s
:= 'SOUND_MONSTER_DIE_3';
1056 2: s
:= 'SOUND_MONSTER_SLOP';
1057 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1058 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1059 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1060 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1061 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1062 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1063 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1064 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1065 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1066 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1067 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1068 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1069 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1070 else s
:= 'SOUND_PLAYER_FALL';
1072 snd
:= TPlayableSound
.Create();
1073 res
:= snd
.SetByName(s
);
1074 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1078 while snd
.IsPlaying() do begin end;
1086 procedure ProcLoadMenu();
1093 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1094 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1095 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1099 procedure ProcSaveMenu();
1107 name
:= g_GetSaveName(a
, valid
);
1108 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1109 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1113 procedure ProcSaveGame(Sender
: TGUIControl
);
1117 if g_Game_IsNet
then Exit
;
1118 if g_Game_IsTestMap
then Exit
;
1119 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1120 g_Game_PauseAllSounds(True);
1121 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1123 g_ActiveWindow
:= nil;
1124 g_Game_Pause(False);
1127 procedure ProcLoadGame(Sender
: TGUIControl
);
1131 if g_Game_IsNet
then Exit
;
1132 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1133 if g_LoadGame(a
) then
1135 g_Game_PauseAllSounds(False)
1137 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1139 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1140 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1141 //g_ActiveWindow := nil;
1145 procedure ProcSinglePlayer (n
: Integer);
1146 var wad
, map
: AnsiString;
1149 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1150 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1151 if e_FindResource(AllMapDirs
, wad
) then
1153 wad
:= ExpandFileName(wad
);
1154 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1158 procedure ProcSingle1Player
;
1163 procedure ProcSingle2Players
;
1168 procedure ProcSelectMapMenu();
1171 wad_lb
: TGUIFileListBox
;
1172 map_lb
: TGUIListBox
;
1175 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1176 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1177 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1179 if wad_lb
.SelectedItem() <> '' then
1180 map
:= map_lb
.SelectedItem()
1184 wad_lb
.UpdateFileList();
1187 if wad_lb
.SelectedItem() <> '' then
1190 map_lb
.SelectItem(map
);
1192 if map_lb
.SelectedItem() <> '' then
1196 g_GUI_ShowWindow('SelectMapMenu');
1199 procedure ProcSelectCampaignMenu();
1202 wad_lb
: TGUIFileListBox
;
1204 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1205 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1207 wad_lb
.UpdateFileList();
1209 if wad_lb
.SelectedItem() <> '' then
1210 ProcSelectCampaignWAD(nil);
1213 procedure ProcSetMap();
1215 wad
, map
, res
: String;
1217 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1219 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1220 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1223 if (wad
= '') or (map
= '') then
1226 wad
:= e_FindWadRel(MapDirs
, WAD
);
1228 res
:= wad
+':\'+map
;
1230 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1231 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1234 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1238 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1240 g_Sound_SetupAllVolumes(
1241 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1242 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1246 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1250 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1251 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1253 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1254 g_dbg_scale
:= TempScale
+ 1;
1258 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1262 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1263 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1264 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1265 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1268 procedure ProcOptionsPlayersMIMenu();
1273 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1275 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1277 if a
= '' then Exit
;
1279 i
:= g_PlayerModel_GetIndex(a
);
1280 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1282 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1283 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1284 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1286 if PlayerModelsArray
[i
].HaveWeapon
then
1287 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1289 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1292 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1295 procedure ProcOptionsPlayersAnim();
1299 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1304 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1307 Model
.AnimState
.Loop
:= True;
1311 procedure ProcOptionsPlayersWeap();
1315 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1320 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1324 procedure ProcOptionsPlayersRot();
1328 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1329 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1331 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1335 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1339 g_Options_SetDefault();
1345 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1347 if yes
then ReadOptions();
1351 procedure ProcAuthorsClose();
1353 gMusic
.SetByName('MUSIC_MENU');
1355 gState
:= STATE_MENU
;
1358 procedure ProcGMClose();
1360 g_Game_InGameMenu(False);
1363 procedure ProcGMShow();
1368 if (gGameSettings
.GameType
= GT_SINGLE
) and
1369 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1370 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1371 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1373 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1374 if g_Game_IsTestMap
then
1375 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1376 TGUIMainMenu(g_ActiveWindow
.GetControl(
1377 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1380 procedure ProcChangePlayers();
1382 TeamGame
, Spectator
, AddTwo
: Boolean;
1383 P1Team
{, P2Team}: Byte;
1384 bP2
: TGUITextButton
;
1386 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1387 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1388 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1389 P1Team
:= TEAM_NONE
;
1390 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1392 //P2Team := TEAM_NONE;
1393 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1395 TGUIMainMenu(g_ActiveWindow
.GetControl(
1396 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1397 TGUIMainMenu(g_ActiveWindow
.GetControl(
1398 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1399 TGUIMainMenu(g_ActiveWindow
.GetControl(
1400 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1402 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1403 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1404 bP2
.Enabled
:= AddTwo
and not Spectator
;
1406 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1408 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1409 if gPlayer2
= nil then
1410 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1412 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1414 TGUIMainMenu(g_ActiveWindow
.GetControl(
1415 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1418 procedure ProcJoinRed();
1420 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1422 if g_Game_IsServer
then
1424 if gPlayer1
= nil then
1425 g_Game_AddPlayer(TEAM_RED
)
1428 if gPlayer1
.Team
<> TEAM_RED
then
1430 gPlayer1
.SwitchTeam
;
1431 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1434 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1439 gPlayer1Settings
.Team
:= TEAM_RED
;
1440 MC_SEND_PlayerSettings
;
1441 if gPlayer1
= nil then
1442 g_Game_AddPlayer(TEAM_RED
);
1444 g_ActiveWindow
:= nil;
1445 g_Game_Pause(False);
1448 procedure ProcJoinBlue();
1450 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1452 if g_Game_IsServer
then
1454 if gPlayer1
= nil then
1455 g_Game_AddPlayer(TEAM_BLUE
)
1458 if gPlayer1
.Team
<> TEAM_BLUE
then
1460 gPlayer1
.SwitchTeam
;
1461 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1464 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1469 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1470 MC_SEND_PlayerSettings
;
1471 if gPlayer1
= nil then
1472 g_Game_AddPlayer(TEAM_BLUE
);
1474 g_ActiveWindow
:= nil;
1475 g_Game_Pause(False);
1478 procedure ProcJoinGame();
1480 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1482 if gPlayer1
= nil then
1484 g_ActiveWindow
:= nil;
1485 g_Game_Pause(False);
1488 procedure ProcSwitchP2();
1490 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1492 if gPlayer1
= nil then
1494 if gPlayer2
= nil then
1497 g_Game_RemovePlayer();
1498 g_ActiveWindow
:= nil;
1499 g_Game_Pause(False);
1502 procedure ProcSpectate();
1504 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1507 g_ActiveWindow
:= nil;
1508 g_Game_Pause(False);
1511 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1513 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1516 procedure ProcEndMenuKeyDown (yes
: Boolean);
1518 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1521 procedure ProcSetRussianLanguage
;
1523 if gLanguage
<> LANGUAGE_RUSSIAN
then
1525 gLanguage
:= LANGUAGE_RUSSIAN
;
1526 gLanguageChange
:= True;
1527 gAskLanguage
:= False;
1532 procedure ProcSetEnglishLanguage
;
1534 if gLanguage
<> LANGUAGE_ENGLISH
then
1536 gLanguage
:= LANGUAGE_ENGLISH
;
1537 gLanguageChange
:= True;
1538 gAskLanguage
:= False;
1543 procedure ReadGameSettings();
1547 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1549 with gGameSettings
do
1551 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1552 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1556 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1557 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1559 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1561 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1565 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1566 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1571 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1572 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1573 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1575 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1576 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1577 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1580 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1585 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1587 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1588 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1589 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1591 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1592 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1596 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1597 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1599 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1600 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1601 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1602 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1603 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1604 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1605 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1609 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1610 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1611 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1612 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1613 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1618 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1619 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1624 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1625 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1630 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1631 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1636 procedure ProcApplyGameSet();
1640 stat
: TPlayerStatArray
;
1642 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1644 if not g_Game_IsServer
then Exit
;
1646 with gGameSettings
do
1648 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1650 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1651 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1653 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1656 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1658 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1659 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1660 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1661 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1662 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1666 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1668 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1669 Options
:= Options
or GAME_OPTION_DMKEYS
1671 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1674 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1676 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1682 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1684 TimeLimit
:= Max(n
, b
);
1688 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1690 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1697 if GameMode
= GM_DM
then
1699 stat
:= g_Player_GetStats();
1701 for a
:= 0 to High(stat
) do
1702 if stat
[a
].Frags
> b
then
1706 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1708 GoalLimit
:= Max(n
, b
);
1712 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1714 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1715 if n
< 0 then n
:= 0;
1716 if n
> 255 then n
:= 255;
1722 stat
:= g_Player_GetStats();
1724 for a
:= 0 to High(stat
) do
1725 if stat
[a
].Lives
> b
then
1728 MaxLives
:= Max(n
, b
);
1732 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1734 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1737 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1738 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1742 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1743 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1747 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1748 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1753 // don't forget to latch this shit
1754 gsGameFlags
:= Options
;
1755 gsMaxLives
:= MaxLives
;
1756 gsGoalLimit
:= GoalLimit
;
1757 gsTimeLimit
:= TimeLimit
;
1760 if g_Game_IsNet
then MH_SEND_GameSettings
;
1763 procedure ProcVideoOptionsRes();
1768 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1770 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1771 IntToStr(gWinSizeX
) +
1772 ' x ' + IntToStr(gWinSizeY
) +
1773 ', ' + IntToStr(gBPP
) + ' bpp';
1775 with TGUIListBox(menu
.GetControl('lsResolution')) do
1777 list
:= sys_GetDisplayModes(gBPP
);
1781 ItemIndex
:= Length(list
)
1789 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1795 TempResScale
:= Round(r_pixel_scale
- 1);
1796 with TGUISwitch(menu
.GetControl('swResFactor')) do
1797 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1800 procedure ProcApplyVideoOptions();
1803 Fullscreen
: Boolean;
1804 SWidth
, SHeight
: Integer;
1805 ScaleChanged
: Boolean;
1808 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1810 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1812 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1815 SWidth
:= gWinSizeX
;
1816 SHeight
:= gWinSizeY
;
1817 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1820 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1822 ScaleChanged
:= False;
1823 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1825 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1826 r_pixel_scale
:= TempResScale
+ 1;
1827 ScaleChanged
:= True;
1830 if (SWidth
<> gWinSizeX
) or
1831 (SHeight
<> gWinSizeY
) or
1832 (Fullscreen
<> gFullscreen
) or
1835 gResolutionChange
:= True;
1836 gRC_Width
:= SWidth
;
1837 gRC_Height
:= SHeight
;
1838 gRC_FullScreen
:= Fullscreen
;
1839 gRC_Maximized
:= gWinMaximized
;
1842 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1846 procedure ProcSetFirstRussianLanguage
;
1848 gLanguage
:= LANGUAGE_RUSSIAN
;
1849 gLanguageChange
:= True;
1850 gAskLanguage
:= False;
1853 procedure ProcSetFirstEnglishLanguage
;
1855 gLanguage
:= LANGUAGE_ENGLISH
;
1856 gLanguageChange
:= True;
1857 gAskLanguage
:= False;
1860 procedure ProcRecallAddress();
1862 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1864 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1865 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1869 procedure CreateFirstLanguageMenu();
1873 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1875 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1877 Name
:= 'mmFirstLanguageMenu';
1878 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1879 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1882 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1883 Menu
.MainWindow
:= True;
1884 g_GUI_AddWindow(Menu
);
1887 procedure g_Menu_AskLanguage();
1889 CreateFirstLanguageMenu();
1890 g_GUI_ShowWindow('FirstLanguageMenu');
1893 procedure CreatePlayerOptionsMenu(s
: String);
1898 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1900 a
:= _lc
[I_MENU_PLAYER_1
]
1902 a
:= _lc
[I_MENU_PLAYER_2
];
1903 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1905 Name
:= 'mOptionsPlayers'+s
+'Menu';
1906 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1908 Name
:= 'ed'+s
+'Name';
1912 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1914 Name
:= 'sw'+s
+'Team';
1915 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1916 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1918 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1920 Name
:= 'ls'+s
+'Model';
1922 Items
:= g_PlayerModel_GetNames();
1923 OnChange
:= ProcSelectModel
;
1925 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1927 Name
:= 'sc'+s
+'Red';
1929 OnChange
:= ProcChangeColor
;
1931 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1933 Name
:= 'sc'+s
+'Green';
1935 OnChange
:= ProcChangeColor
;
1937 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1939 Name
:= 'sc'+s
+'Blue';
1941 OnChange
:= ProcChangeColor
;
1944 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1945 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1946 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1947 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1949 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1951 Name
:= 'mv'+s
+'Model';
1952 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1953 Y
:= GetControl('ls'+s
+'Model').Y
;
1956 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1957 g_GUI_AddWindow(Menu
);
1960 procedure CreateAllMenus();
1964 a
, cx
, _y
, i
: Integer;
1967 Menu
:= TGUIWindow
.Create('MainMenu');
1968 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
1970 Name
:= 'mmMainMenu';
1971 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1972 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1973 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1974 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1975 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1976 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1978 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1980 Color
:= _RGB(255, 255, 255);
1981 X
:= gScreenWidth
-GetWidth
-8;
1982 Y
:= gScreenHeight
-GetHeight
-8;
1984 Menu
.DefControl
:= 'mmMainMenu';
1985 Menu
.MainWindow
:= True;
1986 g_GUI_AddWindow(Menu
);
1988 Menu
:= TGUIWindow
.Create('NewGameMenu');
1989 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
1991 Name
:= 'mmNewGameMenu';
1992 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1993 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1994 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1995 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1997 Menu
.DefControl
:= 'mmNewGameMenu';
1998 g_GUI_AddWindow(Menu
);
2000 Menu
:= TGUIWindow
.Create('NetGameMenu');
2001 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2003 Name
:= 'mmNetGameMenu';
2004 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2005 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2007 Menu
.DefControl
:= 'mmNetGameMenu';
2008 g_GUI_AddWindow(Menu
);
2010 Menu
:= TGUIWindow
.Create('NetServerMenu');
2011 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2013 Name
:= 'mNetServerMenu';
2014 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2016 Name
:= 'edSrvName';
2017 OnlyDigits
:= False;
2020 Text := NetServerName
;
2022 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2024 Name
:= 'edSrvPassword';
2025 OnlyDigits
:= False;
2028 Text := NetPassword
;
2030 with AddEdit(_lc
[I_NET_PORT
]) do
2036 Text := IntToStr(NetPort
);
2038 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2040 Name
:= 'edMaxPlayers';
2044 Text := IntToStr(NetMaxClients
);
2046 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2048 Name
:= 'swUseMaster';
2049 AddItem(_lc
[I_MENU_YES
]);
2050 AddItem(_lc
[I_MENU_NO
]);
2051 if NetUseMaster
then
2057 with AddLabel(_lc
[I_MENU_MAP
]) do
2062 OnClick
:= @ProcSelectMapMenu
;
2064 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2066 Name
:= 'swGameMode';
2067 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2068 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2069 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2070 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2071 case g_Game_TextToMode(gsGameMode
) of
2073 GM_DM
: ItemIndex
:= 0;
2074 GM_TDM
: ItemIndex
:= 1;
2075 GM_CTF
: ItemIndex
:= 2;
2077 GM_COOP
: ItemIndex
:= 3;
2079 OnChange
:= ProcSwitchMonstersCustom
;
2081 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2083 Name
:= 'edTimeLimit';
2087 if gsTimeLimit
> 0 then
2088 Text := IntToStr(gsTimeLimit
);
2090 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2092 Name
:= 'edGoalLimit';
2096 if gsGoalLimit
> 0 then
2097 Text := IntToStr(gsGoalLimit
);
2099 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2101 Name
:= 'edMaxLives';
2105 if gsMaxLives
> 0 then
2106 Text := IntToStr(gsMaxLives
);
2108 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2110 Name
:= 'edItemRespawnTime';
2114 if gsItemRespawnTime
> 0 then
2115 Text := IntToStr(gsItemRespawnTime
);
2117 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2119 Name
:= 'swPlayers';
2120 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2121 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2122 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2123 ItemIndex
:= gsPlayers
;
2125 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2127 Name
:= 'swTeamDamage';
2128 AddItem(_lc
[I_MENU_YES
]);
2129 AddItem(_lc
[I_MENU_NO
]);
2130 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2135 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2137 Name
:= 'swTeamHit';
2138 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2139 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2140 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2141 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2142 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2144 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2146 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2151 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2153 Name
:= 'swDeathmatchKeys';
2154 AddItem(_lc
[I_MENU_YES
]);
2155 AddItem(_lc
[I_MENU_NO
]);
2156 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2161 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2163 Name
:= 'swEnableExits';
2164 AddItem(_lc
[I_MENU_YES
]);
2165 AddItem(_lc
[I_MENU_NO
]);
2166 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2171 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2173 Name
:= 'swWeaponStay';
2174 AddItem(_lc
[I_MENU_YES
]);
2175 AddItem(_lc
[I_MENU_NO
]);
2176 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2181 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2183 Name
:= 'swMonsters';
2184 AddItem(_lc
[I_MENU_YES
]);
2185 AddItem(_lc
[I_MENU_NO
]);
2186 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2191 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2194 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2195 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2196 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2198 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2200 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2204 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2208 Menu
.DefControl
:= 'mNetServerMenu';
2209 g_GUI_AddWindow(Menu
);
2211 Menu
:= TGUIWindow
.Create('NetClientMenu');
2212 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2214 Name
:= 'mNetClientMenu';
2216 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2219 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2225 Text := 'localhost';
2227 with AddEdit(_lc
[I_NET_PORT
]) do
2235 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2238 OnlyDigits
:= False;
2245 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2249 Menu
.DefControl
:= 'mNetClientMenu';
2250 g_GUI_AddWindow(Menu
);
2252 Menu
:= TGUIWindow
.Create('LoadMenu');
2253 Menu
.OnShow
:= ProcLoadMenu
;
2254 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2256 Name
:= 'mmLoadMenu';
2261 Name
:= 'edSlot'+IntToStr(a
);
2264 OnEnter
:= ProcLoadGame
;
2267 Menu
.DefControl
:= 'mmLoadMenu';
2268 g_GUI_AddWindow(Menu
);
2270 Menu
:= TGUIWindow
.Create('SaveMenu');
2271 Menu
.OnShow
:= ProcSaveMenu
;
2272 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2274 Name
:= 'mmSaveMenu';
2279 Name
:= 'edSlot'+IntToStr(a
);
2282 OnChange
:= ProcSaveGame
;
2285 Menu
.DefControl
:= 'mmSaveMenu';
2286 g_GUI_AddWindow(Menu
);
2288 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2289 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2291 Name
:= 'mCustomGameMenu';
2292 with AddLabel(_lc
[I_MENU_MAP
]) do
2297 OnClick
:= @ProcSelectMapMenu
;
2299 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2301 Name
:= 'swGameMode';
2302 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2303 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2304 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2305 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2306 case g_Game_TextToMode(gsGameMode
) of
2308 GM_DM
: ItemIndex
:= 0;
2309 GM_TDM
: ItemIndex
:= 1;
2310 GM_CTF
: ItemIndex
:= 2;
2312 GM_COOP
: ItemIndex
:= 3;
2314 OnChange
:= ProcSwitchMonstersCustom
;
2316 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2318 Name
:= 'edTimeLimit';
2322 if gsTimeLimit
> 0 then
2323 Text := IntToStr(gsTimeLimit
);
2325 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2327 Name
:= 'edGoalLimit';
2331 if gsGoalLimit
> 0 then
2332 Text := IntToStr(gsGoalLimit
);
2334 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2336 Name
:= 'edMaxLives';
2340 if gsMaxLives
> 0 then
2341 Text := IntToStr(gsMaxLives
);
2343 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2345 Name
:= 'edItemRespawnTime';
2349 if gsItemRespawnTime
> 0 then
2350 Text := IntToStr(gsItemRespawnTime
);
2352 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2354 Name
:= 'swPlayers';
2355 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2356 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2357 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2358 ItemIndex
:= gsPlayers
;
2360 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2362 Name
:= 'swTeamDamage';
2363 AddItem(_lc
[I_MENU_YES
]);
2364 AddItem(_lc
[I_MENU_NO
]);
2365 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2370 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2372 Name
:= 'swTeamHit';
2373 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2374 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2375 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2376 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2377 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2379 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2381 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2386 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2388 Name
:= 'swDeathmatchKeys';
2389 AddItem(_lc
[I_MENU_YES
]);
2390 AddItem(_lc
[I_MENU_NO
]);
2391 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2396 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2398 Name
:= 'swEnableExits';
2399 AddItem(_lc
[I_MENU_YES
]);
2400 AddItem(_lc
[I_MENU_NO
]);
2401 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2406 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2408 Name
:= 'swWeaponStay';
2409 AddItem(_lc
[I_MENU_YES
]);
2410 AddItem(_lc
[I_MENU_NO
]);
2411 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2416 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2418 Name
:= 'swMonsters';
2419 AddItem(_lc
[I_MENU_YES
]);
2420 AddItem(_lc
[I_MENU_NO
]);
2421 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2426 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2429 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2430 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2431 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2433 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2435 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2439 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2443 Menu
.DefControl
:= 'mCustomGameMenu';
2444 g_GUI_AddWindow(Menu
);
2446 Menu
:= TGUIWindow
.Create('CampaignMenu');
2447 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2449 Name
:= 'mCampaignMenu';
2458 with AddFileList('', 15, 4) do
2461 OnChange
:= ProcSelectCampaignWAD
;
2465 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2466 SetBase(MegawadDirs
);
2469 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2471 Name
:= 'lbWADName';
2475 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2477 Name
:= 'lbWADAuthor';
2481 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2482 with AddMemo('', 15, 3) do
2484 Name
:= 'meWADDescription';
2485 Color
:= MENU_ITEMSCTRL_COLOR
;
2487 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2489 Name
:= 'swPlayers';
2490 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2491 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2494 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2498 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2500 Name
:= 'mpWADImage';
2501 DefaultRes
:= 'NOPIC';
2502 X
:= GetControl('lsWAD').X
+4;
2503 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2506 Menu
.DefControl
:= 'mCampaignMenu';
2507 g_GUI_AddWindow(Menu
);
2509 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2510 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2512 Name
:= 'mSelectMapMenu';
2513 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2516 OnChange
:= ProcSelectWAD
;
2520 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2523 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2527 OnChange
:= ProcSelectMap
;
2530 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2532 Name
:= 'lbMapName';
2536 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2538 Name
:= 'lbMapAuthor';
2542 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2544 Name
:= 'lbMapSize';
2548 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2550 Name
:= 'meMapDescription';
2555 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2557 Name
:= 'mpMapPreview';
2558 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2559 Y
:= GetControl('lsMapWAD').Y
;
2561 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2563 Name
:= 'lbMapScale';
2566 Color
:= MENU_ITEMSCTRL_COLOR
;
2567 X
:= GetControl('lsMapWAD').X
+
2568 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2569 2 + MAPPREVIEW_WIDTH
*4;
2570 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2573 Menu
.OnClose
:= ProcSetMap
;
2574 Menu
.DefControl
:= 'mSelectMapMenu';
2575 g_GUI_AddWindow(Menu
);
2577 Menu
:= TGUIWindow
.Create('OptionsMenu');
2578 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2580 Name
:= 'mmOptionsMenu';
2581 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2582 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2583 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2584 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2585 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2586 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2588 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2589 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2591 Menu
.OnClose
:= ProcApplyOptions
;
2592 Menu
.DefControl
:= 'mmOptionsMenu';
2593 g_GUI_AddWindow(Menu
);
2595 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2596 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2597 g_GUI_AddWindow(Menu
);
2599 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2600 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2602 Name
:= 'mOptionsVideoMenu';
2603 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2604 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2610 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2613 AddItem(_lc
[I_MENU_YES
]);
2614 AddItem(_lc
[I_MENU_NO
]);
2616 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2618 Name
:= 'swTextureFilter';
2619 AddItem(_lc
[I_MENU_YES
]);
2620 AddItem(_lc
[I_MENU_NO
]);
2622 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2625 AddItem(_lc
[I_MENU_YES
]);
2626 AddItem(_lc
[I_MENU_NO
]);
2628 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2630 Name
:= 'swLegacyNPOT';
2631 AddItem(_lc
[I_MENU_NO
]);
2632 AddItem(_lc
[I_MENU_YES
]);
2635 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2638 Menu
.DefControl
:= 'mOptionsVideoMenu';
2639 g_GUI_AddWindow(Menu
);
2641 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2642 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2644 Name
:= 'mOptionsVideoResMenu';
2645 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2647 Name
:= 'lbCurrentRes';
2651 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2653 Name
:= 'lsResolution';
2656 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2658 Name
:= 'swFullScreen';
2659 AddItem(_lc
[I_MENU_YES
]);
2660 AddItem(_lc
[I_MENU_NO
]);
2662 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2664 Name
:= 'swResFactor';
2666 for i
:= 2 to gRC_Width
div 640 do
2667 AddItem(IntToStr(i
) + 'x');
2670 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2673 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2677 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2679 Name
:= 'mOptionsSoundMenu';
2680 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2682 Name
:= 'scMusicLevel';
2684 OnChange
:= ProcChangeSoundSettings
;
2686 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2688 Name
:= 'scSoundLevel';
2690 OnChange
:= ProcChangeSoundSettings
;
2692 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2694 Name
:= 'scMaxSimSounds';
2697 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2699 Name
:= 'swAnnouncer';
2700 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2701 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2702 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2703 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2705 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2706 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2708 Name
:= 'swSoundEffects';
2709 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2710 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2712 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2713 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2715 Name
:= 'swChatSpeech';
2716 AddItem(_lc
[I_MENU_YES
]);
2717 AddItem(_lc
[I_MENU_NO
]);
2719 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2721 Name
:= 'swInactiveSounds';
2722 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2723 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2727 Menu
.DefControl
:= 'mOptionsSoundMenu';
2728 g_GUI_AddWindow(Menu
);
2730 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2731 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2733 Name
:= 'mOptionsGameMenu';
2734 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2736 Name
:= 'scParticlesCount';
2739 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2741 Name
:= 'swBloodCount';
2742 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2743 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2744 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2745 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2746 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2748 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2750 Name
:= 'scShellsMax';
2753 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2755 Name
:= 'scGibsMax';
2758 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2760 Name
:= 'scCorpsesMax';
2763 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2765 Name
:= 'swGibsCount';
2766 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2767 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2768 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2769 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2770 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2772 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2774 Name
:= 'swCorpseType';
2775 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2776 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2778 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2780 Name
:= 'swGibsType';
2781 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2782 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2784 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2786 Name
:= 'swBloodType';
2787 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2788 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2790 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2792 Name
:= 'swScreenFlash';
2793 AddItem(_lc
[I_MENU_NO
]);
2794 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2795 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2797 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2799 Name
:= 'swBackground';
2800 AddItem(_lc
[I_MENU_YES
]);
2801 AddItem(_lc
[I_MENU_NO
]);
2803 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2805 Name
:= 'swMessages';
2806 AddItem(_lc
[I_MENU_YES
]);
2807 AddItem(_lc
[I_MENU_NO
]);
2809 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2811 Name
:= 'swRevertPlayers';
2812 AddItem(_lc
[I_MENU_YES
]);
2813 AddItem(_lc
[I_MENU_NO
]);
2815 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2817 Name
:= 'swChatBubble';
2818 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2819 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2820 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2821 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2822 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2824 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2826 Name
:= 'swPlayerIndicator';
2827 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2828 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2829 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2831 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2833 Name
:= 'swPlayerIndicatorStyle';
2834 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2835 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2837 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2839 Name
:= 'scScaleFactor';
2841 OnChange
:= ProcChangeGameSettings
;
2845 Menu
.DefControl
:= 'mOptionsGameMenu';
2846 g_GUI_AddWindow(Menu
);
2848 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2849 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2851 Name
:= 'mOptionsControlsMenu';
2852 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2853 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2854 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2855 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2856 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2858 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2859 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2860 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2861 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2862 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2863 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2864 if e_HasJoysticks
then
2867 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2869 if g_touch_enabled
then
2872 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2875 Menu
.DefControl
:= 'mOptionsControlsMenu';
2876 g_GUI_AddWindow(Menu
);
2878 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2879 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2881 Name
:= 'mOptionsControlsP1Menu';
2882 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2883 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2884 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2885 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2886 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2887 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2888 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2889 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2890 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2891 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2893 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2894 g_GUI_AddWindow(Menu
);
2896 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2897 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2899 Name
:= 'mOptionsControlsP1MenuWeapons';
2900 for i
:= WP_FIRST
to WP_LAST
do
2901 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2902 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2904 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2905 g_GUI_AddWindow(Menu
);
2907 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2908 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2910 Name
:= 'mOptionsControlsP2Menu';
2911 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2912 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2913 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2914 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2915 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2916 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2917 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2918 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2919 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2920 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2922 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2923 g_GUI_AddWindow(Menu
);
2925 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2926 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2928 Name
:= 'mOptionsControlsP2MenuWeapons';
2929 for i
:= WP_FIRST
to WP_LAST
do
2930 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2931 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2933 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2937 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2939 Name
:= 'mOptionsControlsJoystickMenu';
2940 for i
:= 0 to e_MaxJoys
- 1 do
2941 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2943 Name
:= 'scDeadzone' + IntToStr(i
);
2947 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2948 g_GUI_AddWindow(Menu
);
2950 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2951 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2953 Name
:= 'mOptionsControlsTouchMenu';
2954 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2956 Name
:= 'swTouchAlt';
2957 AddItem(_lc
[I_MENU_NO
]);
2958 AddItem(_lc
[I_MENU_YES
]);
2959 OnChange
:= ProcChangeTouchSettings
;
2961 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2963 Name
:= 'scTouchSize';
2965 OnChange
:= ProcChangeTouchSettings
;
2967 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2969 Name
:= 'swTouchFire';
2970 AddItem(_lc
[I_MENU_NO
]);
2971 AddItem(_lc
[I_MENU_YES
]);
2973 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2975 Name
:= 'scTouchOffset';
2977 OnChange
:= ProcChangeTouchSettings
;
2980 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2981 g_GUI_AddWindow(Menu
);
2983 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2984 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2986 Name
:= 'mOptionsPlayersMenu';
2987 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2988 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2990 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2991 g_GUI_AddWindow(Menu
);
2993 CreatePlayerOptionsMenu('P1');
2994 CreatePlayerOptionsMenu('P2');
2996 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2997 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2999 Name
:= 'mOptionsPlayersMIMenu';
3000 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3005 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3010 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3012 Name
:= 'meComment';
3015 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3016 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3019 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3023 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3024 g_GUI_AddWindow(Menu
);
3026 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3027 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3029 Name
:= 'mOptionsLanguageMenu';
3030 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3031 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3034 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3035 g_GUI_AddWindow(Menu
);
3037 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3038 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3039 g_GUI_AddWindow(Menu
);
3041 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3042 Menu
.BackTexture
:= 'INTER';
3043 Menu
.OnClose
:= ProcAuthorsClose
;
3047 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3049 Color
:= _RGB(255, 0, 0);
3050 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3052 _y
:= _y
+GetHeight();
3054 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3056 Color
:= _RGB(255, 0, 0);
3057 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3059 _y
:= _y
+GetHeight()+32;
3061 // ×òî äåëàë: Êòî äåëàë
3062 cx
:= gScreenWidth
div 2 - 320 + 64;
3063 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3065 Color
:= _RGB(255, 0, 0);
3070 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3072 Color
:= _RGB(255, 255, 255);
3077 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3079 Color
:= _RGB(255, 0, 0);
3084 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3086 Color
:= _RGB(255, 255, 255);
3091 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3093 Color
:= _RGB(255, 255, 255);
3098 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3100 Color
:= _RGB(255, 0, 0);
3105 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3107 Color
:= _RGB(255, 255, 255);
3112 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3114 Color
:= _RGB(255, 0, 0);
3119 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3121 Color
:= _RGB(255, 255, 255);
3124 _y
:= gScreenHeight
- 128;
3127 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3129 Color
:= _RGB(255, 0, 0);
3134 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3136 Color
:= _RGB(255, 255, 255);
3139 _y
:= _y
+GetHeight();
3141 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3143 Color
:= _RGB(255, 255, 255);
3146 _y
:= _y
+GetHeight();
3148 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3150 Color
:= _RGB(255, 255, 255);
3153 _y
:= gScreenHeight
- 32;
3155 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3157 Color
:= _RGB(255, 0, 0);
3158 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3161 g_GUI_AddWindow(Menu
);
3163 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3164 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3165 g_GUI_AddWindow(Menu
);
3167 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3168 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3170 Name
:= 'mmGameSingleMenu';
3171 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3172 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3173 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3174 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3175 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3176 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3178 Menu
.DefControl
:= 'mmGameSingleMenu';
3179 Menu
.MainWindow
:= True;
3180 Menu
.OnClose
:= ProcGMClose
;
3181 Menu
.OnShow
:= ProcGMShow
;
3182 g_GUI_AddWindow(Menu
);
3184 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3185 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3186 g_GUI_AddWindow(Menu
);
3188 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3189 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3190 g_GUI_AddWindow(Menu
);
3192 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3193 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3195 Name
:= 'mmGameCustomMenu';
3196 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3197 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3198 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3199 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3200 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3201 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3202 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3204 Menu
.DefControl
:= 'mmGameCustomMenu';
3205 Menu
.MainWindow
:= True;
3206 Menu
.OnClose
:= ProcGMClose
;
3207 Menu
.OnShow
:= ProcGMShow
;
3208 g_GUI_AddWindow(Menu
);
3210 Menu
:= TGUIWindow
.Create('GameServerMenu');
3211 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3213 Name
:= 'mmGameServerMenu';
3214 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3215 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3216 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3217 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3218 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3220 Menu
.DefControl
:= 'mmGameServerMenu';
3221 Menu
.MainWindow
:= True;
3222 Menu
.OnClose
:= ProcGMClose
;
3223 Menu
.OnShow
:= ProcGMShow
;
3224 g_GUI_AddWindow(Menu
);
3226 Menu
:= TGUIWindow
.Create('GameClientMenu');
3227 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3229 Name
:= 'mmGameClientMenu';
3230 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3231 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3232 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3234 Menu
.DefControl
:= 'mmGameClientMenu';
3235 Menu
.MainWindow
:= True;
3236 Menu
.OnClose
:= ProcGMClose
;
3237 Menu
.OnShow
:= ProcGMShow
;
3238 g_GUI_AddWindow(Menu
);
3240 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3241 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3243 Name
:= 'mClientPasswordMenu';
3244 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3252 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3255 Menu
.DefControl
:= 'mClientPasswordMenu';
3256 g_GUI_AddWindow(Menu
);
3258 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3259 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3261 Name
:= 'mGameSetGameMenu';
3262 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3264 Name
:= 'swTeamDamage';
3265 AddItem(_lc
[I_MENU_YES
]);
3266 AddItem(_lc
[I_MENU_NO
]);
3269 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3271 Name
:= 'swTeamHit';
3272 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3273 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3274 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3275 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3278 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3280 Name
:= 'swDeathmatchKeys';
3281 AddItem(_lc
[I_MENU_YES
]);
3282 AddItem(_lc
[I_MENU_NO
]);
3285 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3287 Name
:= 'edTimeLimit';
3292 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3294 Name
:= 'edGoalLimit';
3299 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3301 Name
:= 'edMaxLives';
3306 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3309 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3310 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3311 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3317 Menu
.DefControl
:= 'mGameSetGameMenu';
3318 Menu
.OnClose
:= ProcApplyGameSet
;
3319 g_GUI_AddWindow(Menu
);
3321 Menu
:= TGUIWindow
.Create('TeamMenu');
3322 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3324 Name
:= 'mmTeamMenu';
3325 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3326 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3327 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3328 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3329 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3331 Menu
.DefControl
:= 'mmTeamMenu';
3332 Menu
.OnShow
:= ProcChangePlayers
;
3333 g_GUI_AddWindow(Menu
);
3336 procedure g_Menu_Show_SaveMenu();
3338 if g_Game_IsTestMap
then
3340 if gGameSettings
.GameType
= GT_SINGLE
then
3341 g_GUI_ShowWindow('GameSingleMenu')
3344 if g_Game_IsClient
then
3347 if g_Game_IsNet
then
3350 g_GUI_ShowWindow('GameCustomMenu');
3352 g_GUI_ShowWindow('SaveMenu');
3353 g_Sound_PlayEx('MENU_OPEN');
3356 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3358 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3359 if gGameSettings
.GameType
= GT_SINGLE
then
3361 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3365 if g_Game_IsClient
then exit
;
3366 if g_Game_IsNet
then exit
;
3367 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3369 g_GUI_ShowWindow('LoadMenu');
3370 g_Sound_PlayEx('MENU_OPEN');
3373 procedure g_Menu_Show_GameSetGame();
3375 if gGameSettings
.GameType
= GT_SINGLE
then
3376 g_GUI_ShowWindow('GameSingleMenu')
3379 if g_Game_IsClient
then
3382 if g_Game_IsNet
then
3383 g_GUI_ShowWindow('GameServerMenu')
3385 g_GUI_ShowWindow('GameCustomMenu');
3388 g_GUI_ShowWindow('GameSetGameMenu');
3389 g_Sound_PlayEx('MENU_OPEN');
3392 procedure g_Menu_Show_OptionsVideo();
3394 if gGameSettings
.GameType
= GT_SINGLE
then
3395 g_GUI_ShowWindow('GameSingleMenu')
3398 if g_Game_IsClient
then
3399 g_GUI_ShowWindow('GameClientMenu')
3401 if g_Game_IsNet
then
3402 g_GUI_ShowWindow('GameServerMenu')
3404 g_GUI_ShowWindow('GameCustomMenu');
3407 g_GUI_ShowWindow('OptionsMenu');
3408 g_GUI_ShowWindow('OptionsVideoMenu');
3409 g_Sound_PlayEx('MENU_OPEN');
3412 procedure g_Menu_Show_OptionsSound();
3414 if gGameSettings
.GameType
= GT_SINGLE
then
3415 g_GUI_ShowWindow('GameSingleMenu')
3418 if g_Game_IsClient
then
3419 g_GUI_ShowWindow('GameClientMenu')
3421 if g_Game_IsNet
then
3422 g_GUI_ShowWindow('GameServerMenu')
3424 g_GUI_ShowWindow('GameCustomMenu');
3427 g_GUI_ShowWindow('OptionsMenu');
3428 g_GUI_ShowWindow('OptionsSoundMenu');
3429 g_Sound_PlayEx('MENU_OPEN');
3432 procedure g_Menu_Show_EndGameMenu();
3434 g_GUI_ShowWindow('EndGameMenu');
3435 g_Sound_PlayEx('MENU_OPEN');
3438 procedure g_Menu_Show_QuitGameMenu();
3440 g_GUI_ShowWindow('ExitMenu');
3441 g_Sound_PlayEx('MENU_OPEN');
3444 procedure g_Menu_Init();
3450 procedure g_Menu_Free();
3455 procedure g_Menu_Reset();
3459 g_GUI_SaveMenuPos();
3460 ex
:= g_GUI_Destroy();
3464 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3469 g_Game_SetDebugMode();
3471 g_GUI_LoadMenuPos();