1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
45 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
46 g_base
, g_basic
, g_console
, g_sound
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, Math
, g_saveload
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
51 utils
, wadreader
, g_system
, r_render
, r_game
;
54 type TYNCallback
= procedure (yes
:Boolean);
56 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
58 if win
.UserData
= nil then exit
;
60 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
61 IK_N
: TYNCallback(win
.UserData
)(false);
65 procedure YesButtonCB (ctl
: TGUITextButton
);
67 if ctl
.UserData
= nil then exit
;
68 TYNCallback(ctl
.UserData
)(true);
71 procedure NoButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(false);
77 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
81 //if length(Text) = 0 then exit;
82 Result
:= TGUIWindow
.Create(WinName
);
85 //OnKeyDownEx := @YNKeyDownProc;
86 //UserData := @ActionProc;
87 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
90 Name
:= '__temp_yes_no_menu:'+WinName
;
92 AddText(Text, MaxLen
);
93 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
94 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
96 DefControl
:= '__temp_yes_no_menu:'+WinName
;
102 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
103 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
105 procedure ProcApplyOptions();
110 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
112 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
117 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
119 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
120 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
121 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
123 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
125 g_Sound_SetupAllVolumes(
126 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
127 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
130 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
131 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
132 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
133 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
134 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
136 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
139 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
141 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
142 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
143 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
145 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
150 else gGibsCount
:= 48;
153 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
154 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
155 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
156 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
157 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
158 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
159 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
160 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
161 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
162 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
163 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
164 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
166 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
167 g_dbg_scale
:= TempScale
+ 1;
171 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
175 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
176 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
177 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
178 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
185 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
196 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
197 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
198 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
219 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
220 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
221 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
235 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
238 for i
:= WP_FIRST
to WP_LAST
do
240 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
242 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
243 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
247 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
258 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
259 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
260 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
281 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
282 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
283 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
297 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
300 for i
:= WP_FIRST
to WP_LAST
do
302 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
303 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
304 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
305 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
309 if e_HasJoysticks
then
311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
314 for i
:= 0 to e_MaxJoys
- 1 do
315 if e_JoystickAvailable
[i
] then
316 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
320 if g_touch_enabled
then
322 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
323 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
324 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
325 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
326 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
329 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
330 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
331 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
332 TEAM_RED
, TEAM_BLUE
);
333 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
335 gPlayer1Settings
.Model
:= Model
.GetName();
336 gPlayer1Settings
.Color
:= Model
.Color
;
339 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
340 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
341 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
342 TEAM_RED
, TEAM_BLUE
);
343 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
345 gPlayer2Settings
.Model
:= Model
.GetName();
346 gPlayer2Settings
.Color
:= Model
.Color
;
349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
350 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
351 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
352 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
353 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
356 for i
:= WP_FIRST
to WP_LAST
+1 do
358 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
362 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
363 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
364 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
365 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
366 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
369 for i
:= WP_FIRST
to WP_LAST
+1 do
371 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
375 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
376 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
378 if g_Game_IsServer
then
380 if gPlayer1
<> nil then
382 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
383 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
384 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
385 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
387 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
389 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
390 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
391 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
392 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
393 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
396 if gPlayer2
<> nil then
398 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
399 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
400 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
401 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
403 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
405 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
406 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
407 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
408 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
409 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
413 if g_Game_IsClient
then
415 MC_SEND_PlayerSettings
;
416 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
419 g_Console_WriteGameConfig
;
422 procedure ReadOptions();
427 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
429 with TGUISwitch(menu
.GetControl('swBPP')) do
435 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
436 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
438 with TGUISwitch(menu
.GetControl('swVSync')) do
439 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
441 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
442 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
444 with TGUISwitch(menu
.GetControl('swInterp')) do
445 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
447 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
449 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
450 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
451 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
453 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
454 if gMuteWhenInactive
then
459 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
461 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
462 if gSoundEffectsDF
then
467 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
468 if gUseChatSounds
then
473 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
501 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
504 for i
:= WP_FIRST
to WP_LAST
do
506 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
507 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
511 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
516 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
520 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
522 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
523 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
524 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
539 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
542 for i
:= WP_FIRST
to WP_LAST
do
544 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
545 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
549 if e_HasJoysticks
then
551 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
554 for i
:= 0 to e_MaxJoys
- 1 do
555 if e_JoystickAvailable
[i
] then
556 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
560 if g_touch_enabled
then
562 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
563 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
564 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
565 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
566 with TGUISwitch(menu
.GetControl('swTouchFire')) do
567 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
568 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
571 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
574 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
575 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
576 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
577 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
580 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
583 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
585 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
586 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
587 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
588 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
590 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
593 with TGUISwitch(menu
.GetControl('swBloodType')) do
594 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
596 with TGUISwitch(menu
.GetControl('swCorpseType')) do
597 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
599 with TGUISwitch(menu
.GetControl('swGibsType')) do
600 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
602 with TGUISwitch(menu
.GetControl('swGibsCount')) do
611 with TGUISwitch(menu
.GetControl('swBackGround')) do
612 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
614 with TGUISwitch(menu
.GetControl('swMessages')) do
615 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
617 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
618 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
620 with TGUISwitch(menu
.GetControl('swChatBubble')) do
621 ItemIndex
:= gChatBubble
;
623 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
624 ItemIndex
:= gPlayerIndicator
;
626 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
627 ItemIndex
:= gPlayerIndicatorStyle
;
629 TempScale
:= Round(g_dbg_scale
- 1);
630 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
632 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
634 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
635 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
637 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
638 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
640 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
641 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
642 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
644 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
645 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
646 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
647 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
648 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
649 for i
:= WP_FIRST
to WP_LAST
+1 do
651 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
652 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
655 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
656 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
657 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
658 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
659 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
660 for i
:= WP_FIRST
to WP_LAST
+1 do
662 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
663 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
666 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
668 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
669 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
671 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
672 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
674 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
675 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
676 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
678 ProcSelectModel(nil);
681 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
683 // don't turn off monsters in DM
685 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
686 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
687 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
689 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
692 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
693 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
694 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
695 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
699 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
701 // don't turn off monsters in DM
703 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
704 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
705 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
707 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
710 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
711 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
712 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
713 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
717 function LatchGameOptions(const MenuName
: string): Byte;
723 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
725 Map
:= TGUILabel(GetControl('lbMap')).Text;
728 if not isWadPath(Map
) then
731 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
732 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
733 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
734 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
735 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
736 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
737 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
741 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
742 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
743 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
744 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
745 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
746 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
747 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
748 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
749 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
750 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
752 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
753 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
754 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
755 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
758 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
759 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
760 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
761 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
764 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
765 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
766 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
767 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
770 // TODO: get this crap out of here
771 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
772 gGameSettings
.WarmupTime
:= gsWarmupTime
;
773 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
777 procedure ProcStartCustomGame();
781 GameMode
:= LatchGameOptions('mCustomGameMenu');
782 if GameMode
= GM_NONE
then Exit
;
784 g_Console_WriteGameConfig
;
785 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
786 gsMaxLives
, gsGameFlags
, gsPlayers
);
790 procedure ProcStartNetGame();
794 GameMode
:= LatchGameOptions('mNetServerMenu');
795 if GameMode
= GM_NONE
then Exit
;
797 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
799 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
800 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
801 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
802 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
803 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
804 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
807 g_Console_WriteGameConfig
;
808 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
809 gsGameFlags
, gsPlayers
, 0, NetPort
);
812 procedure ProcConnectNetGame();
816 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
818 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
819 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
820 PW
:= TGUIEdit(GetControl('edPW')).Text;
823 g_Console_WriteGameConfig
;
824 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
827 procedure ProcEnterPassword();
831 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
833 NetClientIP
:= PromptIP
;
834 NetClientPort
:= PromptPort
;
835 PW
:= TGUIEdit(GetControl('edPW')).Text;
838 g_Console_WriteGameConfig
;
839 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
842 procedure ProcServerlist();
844 if not NetInitDone
then
846 if (not g_Net_Init()) then
848 g_Console_Add('NET: ERROR: Failed to init ENet!');
855 g_Net_Slist_Set(NetMasterList
);
857 gState
:= STATE_SLIST
;
858 g_ActiveWindow
:= nil;
860 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
865 slReturnPressed
:= True;
866 if g_Net_Slist_Fetch(slCurrent
) then
868 if slCurrent
= nil then
869 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
872 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
873 g_Serverlist_GenerateTable(slCurrent
, slTable
);
876 procedure ProcStartCampaign();
882 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
884 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
885 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
887 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
893 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
896 procedure ProcSelectMap(Sender
: TGUIControl
);
900 wad
, map
, res
: String;
902 win
:= g_GUI_GetWindow('SelectMapMenu');
903 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
905 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
906 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
908 if (wad
= '') or (map
= '') then
909 begin // Ýòî íå êàðòà
910 TGUILabel(GetControl('lbMapName')).Text := '';
911 TGUILabel(GetControl('lbMapAuthor')).Text := '';
912 TGUILabel(GetControl('lbMapSize')).Text := '';
913 TGUIMemo(GetControl('meMapDescription')).SetText('');
914 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
915 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
921 a
:= g_Map_GetMapInfo(res
);
923 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
924 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
925 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
926 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
927 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
928 TGUILabel(win
.GetControl('lbMapScale')).Text :=
929 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
934 procedure ProcSelectWAD(Sender
: TGUIControl
);
939 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
941 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
943 with TGUIListBox(GetControl('lsMapRes')) do
949 list
:= g_Map_GetMapsList(wad
);
963 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
969 win
:= g_GUI_GetWindow('CampaignMenu');
970 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
972 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
976 TGUILabel(GetControl('lbWADName')).Text := '';
977 TGUILabel(GetControl('lbWADAuthor')).Text := '';
978 TGUIMemo(GetControl('meWADDescription')).SetText('');
981 a
:= g_Game_GetMegaWADInfo(wad
);
983 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
984 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
985 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
987 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
991 fn
:= g_ExtractWadName(a
.pic
);
993 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
995 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1000 procedure ProcChangeColor(Sender
: TGUIControl
);
1004 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1005 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1006 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1007 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1008 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1009 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1011 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1012 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1013 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1014 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1015 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1016 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1019 procedure ProcSelectModel(Sender
: TGUIControl
);
1024 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1025 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1026 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1028 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1029 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1030 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1032 ProcChangeColor(nil);
1035 procedure MenuLoadData();
1037 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1039 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1040 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1041 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1042 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1043 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1044 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1045 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1046 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1047 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1048 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1049 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1050 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1051 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1052 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1053 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1054 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1055 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1056 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1057 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1058 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1059 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1060 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1061 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1062 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1063 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1065 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1066 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1067 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1068 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1069 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1070 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1071 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1074 procedure MenuFreeData();
1076 e_CharFont_Remove(gMenuFont
);
1077 e_CharFont_Remove(gMenuSmallFont
);
1079 g_Texture_Delete('MAINMENU_LOGO');
1080 g_Texture_Delete('MAINMENU_MARKER1');
1081 g_Texture_Delete('MAINMENU_MARKER2');
1082 g_Texture_Delete('SCROLL_LEFT');
1083 g_Texture_Delete('SCROLL_RIGHT');
1084 g_Texture_Delete('SCROLL_MIDDLE');
1085 g_Texture_Delete('SCROLL_MARKER');
1086 g_Texture_Delete('EDIT_LEFT');
1087 g_Texture_Delete('EDIT_RIGHT');
1088 g_Texture_Delete('EDIT_MIDDLE');
1089 g_Texture_Delete('BOX1');
1090 g_Texture_Delete('BOX2');
1091 g_Texture_Delete('BOX3');
1092 g_Texture_Delete('BOX4');
1093 g_Texture_Delete('BOX5');
1094 g_Texture_Delete('BOX6');
1095 g_Texture_Delete('BOX7');
1096 g_Texture_Delete('BOX8');
1097 g_Texture_Delete('BOX9');
1098 g_Texture_Delete('BSCROLL_UP_A');
1099 g_Texture_Delete('BSCROLL_UP_U');
1100 g_Texture_Delete('BSCROLL_DOWN_A');
1101 g_Texture_Delete('BSCROLL_DOWN_U');
1102 g_Texture_Delete('BSCROLL_MIDDLE');
1103 g_Texture_Delete('NOPIC');
1105 g_Sound_Delete('MENU_SELECT');
1106 g_Sound_Delete('MENU_OPEN');
1107 g_Sound_Delete('MENU_CLOSE');
1108 g_Sound_Delete('MENU_CHANGE');
1109 g_Sound_Delete('SCROLL_ADD');
1110 g_Sound_Delete('SCROLL_SUB');
1111 g_Sound_Delete('SOUND_PLAYER_FALL');
1114 procedure ProcAuthorsMenu();
1116 gMusic
.SetByName('MUSIC_INTERMUS');
1120 procedure ProcExitMenuKeyDown (yes
: Boolean);
1123 snd
: TPlayableSound
;
1128 g_Game_StopAllSounds(True);
1129 case (Random(18)) of
1130 0: s
:= 'SOUND_MONSTER_PAIN';
1131 1: s
:= 'SOUND_MONSTER_DIE_3';
1132 2: s
:= 'SOUND_MONSTER_SLOP';
1133 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1134 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1135 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1136 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1137 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1138 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1139 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1140 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1141 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1142 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1143 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1144 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1145 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1146 else s
:= 'SOUND_PLAYER_FALL';
1148 snd
:= TPlayableSound
.Create();
1149 res
:= snd
.SetByName(s
);
1150 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1154 while snd
.IsPlaying() do begin end;
1162 procedure ProcLoadMenu();
1169 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1170 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1171 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1175 procedure ProcSaveMenu();
1183 name
:= g_GetSaveName(a
, valid
);
1184 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1185 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1189 procedure ProcSaveGame(Sender
: TGUIControl
);
1193 if g_Game_IsNet
then Exit
;
1194 if g_Game_IsTestMap
then Exit
;
1195 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1196 g_Game_PauseAllSounds(True);
1197 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1199 g_ActiveWindow
:= nil;
1200 g_Game_Pause(False);
1203 procedure ProcLoadGame(Sender
: TGUIControl
);
1207 if g_Game_IsNet
then Exit
;
1208 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1209 if g_LoadGame(a
) then
1211 g_Game_PauseAllSounds(False)
1213 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1215 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1216 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1217 //g_ActiveWindow := nil;
1221 procedure ProcSinglePlayer (n
: Integer);
1222 var wad
, map
: AnsiString;
1225 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1226 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1227 if e_FindResource(AllMapDirs
, wad
) then
1229 wad
:= ExpandFileName(wad
);
1230 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1234 procedure ProcSingle1Player
;
1239 procedure ProcSingle2Players
;
1244 procedure ProcSelectMapMenu();
1247 wad_lb
: TGUIFileListBox
;
1248 map_lb
: TGUIListBox
;
1251 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1252 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1253 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1255 if wad_lb
.SelectedItem() <> '' then
1256 map
:= map_lb
.SelectedItem()
1260 wad_lb
.UpdateFileList();
1263 if wad_lb
.SelectedItem() <> '' then
1266 map_lb
.SelectItem(map
);
1268 if map_lb
.SelectedItem() <> '' then
1272 g_GUI_ShowWindow('SelectMapMenu');
1275 procedure ProcSelectCampaignMenu();
1278 wad_lb
: TGUIFileListBox
;
1280 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1281 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1283 wad_lb
.UpdateFileList();
1285 if wad_lb
.SelectedItem() <> '' then
1286 ProcSelectCampaignWAD(nil);
1289 procedure ProcSetMap();
1291 wad
, map
, res
: String;
1293 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1295 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1296 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1299 if (wad
= '') or (map
= '') then
1302 wad
:= e_FindWadRel(MapDirs
, WAD
);
1304 res
:= wad
+':\'+map
;
1306 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1307 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1310 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1316 g_Sound_SetupAllVolumes(
1317 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1318 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1322 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1326 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1327 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1329 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1330 g_dbg_scale
:= TempScale
+ 1;
1334 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1338 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1339 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1340 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1341 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1344 procedure ProcOptionsPlayersMIMenu();
1349 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1351 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1353 if a
= '' then Exit
;
1355 i
:= g_PlayerModel_GetIndex(a
);
1356 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1358 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1359 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1360 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1362 if PlayerModelsArray
[i
].HaveWeapon
then
1363 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1365 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1368 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1371 procedure ProcOptionsPlayerP1WeaponMenu();
1375 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1376 if a
= '' then Exit
;
1377 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1380 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1382 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1385 procedure ProcOptionsPlayerP2WeaponMenu();
1389 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1390 if a
= '' then Exit
;
1391 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1394 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1396 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1399 procedure ProcOptionsPlayersAnim();
1403 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1408 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1411 Model
.AnimState
.Loop
:= True;
1415 procedure ProcOptionsPlayersWeap();
1419 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1424 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1428 procedure ProcOptionsPlayersRot();
1432 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1433 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1435 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1439 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1443 g_Options_SetDefault();
1449 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1451 if yes
then ReadOptions();
1455 procedure ProcAuthorsClose();
1457 gMusic
.SetByName('MUSIC_MENU');
1459 gState
:= STATE_MENU
;
1462 procedure ProcGMClose();
1464 g_Game_InGameMenu(False);
1467 procedure ProcGMShow();
1472 if (gGameSettings
.GameType
= GT_SINGLE
) and
1473 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1474 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1475 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1477 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1478 if g_Game_IsTestMap
then
1479 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1480 TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1484 procedure ProcChangePlayers();
1486 TeamGame
, Spectator
, AddTwo
: Boolean;
1487 P1Team
{, P2Team}: Byte;
1488 bP2
: TGUITextButton
;
1490 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1491 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1492 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1493 P1Team
:= TEAM_NONE
;
1494 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1496 //P2Team := TEAM_NONE;
1497 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1499 TGUIMainMenu(g_ActiveWindow
.GetControl(
1500 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1501 TGUIMainMenu(g_ActiveWindow
.GetControl(
1502 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1503 TGUIMainMenu(g_ActiveWindow
.GetControl(
1504 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1506 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1507 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1508 bP2
.Enabled
:= AddTwo
and not Spectator
;
1510 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1512 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1513 if gPlayer2
= nil then
1514 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1516 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1518 TGUIMainMenu(g_ActiveWindow
.GetControl(
1519 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1522 procedure ProcJoinRed();
1524 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1526 if g_Game_IsServer
then
1528 if gPlayer1
= nil then
1529 g_Game_AddPlayer(TEAM_RED
)
1532 if gPlayer1
.Team
<> TEAM_RED
then
1534 gPlayer1
.SwitchTeam
;
1535 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1538 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1543 gPlayer1Settings
.Team
:= TEAM_RED
;
1544 MC_SEND_PlayerSettings
;
1545 if gPlayer1
= nil then
1546 g_Game_AddPlayer(TEAM_RED
);
1548 g_ActiveWindow
:= nil;
1549 g_Game_Pause(False);
1552 procedure ProcJoinBlue();
1554 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1556 if g_Game_IsServer
then
1558 if gPlayer1
= nil then
1559 g_Game_AddPlayer(TEAM_BLUE
)
1562 if gPlayer1
.Team
<> TEAM_BLUE
then
1564 gPlayer1
.SwitchTeam
;
1565 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1568 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1573 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1574 MC_SEND_PlayerSettings
;
1575 if gPlayer1
= nil then
1576 g_Game_AddPlayer(TEAM_BLUE
);
1578 g_ActiveWindow
:= nil;
1579 g_Game_Pause(False);
1582 procedure ProcJoinGame();
1584 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1586 if gPlayer1
= nil then
1588 g_ActiveWindow
:= nil;
1589 g_Game_Pause(False);
1592 procedure ProcSwitchP2();
1594 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1596 if gPlayer1
= nil then
1598 if gPlayer2
= nil then
1601 g_Game_RemovePlayer();
1602 g_ActiveWindow
:= nil;
1603 g_Game_Pause(False);
1606 procedure ProcSpectate();
1608 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1611 g_ActiveWindow
:= nil;
1612 g_Game_Pause(False);
1615 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1617 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1620 procedure ProcEndMenuKeyDown (yes
: Boolean);
1622 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1625 procedure ProcSetRussianLanguage
;
1627 if gLanguage
<> LANGUAGE_RUSSIAN
then
1629 gLanguage
:= LANGUAGE_RUSSIAN
;
1630 gLanguageChange
:= True;
1631 gAskLanguage
:= False;
1636 procedure ProcSetEnglishLanguage
;
1638 if gLanguage
<> LANGUAGE_ENGLISH
then
1640 gLanguage
:= LANGUAGE_ENGLISH
;
1641 gLanguageChange
:= True;
1642 gAskLanguage
:= False;
1647 procedure ReadGameSettings();
1651 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1653 with gGameSettings
do
1655 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1656 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1660 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1661 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1663 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1665 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1669 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1670 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1674 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1675 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1677 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1682 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1683 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1684 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1686 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1687 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1688 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1691 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1696 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1698 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1699 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1700 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1702 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1703 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1707 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1708 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1710 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1711 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1712 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1713 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1714 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1715 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1716 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1717 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1721 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1722 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1723 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1724 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1725 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1730 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1731 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1736 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1737 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1742 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1743 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1744 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1749 procedure ProcApplyGameSet();
1753 stat
: TPlayerStatArray
;
1755 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1757 if not g_Game_IsServer
then Exit
;
1759 with gGameSettings
do
1761 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1763 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1764 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1766 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1769 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1771 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1772 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1773 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1774 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1775 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1779 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1781 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1782 Options
:= Options
or GAME_OPTION_DMKEYS
1784 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1787 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1789 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1795 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1797 TimeLimit
:= Max(n
, b
);
1801 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1803 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1810 if GameMode
= GM_DM
then
1812 stat
:= g_Player_GetStats();
1814 for a
:= 0 to High(stat
) do
1815 if stat
[a
].Frags
> b
then
1819 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1821 ScoreLimit
:= Max(n
, b
);
1825 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1827 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1828 if n
< 0 then n
:= 0;
1829 if n
> 255 then n
:= 255;
1835 stat
:= g_Player_GetStats();
1837 for a
:= 0 to High(stat
) do
1838 if stat
[a
].Lives
> b
then
1841 MaxLives
:= Max(n
, b
);
1845 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1847 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1850 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1851 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1855 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1856 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1860 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1861 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1866 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1868 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1869 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1870 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1871 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1875 // don't forget to latch this shit
1876 gsGameFlags
:= Options
;
1877 gsMaxLives
:= MaxLives
;
1878 gsScoreLimit
:= ScoreLimit
;
1879 gsTimeLimit
:= TimeLimit
;
1882 if g_Game_IsNet
then MH_SEND_GameSettings
;
1885 procedure ProcVideoOptionsRes();
1890 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1892 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1893 IntToStr(gWinSizeX
) +
1894 ' x ' + IntToStr(gWinSizeY
) +
1895 ', ' + IntToStr(gBPP
) + ' bpp';
1897 with TGUIListBox(menu
.GetControl('lsResolution')) do
1899 list
:= sys_GetDisplayModes(gBPP
);
1903 ItemIndex
:= Length(list
)
1911 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1917 TempResScale
:= Round(r_pixel_scale
- 1);
1918 with TGUISwitch(menu
.GetControl('swResFactor')) do
1919 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1922 procedure ProcApplyVideoOptions();
1925 Fullscreen
: Boolean;
1926 SWidth
, SHeight
: Integer;
1927 ScaleChanged
: Boolean;
1930 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1932 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1934 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1937 SWidth
:= gWinSizeX
;
1938 SHeight
:= gWinSizeY
;
1939 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1942 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1944 ScaleChanged
:= False;
1945 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1947 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1948 r_pixel_scale
:= TempResScale
+ 1;
1949 ScaleChanged
:= True;
1952 if (SWidth
<> gWinSizeX
) or
1953 (SHeight
<> gWinSizeY
) or
1954 (Fullscreen
<> gFullscreen
) or
1957 gResolutionChange
:= True;
1958 gRC_Width
:= SWidth
;
1959 gRC_Height
:= SHeight
;
1960 gRC_FullScreen
:= Fullscreen
;
1961 gRC_Maximized
:= gWinMaximized
;
1964 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1968 procedure ProcSetFirstRussianLanguage
;
1970 gLanguage
:= LANGUAGE_RUSSIAN
;
1971 gLanguageChange
:= True;
1972 gAskLanguage
:= False;
1975 procedure ProcSetFirstEnglishLanguage
;
1977 gLanguage
:= LANGUAGE_ENGLISH
;
1978 gLanguageChange
:= True;
1979 gAskLanguage
:= False;
1982 procedure ProcRecallAddress();
1984 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1986 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1987 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1991 procedure CreateFirstLanguageMenu();
1995 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1997 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1999 Name
:= 'mmFirstLanguageMenu';
2000 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2001 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2004 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2005 Menu
.MainWindow
:= True;
2006 g_GUI_AddWindow(Menu
);
2009 procedure g_Menu_AskLanguage();
2011 CreateFirstLanguageMenu();
2012 g_GUI_ShowWindow('FirstLanguageMenu');
2015 procedure CreatePlayerOptionsMenu(s
: String);
2020 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2022 a
:= _lc
[I_MENU_PLAYER_1
]
2024 a
:= _lc
[I_MENU_PLAYER_2
];
2025 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2027 Name
:= 'mOptionsPlayers'+s
+'Menu';
2028 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2030 Name
:= 'ed'+s
+'Name';
2034 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2036 Name
:= 'sw'+s
+'Team';
2037 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2038 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2040 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2042 Name
:= 'ls'+s
+'Model';
2044 Items
:= g_PlayerModel_GetNames();
2045 OnChange
:= ProcSelectModel
;
2047 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2049 Name
:= 'sc'+s
+'Red';
2051 OnChange
:= ProcChangeColor
;
2053 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2055 Name
:= 'sc'+s
+'Green';
2057 OnChange
:= ProcChangeColor
;
2059 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2061 Name
:= 'sc'+s
+'Blue';
2063 OnChange
:= ProcChangeColor
;
2066 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2067 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2068 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2069 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2070 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2071 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2072 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2074 Name
:= 'mv'+s
+'Model';
2075 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2076 Y
:= GetControl('ls'+s
+'Model').Y
;
2079 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2080 g_GUI_AddWindow(Menu
);
2083 procedure CreateAllMenus();
2087 a
, cx
, _y
, i
: Integer;
2090 Menu
:= TGUIWindow
.Create('MainMenu');
2091 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2093 Name
:= 'mmMainMenu';
2094 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2095 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2096 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2097 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2098 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2099 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2101 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2103 Color
:= _RGB(255, 255, 255);
2104 X
:= gScreenWidth
-GetWidth
-8;
2105 Y
:= gScreenHeight
-GetHeight
-8;
2107 Menu
.DefControl
:= 'mmMainMenu';
2108 Menu
.MainWindow
:= True;
2109 g_GUI_AddWindow(Menu
);
2111 Menu
:= TGUIWindow
.Create('NewGameMenu');
2112 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2114 Name
:= 'mmNewGameMenu';
2115 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2116 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2117 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2118 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2120 Menu
.DefControl
:= 'mmNewGameMenu';
2121 g_GUI_AddWindow(Menu
);
2123 Menu
:= TGUIWindow
.Create('NetGameMenu');
2124 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2126 Name
:= 'mmNetGameMenu';
2127 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2128 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2130 Menu
.DefControl
:= 'mmNetGameMenu';
2131 g_GUI_AddWindow(Menu
);
2133 Menu
:= TGUIWindow
.Create('NetServerMenu');
2134 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2136 Name
:= 'mNetServerMenu';
2137 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2139 Name
:= 'edSrvName';
2140 OnlyDigits
:= False;
2143 Text := NetServerName
;
2145 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2147 Name
:= 'edSrvPassword';
2148 OnlyDigits
:= False;
2151 Text := NetPassword
;
2153 with AddEdit(_lc
[I_NET_PORT
]) do
2159 Text := IntToStr(NetPort
);
2161 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2163 Name
:= 'edMaxPlayers';
2167 Text := IntToStr(NetMaxClients
);
2169 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2171 Name
:= 'swUseMaster';
2172 AddItem(_lc
[I_MENU_YES
]);
2173 AddItem(_lc
[I_MENU_NO
]);
2174 if NetUseMaster
then
2180 with AddLabel(_lc
[I_MENU_MAP
]) do
2185 OnClick
:= @ProcSelectMapMenu
;
2187 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2189 Name
:= 'swGameMode';
2190 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2191 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2192 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2193 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2194 case g_Game_TextToMode(gsGameMode
) of
2196 GM_DM
: ItemIndex
:= 0;
2197 GM_TDM
: ItemIndex
:= 1;
2198 GM_CTF
: ItemIndex
:= 2;
2200 GM_COOP
: ItemIndex
:= 3;
2202 OnChange
:= ProcSwitchMonstersCustom
;
2204 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2206 Name
:= 'edTimeLimit';
2210 if gsTimeLimit
> 0 then
2211 Text := IntToStr(gsTimeLimit
);
2213 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2215 Name
:= 'edScoreLimit';
2219 if gsScoreLimit
> 0 then
2220 Text := IntToStr(gsScoreLimit
);
2222 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2224 Name
:= 'edMaxLives';
2228 if gsMaxLives
> 0 then
2229 Text := IntToStr(gsMaxLives
);
2231 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2233 Name
:= 'edItemRespawnTime';
2237 if gsItemRespawnTime
> 0 then
2238 Text := IntToStr(gsItemRespawnTime
);
2240 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2242 Name
:= 'swPlayers';
2243 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2244 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2245 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2246 ItemIndex
:= gsPlayers
;
2248 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2250 Name
:= 'swTeamDamage';
2251 AddItem(_lc
[I_MENU_YES
]);
2252 AddItem(_lc
[I_MENU_NO
]);
2253 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2258 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2260 Name
:= 'swTeamHit';
2261 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2262 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2263 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2264 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2265 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2267 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2269 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2274 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2276 Name
:= 'swDeathmatchKeys';
2277 AddItem(_lc
[I_MENU_YES
]);
2278 AddItem(_lc
[I_MENU_NO
]);
2279 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2284 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2286 Name
:= 'swEnableExits';
2287 AddItem(_lc
[I_MENU_YES
]);
2288 AddItem(_lc
[I_MENU_NO
]);
2289 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2294 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2296 Name
:= 'swWeaponStay';
2297 AddItem(_lc
[I_MENU_YES
]);
2298 AddItem(_lc
[I_MENU_NO
]);
2299 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2304 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2306 Name
:= 'swMonsters';
2307 AddItem(_lc
[I_MENU_YES
]);
2308 AddItem(_lc
[I_MENU_NO
]);
2309 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2314 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2317 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2318 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2319 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2321 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2323 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2326 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2328 Name
:= 'swFlagDrop';
2329 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2330 AddItem(_lc
[I_MENU_YES
]);
2331 AddItem(_lc
[I_MENU_NO
]);
2332 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2334 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2340 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2344 Menu
.DefControl
:= 'mNetServerMenu';
2345 g_GUI_AddWindow(Menu
);
2347 Menu
:= TGUIWindow
.Create('NetClientMenu');
2348 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2350 Name
:= 'mNetClientMenu';
2352 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2355 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2361 Text := 'localhost';
2363 with AddEdit(_lc
[I_NET_PORT
]) do
2371 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2374 OnlyDigits
:= False;
2381 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2385 Menu
.DefControl
:= 'mNetClientMenu';
2386 g_GUI_AddWindow(Menu
);
2388 Menu
:= TGUIWindow
.Create('LoadMenu');
2389 Menu
.OnShow
:= ProcLoadMenu
;
2390 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2392 Name
:= 'mmLoadMenu';
2397 Name
:= 'edSlot'+IntToStr(a
);
2400 OnEnter
:= ProcLoadGame
;
2403 Menu
.DefControl
:= 'mmLoadMenu';
2404 g_GUI_AddWindow(Menu
);
2406 Menu
:= TGUIWindow
.Create('SaveMenu');
2407 Menu
.OnShow
:= ProcSaveMenu
;
2408 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2410 Name
:= 'mmSaveMenu';
2415 Name
:= 'edSlot'+IntToStr(a
);
2418 OnChange
:= ProcSaveGame
;
2421 Menu
.DefControl
:= 'mmSaveMenu';
2422 g_GUI_AddWindow(Menu
);
2424 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2425 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2427 Name
:= 'mCustomGameMenu';
2428 with AddLabel(_lc
[I_MENU_MAP
]) do
2433 OnClick
:= @ProcSelectMapMenu
;
2435 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2437 Name
:= 'swGameMode';
2438 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2439 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2440 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2441 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2442 case g_Game_TextToMode(gsGameMode
) of
2444 GM_DM
: ItemIndex
:= 0;
2445 GM_TDM
: ItemIndex
:= 1;
2446 GM_CTF
: ItemIndex
:= 2;
2448 GM_COOP
: ItemIndex
:= 3;
2450 OnChange
:= ProcSwitchMonstersCustom
;
2452 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2454 Name
:= 'edTimeLimit';
2458 if gsTimeLimit
> 0 then
2459 Text := IntToStr(gsTimeLimit
);
2461 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2463 Name
:= 'edScoreLimit';
2467 if gsScoreLimit
> 0 then
2468 Text := IntToStr(gsScoreLimit
);
2470 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2472 Name
:= 'edMaxLives';
2476 if gsMaxLives
> 0 then
2477 Text := IntToStr(gsMaxLives
);
2479 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2481 Name
:= 'edItemRespawnTime';
2485 if gsItemRespawnTime
> 0 then
2486 Text := IntToStr(gsItemRespawnTime
);
2488 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2490 Name
:= 'swPlayers';
2491 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2492 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2493 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2494 ItemIndex
:= gsPlayers
;
2496 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2498 Name
:= 'swTeamDamage';
2499 AddItem(_lc
[I_MENU_YES
]);
2500 AddItem(_lc
[I_MENU_NO
]);
2501 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2506 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2508 Name
:= 'swTeamHit';
2509 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2510 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2511 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2512 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2513 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2515 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2517 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2522 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2524 Name
:= 'swDeathmatchKeys';
2525 AddItem(_lc
[I_MENU_YES
]);
2526 AddItem(_lc
[I_MENU_NO
]);
2527 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2532 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2534 Name
:= 'swEnableExits';
2535 AddItem(_lc
[I_MENU_YES
]);
2536 AddItem(_lc
[I_MENU_NO
]);
2537 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2542 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2544 Name
:= 'swWeaponStay';
2545 AddItem(_lc
[I_MENU_YES
]);
2546 AddItem(_lc
[I_MENU_NO
]);
2547 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2552 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2554 Name
:= 'swMonsters';
2555 AddItem(_lc
[I_MENU_YES
]);
2556 AddItem(_lc
[I_MENU_NO
]);
2557 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2562 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2565 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2566 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2567 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2569 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2571 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2574 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2576 Name
:= 'swFlagDrop';
2577 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2578 AddItem(_lc
[I_MENU_YES
]);
2579 AddItem(_lc
[I_MENU_NO
]);
2580 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2582 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2588 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2592 Menu
.DefControl
:= 'mCustomGameMenu';
2593 g_GUI_AddWindow(Menu
);
2595 Menu
:= TGUIWindow
.Create('CampaignMenu');
2596 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2598 Name
:= 'mCampaignMenu';
2607 with AddFileList('', 15, 4) do
2610 OnChange
:= ProcSelectCampaignWAD
;
2614 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2615 SetBase(MegawadDirs
);
2618 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2620 Name
:= 'lbWADName';
2624 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2626 Name
:= 'lbWADAuthor';
2630 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2631 with AddMemo('', 15, 3) do
2633 Name
:= 'meWADDescription';
2634 Color
:= MENU_ITEMSCTRL_COLOR
;
2636 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2638 Name
:= 'swPlayers';
2639 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2640 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2643 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2647 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2649 Name
:= 'mpWADImage';
2650 DefaultRes
:= 'NOPIC';
2651 X
:= GetControl('lsWAD').X
+4;
2652 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2655 Menu
.DefControl
:= 'mCampaignMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2659 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2661 Name
:= 'mSelectMapMenu';
2662 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2665 OnChange
:= ProcSelectWAD
;
2669 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2672 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2676 OnChange
:= ProcSelectMap
;
2679 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2681 Name
:= 'lbMapName';
2685 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2687 Name
:= 'lbMapAuthor';
2691 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2693 Name
:= 'lbMapSize';
2697 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2699 Name
:= 'meMapDescription';
2704 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2706 Name
:= 'mpMapPreview';
2707 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2708 Y
:= GetControl('lsMapWAD').Y
;
2710 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2712 Name
:= 'lbMapScale';
2715 Color
:= MENU_ITEMSCTRL_COLOR
;
2716 X
:= GetControl('lsMapWAD').X
+
2717 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2718 2 + MAPPREVIEW_WIDTH
*4;
2719 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2722 Menu
.OnClose
:= ProcSetMap
;
2723 Menu
.DefControl
:= 'mSelectMapMenu';
2724 g_GUI_AddWindow(Menu
);
2726 Menu
:= TGUIWindow
.Create('OptionsMenu');
2727 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2729 Name
:= 'mmOptionsMenu';
2730 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2731 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2732 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2733 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2734 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2735 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2737 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2738 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2740 Menu
.OnClose
:= ProcApplyOptions
;
2741 Menu
.DefControl
:= 'mmOptionsMenu';
2742 g_GUI_AddWindow(Menu
);
2744 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2745 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2746 g_GUI_AddWindow(Menu
);
2748 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2749 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2751 Name
:= 'mOptionsVideoMenu';
2752 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2753 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2759 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2762 AddItem(_lc
[I_MENU_YES
]);
2763 AddItem(_lc
[I_MENU_NO
]);
2765 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2767 Name
:= 'swTextureFilter';
2768 AddItem(_lc
[I_MENU_YES
]);
2769 AddItem(_lc
[I_MENU_NO
]);
2771 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2774 AddItem(_lc
[I_MENU_YES
]);
2775 AddItem(_lc
[I_MENU_NO
]);
2777 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2779 Name
:= 'swLegacyNPOT';
2780 AddItem(_lc
[I_MENU_NO
]);
2781 AddItem(_lc
[I_MENU_YES
]);
2784 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2787 Menu
.DefControl
:= 'mOptionsVideoMenu';
2788 g_GUI_AddWindow(Menu
);
2790 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2791 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2793 Name
:= 'mOptionsVideoResMenu';
2794 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2796 Name
:= 'lbCurrentRes';
2800 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2802 Name
:= 'lsResolution';
2805 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2807 Name
:= 'swFullScreen';
2808 AddItem(_lc
[I_MENU_YES
]);
2809 AddItem(_lc
[I_MENU_NO
]);
2811 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2813 Name
:= 'swResFactor';
2815 for i
:= 2 to gRC_Width
div 640 do
2816 AddItem(IntToStr(i
) + 'x');
2819 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2822 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2823 g_GUI_AddWindow(Menu
);
2825 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2826 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2828 Name
:= 'mOptionsSoundMenu';
2829 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2831 Name
:= 'scMusicLevel';
2833 OnChange
:= ProcChangeSoundSettings
;
2835 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2837 Name
:= 'scSoundLevel';
2839 OnChange
:= ProcChangeSoundSettings
;
2841 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2843 Name
:= 'scMaxSimSounds';
2846 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2848 Name
:= 'swAnnouncer';
2849 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2850 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2851 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2852 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2854 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2855 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2857 Name
:= 'swSoundEffects';
2858 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2859 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2861 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2862 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2864 Name
:= 'swChatSpeech';
2865 AddItem(_lc
[I_MENU_YES
]);
2866 AddItem(_lc
[I_MENU_NO
]);
2868 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2870 Name
:= 'swInactiveSounds';
2871 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2872 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2876 Menu
.DefControl
:= 'mOptionsSoundMenu';
2877 g_GUI_AddWindow(Menu
);
2879 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2880 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2882 Name
:= 'mOptionsGameMenu';
2883 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2885 Name
:= 'scParticlesCount';
2888 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2890 Name
:= 'swBloodCount';
2891 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2892 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2893 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2894 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2895 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2897 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2899 Name
:= 'scShellsMax';
2902 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2904 Name
:= 'scGibsMax';
2907 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2909 Name
:= 'scCorpsesMax';
2912 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2914 Name
:= 'swGibsCount';
2915 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2916 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2917 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2918 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2919 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2921 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2923 Name
:= 'swCorpseType';
2924 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2925 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2927 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2929 Name
:= 'swGibsType';
2930 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2931 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2933 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2935 Name
:= 'swBloodType';
2936 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2937 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2939 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2941 Name
:= 'swScreenFlash';
2942 AddItem(_lc
[I_MENU_NO
]);
2943 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2944 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2946 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2948 Name
:= 'swBackground';
2949 AddItem(_lc
[I_MENU_YES
]);
2950 AddItem(_lc
[I_MENU_NO
]);
2952 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2954 Name
:= 'swMessages';
2955 AddItem(_lc
[I_MENU_YES
]);
2956 AddItem(_lc
[I_MENU_NO
]);
2958 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2960 Name
:= 'swRevertPlayers';
2961 AddItem(_lc
[I_MENU_YES
]);
2962 AddItem(_lc
[I_MENU_NO
]);
2964 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2966 Name
:= 'swChatBubble';
2967 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2968 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2969 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2970 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2971 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2973 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2975 Name
:= 'swPlayerIndicator';
2976 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2977 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2978 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2980 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2982 Name
:= 'swPlayerIndicatorStyle';
2983 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2984 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2986 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2988 Name
:= 'scScaleFactor';
2990 OnChange
:= ProcChangeGameSettings
;
2994 Menu
.DefControl
:= 'mOptionsGameMenu';
2995 g_GUI_AddWindow(Menu
);
2997 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2998 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3000 Name
:= 'mOptionsControlsMenu';
3001 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3002 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3003 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3004 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3005 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3007 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3008 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3009 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3010 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3011 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3012 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3013 if e_HasJoysticks
then
3016 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3018 if g_touch_enabled
then
3021 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3024 Menu
.DefControl
:= 'mOptionsControlsMenu';
3025 g_GUI_AddWindow(Menu
);
3027 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3028 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3030 Name
:= 'mOptionsControlsP1Menu';
3031 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3032 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3033 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3034 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3035 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3036 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3037 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3038 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3039 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3040 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3041 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3043 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3044 g_GUI_AddWindow(Menu
);
3046 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3047 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3049 Name
:= 'mOptionsControlsP1MenuWeapons';
3050 for i
:= WP_FIRST
to WP_LAST
do
3051 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3052 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3054 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3055 g_GUI_AddWindow(Menu
);
3057 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3058 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3060 Name
:= 'mOptionsControlsP2Menu';
3061 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3062 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3063 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3064 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3065 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3066 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3067 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3068 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3069 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3070 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3071 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3073 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3074 g_GUI_AddWindow(Menu
);
3076 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3077 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3079 Name
:= 'mOptionsControlsP2MenuWeapons';
3080 for i
:= WP_FIRST
to WP_LAST
do
3081 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3082 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3084 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3085 g_GUI_AddWindow(Menu
);
3087 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3088 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3090 Name
:= 'mOptionsControlsJoystickMenu';
3091 for i
:= 0 to e_MaxJoys
- 1 do
3092 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3094 Name
:= 'scDeadzone' + IntToStr(i
);
3098 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3099 g_GUI_AddWindow(Menu
);
3101 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3102 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3104 Name
:= 'mOptionsControlsTouchMenu';
3105 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3107 Name
:= 'swTouchAlt';
3108 AddItem(_lc
[I_MENU_NO
]);
3109 AddItem(_lc
[I_MENU_YES
]);
3110 OnChange
:= ProcChangeTouchSettings
;
3112 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3114 Name
:= 'scTouchSize';
3116 OnChange
:= ProcChangeTouchSettings
;
3118 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3120 Name
:= 'swTouchFire';
3121 AddItem(_lc
[I_MENU_NO
]);
3122 AddItem(_lc
[I_MENU_YES
]);
3124 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3126 Name
:= 'scTouchOffset';
3128 OnChange
:= ProcChangeTouchSettings
;
3131 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3132 g_GUI_AddWindow(Menu
);
3134 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3135 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3137 Name
:= 'mOptionsPlayersMenu';
3138 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3139 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3141 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3142 g_GUI_AddWindow(Menu
);
3144 CreatePlayerOptionsMenu('P1');
3145 CreatePlayerOptionsMenu('P2');
3147 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3148 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3150 Name
:= 'mOptionsPlayersMIMenu';
3151 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3156 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3161 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3163 Name
:= 'meComment';
3166 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3167 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3170 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3174 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3175 g_GUI_AddWindow(Menu
);
3177 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3178 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3180 Name
:= 'mOptionsPlayersP1WeaponMenu';
3181 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3183 Name
:= 'swWeaponAutoswitch';
3184 AddItem(_lc
[I_MENU_NO
]);
3185 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3186 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3188 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3190 Name
:= 'swWeaponAllowEmpty';
3191 AddItem(_lc
[I_MENU_YES
]);
3192 AddItem(_lc
[I_MENU_NO
]);
3194 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3196 Name
:= 'swWeaponAllowFist';
3197 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3198 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3200 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3203 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3204 g_GUI_AddWindow(Menu
);
3206 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3207 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3209 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3210 for i
:= WP_FIRST
to WP_LAST
do
3212 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3214 Name
:= IntToStr(i
);
3215 for a
:= WP_FIRST
to WP_LAST
+1 do
3217 AddItem(IntToStr(a
));
3222 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3224 Name
:= IntToStr(WP_LAST
+1);
3225 for a
:= WP_FIRST
to WP_LAST
+1 do
3227 AddItem(IntToStr(a
));
3229 ItemIndex
:= WP_LAST
+ 1;
3232 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3233 g_GUI_AddWindow(Menu
);
3236 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3237 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3239 Name
:= 'mOptionsPlayersP2WeaponMenu';
3240 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3242 Name
:= 'swWeaponAutoswitch';
3243 AddItem(_lc
[I_MENU_NO
]);
3244 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3245 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3247 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3249 Name
:= 'swWeaponAllowEmpty';
3250 AddItem(_lc
[I_MENU_YES
]);
3251 AddItem(_lc
[I_MENU_NO
]);
3253 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3255 Name
:= 'swWeaponAllowFist';
3256 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3257 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3259 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3262 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3263 g_GUI_AddWindow(Menu
);
3265 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3266 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3268 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3269 for i
:= WP_FIRST
to WP_LAST
do
3271 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3273 Name
:= IntToStr(i
);
3274 for a
:= WP_FIRST
to WP_LAST
+1 do
3276 AddItem(IntToStr(a
));
3281 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3283 Name
:= IntToStr(WP_LAST
+1);
3284 for a
:= WP_FIRST
to WP_LAST
+1 do
3286 AddItem(IntToStr(a
));
3288 ItemIndex
:= WP_LAST
+ 1;
3291 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3292 g_GUI_AddWindow(Menu
);
3294 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3295 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3297 Name
:= 'mOptionsLanguageMenu';
3298 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3299 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3302 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3303 g_GUI_AddWindow(Menu
);
3305 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3306 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3307 g_GUI_AddWindow(Menu
);
3309 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3310 Menu
.BackTexture
:= 'INTER';
3311 Menu
.OnClose
:= ProcAuthorsClose
;
3315 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3317 Color
:= _RGB(255, 0, 0);
3318 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3320 _y
:= _y
+GetHeight();
3322 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3324 Color
:= _RGB(255, 0, 0);
3325 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3327 _y
:= _y
+GetHeight()+32;
3329 // ×òî äåëàë: Êòî äåëàë
3330 cx
:= gScreenWidth
div 2 - 320 + 64;
3331 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3333 Color
:= _RGB(255, 0, 0);
3338 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3340 Color
:= _RGB(255, 255, 255);
3345 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3347 Color
:= _RGB(255, 0, 0);
3352 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3354 Color
:= _RGB(255, 255, 255);
3359 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3361 Color
:= _RGB(255, 255, 255);
3366 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3368 Color
:= _RGB(255, 0, 0);
3373 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3375 Color
:= _RGB(255, 255, 255);
3380 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3382 Color
:= _RGB(255, 0, 0);
3387 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3389 Color
:= _RGB(255, 255, 255);
3392 _y
:= gScreenHeight
- 128;
3395 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3397 Color
:= _RGB(255, 0, 0);
3402 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3404 Color
:= _RGB(255, 255, 255);
3407 _y
:= _y
+GetHeight();
3409 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3411 Color
:= _RGB(255, 255, 255);
3414 _y
:= _y
+GetHeight();
3416 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3418 Color
:= _RGB(255, 255, 255);
3421 _y
:= gScreenHeight
- 32;
3423 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3425 Color
:= _RGB(255, 0, 0);
3426 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3429 g_GUI_AddWindow(Menu
);
3431 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3432 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3433 g_GUI_AddWindow(Menu
);
3435 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3436 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3438 Name
:= 'mmGameSingleMenu';
3439 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3440 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3441 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3442 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3443 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3444 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3446 Menu
.DefControl
:= 'mmGameSingleMenu';
3447 Menu
.MainWindow
:= True;
3448 Menu
.OnClose
:= ProcGMClose
;
3449 Menu
.OnShow
:= ProcGMShow
;
3450 g_GUI_AddWindow(Menu
);
3452 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3453 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3454 g_GUI_AddWindow(Menu
);
3456 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3457 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3458 g_GUI_AddWindow(Menu
);
3460 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3461 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3463 Name
:= 'mmGameCustomMenu';
3464 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3465 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3466 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3467 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3468 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3469 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3470 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3472 Menu
.DefControl
:= 'mmGameCustomMenu';
3473 Menu
.MainWindow
:= True;
3474 Menu
.OnClose
:= ProcGMClose
;
3475 Menu
.OnShow
:= ProcGMShow
;
3476 g_GUI_AddWindow(Menu
);
3478 Menu
:= TGUIWindow
.Create('GameServerMenu');
3479 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3481 Name
:= 'mmGameServerMenu';
3482 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3483 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3484 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3485 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3486 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3488 Menu
.DefControl
:= 'mmGameServerMenu';
3489 Menu
.MainWindow
:= True;
3490 Menu
.OnClose
:= ProcGMClose
;
3491 Menu
.OnShow
:= ProcGMShow
;
3492 g_GUI_AddWindow(Menu
);
3494 Menu
:= TGUIWindow
.Create('GameClientMenu');
3495 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3497 Name
:= 'mmGameClientMenu';
3498 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3499 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3500 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3502 Menu
.DefControl
:= 'mmGameClientMenu';
3503 Menu
.MainWindow
:= True;
3504 Menu
.OnClose
:= ProcGMClose
;
3505 Menu
.OnShow
:= ProcGMShow
;
3506 g_GUI_AddWindow(Menu
);
3508 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3509 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3511 Name
:= 'mClientPasswordMenu';
3512 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3520 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3523 Menu
.DefControl
:= 'mClientPasswordMenu';
3524 g_GUI_AddWindow(Menu
);
3526 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3527 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3529 Name
:= 'mGameSetGameMenu';
3530 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3532 Name
:= 'swTeamDamage';
3533 AddItem(_lc
[I_MENU_YES
]);
3534 AddItem(_lc
[I_MENU_NO
]);
3537 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3539 Name
:= 'swTeamHit';
3540 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3541 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3542 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3543 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3546 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3548 Name
:= 'swDeathmatchKeys';
3549 AddItem(_lc
[I_MENU_YES
]);
3550 AddItem(_lc
[I_MENU_NO
]);
3553 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3555 Name
:= 'edTimeLimit';
3560 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3562 Name
:= 'edScoreLimit';
3567 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3569 Name
:= 'edMaxLives';
3574 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3577 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3578 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3579 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3582 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3584 Name
:= 'swFlagDrop';
3585 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3586 AddItem(_lc
[I_MENU_YES
]);
3587 AddItem(_lc
[I_MENU_NO
]);
3593 Menu
.DefControl
:= 'mGameSetGameMenu';
3594 Menu
.OnClose
:= ProcApplyGameSet
;
3595 g_GUI_AddWindow(Menu
);
3597 Menu
:= TGUIWindow
.Create('TeamMenu');
3598 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3600 Name
:= 'mmTeamMenu';
3601 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3602 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3603 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3604 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3605 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3607 Menu
.DefControl
:= 'mmTeamMenu';
3608 Menu
.OnShow
:= ProcChangePlayers
;
3609 g_GUI_AddWindow(Menu
);
3612 procedure g_Menu_Show_SaveMenu();
3614 if g_Game_IsTestMap
then
3616 if gGameSettings
.GameType
= GT_SINGLE
then
3617 g_GUI_ShowWindow('GameSingleMenu')
3620 if g_Game_IsClient
then
3623 if g_Game_IsNet
then
3626 g_GUI_ShowWindow('GameCustomMenu');
3628 g_GUI_ShowWindow('SaveMenu');
3629 g_Sound_PlayEx('MENU_OPEN');
3632 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3634 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3635 if gGameSettings
.GameType
= GT_SINGLE
then
3637 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3641 if g_Game_IsClient
then exit
;
3642 if g_Game_IsNet
then exit
;
3643 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3645 g_GUI_ShowWindow('LoadMenu');
3646 g_Sound_PlayEx('MENU_OPEN');
3649 procedure g_Menu_Show_GameSetGame();
3651 if gGameSettings
.GameType
= GT_SINGLE
then
3652 g_GUI_ShowWindow('GameSingleMenu')
3655 if g_Game_IsClient
then
3658 if g_Game_IsNet
then
3659 g_GUI_ShowWindow('GameServerMenu')
3661 g_GUI_ShowWindow('GameCustomMenu');
3664 g_GUI_ShowWindow('GameSetGameMenu');
3665 g_Sound_PlayEx('MENU_OPEN');
3668 procedure g_Menu_Show_OptionsVideo();
3670 if gGameSettings
.GameType
= GT_SINGLE
then
3671 g_GUI_ShowWindow('GameSingleMenu')
3674 if g_Game_IsClient
then
3675 g_GUI_ShowWindow('GameClientMenu')
3677 if g_Game_IsNet
then
3678 g_GUI_ShowWindow('GameServerMenu')
3680 g_GUI_ShowWindow('GameCustomMenu');
3683 g_GUI_ShowWindow('OptionsMenu');
3684 g_GUI_ShowWindow('OptionsVideoMenu');
3685 g_Sound_PlayEx('MENU_OPEN');
3688 procedure g_Menu_Show_OptionsSound();
3690 if gGameSettings
.GameType
= GT_SINGLE
then
3691 g_GUI_ShowWindow('GameSingleMenu')
3694 if g_Game_IsClient
then
3695 g_GUI_ShowWindow('GameClientMenu')
3697 if g_Game_IsNet
then
3698 g_GUI_ShowWindow('GameServerMenu')
3700 g_GUI_ShowWindow('GameCustomMenu');
3703 g_GUI_ShowWindow('OptionsMenu');
3704 g_GUI_ShowWindow('OptionsSoundMenu');
3705 g_Sound_PlayEx('MENU_OPEN');
3708 procedure g_Menu_Show_EndGameMenu();
3710 g_GUI_ShowWindow('EndGameMenu');
3711 g_Sound_PlayEx('MENU_OPEN');
3714 procedure g_Menu_Show_QuitGameMenu();
3716 g_GUI_ShowWindow('ExitMenu');
3717 g_Sound_PlayEx('MENU_OPEN');
3720 procedure g_Menu_Init();
3726 procedure g_Menu_Free();
3731 procedure g_Menu_Reset();
3735 g_GUI_SaveMenuPos();
3736 ex
:= g_GUI_Destroy();
3740 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3745 g_Game_SetDebugMode();
3747 g_GUI_LoadMenuPos();