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;
42 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
43 g_base
, g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
44 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
45 MAPDEF
, Math
, g_saveload
,
47 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
48 utils
, wadreader
, g_system
, r_render
, r_game
;
51 type TYNCallback
= procedure (yes
:Boolean);
53 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
55 if win
.UserData
= nil then exit
;
57 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
58 IK_N
: TYNCallback(win
.UserData
)(false);
62 procedure YesButtonCB (ctl
: TGUITextButton
);
64 if ctl
.UserData
= nil then exit
;
65 TYNCallback(ctl
.UserData
)(true);
68 procedure NoButtonCB (ctl
: TGUITextButton
);
70 if ctl
.UserData
= nil then exit
;
71 TYNCallback(ctl
.UserData
)(false);
74 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
78 //if length(Text) = 0 then exit;
79 Result
:= TGUIWindow
.Create(WinName
);
82 //OnKeyDownEx := @YNKeyDownProc;
83 //UserData := @ActionProc;
84 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
87 Name
:= '__temp_yes_no_menu:'+WinName
;
89 AddText(Text, MaxLen
);
90 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
91 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
93 DefControl
:= '__temp_yes_no_menu:'+WinName
;
99 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
100 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
102 procedure ProcApplyOptions();
107 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
109 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
114 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
116 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
117 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
118 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
120 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
122 g_Sound_SetupAllVolumes(
123 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
124 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
127 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
128 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
129 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
130 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
133 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
135 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
136 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
137 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
138 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
140 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
145 else gGibsCount
:= 48;
148 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
149 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
150 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
151 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
152 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
153 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
154 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
155 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
156 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
157 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
158 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
159 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
161 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
162 g_dbg_scale
:= TempScale
+ 1;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
170 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
171 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
172 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
173 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
174 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
175 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
176 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
180 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
183 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
191 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
192 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
193 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
206 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
214 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
215 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
216 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
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_activate', '-p2_activate'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
253 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
254 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
255 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
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(g_Console_FindBind(2, 'p2_dropflag', ''), '');
277 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
278 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
292 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
295 for i
:= WP_FIRST
to WP_LAST
do
297 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
299 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
304 if e_HasJoysticks
then
306 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
309 for i
:= 0 to e_MaxJoys
- 1 do
310 if e_JoystickAvailable
[i
] then
311 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
315 if g_touch_enabled
then
317 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
318 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
319 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
320 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
321 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
325 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
326 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
327 TEAM_RED
, TEAM_BLUE
);
328 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
330 gPlayer1Settings
.Model
:= Model
.GetName();
331 gPlayer1Settings
.Color
:= Model
.Color
;
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
335 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
336 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
337 TEAM_RED
, TEAM_BLUE
);
338 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
340 gPlayer2Settings
.Model
:= Model
.GetName();
341 gPlayer2Settings
.Color
:= Model
.Color
;
344 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
345 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
346 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
347 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
351 for i
:= WP_FIRST
to WP_LAST
+1 do
353 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
357 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
358 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
359 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
360 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
361 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
364 for i
:= WP_FIRST
to WP_LAST
+1 do
366 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
370 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
371 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
373 if g_Game_IsServer
then
375 if gPlayer1
<> nil then
377 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
378 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
379 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
380 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
382 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
384 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
385 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
386 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
387 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
388 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
391 if gPlayer2
<> nil then
393 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
394 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
395 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
396 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
398 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
400 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
401 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
402 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
403 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
404 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
408 if g_Game_IsClient
then
410 MC_SEND_PlayerSettings
;
411 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
414 g_Console_WriteGameConfig
;
417 procedure ReadOptions();
422 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
424 with TGUISwitch(menu
.GetControl('swBPP')) do
430 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
431 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
433 with TGUISwitch(menu
.GetControl('swVSync')) do
434 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
436 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
437 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
439 with TGUISwitch(menu
.GetControl('swInterp')) do
440 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
442 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
444 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
445 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
446 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
448 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
449 if gMuteWhenInactive
then
454 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
456 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
457 if gSoundEffectsDF
then
462 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
463 if gUseChatSounds
then
468 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
496 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
499 for i
:= WP_FIRST
to WP_LAST
do
501 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
502 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
506 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
516 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
522 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
523 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
524 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
525 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
534 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
537 for i
:= WP_FIRST
to WP_LAST
do
539 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
540 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
544 if e_HasJoysticks
then
546 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
549 for i
:= 0 to e_MaxJoys
- 1 do
550 if e_JoystickAvailable
[i
] then
551 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
555 if g_touch_enabled
then
557 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
558 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
559 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
560 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
561 with TGUISwitch(menu
.GetControl('swTouchFire')) do
562 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
563 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
566 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
569 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
570 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
571 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
572 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
575 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
577 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
578 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
579 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
580 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
581 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
583 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
586 with TGUISwitch(menu
.GetControl('swBloodType')) do
587 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
589 with TGUISwitch(menu
.GetControl('swCorpseType')) do
590 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
592 with TGUISwitch(menu
.GetControl('swGibsType')) do
593 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
595 with TGUISwitch(menu
.GetControl('swGibsCount')) do
604 with TGUISwitch(menu
.GetControl('swBackGround')) do
605 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
607 with TGUISwitch(menu
.GetControl('swMessages')) do
608 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
610 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
611 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
613 with TGUISwitch(menu
.GetControl('swChatBubble')) do
614 ItemIndex
:= gChatBubble
;
616 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
617 ItemIndex
:= gPlayerIndicator
;
619 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
620 ItemIndex
:= gPlayerIndicatorStyle
;
622 TempScale
:= Round(g_dbg_scale
- 1);
623 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
625 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
627 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
628 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
630 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
631 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
633 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
634 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
635 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
637 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
638 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
639 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
640 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
641 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
642 for i
:= WP_FIRST
to WP_LAST
+1 do
644 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
645 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
648 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
649 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
650 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
651 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
652 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
653 for i
:= WP_FIRST
to WP_LAST
+1 do
655 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
656 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
659 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
661 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
662 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
664 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
665 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
667 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
668 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
669 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
671 ProcSelectModel(nil);
674 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
676 // don't turn off monsters in DM
678 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
679 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
680 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
682 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
685 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
686 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
687 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
688 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
692 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
694 // don't turn off monsters in DM
696 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
697 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
698 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
700 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
703 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
704 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
705 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
706 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
710 function LatchGameOptions(const MenuName
: string): Byte;
716 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
718 Map
:= TGUILabel(GetControl('lbMap')).Text;
721 if not isWadPath(Map
) then
724 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
725 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
726 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
727 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
728 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
729 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
730 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
734 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
735 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
736 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
737 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
738 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
739 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
740 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
741 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
742 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
743 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
745 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
746 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
747 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
748 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
751 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
752 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
753 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
754 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
757 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
758 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
759 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
760 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
763 // TODO: get this crap out of here
764 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
765 gGameSettings
.WarmupTime
:= gsWarmupTime
;
766 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
770 procedure ProcStartCustomGame();
774 GameMode
:= LatchGameOptions('mCustomGameMenu');
775 if GameMode
= GM_NONE
then Exit
;
777 g_Console_WriteGameConfig
;
778 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
779 gsMaxLives
, gsGameFlags
, gsPlayers
);
783 procedure ProcStartNetGame();
787 GameMode
:= LatchGameOptions('mNetServerMenu');
788 if GameMode
= GM_NONE
then Exit
;
790 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
792 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
793 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
794 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
795 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
796 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
797 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
800 g_Console_WriteGameConfig
;
801 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
802 gsGameFlags
, gsPlayers
, 0, NetPort
);
805 procedure ProcConnectNetGame();
809 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
811 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
812 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
813 PW
:= TGUIEdit(GetControl('edPW')).Text;
816 g_Console_WriteGameConfig
;
817 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
820 procedure ProcEnterPassword();
824 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
826 NetClientIP
:= PromptIP
;
827 NetClientPort
:= PromptPort
;
828 PW
:= TGUIEdit(GetControl('edPW')).Text;
831 g_Console_WriteGameConfig
;
832 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
835 procedure ProcServerlist();
837 if not NetInitDone
then
839 if (not g_Net_Init()) then
841 g_Console_Add('NET: ERROR: Failed to init ENet!');
848 g_Net_Slist_Set(NetMasterList
);
850 gState
:= STATE_SLIST
;
851 g_ActiveWindow
:= nil;
853 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
858 slReturnPressed
:= True;
859 if g_Net_Slist_Fetch(slCurrent
) then
861 if slCurrent
= nil then
862 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
865 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
866 g_Serverlist_GenerateTable(slCurrent
, slTable
);
869 procedure ProcStartCampaign();
875 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
877 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
878 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
880 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
886 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
889 procedure ProcSelectMap(Sender
: TGUIControl
);
893 wad
, map
, res
: String;
895 win
:= g_GUI_GetWindow('SelectMapMenu');
896 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
898 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
899 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
901 if (wad
= '') or (map
= '') then
902 begin // Ýòî íå êàðòà
903 TGUILabel(GetControl('lbMapName')).Text := '';
904 TGUILabel(GetControl('lbMapAuthor')).Text := '';
905 TGUILabel(GetControl('lbMapSize')).Text := '';
906 TGUIMemo(GetControl('meMapDescription')).SetText('');
907 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
908 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
914 a
:= g_Map_GetMapInfo(res
);
916 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
917 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
918 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
919 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
920 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
921 TGUILabel(win
.GetControl('lbMapScale')).Text :=
922 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
927 procedure ProcSelectWAD(Sender
: TGUIControl
);
932 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
934 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
936 with TGUIListBox(GetControl('lsMapRes')) do
942 list
:= g_Map_GetMapsList(wad
);
956 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
962 win
:= g_GUI_GetWindow('CampaignMenu');
963 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
965 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
969 TGUILabel(GetControl('lbWADName')).Text := '';
970 TGUILabel(GetControl('lbWADAuthor')).Text := '';
971 TGUIMemo(GetControl('meWADDescription')).SetText('');
974 a
:= g_Game_GetMegaWADInfo(wad
);
976 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
977 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
978 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
980 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
984 fn
:= g_ExtractWadName(a
.pic
);
986 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
988 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
993 procedure ProcChangeColor(Sender
: TGUIControl
);
997 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
998 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
999 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1000 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1001 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1002 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1004 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1005 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1006 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1007 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1008 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1009 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1012 procedure ProcSelectModel(Sender
: TGUIControl
);
1017 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1018 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1019 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1021 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1022 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1023 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1025 ProcChangeColor(nil);
1028 procedure MenuLoadData();
1030 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1032 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1033 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1034 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1035 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1036 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1037 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1038 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1039 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1040 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1041 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1042 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1043 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1044 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1045 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1046 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1047 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1048 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1049 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1050 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1051 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1052 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1053 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1054 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1055 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1056 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1058 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1059 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1060 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1061 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1062 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1063 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1064 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1067 procedure MenuFreeData();
1069 e_CharFont_Remove(gMenuFont
);
1070 e_CharFont_Remove(gMenuSmallFont
);
1072 g_Texture_Delete('MAINMENU_LOGO');
1073 g_Texture_Delete('MAINMENU_MARKER1');
1074 g_Texture_Delete('MAINMENU_MARKER2');
1075 g_Texture_Delete('SCROLL_LEFT');
1076 g_Texture_Delete('SCROLL_RIGHT');
1077 g_Texture_Delete('SCROLL_MIDDLE');
1078 g_Texture_Delete('SCROLL_MARKER');
1079 g_Texture_Delete('EDIT_LEFT');
1080 g_Texture_Delete('EDIT_RIGHT');
1081 g_Texture_Delete('EDIT_MIDDLE');
1082 g_Texture_Delete('BOX1');
1083 g_Texture_Delete('BOX2');
1084 g_Texture_Delete('BOX3');
1085 g_Texture_Delete('BOX4');
1086 g_Texture_Delete('BOX5');
1087 g_Texture_Delete('BOX6');
1088 g_Texture_Delete('BOX7');
1089 g_Texture_Delete('BOX8');
1090 g_Texture_Delete('BOX9');
1091 g_Texture_Delete('BSCROLL_UP_A');
1092 g_Texture_Delete('BSCROLL_UP_U');
1093 g_Texture_Delete('BSCROLL_DOWN_A');
1094 g_Texture_Delete('BSCROLL_DOWN_U');
1095 g_Texture_Delete('BSCROLL_MIDDLE');
1096 g_Texture_Delete('NOPIC');
1098 g_Sound_Delete('MENU_SELECT');
1099 g_Sound_Delete('MENU_OPEN');
1100 g_Sound_Delete('MENU_CLOSE');
1101 g_Sound_Delete('MENU_CHANGE');
1102 g_Sound_Delete('SCROLL_ADD');
1103 g_Sound_Delete('SCROLL_SUB');
1104 g_Sound_Delete('SOUND_PLAYER_FALL');
1107 procedure ProcAuthorsMenu();
1109 gMusic
.SetByName('MUSIC_INTERMUS');
1113 procedure ProcExitMenuKeyDown (yes
: Boolean);
1116 snd
: TPlayableSound
;
1121 g_Game_StopAllSounds(True);
1122 case (Random(18)) of
1123 0: s
:= 'SOUND_MONSTER_PAIN';
1124 1: s
:= 'SOUND_MONSTER_DIE_3';
1125 2: s
:= 'SOUND_MONSTER_SLOP';
1126 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1127 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1128 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1129 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1130 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1131 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1132 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1133 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1134 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1135 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1136 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1137 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1138 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1139 else s
:= 'SOUND_PLAYER_FALL';
1141 snd
:= TPlayableSound
.Create();
1142 res
:= snd
.SetByName(s
);
1143 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1147 while snd
.IsPlaying() do begin end;
1155 procedure ProcLoadMenu();
1162 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1163 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1164 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1168 procedure ProcSaveMenu();
1176 name
:= g_GetSaveName(a
, valid
);
1177 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1178 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1182 procedure ProcSaveGame(Sender
: TGUIControl
);
1186 if g_Game_IsNet
then Exit
;
1187 if g_Game_IsTestMap
then Exit
;
1188 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1189 g_Game_PauseAllSounds(True);
1190 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1192 g_ActiveWindow
:= nil;
1193 g_Game_Pause(False);
1196 procedure ProcLoadGame(Sender
: TGUIControl
);
1200 if g_Game_IsNet
then Exit
;
1201 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1202 if g_LoadGame(a
) then
1204 g_Game_PauseAllSounds(False)
1206 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1208 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1209 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1210 //g_ActiveWindow := nil;
1214 procedure ProcSinglePlayer (n
: Integer);
1215 var wad
, map
: AnsiString;
1218 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1219 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1220 if e_FindResource(AllMapDirs
, wad
) then
1222 wad
:= ExpandFileName(wad
);
1223 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1227 procedure ProcSingle1Player
;
1232 procedure ProcSingle2Players
;
1237 procedure ProcSelectMapMenu();
1240 wad_lb
: TGUIFileListBox
;
1241 map_lb
: TGUIListBox
;
1244 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1245 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1246 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1248 if wad_lb
.SelectedItem() <> '' then
1249 map
:= map_lb
.SelectedItem()
1253 wad_lb
.UpdateFileList();
1256 if wad_lb
.SelectedItem() <> '' then
1259 map_lb
.SelectItem(map
);
1261 if map_lb
.SelectedItem() <> '' then
1265 g_GUI_ShowWindow('SelectMapMenu');
1268 procedure ProcSelectCampaignMenu();
1271 wad_lb
: TGUIFileListBox
;
1273 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1274 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1276 wad_lb
.UpdateFileList();
1278 if wad_lb
.SelectedItem() <> '' then
1279 ProcSelectCampaignWAD(nil);
1282 procedure ProcSetMap();
1284 wad
, map
, res
: String;
1286 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1288 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1289 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1292 if (wad
= '') or (map
= '') then
1295 wad
:= e_FindWadRel(MapDirs
, WAD
);
1297 res
:= wad
+':\'+map
;
1299 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1300 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1303 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1307 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1309 g_Sound_SetupAllVolumes(
1310 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1311 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1315 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1320 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1322 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1323 g_dbg_scale
:= TempScale
+ 1;
1327 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1331 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1332 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1333 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1334 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1337 procedure ProcOptionsPlayersMIMenu();
1342 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1344 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1346 if a
= '' then Exit
;
1348 i
:= g_PlayerModel_GetIndex(a
);
1349 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1351 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1352 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1353 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1355 if PlayerModelsArray
[i
].HaveWeapon
then
1356 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1358 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1361 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1364 procedure ProcOptionsPlayerP1WeaponMenu();
1368 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1369 if a
= '' then Exit
;
1370 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1373 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1375 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1378 procedure ProcOptionsPlayerP2WeaponMenu();
1382 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1383 if a
= '' then Exit
;
1384 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1387 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1389 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1392 procedure ProcOptionsPlayersAnim();
1396 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1401 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1404 Model
.AnimState
.Loop
:= True;
1408 procedure ProcOptionsPlayersWeap();
1412 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1417 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1421 procedure ProcOptionsPlayersRot();
1425 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1426 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1428 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1432 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1436 g_Options_SetDefault();
1442 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1444 if yes
then ReadOptions();
1448 procedure ProcAuthorsClose();
1450 gMusic
.SetByName('MUSIC_MENU');
1452 gState
:= STATE_MENU
;
1455 procedure ProcGMClose();
1457 g_Game_InGameMenu(False);
1460 procedure ProcGMShow();
1465 if (gGameSettings
.GameType
= GT_SINGLE
) and
1466 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1467 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1468 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1470 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1471 if g_Game_IsTestMap
then
1472 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1473 TGUIMainMenu(g_ActiveWindow
.GetControl(
1474 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1477 procedure ProcChangePlayers();
1479 TeamGame
, Spectator
, AddTwo
: Boolean;
1480 P1Team
{, P2Team}: Byte;
1481 bP2
: TGUITextButton
;
1483 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1484 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1485 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1486 P1Team
:= TEAM_NONE
;
1487 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1489 //P2Team := TEAM_NONE;
1490 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1492 TGUIMainMenu(g_ActiveWindow
.GetControl(
1493 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1494 TGUIMainMenu(g_ActiveWindow
.GetControl(
1495 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1496 TGUIMainMenu(g_ActiveWindow
.GetControl(
1497 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1499 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1500 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1501 bP2
.Enabled
:= AddTwo
and not Spectator
;
1503 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1505 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1506 if gPlayer2
= nil then
1507 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1509 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1511 TGUIMainMenu(g_ActiveWindow
.GetControl(
1512 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1515 procedure ProcJoinRed();
1517 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1519 if g_Game_IsServer
then
1521 if gPlayer1
= nil then
1522 g_Game_AddPlayer(TEAM_RED
)
1525 if gPlayer1
.Team
<> TEAM_RED
then
1527 gPlayer1
.SwitchTeam
;
1528 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1531 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1536 gPlayer1Settings
.Team
:= TEAM_RED
;
1537 MC_SEND_PlayerSettings
;
1538 if gPlayer1
= nil then
1539 g_Game_AddPlayer(TEAM_RED
);
1541 g_ActiveWindow
:= nil;
1542 g_Game_Pause(False);
1545 procedure ProcJoinBlue();
1547 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1549 if g_Game_IsServer
then
1551 if gPlayer1
= nil then
1552 g_Game_AddPlayer(TEAM_BLUE
)
1555 if gPlayer1
.Team
<> TEAM_BLUE
then
1557 gPlayer1
.SwitchTeam
;
1558 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1561 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1566 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1567 MC_SEND_PlayerSettings
;
1568 if gPlayer1
= nil then
1569 g_Game_AddPlayer(TEAM_BLUE
);
1571 g_ActiveWindow
:= nil;
1572 g_Game_Pause(False);
1575 procedure ProcJoinGame();
1577 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1579 if gPlayer1
= nil then
1581 g_ActiveWindow
:= nil;
1582 g_Game_Pause(False);
1585 procedure ProcSwitchP2();
1587 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1589 if gPlayer1
= nil then
1591 if gPlayer2
= nil then
1594 g_Game_RemovePlayer();
1595 g_ActiveWindow
:= nil;
1596 g_Game_Pause(False);
1599 procedure ProcSpectate();
1601 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1604 g_ActiveWindow
:= nil;
1605 g_Game_Pause(False);
1608 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1610 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1613 procedure ProcEndMenuKeyDown (yes
: Boolean);
1615 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1618 procedure ProcSetRussianLanguage
;
1620 if gLanguage
<> LANGUAGE_RUSSIAN
then
1622 gLanguage
:= LANGUAGE_RUSSIAN
;
1623 gLanguageChange
:= True;
1624 gAskLanguage
:= False;
1629 procedure ProcSetEnglishLanguage
;
1631 if gLanguage
<> LANGUAGE_ENGLISH
then
1633 gLanguage
:= LANGUAGE_ENGLISH
;
1634 gLanguageChange
:= True;
1635 gAskLanguage
:= False;
1640 procedure ReadGameSettings();
1644 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1646 with gGameSettings
do
1648 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1649 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1653 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1654 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1656 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1658 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1662 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1663 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1667 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1668 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1670 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1675 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1676 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1677 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1679 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1680 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1681 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1684 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1689 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1691 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1692 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1693 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1695 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1696 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1700 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1701 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1703 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1704 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1705 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1706 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1707 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1708 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1709 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1710 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1714 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1715 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1716 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1717 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1718 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1723 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1724 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1729 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1730 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1735 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1736 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1737 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1742 procedure ProcApplyGameSet();
1746 stat
: TPlayerStatArray
;
1748 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1750 if not g_Game_IsServer
then Exit
;
1752 with gGameSettings
do
1754 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1756 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1757 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1759 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1762 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1764 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1765 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1766 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1767 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1768 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1772 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1774 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1775 Options
:= Options
or GAME_OPTION_DMKEYS
1777 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1780 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1782 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1788 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1790 TimeLimit
:= Max(n
, b
);
1794 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1796 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1803 if GameMode
= GM_DM
then
1805 stat
:= g_Player_GetStats();
1807 for a
:= 0 to High(stat
) do
1808 if stat
[a
].Frags
> b
then
1812 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1814 ScoreLimit
:= Max(n
, b
);
1818 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1820 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1821 if n
< 0 then n
:= 0;
1822 if n
> 255 then n
:= 255;
1828 stat
:= g_Player_GetStats();
1830 for a
:= 0 to High(stat
) do
1831 if stat
[a
].Lives
> b
then
1834 MaxLives
:= Max(n
, b
);
1838 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1840 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1843 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1844 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1848 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1849 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1853 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1854 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1859 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1861 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1862 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1863 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1864 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1868 // don't forget to latch this shit
1869 gsGameFlags
:= Options
;
1870 gsMaxLives
:= MaxLives
;
1871 gsScoreLimit
:= ScoreLimit
;
1872 gsTimeLimit
:= TimeLimit
;
1875 if g_Game_IsNet
then MH_SEND_GameSettings
;
1878 procedure ProcVideoOptionsRes();
1883 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1885 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1886 IntToStr(gWinSizeX
) +
1887 ' x ' + IntToStr(gWinSizeY
) +
1888 ', ' + IntToStr(gBPP
) + ' bpp';
1890 with TGUIListBox(menu
.GetControl('lsResolution')) do
1892 list
:= sys_GetDisplayModes(gBPP
);
1896 ItemIndex
:= Length(list
)
1904 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1910 TempResScale
:= Round(r_pixel_scale
- 1);
1911 with TGUISwitch(menu
.GetControl('swResFactor')) do
1912 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1915 procedure ProcApplyVideoOptions();
1918 Fullscreen
: Boolean;
1919 SWidth
, SHeight
: Integer;
1920 ScaleChanged
: Boolean;
1923 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1925 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1927 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1930 SWidth
:= gWinSizeX
;
1931 SHeight
:= gWinSizeY
;
1932 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1935 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1937 ScaleChanged
:= False;
1938 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1940 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1941 r_pixel_scale
:= TempResScale
+ 1;
1942 ScaleChanged
:= True;
1945 if (SWidth
<> gWinSizeX
) or
1946 (SHeight
<> gWinSizeY
) or
1947 (Fullscreen
<> gFullscreen
) or
1950 gResolutionChange
:= True;
1951 gRC_Width
:= SWidth
;
1952 gRC_Height
:= SHeight
;
1953 gRC_FullScreen
:= Fullscreen
;
1954 gRC_Maximized
:= gWinMaximized
;
1957 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1961 procedure ProcSetFirstRussianLanguage
;
1963 gLanguage
:= LANGUAGE_RUSSIAN
;
1964 gLanguageChange
:= True;
1965 gAskLanguage
:= False;
1968 procedure ProcSetFirstEnglishLanguage
;
1970 gLanguage
:= LANGUAGE_ENGLISH
;
1971 gLanguageChange
:= True;
1972 gAskLanguage
:= False;
1975 procedure ProcRecallAddress();
1977 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1979 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1980 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1984 procedure CreateFirstLanguageMenu();
1988 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1990 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1992 Name
:= 'mmFirstLanguageMenu';
1993 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1994 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1997 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1998 Menu
.MainWindow
:= True;
1999 g_GUI_AddWindow(Menu
);
2002 procedure g_Menu_AskLanguage();
2004 CreateFirstLanguageMenu();
2005 g_GUI_ShowWindow('FirstLanguageMenu');
2008 procedure CreatePlayerOptionsMenu(s
: String);
2013 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2015 a
:= _lc
[I_MENU_PLAYER_1
]
2017 a
:= _lc
[I_MENU_PLAYER_2
];
2018 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2020 Name
:= 'mOptionsPlayers'+s
+'Menu';
2021 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2023 Name
:= 'ed'+s
+'Name';
2027 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2029 Name
:= 'sw'+s
+'Team';
2030 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2031 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2033 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2035 Name
:= 'ls'+s
+'Model';
2037 Items
:= g_PlayerModel_GetNames();
2038 OnChange
:= ProcSelectModel
;
2040 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2042 Name
:= 'sc'+s
+'Red';
2044 OnChange
:= ProcChangeColor
;
2046 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2048 Name
:= 'sc'+s
+'Green';
2050 OnChange
:= ProcChangeColor
;
2052 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2054 Name
:= 'sc'+s
+'Blue';
2056 OnChange
:= ProcChangeColor
;
2059 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2060 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2061 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2062 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2063 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2064 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2065 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2067 Name
:= 'mv'+s
+'Model';
2068 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2069 Y
:= GetControl('ls'+s
+'Model').Y
;
2072 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2073 g_GUI_AddWindow(Menu
);
2076 procedure CreateAllMenus();
2080 a
, cx
, _y
, i
: Integer;
2083 Menu
:= TGUIWindow
.Create('MainMenu');
2084 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2086 Name
:= 'mmMainMenu';
2087 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2088 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2089 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2090 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2091 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2092 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2094 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2096 Color
:= _RGB(255, 255, 255);
2097 X
:= gScreenWidth
-GetWidth
-8;
2098 Y
:= gScreenHeight
-GetHeight
-8;
2100 Menu
.DefControl
:= 'mmMainMenu';
2101 Menu
.MainWindow
:= True;
2102 g_GUI_AddWindow(Menu
);
2104 Menu
:= TGUIWindow
.Create('NewGameMenu');
2105 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2107 Name
:= 'mmNewGameMenu';
2108 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2109 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2110 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2111 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2113 Menu
.DefControl
:= 'mmNewGameMenu';
2114 g_GUI_AddWindow(Menu
);
2116 Menu
:= TGUIWindow
.Create('NetGameMenu');
2117 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2119 Name
:= 'mmNetGameMenu';
2120 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2121 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2123 Menu
.DefControl
:= 'mmNetGameMenu';
2124 g_GUI_AddWindow(Menu
);
2126 Menu
:= TGUIWindow
.Create('NetServerMenu');
2127 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2129 Name
:= 'mNetServerMenu';
2130 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2132 Name
:= 'edSrvName';
2133 OnlyDigits
:= False;
2136 Text := NetServerName
;
2138 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2140 Name
:= 'edSrvPassword';
2141 OnlyDigits
:= False;
2144 Text := NetPassword
;
2146 with AddEdit(_lc
[I_NET_PORT
]) do
2152 Text := IntToStr(NetPort
);
2154 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2156 Name
:= 'edMaxPlayers';
2160 Text := IntToStr(NetMaxClients
);
2162 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2164 Name
:= 'swUseMaster';
2165 AddItem(_lc
[I_MENU_YES
]);
2166 AddItem(_lc
[I_MENU_NO
]);
2167 if NetUseMaster
then
2173 with AddLabel(_lc
[I_MENU_MAP
]) do
2178 OnClick
:= @ProcSelectMapMenu
;
2180 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2182 Name
:= 'swGameMode';
2183 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2184 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2185 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2186 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2187 case g_Game_TextToMode(gsGameMode
) of
2189 GM_DM
: ItemIndex
:= 0;
2190 GM_TDM
: ItemIndex
:= 1;
2191 GM_CTF
: ItemIndex
:= 2;
2193 GM_COOP
: ItemIndex
:= 3;
2195 OnChange
:= ProcSwitchMonstersCustom
;
2197 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2199 Name
:= 'edTimeLimit';
2203 if gsTimeLimit
> 0 then
2204 Text := IntToStr(gsTimeLimit
);
2206 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2208 Name
:= 'edScoreLimit';
2212 if gsScoreLimit
> 0 then
2213 Text := IntToStr(gsScoreLimit
);
2215 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2217 Name
:= 'edMaxLives';
2221 if gsMaxLives
> 0 then
2222 Text := IntToStr(gsMaxLives
);
2224 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2226 Name
:= 'edItemRespawnTime';
2230 if gsItemRespawnTime
> 0 then
2231 Text := IntToStr(gsItemRespawnTime
);
2233 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2235 Name
:= 'swPlayers';
2236 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2237 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2238 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2239 ItemIndex
:= gsPlayers
;
2241 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2243 Name
:= 'swTeamDamage';
2244 AddItem(_lc
[I_MENU_YES
]);
2245 AddItem(_lc
[I_MENU_NO
]);
2246 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2251 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2253 Name
:= 'swTeamHit';
2254 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2255 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2256 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2257 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2258 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2260 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2262 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2267 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2269 Name
:= 'swDeathmatchKeys';
2270 AddItem(_lc
[I_MENU_YES
]);
2271 AddItem(_lc
[I_MENU_NO
]);
2272 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2277 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2279 Name
:= 'swEnableExits';
2280 AddItem(_lc
[I_MENU_YES
]);
2281 AddItem(_lc
[I_MENU_NO
]);
2282 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2287 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2289 Name
:= 'swWeaponStay';
2290 AddItem(_lc
[I_MENU_YES
]);
2291 AddItem(_lc
[I_MENU_NO
]);
2292 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2297 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2299 Name
:= 'swMonsters';
2300 AddItem(_lc
[I_MENU_YES
]);
2301 AddItem(_lc
[I_MENU_NO
]);
2302 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2307 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2310 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2311 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2312 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2314 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2316 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2319 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2321 Name
:= 'swFlagDrop';
2322 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2323 AddItem(_lc
[I_MENU_YES
]);
2324 AddItem(_lc
[I_MENU_NO
]);
2325 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2327 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2333 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2337 Menu
.DefControl
:= 'mNetServerMenu';
2338 g_GUI_AddWindow(Menu
);
2340 Menu
:= TGUIWindow
.Create('NetClientMenu');
2341 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2343 Name
:= 'mNetClientMenu';
2345 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2348 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2354 Text := 'localhost';
2356 with AddEdit(_lc
[I_NET_PORT
]) do
2364 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2367 OnlyDigits
:= False;
2374 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2378 Menu
.DefControl
:= 'mNetClientMenu';
2379 g_GUI_AddWindow(Menu
);
2381 Menu
:= TGUIWindow
.Create('LoadMenu');
2382 Menu
.OnShow
:= ProcLoadMenu
;
2383 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2385 Name
:= 'mmLoadMenu';
2390 Name
:= 'edSlot'+IntToStr(a
);
2393 OnEnter
:= ProcLoadGame
;
2396 Menu
.DefControl
:= 'mmLoadMenu';
2397 g_GUI_AddWindow(Menu
);
2399 Menu
:= TGUIWindow
.Create('SaveMenu');
2400 Menu
.OnShow
:= ProcSaveMenu
;
2401 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2403 Name
:= 'mmSaveMenu';
2408 Name
:= 'edSlot'+IntToStr(a
);
2411 OnChange
:= ProcSaveGame
;
2414 Menu
.DefControl
:= 'mmSaveMenu';
2415 g_GUI_AddWindow(Menu
);
2417 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2418 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2420 Name
:= 'mCustomGameMenu';
2421 with AddLabel(_lc
[I_MENU_MAP
]) do
2426 OnClick
:= @ProcSelectMapMenu
;
2428 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2430 Name
:= 'swGameMode';
2431 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2432 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2433 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2434 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2435 case g_Game_TextToMode(gsGameMode
) of
2437 GM_DM
: ItemIndex
:= 0;
2438 GM_TDM
: ItemIndex
:= 1;
2439 GM_CTF
: ItemIndex
:= 2;
2441 GM_COOP
: ItemIndex
:= 3;
2443 OnChange
:= ProcSwitchMonstersCustom
;
2445 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2447 Name
:= 'edTimeLimit';
2451 if gsTimeLimit
> 0 then
2452 Text := IntToStr(gsTimeLimit
);
2454 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2456 Name
:= 'edScoreLimit';
2460 if gsScoreLimit
> 0 then
2461 Text := IntToStr(gsScoreLimit
);
2463 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2465 Name
:= 'edMaxLives';
2469 if gsMaxLives
> 0 then
2470 Text := IntToStr(gsMaxLives
);
2472 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2474 Name
:= 'edItemRespawnTime';
2478 if gsItemRespawnTime
> 0 then
2479 Text := IntToStr(gsItemRespawnTime
);
2481 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2483 Name
:= 'swPlayers';
2484 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2485 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2486 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2487 ItemIndex
:= gsPlayers
;
2489 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2491 Name
:= 'swTeamDamage';
2492 AddItem(_lc
[I_MENU_YES
]);
2493 AddItem(_lc
[I_MENU_NO
]);
2494 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2499 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2501 Name
:= 'swTeamHit';
2502 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2503 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2504 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2505 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2506 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2508 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2510 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2515 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2517 Name
:= 'swDeathmatchKeys';
2518 AddItem(_lc
[I_MENU_YES
]);
2519 AddItem(_lc
[I_MENU_NO
]);
2520 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2525 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2527 Name
:= 'swEnableExits';
2528 AddItem(_lc
[I_MENU_YES
]);
2529 AddItem(_lc
[I_MENU_NO
]);
2530 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2535 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2537 Name
:= 'swWeaponStay';
2538 AddItem(_lc
[I_MENU_YES
]);
2539 AddItem(_lc
[I_MENU_NO
]);
2540 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2545 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2547 Name
:= 'swMonsters';
2548 AddItem(_lc
[I_MENU_YES
]);
2549 AddItem(_lc
[I_MENU_NO
]);
2550 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2555 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2558 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2559 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2560 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2562 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2564 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2567 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2569 Name
:= 'swFlagDrop';
2570 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2571 AddItem(_lc
[I_MENU_YES
]);
2572 AddItem(_lc
[I_MENU_NO
]);
2573 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2575 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2581 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2585 Menu
.DefControl
:= 'mCustomGameMenu';
2586 g_GUI_AddWindow(Menu
);
2588 Menu
:= TGUIWindow
.Create('CampaignMenu');
2589 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2591 Name
:= 'mCampaignMenu';
2600 with AddFileList('', 15, 4) do
2603 OnChange
:= ProcSelectCampaignWAD
;
2607 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2608 SetBase(MegawadDirs
);
2611 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2613 Name
:= 'lbWADName';
2617 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2619 Name
:= 'lbWADAuthor';
2623 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2624 with AddMemo('', 15, 3) do
2626 Name
:= 'meWADDescription';
2627 Color
:= MENU_ITEMSCTRL_COLOR
;
2629 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2631 Name
:= 'swPlayers';
2632 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2633 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2636 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2640 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2642 Name
:= 'mpWADImage';
2643 DefaultRes
:= 'NOPIC';
2644 X
:= GetControl('lsWAD').X
+4;
2645 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2648 Menu
.DefControl
:= 'mCampaignMenu';
2649 g_GUI_AddWindow(Menu
);
2651 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2652 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2654 Name
:= 'mSelectMapMenu';
2655 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2658 OnChange
:= ProcSelectWAD
;
2662 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2665 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2669 OnChange
:= ProcSelectMap
;
2672 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2674 Name
:= 'lbMapName';
2678 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2680 Name
:= 'lbMapAuthor';
2684 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2686 Name
:= 'lbMapSize';
2690 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2692 Name
:= 'meMapDescription';
2697 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2699 Name
:= 'mpMapPreview';
2700 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2701 Y
:= GetControl('lsMapWAD').Y
;
2703 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2705 Name
:= 'lbMapScale';
2708 Color
:= MENU_ITEMSCTRL_COLOR
;
2709 X
:= GetControl('lsMapWAD').X
+
2710 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2711 2 + MAPPREVIEW_WIDTH
*4;
2712 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2715 Menu
.OnClose
:= ProcSetMap
;
2716 Menu
.DefControl
:= 'mSelectMapMenu';
2717 g_GUI_AddWindow(Menu
);
2719 Menu
:= TGUIWindow
.Create('OptionsMenu');
2720 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2722 Name
:= 'mmOptionsMenu';
2723 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2724 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2725 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2726 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2727 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2728 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2730 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2731 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2733 Menu
.OnClose
:= ProcApplyOptions
;
2734 Menu
.DefControl
:= 'mmOptionsMenu';
2735 g_GUI_AddWindow(Menu
);
2737 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2738 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2739 g_GUI_AddWindow(Menu
);
2741 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2742 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2744 Name
:= 'mOptionsVideoMenu';
2745 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2746 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2752 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2755 AddItem(_lc
[I_MENU_YES
]);
2756 AddItem(_lc
[I_MENU_NO
]);
2758 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2760 Name
:= 'swTextureFilter';
2761 AddItem(_lc
[I_MENU_YES
]);
2762 AddItem(_lc
[I_MENU_NO
]);
2764 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2767 AddItem(_lc
[I_MENU_YES
]);
2768 AddItem(_lc
[I_MENU_NO
]);
2770 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2772 Name
:= 'swLegacyNPOT';
2773 AddItem(_lc
[I_MENU_NO
]);
2774 AddItem(_lc
[I_MENU_YES
]);
2777 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2780 Menu
.DefControl
:= 'mOptionsVideoMenu';
2781 g_GUI_AddWindow(Menu
);
2783 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2784 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2786 Name
:= 'mOptionsVideoResMenu';
2787 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2789 Name
:= 'lbCurrentRes';
2793 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2795 Name
:= 'lsResolution';
2798 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2800 Name
:= 'swFullScreen';
2801 AddItem(_lc
[I_MENU_YES
]);
2802 AddItem(_lc
[I_MENU_NO
]);
2804 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2806 Name
:= 'swResFactor';
2808 for i
:= 2 to gRC_Width
div 640 do
2809 AddItem(IntToStr(i
) + 'x');
2812 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2815 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2816 g_GUI_AddWindow(Menu
);
2818 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2819 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2821 Name
:= 'mOptionsSoundMenu';
2822 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2824 Name
:= 'scMusicLevel';
2826 OnChange
:= ProcChangeSoundSettings
;
2828 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2830 Name
:= 'scSoundLevel';
2832 OnChange
:= ProcChangeSoundSettings
;
2834 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2836 Name
:= 'scMaxSimSounds';
2839 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2841 Name
:= 'swAnnouncer';
2842 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2843 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2844 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2845 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2847 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2848 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2850 Name
:= 'swSoundEffects';
2851 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2852 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2854 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2855 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2857 Name
:= 'swChatSpeech';
2858 AddItem(_lc
[I_MENU_YES
]);
2859 AddItem(_lc
[I_MENU_NO
]);
2861 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2863 Name
:= 'swInactiveSounds';
2864 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2865 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2869 Menu
.DefControl
:= 'mOptionsSoundMenu';
2870 g_GUI_AddWindow(Menu
);
2872 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2873 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2875 Name
:= 'mOptionsGameMenu';
2876 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2878 Name
:= 'scParticlesCount';
2881 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2883 Name
:= 'swBloodCount';
2884 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2885 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2886 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2887 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2888 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2890 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2892 Name
:= 'scShellsMax';
2895 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2897 Name
:= 'scGibsMax';
2900 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2902 Name
:= 'scCorpsesMax';
2905 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2907 Name
:= 'swGibsCount';
2908 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2909 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2910 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2911 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2912 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2914 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2916 Name
:= 'swCorpseType';
2917 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2918 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2920 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2922 Name
:= 'swGibsType';
2923 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2924 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2926 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2928 Name
:= 'swBloodType';
2929 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2930 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2932 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2934 Name
:= 'swScreenFlash';
2935 AddItem(_lc
[I_MENU_NO
]);
2936 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2937 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2939 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2941 Name
:= 'swBackground';
2942 AddItem(_lc
[I_MENU_YES
]);
2943 AddItem(_lc
[I_MENU_NO
]);
2945 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2947 Name
:= 'swMessages';
2948 AddItem(_lc
[I_MENU_YES
]);
2949 AddItem(_lc
[I_MENU_NO
]);
2951 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2953 Name
:= 'swRevertPlayers';
2954 AddItem(_lc
[I_MENU_YES
]);
2955 AddItem(_lc
[I_MENU_NO
]);
2957 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2959 Name
:= 'swChatBubble';
2960 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2961 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2962 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2963 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2964 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2966 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2968 Name
:= 'swPlayerIndicator';
2969 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2970 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2971 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2973 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2975 Name
:= 'swPlayerIndicatorStyle';
2976 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2977 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2979 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2981 Name
:= 'scScaleFactor';
2983 OnChange
:= ProcChangeGameSettings
;
2987 Menu
.DefControl
:= 'mOptionsGameMenu';
2988 g_GUI_AddWindow(Menu
);
2990 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2991 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2993 Name
:= 'mOptionsControlsMenu';
2994 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2995 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2996 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2997 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2998 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3000 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3001 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3002 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3003 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3004 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3005 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3006 if e_HasJoysticks
then
3009 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3011 if g_touch_enabled
then
3014 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3017 Menu
.DefControl
:= 'mOptionsControlsMenu';
3018 g_GUI_AddWindow(Menu
);
3020 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3021 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3023 Name
:= 'mOptionsControlsP1Menu';
3024 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3025 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3026 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3027 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3028 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3029 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3030 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3031 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3032 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3033 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3034 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3036 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3037 g_GUI_AddWindow(Menu
);
3039 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3040 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3042 Name
:= 'mOptionsControlsP1MenuWeapons';
3043 for i
:= WP_FIRST
to WP_LAST
do
3044 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3045 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3047 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3048 g_GUI_AddWindow(Menu
);
3050 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3051 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3053 Name
:= 'mOptionsControlsP2Menu';
3054 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3055 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3056 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3057 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3058 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3059 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3060 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3061 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3062 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3063 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3064 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3066 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3067 g_GUI_AddWindow(Menu
);
3069 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3070 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3072 Name
:= 'mOptionsControlsP2MenuWeapons';
3073 for i
:= WP_FIRST
to WP_LAST
do
3074 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3075 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3077 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3078 g_GUI_AddWindow(Menu
);
3080 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3081 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3083 Name
:= 'mOptionsControlsJoystickMenu';
3084 for i
:= 0 to e_MaxJoys
- 1 do
3085 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3087 Name
:= 'scDeadzone' + IntToStr(i
);
3091 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3092 g_GUI_AddWindow(Menu
);
3094 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3095 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3097 Name
:= 'mOptionsControlsTouchMenu';
3098 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3100 Name
:= 'swTouchAlt';
3101 AddItem(_lc
[I_MENU_NO
]);
3102 AddItem(_lc
[I_MENU_YES
]);
3103 OnChange
:= ProcChangeTouchSettings
;
3105 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3107 Name
:= 'scTouchSize';
3109 OnChange
:= ProcChangeTouchSettings
;
3111 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3113 Name
:= 'swTouchFire';
3114 AddItem(_lc
[I_MENU_NO
]);
3115 AddItem(_lc
[I_MENU_YES
]);
3117 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3119 Name
:= 'scTouchOffset';
3121 OnChange
:= ProcChangeTouchSettings
;
3124 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3125 g_GUI_AddWindow(Menu
);
3127 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3128 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3130 Name
:= 'mOptionsPlayersMenu';
3131 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3132 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3134 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3135 g_GUI_AddWindow(Menu
);
3137 CreatePlayerOptionsMenu('P1');
3138 CreatePlayerOptionsMenu('P2');
3140 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3141 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3143 Name
:= 'mOptionsPlayersMIMenu';
3144 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3149 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3154 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3156 Name
:= 'meComment';
3159 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3160 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3163 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3167 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3168 g_GUI_AddWindow(Menu
);
3170 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3171 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3173 Name
:= 'mOptionsPlayersP1WeaponMenu';
3174 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3176 Name
:= 'swWeaponAutoswitch';
3177 AddItem(_lc
[I_MENU_NO
]);
3178 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3179 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3181 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3183 Name
:= 'swWeaponAllowEmpty';
3184 AddItem(_lc
[I_MENU_YES
]);
3185 AddItem(_lc
[I_MENU_NO
]);
3187 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3189 Name
:= 'swWeaponAllowFist';
3190 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3191 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3193 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3196 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3197 g_GUI_AddWindow(Menu
);
3199 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3200 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3202 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3203 for i
:= WP_FIRST
to WP_LAST
do
3205 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3207 Name
:= IntToStr(i
);
3208 for a
:= WP_FIRST
to WP_LAST
+1 do
3210 AddItem(IntToStr(a
));
3215 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3217 Name
:= IntToStr(WP_LAST
+1);
3218 for a
:= WP_FIRST
to WP_LAST
+1 do
3220 AddItem(IntToStr(a
));
3222 ItemIndex
:= WP_LAST
+ 1;
3225 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3226 g_GUI_AddWindow(Menu
);
3229 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3230 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3232 Name
:= 'mOptionsPlayersP2WeaponMenu';
3233 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3235 Name
:= 'swWeaponAutoswitch';
3236 AddItem(_lc
[I_MENU_NO
]);
3237 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3238 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3240 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3242 Name
:= 'swWeaponAllowEmpty';
3243 AddItem(_lc
[I_MENU_YES
]);
3244 AddItem(_lc
[I_MENU_NO
]);
3246 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3248 Name
:= 'swWeaponAllowFist';
3249 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3250 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3252 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3255 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3256 g_GUI_AddWindow(Menu
);
3258 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3259 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3261 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3262 for i
:= WP_FIRST
to WP_LAST
do
3264 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3266 Name
:= IntToStr(i
);
3267 for a
:= WP_FIRST
to WP_LAST
+1 do
3269 AddItem(IntToStr(a
));
3274 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3276 Name
:= IntToStr(WP_LAST
+1);
3277 for a
:= WP_FIRST
to WP_LAST
+1 do
3279 AddItem(IntToStr(a
));
3281 ItemIndex
:= WP_LAST
+ 1;
3284 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3285 g_GUI_AddWindow(Menu
);
3287 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3288 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3290 Name
:= 'mOptionsLanguageMenu';
3291 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3292 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3295 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3296 g_GUI_AddWindow(Menu
);
3298 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3299 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3300 g_GUI_AddWindow(Menu
);
3302 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3303 Menu
.BackTexture
:= 'INTER';
3304 Menu
.OnClose
:= ProcAuthorsClose
;
3308 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3310 Color
:= _RGB(255, 0, 0);
3311 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3313 _y
:= _y
+GetHeight();
3315 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3317 Color
:= _RGB(255, 0, 0);
3318 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3320 _y
:= _y
+GetHeight()+32;
3322 // ×òî äåëàë: Êòî äåëàë
3323 cx
:= gScreenWidth
div 2 - 320 + 64;
3324 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3326 Color
:= _RGB(255, 0, 0);
3331 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3333 Color
:= _RGB(255, 255, 255);
3338 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3340 Color
:= _RGB(255, 0, 0);
3345 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3347 Color
:= _RGB(255, 255, 255);
3352 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3354 Color
:= _RGB(255, 255, 255);
3359 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3361 Color
:= _RGB(255, 0, 0);
3366 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3368 Color
:= _RGB(255, 255, 255);
3373 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3375 Color
:= _RGB(255, 0, 0);
3380 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3382 Color
:= _RGB(255, 255, 255);
3385 _y
:= gScreenHeight
- 128;
3388 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3390 Color
:= _RGB(255, 0, 0);
3395 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3397 Color
:= _RGB(255, 255, 255);
3400 _y
:= _y
+GetHeight();
3402 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3404 Color
:= _RGB(255, 255, 255);
3407 _y
:= _y
+GetHeight();
3409 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3411 Color
:= _RGB(255, 255, 255);
3414 _y
:= gScreenHeight
- 32;
3416 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3418 Color
:= _RGB(255, 0, 0);
3419 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3422 g_GUI_AddWindow(Menu
);
3424 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3425 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3426 g_GUI_AddWindow(Menu
);
3428 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3429 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3431 Name
:= 'mmGameSingleMenu';
3432 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3433 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3434 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3435 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3436 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3437 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3439 Menu
.DefControl
:= 'mmGameSingleMenu';
3440 Menu
.MainWindow
:= True;
3441 Menu
.OnClose
:= ProcGMClose
;
3442 Menu
.OnShow
:= ProcGMShow
;
3443 g_GUI_AddWindow(Menu
);
3445 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3446 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3447 g_GUI_AddWindow(Menu
);
3449 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3450 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3451 g_GUI_AddWindow(Menu
);
3453 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3454 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3456 Name
:= 'mmGameCustomMenu';
3457 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3458 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3459 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3460 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3461 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3462 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3463 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3465 Menu
.DefControl
:= 'mmGameCustomMenu';
3466 Menu
.MainWindow
:= True;
3467 Menu
.OnClose
:= ProcGMClose
;
3468 Menu
.OnShow
:= ProcGMShow
;
3469 g_GUI_AddWindow(Menu
);
3471 Menu
:= TGUIWindow
.Create('GameServerMenu');
3472 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3474 Name
:= 'mmGameServerMenu';
3475 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3476 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3477 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3478 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3479 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3481 Menu
.DefControl
:= 'mmGameServerMenu';
3482 Menu
.MainWindow
:= True;
3483 Menu
.OnClose
:= ProcGMClose
;
3484 Menu
.OnShow
:= ProcGMShow
;
3485 g_GUI_AddWindow(Menu
);
3487 Menu
:= TGUIWindow
.Create('GameClientMenu');
3488 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3490 Name
:= 'mmGameClientMenu';
3491 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3492 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3493 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3495 Menu
.DefControl
:= 'mmGameClientMenu';
3496 Menu
.MainWindow
:= True;
3497 Menu
.OnClose
:= ProcGMClose
;
3498 Menu
.OnShow
:= ProcGMShow
;
3499 g_GUI_AddWindow(Menu
);
3501 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3502 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3504 Name
:= 'mClientPasswordMenu';
3505 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3513 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3516 Menu
.DefControl
:= 'mClientPasswordMenu';
3517 g_GUI_AddWindow(Menu
);
3519 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3520 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3522 Name
:= 'mGameSetGameMenu';
3523 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3525 Name
:= 'swTeamDamage';
3526 AddItem(_lc
[I_MENU_YES
]);
3527 AddItem(_lc
[I_MENU_NO
]);
3530 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3532 Name
:= 'swTeamHit';
3533 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3534 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3535 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3536 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3539 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3541 Name
:= 'swDeathmatchKeys';
3542 AddItem(_lc
[I_MENU_YES
]);
3543 AddItem(_lc
[I_MENU_NO
]);
3546 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3548 Name
:= 'edTimeLimit';
3553 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3555 Name
:= 'edScoreLimit';
3560 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3562 Name
:= 'edMaxLives';
3567 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3570 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3571 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3572 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3575 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3577 Name
:= 'swFlagDrop';
3578 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3579 AddItem(_lc
[I_MENU_YES
]);
3580 AddItem(_lc
[I_MENU_NO
]);
3586 Menu
.DefControl
:= 'mGameSetGameMenu';
3587 Menu
.OnClose
:= ProcApplyGameSet
;
3588 g_GUI_AddWindow(Menu
);
3590 Menu
:= TGUIWindow
.Create('TeamMenu');
3591 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3593 Name
:= 'mmTeamMenu';
3594 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3595 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3596 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3597 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3598 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3600 Menu
.DefControl
:= 'mmTeamMenu';
3601 Menu
.OnShow
:= ProcChangePlayers
;
3602 g_GUI_AddWindow(Menu
);
3605 procedure g_Menu_Show_SaveMenu();
3607 if g_Game_IsTestMap
then
3609 if gGameSettings
.GameType
= GT_SINGLE
then
3610 g_GUI_ShowWindow('GameSingleMenu')
3613 if g_Game_IsClient
then
3616 if g_Game_IsNet
then
3619 g_GUI_ShowWindow('GameCustomMenu');
3621 g_GUI_ShowWindow('SaveMenu');
3622 g_Sound_PlayEx('MENU_OPEN');
3625 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3627 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3628 if gGameSettings
.GameType
= GT_SINGLE
then
3630 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3634 if g_Game_IsClient
then exit
;
3635 if g_Game_IsNet
then exit
;
3636 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3638 g_GUI_ShowWindow('LoadMenu');
3639 g_Sound_PlayEx('MENU_OPEN');
3642 procedure g_Menu_Show_GameSetGame();
3644 if gGameSettings
.GameType
= GT_SINGLE
then
3645 g_GUI_ShowWindow('GameSingleMenu')
3648 if g_Game_IsClient
then
3651 if g_Game_IsNet
then
3652 g_GUI_ShowWindow('GameServerMenu')
3654 g_GUI_ShowWindow('GameCustomMenu');
3657 g_GUI_ShowWindow('GameSetGameMenu');
3658 g_Sound_PlayEx('MENU_OPEN');
3661 procedure g_Menu_Show_OptionsVideo();
3663 if gGameSettings
.GameType
= GT_SINGLE
then
3664 g_GUI_ShowWindow('GameSingleMenu')
3667 if g_Game_IsClient
then
3668 g_GUI_ShowWindow('GameClientMenu')
3670 if g_Game_IsNet
then
3671 g_GUI_ShowWindow('GameServerMenu')
3673 g_GUI_ShowWindow('GameCustomMenu');
3676 g_GUI_ShowWindow('OptionsMenu');
3677 g_GUI_ShowWindow('OptionsVideoMenu');
3678 g_Sound_PlayEx('MENU_OPEN');
3681 procedure g_Menu_Show_OptionsSound();
3683 if gGameSettings
.GameType
= GT_SINGLE
then
3684 g_GUI_ShowWindow('GameSingleMenu')
3687 if g_Game_IsClient
then
3688 g_GUI_ShowWindow('GameClientMenu')
3690 if g_Game_IsNet
then
3691 g_GUI_ShowWindow('GameServerMenu')
3693 g_GUI_ShowWindow('GameCustomMenu');
3696 g_GUI_ShowWindow('OptionsMenu');
3697 g_GUI_ShowWindow('OptionsSoundMenu');
3698 g_Sound_PlayEx('MENU_OPEN');
3701 procedure g_Menu_Show_EndGameMenu();
3703 g_GUI_ShowWindow('EndGameMenu');
3704 g_Sound_PlayEx('MENU_OPEN');
3707 procedure g_Menu_Show_QuitGameMenu();
3709 g_GUI_ShowWindow('ExitMenu');
3710 g_Sound_PlayEx('MENU_OPEN');
3713 procedure g_Menu_Init();
3719 procedure g_Menu_Free();
3724 procedure g_Menu_Reset();
3728 g_GUI_SaveMenuPos();
3729 ex
:= g_GUI_Destroy();
3733 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3738 g_Game_SetDebugMode();
3740 g_GUI_LoadMenuPos();