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 LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 {$INCLUDE ../nogl/noGLuses.inc}
47 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
48 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
49 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
50 MAPDEF
, Math
, g_saveload
,
51 e_texture
, g_language
, e_res
,
52 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
53 utils
, wadreader
, g_system
;
56 type TYNCallback
= procedure (yes
:Boolean);
58 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
60 if win
.UserData
= nil then exit
;
62 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
63 IK_N
: TYNCallback(win
.UserData
)(false);
67 procedure YesButtonCB (ctl
: TGUITextButton
);
69 if ctl
.UserData
= nil then exit
;
70 TYNCallback(ctl
.UserData
)(true);
73 procedure NoButtonCB (ctl
: TGUITextButton
);
75 if ctl
.UserData
= nil then exit
;
76 TYNCallback(ctl
.UserData
)(false);
79 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
83 //if length(Text) = 0 then exit;
84 Result
:= TGUIWindow
.Create(WinName
);
87 //OnKeyDownEx := @YNKeyDownProc;
88 //UserData := @ActionProc;
89 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
92 Name
:= '__temp_yes_no_menu:'+WinName
;
94 AddText(Text, MaxLen
);
95 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
96 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
98 DefControl
:= '__temp_yes_no_menu:'+WinName
;
104 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
105 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
107 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
144 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
145 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
147 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
149 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
154 else gGibsCount
:= 48;
157 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
158 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
159 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
160 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
161 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
162 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
163 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
164 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
165 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
166 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
167 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
168 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
170 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
171 g_dbg_scale
:= TempScale
+ 1;
175 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
179 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
180 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
181 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
182 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
186 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
189 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
201 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
202 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
222 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
223 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
224 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
225 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
239 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
242 for i
:= WP_FIRST
to WP_LAST
do
244 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
245 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
246 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
247 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
251 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
261 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
262 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
263 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
264 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
284 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
285 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
286 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
287 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
301 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
304 for i
:= WP_FIRST
to WP_LAST
do
306 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
307 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
308 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
309 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
313 if e_HasJoysticks
then
315 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
318 for i
:= 0 to e_MaxJoys
- 1 do
319 if e_JoystickAvailable
[i
] then
320 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
324 if g_touch_enabled
then
326 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
327 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
328 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
329 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
330 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
333 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
335 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
336 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
337 TEAM_RED
, TEAM_BLUE
);
339 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
341 gPlayer1Settings
.Model
:= Model
.Name
;
342 gPlayer1Settings
.Color
:= Model
.Color
;
345 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
347 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
348 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
349 TEAM_RED
, TEAM_BLUE
);
351 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
353 gPlayer1Settings
.Model
:= Model
.Name
;
354 gPlayer1Settings
.Color
:= Model
.Color
;
357 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
358 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
359 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
360 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
362 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
365 for i
:= WP_FIRST
to WP_LAST
+1 do
367 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
371 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
372 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
373 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
374 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
375 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
378 for i
:= WP_FIRST
to WP_LAST
+1 do
380 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
384 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
386 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
387 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
388 TEAM_RED
, TEAM_BLUE
);
389 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
391 gPlayer2Settings
.Model
:= Model
.Name
;
392 gPlayer2Settings
.Color
:= Model
.Color
;
395 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
396 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
398 if g_Game_IsServer
then
400 if gPlayer1
<> nil then
402 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
403 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
404 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
405 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
407 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
409 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
410 if (gPlayer1
.WeapSwitchMode
= 2) then
411 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
412 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
413 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
414 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
417 if gPlayer2
<> nil then
419 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
420 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
421 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
422 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
424 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
426 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
427 if (gPlayer2
.WeapSwitchMode
= 2) then
428 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
429 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
430 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
434 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
436 g_Console_WriteGameConfig
;
439 procedure ReadOptions();
444 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
446 with TGUISwitch(menu
.GetControl('swBPP')) do
452 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
453 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
455 with TGUISwitch(menu
.GetControl('swVSync')) do
456 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
458 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
459 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
461 with TGUISwitch(menu
.GetControl('swInterp')) do
462 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
466 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
467 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
468 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
470 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
471 if gMuteWhenInactive
then
476 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
478 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
479 if gSoundEffectsDF
then
484 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
485 if gUseChatSounds
then
490 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
521 for i
:= WP_FIRST
to WP_LAST
do
523 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
524 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
528 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
548 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
551 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
552 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
553 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
556 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
559 for i
:= WP_FIRST
to WP_LAST
do
561 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
562 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
566 if e_HasJoysticks
then
568 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
571 for i
:= 0 to e_MaxJoys
- 1 do
572 if e_JoystickAvailable
[i
] then
573 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
577 if g_touch_enabled
then
579 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
580 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
581 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
582 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
583 with TGUISwitch(menu
.GetControl('swTouchFire')) do
584 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
585 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
588 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
591 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
592 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
593 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
594 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
599 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
600 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
601 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
602 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
603 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
605 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
608 with TGUISwitch(menu
.GetControl('swBloodType')) do
609 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
611 with TGUISwitch(menu
.GetControl('swCorpseType')) do
612 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
614 with TGUISwitch(menu
.GetControl('swGibsType')) do
615 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
617 with TGUISwitch(menu
.GetControl('swGibsCount')) do
626 with TGUISwitch(menu
.GetControl('swBackGround')) do
627 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
629 with TGUISwitch(menu
.GetControl('swMessages')) do
630 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
632 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
633 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
635 with TGUISwitch(menu
.GetControl('swChatBubble')) do
636 ItemIndex
:= gChatBubble
;
638 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
639 ItemIndex
:= gPlayerIndicator
;
641 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
642 ItemIndex
:= gPlayerIndicatorStyle
;
644 TempScale
:= Round(g_dbg_scale
- 1);
645 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
647 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
649 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
650 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
652 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
653 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
655 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
656 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
657 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
659 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
660 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
661 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
662 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
663 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
664 for i
:= WP_FIRST
to WP_LAST
+1 do
666 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
667 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
670 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
671 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
672 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
673 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
674 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
675 for i
:= WP_FIRST
to WP_LAST
+1 do
677 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
678 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
681 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
683 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
684 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
686 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
687 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
689 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
690 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
691 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
693 ProcSelectModel(nil);
696 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
698 // don't turn off monsters in DM
700 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
701 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
702 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
704 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
707 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
708 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
709 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
710 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
714 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
716 // don't turn off monsters in DM
718 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
719 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
720 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
725 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
726 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
727 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
728 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
732 function LatchGameOptions(const MenuName
: string): Byte;
738 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
740 Map
:= TGUILabel(GetControl('lbMap')).Text;
743 if not isWadPath(Map
) then
746 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
747 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
748 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
749 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
750 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
751 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
752 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
756 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
757 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
758 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
759 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
760 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
761 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
762 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
763 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
764 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
765 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
767 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
768 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
769 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
770 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
773 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
774 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
775 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
776 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
779 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
780 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
781 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
782 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
785 // TODO: get this crap out of here
786 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
787 gGameSettings
.WarmupTime
:= gsWarmupTime
;
788 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
792 procedure ProcStartCustomGame();
796 GameMode
:= LatchGameOptions('mCustomGameMenu');
797 if GameMode
= GM_NONE
then Exit
;
799 g_Console_WriteGameConfig
;
800 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
801 gsMaxLives
, gsGameFlags
, gsPlayers
);
805 procedure ProcStartNetGame();
809 GameMode
:= LatchGameOptions('mNetServerMenu');
810 if GameMode
= GM_NONE
then Exit
;
812 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
814 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
815 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
816 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
817 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
818 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
819 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
822 g_Console_WriteGameConfig
;
823 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
824 gsGameFlags
, gsPlayers
, 0, NetPort
);
827 procedure ProcConnectNetGame();
831 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
833 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
834 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
835 PW
:= TGUIEdit(GetControl('edPW')).Text;
838 g_Console_WriteGameConfig
;
839 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
842 procedure ProcEnterPassword();
846 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
848 NetClientIP
:= PromptIP
;
849 NetClientPort
:= PromptPort
;
850 PW
:= TGUIEdit(GetControl('edPW')).Text;
853 g_Console_WriteGameConfig
;
854 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
857 procedure ProcServerlist();
859 if not NetInitDone
then
861 if (not g_Net_Init()) then
863 g_Console_Add('NET: ERROR: Failed to init ENet!');
870 g_Net_Slist_Set(NetMasterList
);
872 gState
:= STATE_SLIST
;
873 g_ActiveWindow
:= nil;
875 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
880 slReturnPressed
:= True;
881 if g_Net_Slist_Fetch(slCurrent
) then
883 if slCurrent
= nil then
884 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
887 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
888 g_Serverlist_GenerateTable(slCurrent
, slTable
);
891 procedure ProcStartCampaign();
897 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
899 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
900 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
902 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
908 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
911 procedure ProcSelectMap(Sender
: TGUIControl
);
915 wad
, map
, res
: String;
917 win
:= g_GUI_GetWindow('SelectMapMenu');
918 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
920 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
921 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
923 if (wad
= '') or (map
= '') then
924 begin // Ýòî íå êàðòà
925 TGUILabel(GetControl('lbMapName')).Text := '';
926 TGUILabel(GetControl('lbMapAuthor')).Text := '';
927 TGUILabel(GetControl('lbMapSize')).Text := '';
928 TGUIMemo(GetControl('meMapDescription')).SetText('');
929 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
930 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
936 a
:= g_Map_GetMapInfo(res
);
938 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
939 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
940 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
941 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
942 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
943 TGUILabel(win
.GetControl('lbMapScale')).Text :=
944 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
949 procedure ProcSelectWAD(Sender
: TGUIControl
);
954 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
956 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
958 with TGUIListBox(GetControl('lsMapRes')) do
964 list
:= g_Map_GetMapsList(wad
);
978 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
984 win
:= g_GUI_GetWindow('CampaignMenu');
985 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
987 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
991 TGUILabel(GetControl('lbWADName')).Text := '';
992 TGUILabel(GetControl('lbWADAuthor')).Text := '';
993 TGUIMemo(GetControl('meWADDescription')).SetText('');
996 a
:= g_Game_GetMegaWADInfo(wad
);
998 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
999 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1000 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1002 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1006 fn
:= g_ExtractWadName(a
.pic
);
1008 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1010 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1015 procedure ProcChangeColor(Sender
: TGUIControl
);
1019 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1020 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1021 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1022 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1023 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1024 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1026 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1027 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1028 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1029 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1030 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1031 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1034 procedure ProcSelectModel(Sender
: TGUIControl
);
1039 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1040 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1041 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1043 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1044 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1045 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1047 ProcChangeColor(nil);
1050 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1062 wad
:= TWADFile
.Create
;
1063 if wad
.ReadFile(GameWAD
) then
1064 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1069 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1071 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1072 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1073 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1074 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1076 if g_Texture_Get('FONT_STD', ID
) then
1077 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1082 if cfglen
<> 0 then FreeMem(cfgdata
);
1085 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1091 cfgdata
, fntdata
: Pointer;
1092 cfglen
, fntlen
: Integer;
1100 wad
:= TWADFile
.Create
;
1101 if wad
.ReadFile(GameWAD
) then
1103 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1104 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1110 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1111 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1112 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1114 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1115 FontID
:= e_CharFont_Create(spc
);
1117 for a
:= 0 to 255 do
1119 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1120 if chrwidth
= 0 then Continue
;
1122 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1124 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1130 if cfglen
<> 0 then FreeMem(cfgdata
);
1131 if fntlen
<> 0 then FreeMem(fntdata
);
1134 procedure MenuLoadData();
1136 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1138 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1139 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1140 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1141 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1142 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1143 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1144 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1145 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1146 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1147 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1148 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1149 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1150 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1151 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1152 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1153 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1154 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1155 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1156 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1157 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1158 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1159 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1160 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1161 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1162 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1164 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1165 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1166 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1167 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1168 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1169 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1170 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1173 procedure MenuFreeData();
1175 e_CharFont_Remove(gMenuFont
);
1176 e_CharFont_Remove(gMenuSmallFont
);
1178 g_Texture_Delete('MAINMENU_LOGO');
1179 g_Texture_Delete('MAINMENU_MARKER1');
1180 g_Texture_Delete('MAINMENU_MARKER2');
1181 g_Texture_Delete('SCROLL_LEFT');
1182 g_Texture_Delete('SCROLL_RIGHT');
1183 g_Texture_Delete('SCROLL_MIDDLE');
1184 g_Texture_Delete('SCROLL_MARKER');
1185 g_Texture_Delete('EDIT_LEFT');
1186 g_Texture_Delete('EDIT_RIGHT');
1187 g_Texture_Delete('EDIT_MIDDLE');
1188 g_Texture_Delete('BOX1');
1189 g_Texture_Delete('BOX2');
1190 g_Texture_Delete('BOX3');
1191 g_Texture_Delete('BOX4');
1192 g_Texture_Delete('BOX5');
1193 g_Texture_Delete('BOX6');
1194 g_Texture_Delete('BOX7');
1195 g_Texture_Delete('BOX8');
1196 g_Texture_Delete('BOX9');
1197 g_Texture_Delete('BSCROLL_UP_A');
1198 g_Texture_Delete('BSCROLL_UP_U');
1199 g_Texture_Delete('BSCROLL_DOWN_A');
1200 g_Texture_Delete('BSCROLL_DOWN_U');
1201 g_Texture_Delete('BSCROLL_MIDDLE');
1202 g_Texture_Delete('NOPIC');
1204 g_Sound_Delete('MENU_SELECT');
1205 g_Sound_Delete('MENU_OPEN');
1206 g_Sound_Delete('MENU_CLOSE');
1207 g_Sound_Delete('MENU_CHANGE');
1208 g_Sound_Delete('SCROLL_ADD');
1209 g_Sound_Delete('SCROLL_SUB');
1210 g_Sound_Delete('SOUND_PLAYER_FALL');
1213 procedure ProcAuthorsMenu();
1215 gMusic
.SetByName('MUSIC_INTERMUS');
1219 procedure ProcExitMenuKeyDown (yes
: Boolean);
1222 snd
: TPlayableSound
;
1227 g_Game_StopAllSounds(True);
1228 case (Random(18)) of
1229 0: s
:= 'SOUND_MONSTER_PAIN';
1230 1: s
:= 'SOUND_MONSTER_DIE_3';
1231 2: s
:= 'SOUND_MONSTER_SLOP';
1232 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1233 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1234 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1235 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1236 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1237 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1238 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1239 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1240 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1241 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1242 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1243 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1244 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1245 else s
:= 'SOUND_PLAYER_FALL';
1247 snd
:= TPlayableSound
.Create();
1248 res
:= snd
.SetByName(s
);
1249 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1253 while snd
.IsPlaying() do begin end;
1261 procedure ProcLoadMenu();
1268 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1269 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1270 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1274 procedure ProcSaveMenu();
1282 name
:= g_GetSaveName(a
, valid
);
1283 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1284 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1288 procedure ProcSaveGame(Sender
: TGUIControl
);
1292 if g_Game_IsNet
then Exit
;
1293 if g_Game_IsTestMap
then Exit
;
1294 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1295 g_Game_PauseAllSounds(True);
1296 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1298 g_ActiveWindow
:= nil;
1299 g_Game_Pause(False);
1302 procedure ProcLoadGame(Sender
: TGUIControl
);
1306 if g_Game_IsNet
then Exit
;
1307 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1308 if g_LoadGame(a
) then
1310 g_Game_PauseAllSounds(False)
1312 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1314 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1315 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1316 //g_ActiveWindow := nil;
1320 procedure ProcSinglePlayer (n
: Integer);
1321 var wad
, map
: AnsiString;
1324 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1325 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1326 if e_FindResource(AllMapDirs
, wad
) then
1328 wad
:= ExpandFileName(wad
);
1329 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1333 procedure ProcSingle1Player
;
1338 procedure ProcSingle2Players
;
1343 procedure ProcSelectMapMenu();
1346 wad_lb
: TGUIFileListBox
;
1347 map_lb
: TGUIListBox
;
1350 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1351 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1352 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1354 if wad_lb
.SelectedItem() <> '' then
1355 map
:= map_lb
.SelectedItem()
1359 wad_lb
.UpdateFileList();
1362 if wad_lb
.SelectedItem() <> '' then
1365 map_lb
.SelectItem(map
);
1367 if map_lb
.SelectedItem() <> '' then
1371 g_GUI_ShowWindow('SelectMapMenu');
1374 procedure ProcSelectCampaignMenu();
1377 wad_lb
: TGUIFileListBox
;
1379 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1380 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1382 wad_lb
.UpdateFileList();
1384 if wad_lb
.SelectedItem() <> '' then
1385 ProcSelectCampaignWAD(nil);
1388 procedure ProcSetMap();
1390 wad
, map
, res
: String;
1392 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1394 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1395 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1398 if (wad
= '') or (map
= '') then
1401 wad
:= e_FindWadRel(MapDirs
, WAD
);
1403 res
:= wad
+':\'+map
;
1405 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1406 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1409 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1413 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1415 g_Sound_SetupAllVolumes(
1416 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1417 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1421 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1425 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1426 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1428 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1429 g_dbg_scale
:= TempScale
+ 1;
1433 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1437 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1438 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1439 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1440 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1443 procedure ProcOptionsPlayersMIMenu();
1448 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1450 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1452 if a
= '' then Exit
;
1454 b
:= g_PlayerModel_GetInfo(a
);
1456 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1458 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1459 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1460 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1462 if b
.HaveWeapon
then
1463 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1465 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1468 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1471 procedure ProcOptionsPlayerP1WeaponMenu();
1475 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1476 if a
= '' then Exit
;
1477 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1480 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1482 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1485 procedure ProcOptionsPlayerP2WeaponMenu();
1489 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1490 if a
= '' then Exit
;
1491 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1494 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1496 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1499 procedure ProcOptionsPlayersAnim();
1503 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1508 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1511 Model
.GetCurrentAnimation
.Loop
:= True;
1512 Model
.GetCurrentAnimationMask
.Loop
:= True;
1516 procedure ProcOptionsPlayersWeap();
1520 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1525 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1529 procedure ProcOptionsPlayersRot();
1533 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1534 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1536 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1540 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1544 g_Options_SetDefault();
1550 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1552 if yes
then ReadOptions();
1556 procedure ProcAuthorsClose();
1558 gMusic
.SetByName('MUSIC_MENU');
1560 gState
:= STATE_MENU
;
1563 procedure ProcGMClose();
1565 g_Game_InGameMenu(False);
1568 procedure ProcGMShow();
1573 if (gGameSettings
.GameType
= GT_SINGLE
) and
1574 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1575 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1576 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1578 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1579 if g_Game_IsTestMap
then
1580 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1581 TGUIMainMenu(g_ActiveWindow
.GetControl(
1582 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1585 procedure ProcChangePlayers();
1587 TeamGame
, Spectator
, AddTwo
: Boolean;
1588 P1Team
{, P2Team}: Byte;
1589 bP2
: TGUITextButton
;
1591 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1592 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1593 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1594 P1Team
:= TEAM_NONE
;
1595 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1597 //P2Team := TEAM_NONE;
1598 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1600 TGUIMainMenu(g_ActiveWindow
.GetControl(
1601 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1602 TGUIMainMenu(g_ActiveWindow
.GetControl(
1603 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1604 TGUIMainMenu(g_ActiveWindow
.GetControl(
1605 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1607 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1608 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1609 bP2
.Enabled
:= AddTwo
and not Spectator
;
1611 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1613 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1614 if gPlayer2
= nil then
1615 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1617 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1619 TGUIMainMenu(g_ActiveWindow
.GetControl(
1620 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1623 procedure ProcJoinRed();
1625 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1627 if g_Game_IsServer
then
1629 if gPlayer1
= nil then
1630 g_Game_AddPlayer(TEAM_RED
)
1633 if gPlayer1
.Team
<> TEAM_RED
then
1635 gPlayer1
.SwitchTeam
;
1636 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1639 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1644 gPlayer1Settings
.Team
:= TEAM_RED
;
1645 MC_SEND_PlayerSettings
;
1646 if gPlayer1
= nil then
1647 g_Game_AddPlayer(TEAM_RED
);
1649 g_ActiveWindow
:= nil;
1650 g_Game_Pause(False);
1653 procedure ProcJoinBlue();
1655 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1657 if g_Game_IsServer
then
1659 if gPlayer1
= nil then
1660 g_Game_AddPlayer(TEAM_BLUE
)
1663 if gPlayer1
.Team
<> TEAM_BLUE
then
1665 gPlayer1
.SwitchTeam
;
1666 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1669 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1674 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1675 MC_SEND_PlayerSettings
;
1676 if gPlayer1
= nil then
1677 g_Game_AddPlayer(TEAM_BLUE
);
1679 g_ActiveWindow
:= nil;
1680 g_Game_Pause(False);
1683 procedure ProcJoinGame();
1685 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1687 if gPlayer1
= nil then
1689 g_ActiveWindow
:= nil;
1690 g_Game_Pause(False);
1693 procedure ProcSwitchP2();
1695 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1697 if gPlayer1
= nil then
1699 if gPlayer2
= nil then
1702 g_Game_RemovePlayer();
1703 g_ActiveWindow
:= nil;
1704 g_Game_Pause(False);
1707 procedure ProcSpectate();
1709 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1712 g_ActiveWindow
:= nil;
1713 g_Game_Pause(False);
1716 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1718 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1721 procedure ProcEndMenuKeyDown (yes
: Boolean);
1723 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1726 procedure ProcSetRussianLanguage
;
1728 if gLanguage
<> LANGUAGE_RUSSIAN
then
1730 gLanguage
:= LANGUAGE_RUSSIAN
;
1731 gLanguageChange
:= True;
1732 gAskLanguage
:= False;
1737 procedure ProcSetEnglishLanguage
;
1739 if gLanguage
<> LANGUAGE_ENGLISH
then
1741 gLanguage
:= LANGUAGE_ENGLISH
;
1742 gLanguageChange
:= True;
1743 gAskLanguage
:= False;
1748 procedure ReadGameSettings();
1752 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1754 with gGameSettings
do
1756 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1757 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1761 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1762 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1764 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1766 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1770 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1771 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1775 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1776 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1778 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1783 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1784 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1785 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1787 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1788 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1789 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1792 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1797 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1799 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1800 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1801 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1803 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1804 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1808 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1809 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1811 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1812 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1813 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1814 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1815 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1816 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1817 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1818 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1822 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1823 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1824 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1825 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1826 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1831 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1832 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1837 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1838 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1843 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1844 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1845 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1850 procedure ProcApplyGameSet();
1854 stat
: TPlayerStatArray
;
1856 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1858 if not g_Game_IsServer
then Exit
;
1860 with gGameSettings
do
1862 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1864 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1865 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1867 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1870 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1872 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1873 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1874 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1875 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1876 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1880 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1882 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1883 Options
:= Options
or GAME_OPTION_DMKEYS
1885 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1888 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1890 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1896 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1898 TimeLimit
:= Max(n
, b
);
1902 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1904 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1911 if GameMode
= GM_DM
then
1913 stat
:= g_Player_GetStats();
1915 for a
:= 0 to High(stat
) do
1916 if stat
[a
].Frags
> b
then
1920 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1922 GoalLimit
:= Max(n
, b
);
1926 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1928 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1929 if n
< 0 then n
:= 0;
1930 if n
> 255 then n
:= 255;
1936 stat
:= g_Player_GetStats();
1938 for a
:= 0 to High(stat
) do
1939 if stat
[a
].Lives
> b
then
1942 MaxLives
:= Max(n
, b
);
1946 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1948 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1951 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1952 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1956 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1957 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1961 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1962 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1967 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1969 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1970 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1971 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1972 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1976 // don't forget to latch this shit
1977 gsGameFlags
:= Options
;
1978 gsMaxLives
:= MaxLives
;
1979 gsGoalLimit
:= GoalLimit
;
1980 gsTimeLimit
:= TimeLimit
;
1983 if g_Game_IsNet
then MH_SEND_GameSettings
;
1986 procedure ProcVideoOptionsRes();
1991 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1993 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1994 IntToStr(gWinSizeX
) +
1995 ' x ' + IntToStr(gWinSizeY
) +
1996 ', ' + IntToStr(gBPP
) + ' bpp';
1998 with TGUIListBox(menu
.GetControl('lsResolution')) do
2000 list
:= sys_GetDisplayModes(gBPP
);
2004 ItemIndex
:= Length(list
)
2012 with TGUISwitch(menu
.GetControl('swFullScreen')) do
2018 TempResScale
:= Round(r_pixel_scale
- 1);
2019 with TGUISwitch(menu
.GetControl('swResFactor')) do
2020 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
2023 procedure ProcApplyVideoOptions();
2026 Fullscreen
: Boolean;
2027 SWidth
, SHeight
: Integer;
2028 ScaleChanged
: Boolean;
2031 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2033 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
2035 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
2038 SWidth
:= gWinSizeX
;
2039 SHeight
:= gWinSizeY
;
2040 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
2043 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
2045 ScaleChanged
:= False;
2046 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
2048 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
2049 r_pixel_scale
:= TempResScale
+ 1;
2050 ScaleChanged
:= True;
2053 if (SWidth
<> gWinSizeX
) or
2054 (SHeight
<> gWinSizeY
) or
2055 (Fullscreen
<> gFullscreen
) or
2058 gResolutionChange
:= True;
2059 gRC_Width
:= SWidth
;
2060 gRC_Height
:= SHeight
;
2061 gRC_FullScreen
:= Fullscreen
;
2062 gRC_Maximized
:= gWinMaximized
;
2065 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
2069 procedure ProcSetFirstRussianLanguage
;
2071 gLanguage
:= LANGUAGE_RUSSIAN
;
2072 gLanguageChange
:= True;
2073 gAskLanguage
:= False;
2076 procedure ProcSetFirstEnglishLanguage
;
2078 gLanguage
:= LANGUAGE_ENGLISH
;
2079 gLanguageChange
:= True;
2080 gAskLanguage
:= False;
2083 procedure ProcRecallAddress();
2085 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2087 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2088 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2092 procedure CreateFirstLanguageMenu();
2096 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2098 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2100 Name
:= 'mmFirstLanguageMenu';
2101 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2102 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2105 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2106 Menu
.MainWindow
:= True;
2107 g_GUI_AddWindow(Menu
);
2110 procedure g_Menu_AskLanguage();
2112 CreateFirstLanguageMenu();
2113 g_GUI_ShowWindow('FirstLanguageMenu');
2116 procedure CreatePlayerOptionsMenu(s
: String);
2121 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2123 a
:= _lc
[I_MENU_PLAYER_1
]
2125 a
:= _lc
[I_MENU_PLAYER_2
];
2126 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2128 Name
:= 'mOptionsPlayers'+s
+'Menu';
2129 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2131 Name
:= 'ed'+s
+'Name';
2135 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2137 Name
:= 'sw'+s
+'Team';
2138 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2139 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2141 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2143 Name
:= 'ls'+s
+'Model';
2145 Items
:= g_PlayerModel_GetNames();
2146 OnChange
:= ProcSelectModel
;
2148 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2150 Name
:= 'sc'+s
+'Red';
2152 OnChange
:= ProcChangeColor
;
2154 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2156 Name
:= 'sc'+s
+'Green';
2158 OnChange
:= ProcChangeColor
;
2160 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2162 Name
:= 'sc'+s
+'Blue';
2164 OnChange
:= ProcChangeColor
;
2167 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2168 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2169 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2170 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2171 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2172 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2173 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2175 Name
:= 'mv'+s
+'Model';
2176 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2177 Y
:= GetControl('ls'+s
+'Model').Y
;
2180 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2181 g_GUI_AddWindow(Menu
);
2184 procedure CreateAllMenus();
2188 a
, cx
, _y
, i
, x
: Integer;
2191 Menu
:= TGUIWindow
.Create('MainMenu');
2192 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2194 Name
:= 'mmMainMenu';
2195 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2196 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2197 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2198 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2199 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2200 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2202 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2204 Color
:= _RGB(255, 255, 255);
2205 X
:= gScreenWidth
-GetWidth
-8;
2206 Y
:= gScreenHeight
-GetHeight
-8;
2208 Menu
.DefControl
:= 'mmMainMenu';
2209 Menu
.MainWindow
:= True;
2210 g_GUI_AddWindow(Menu
);
2212 Menu
:= TGUIWindow
.Create('NewGameMenu');
2213 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2215 Name
:= 'mmNewGameMenu';
2216 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2217 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2218 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2219 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2221 Menu
.DefControl
:= 'mmNewGameMenu';
2222 g_GUI_AddWindow(Menu
);
2224 Menu
:= TGUIWindow
.Create('NetGameMenu');
2225 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2227 Name
:= 'mmNetGameMenu';
2228 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2229 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2231 Menu
.DefControl
:= 'mmNetGameMenu';
2232 g_GUI_AddWindow(Menu
);
2234 Menu
:= TGUIWindow
.Create('NetServerMenu');
2235 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2237 Name
:= 'mNetServerMenu';
2238 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2240 Name
:= 'edSrvName';
2241 OnlyDigits
:= False;
2244 Text := NetServerName
;
2246 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2248 Name
:= 'edSrvPassword';
2249 OnlyDigits
:= False;
2252 Text := NetPassword
;
2254 with AddEdit(_lc
[I_NET_PORT
]) do
2260 Text := IntToStr(NetPort
);
2262 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2264 Name
:= 'edMaxPlayers';
2268 Text := IntToStr(NetMaxClients
);
2270 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2272 Name
:= 'swUseMaster';
2273 AddItem(_lc
[I_MENU_YES
]);
2274 AddItem(_lc
[I_MENU_NO
]);
2275 if NetUseMaster
then
2281 with AddLabel(_lc
[I_MENU_MAP
]) do
2286 OnClick
:= @ProcSelectMapMenu
;
2288 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2290 Name
:= 'swGameMode';
2291 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2292 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2293 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2294 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2295 case g_Game_TextToMode(gsGameMode
) of
2297 GM_DM
: ItemIndex
:= 0;
2298 GM_TDM
: ItemIndex
:= 1;
2299 GM_CTF
: ItemIndex
:= 2;
2301 GM_COOP
: ItemIndex
:= 3;
2303 OnChange
:= ProcSwitchMonstersCustom
;
2305 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2307 Name
:= 'edTimeLimit';
2311 if gsTimeLimit
> 0 then
2312 Text := IntToStr(gsTimeLimit
);
2314 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2316 Name
:= 'edGoalLimit';
2320 if gsGoalLimit
> 0 then
2321 Text := IntToStr(gsGoalLimit
);
2323 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2325 Name
:= 'edMaxLives';
2329 if gsMaxLives
> 0 then
2330 Text := IntToStr(gsMaxLives
);
2332 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2334 Name
:= 'edItemRespawnTime';
2338 if gsItemRespawnTime
> 0 then
2339 Text := IntToStr(gsItemRespawnTime
);
2341 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2343 Name
:= 'swPlayers';
2344 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2345 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2346 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2347 ItemIndex
:= gsPlayers
;
2349 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2351 Name
:= 'swTeamDamage';
2352 AddItem(_lc
[I_MENU_YES
]);
2353 AddItem(_lc
[I_MENU_NO
]);
2354 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2359 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2361 Name
:= 'swTeamHit';
2362 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2363 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2364 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2365 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2366 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2368 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2370 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2375 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2377 Name
:= 'swDeathmatchKeys';
2378 AddItem(_lc
[I_MENU_YES
]);
2379 AddItem(_lc
[I_MENU_NO
]);
2380 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2385 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2387 Name
:= 'swEnableExits';
2388 AddItem(_lc
[I_MENU_YES
]);
2389 AddItem(_lc
[I_MENU_NO
]);
2390 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2395 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2397 Name
:= 'swWeaponStay';
2398 AddItem(_lc
[I_MENU_YES
]);
2399 AddItem(_lc
[I_MENU_NO
]);
2400 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2405 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2407 Name
:= 'swMonsters';
2408 AddItem(_lc
[I_MENU_YES
]);
2409 AddItem(_lc
[I_MENU_NO
]);
2410 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2415 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2418 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2419 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2420 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2422 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2424 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2427 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2429 Name
:= 'swFlagDrop';
2430 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2431 AddItem(_lc
[I_MENU_YES
]);
2432 AddItem(_lc
[I_MENU_NO
]);
2433 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2435 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2441 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2445 Menu
.DefControl
:= 'mNetServerMenu';
2446 g_GUI_AddWindow(Menu
);
2448 Menu
:= TGUIWindow
.Create('NetClientMenu');
2449 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2451 Name
:= 'mNetClientMenu';
2453 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2456 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2462 Text := 'localhost';
2464 with AddEdit(_lc
[I_NET_PORT
]) do
2472 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2475 OnlyDigits
:= False;
2482 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2486 Menu
.DefControl
:= 'mNetClientMenu';
2487 g_GUI_AddWindow(Menu
);
2489 Menu
:= TGUIWindow
.Create('LoadMenu');
2490 Menu
.OnShow
:= ProcLoadMenu
;
2491 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2493 Name
:= 'mmLoadMenu';
2498 Name
:= 'edSlot'+IntToStr(a
);
2501 OnEnter
:= ProcLoadGame
;
2504 Menu
.DefControl
:= 'mmLoadMenu';
2505 g_GUI_AddWindow(Menu
);
2507 Menu
:= TGUIWindow
.Create('SaveMenu');
2508 Menu
.OnShow
:= ProcSaveMenu
;
2509 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2511 Name
:= 'mmSaveMenu';
2516 Name
:= 'edSlot'+IntToStr(a
);
2519 OnChange
:= ProcSaveGame
;
2522 Menu
.DefControl
:= 'mmSaveMenu';
2523 g_GUI_AddWindow(Menu
);
2525 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2526 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2528 Name
:= 'mCustomGameMenu';
2529 with AddLabel(_lc
[I_MENU_MAP
]) do
2534 OnClick
:= @ProcSelectMapMenu
;
2536 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2538 Name
:= 'swGameMode';
2539 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2540 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2541 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2542 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2543 case g_Game_TextToMode(gsGameMode
) of
2545 GM_DM
: ItemIndex
:= 0;
2546 GM_TDM
: ItemIndex
:= 1;
2547 GM_CTF
: ItemIndex
:= 2;
2549 GM_COOP
: ItemIndex
:= 3;
2551 OnChange
:= ProcSwitchMonstersCustom
;
2553 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2555 Name
:= 'edTimeLimit';
2559 if gsTimeLimit
> 0 then
2560 Text := IntToStr(gsTimeLimit
);
2562 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2564 Name
:= 'edGoalLimit';
2568 if gsGoalLimit
> 0 then
2569 Text := IntToStr(gsGoalLimit
);
2571 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2573 Name
:= 'edMaxLives';
2577 if gsMaxLives
> 0 then
2578 Text := IntToStr(gsMaxLives
);
2580 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2582 Name
:= 'edItemRespawnTime';
2586 if gsItemRespawnTime
> 0 then
2587 Text := IntToStr(gsItemRespawnTime
);
2589 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2591 Name
:= 'swPlayers';
2592 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2593 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2594 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2595 ItemIndex
:= gsPlayers
;
2597 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2599 Name
:= 'swTeamDamage';
2600 AddItem(_lc
[I_MENU_YES
]);
2601 AddItem(_lc
[I_MENU_NO
]);
2602 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2607 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2609 Name
:= 'swTeamHit';
2610 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2611 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2612 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2613 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2614 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2616 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2618 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2623 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2625 Name
:= 'swDeathmatchKeys';
2626 AddItem(_lc
[I_MENU_YES
]);
2627 AddItem(_lc
[I_MENU_NO
]);
2628 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2633 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2635 Name
:= 'swEnableExits';
2636 AddItem(_lc
[I_MENU_YES
]);
2637 AddItem(_lc
[I_MENU_NO
]);
2638 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2643 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2645 Name
:= 'swWeaponStay';
2646 AddItem(_lc
[I_MENU_YES
]);
2647 AddItem(_lc
[I_MENU_NO
]);
2648 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2653 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2655 Name
:= 'swMonsters';
2656 AddItem(_lc
[I_MENU_YES
]);
2657 AddItem(_lc
[I_MENU_NO
]);
2658 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2663 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2666 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2667 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2668 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2670 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2672 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2675 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2677 Name
:= 'swFlagDrop';
2678 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2679 AddItem(_lc
[I_MENU_YES
]);
2680 AddItem(_lc
[I_MENU_NO
]);
2681 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2683 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2689 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2693 Menu
.DefControl
:= 'mCustomGameMenu';
2694 g_GUI_AddWindow(Menu
);
2696 Menu
:= TGUIWindow
.Create('CampaignMenu');
2697 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2699 Name
:= 'mCampaignMenu';
2708 with AddFileList('', 15, 4) do
2711 OnChange
:= ProcSelectCampaignWAD
;
2715 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2716 SetBase(MegawadDirs
);
2719 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2721 Name
:= 'lbWADName';
2725 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2727 Name
:= 'lbWADAuthor';
2731 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2732 with AddMemo('', 15, 3) do
2734 Name
:= 'meWADDescription';
2735 Color
:= MENU_ITEMSCTRL_COLOR
;
2737 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2739 Name
:= 'swPlayers';
2740 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2741 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2744 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2748 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2750 Name
:= 'mpWADImage';
2751 DefaultRes
:= 'NOPIC';
2752 X
:= GetControl('lsWAD').X
+4;
2753 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2756 Menu
.DefControl
:= 'mCampaignMenu';
2757 g_GUI_AddWindow(Menu
);
2759 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2760 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2762 Name
:= 'mSelectMapMenu';
2763 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2766 OnChange
:= ProcSelectWAD
;
2770 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2773 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2777 OnChange
:= ProcSelectMap
;
2780 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2782 Name
:= 'lbMapName';
2786 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2788 Name
:= 'lbMapAuthor';
2792 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2794 Name
:= 'lbMapSize';
2798 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2800 Name
:= 'meMapDescription';
2805 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2807 Name
:= 'mpMapPreview';
2808 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2809 Y
:= GetControl('lsMapWAD').Y
;
2811 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2813 Name
:= 'lbMapScale';
2816 Color
:= MENU_ITEMSCTRL_COLOR
;
2817 X
:= GetControl('lsMapWAD').X
+
2818 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2819 2 + MAPPREVIEW_WIDTH
*4;
2820 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2823 Menu
.OnClose
:= ProcSetMap
;
2824 Menu
.DefControl
:= 'mSelectMapMenu';
2825 g_GUI_AddWindow(Menu
);
2827 Menu
:= TGUIWindow
.Create('OptionsMenu');
2828 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2830 Name
:= 'mmOptionsMenu';
2831 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2832 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2833 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2834 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2835 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2836 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2838 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2839 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2841 Menu
.OnClose
:= ProcApplyOptions
;
2842 Menu
.DefControl
:= 'mmOptionsMenu';
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2846 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2847 g_GUI_AddWindow(Menu
);
2849 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2850 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2852 Name
:= 'mOptionsVideoMenu';
2853 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2854 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2860 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2863 AddItem(_lc
[I_MENU_YES
]);
2864 AddItem(_lc
[I_MENU_NO
]);
2866 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2868 Name
:= 'swTextureFilter';
2869 AddItem(_lc
[I_MENU_YES
]);
2870 AddItem(_lc
[I_MENU_NO
]);
2872 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2875 AddItem(_lc
[I_MENU_YES
]);
2876 AddItem(_lc
[I_MENU_NO
]);
2878 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2880 Name
:= 'swLegacyNPOT';
2881 AddItem(_lc
[I_MENU_NO
]);
2882 AddItem(_lc
[I_MENU_YES
]);
2885 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2888 Menu
.DefControl
:= 'mOptionsVideoMenu';
2889 g_GUI_AddWindow(Menu
);
2891 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2892 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2894 Name
:= 'mOptionsVideoResMenu';
2895 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2897 Name
:= 'lbCurrentRes';
2901 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2903 Name
:= 'lsResolution';
2906 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2908 Name
:= 'swFullScreen';
2909 AddItem(_lc
[I_MENU_YES
]);
2910 AddItem(_lc
[I_MENU_NO
]);
2912 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2914 Name
:= 'swResFactor';
2916 for i
:= 2 to gRC_Width
div 640 do
2917 AddItem(IntToStr(i
) + 'x');
2920 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2923 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2924 g_GUI_AddWindow(Menu
);
2926 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2927 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2929 Name
:= 'mOptionsSoundMenu';
2930 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2932 Name
:= 'scMusicLevel';
2934 OnChange
:= ProcChangeSoundSettings
;
2936 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2938 Name
:= 'scSoundLevel';
2940 OnChange
:= ProcChangeSoundSettings
;
2942 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2944 Name
:= 'scMaxSimSounds';
2947 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2949 Name
:= 'swAnnouncer';
2950 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2951 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2952 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2953 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2955 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2956 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2958 Name
:= 'swSoundEffects';
2959 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2960 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2962 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2963 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2965 Name
:= 'swChatSpeech';
2966 AddItem(_lc
[I_MENU_YES
]);
2967 AddItem(_lc
[I_MENU_NO
]);
2969 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2971 Name
:= 'swInactiveSounds';
2972 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2973 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2977 Menu
.DefControl
:= 'mOptionsSoundMenu';
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2981 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2983 Name
:= 'mOptionsGameMenu';
2984 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2986 Name
:= 'scParticlesCount';
2989 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2991 Name
:= 'swBloodCount';
2992 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2993 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2994 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2995 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2996 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2998 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
3000 Name
:= 'scShellsMax';
3003 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
3005 Name
:= 'scGibsMax';
3008 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
3010 Name
:= 'scCorpsesMax';
3013 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
3015 Name
:= 'swGibsCount';
3016 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3017 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3018 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3019 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3020 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3022 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
3024 Name
:= 'swCorpseType';
3025 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
3026 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
3028 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
3030 Name
:= 'swGibsType';
3031 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
3032 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
3034 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
3036 Name
:= 'swBloodType';
3037 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
3038 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
3040 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
3042 Name
:= 'swScreenFlash';
3043 AddItem(_lc
[I_MENU_NO
]);
3044 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3045 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3047 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
3049 Name
:= 'swBackground';
3050 AddItem(_lc
[I_MENU_YES
]);
3051 AddItem(_lc
[I_MENU_NO
]);
3053 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
3055 Name
:= 'swMessages';
3056 AddItem(_lc
[I_MENU_YES
]);
3057 AddItem(_lc
[I_MENU_NO
]);
3059 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
3061 Name
:= 'swRevertPlayers';
3062 AddItem(_lc
[I_MENU_YES
]);
3063 AddItem(_lc
[I_MENU_NO
]);
3065 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
3067 Name
:= 'swChatBubble';
3068 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
3069 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
3070 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
3071 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
3072 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3074 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3076 Name
:= 'swPlayerIndicator';
3077 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3078 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3079 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3081 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3083 Name
:= 'swPlayerIndicatorStyle';
3084 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3085 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3087 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3089 Name
:= 'scScaleFactor';
3091 OnChange
:= ProcChangeGameSettings
;
3095 Menu
.DefControl
:= 'mOptionsGameMenu';
3096 g_GUI_AddWindow(Menu
);
3098 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3099 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3101 Name
:= 'mOptionsControlsMenu';
3102 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3103 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3104 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3105 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3106 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3108 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3109 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3110 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3111 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3112 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3113 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3114 if e_HasJoysticks
then
3117 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3119 if g_touch_enabled
then
3122 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3125 Menu
.DefControl
:= 'mOptionsControlsMenu';
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3129 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3131 Name
:= 'mOptionsControlsP1Menu';
3132 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3133 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3134 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3135 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3136 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3137 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3138 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3139 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3140 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3141 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3142 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3144 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3145 g_GUI_AddWindow(Menu
);
3147 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3148 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3150 Name
:= 'mOptionsControlsP1MenuWeapons';
3151 for i
:= WP_FIRST
to WP_LAST
do
3152 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3153 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3155 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3156 g_GUI_AddWindow(Menu
);
3158 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3159 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3161 Name
:= 'mOptionsControlsP2Menu';
3162 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3163 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3164 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3165 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3166 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3167 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3168 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3169 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3170 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3171 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3172 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3174 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3175 g_GUI_AddWindow(Menu
);
3177 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3178 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3180 Name
:= 'mOptionsControlsP2MenuWeapons';
3181 for i
:= WP_FIRST
to WP_LAST
do
3182 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3183 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3185 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3186 g_GUI_AddWindow(Menu
);
3188 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3189 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3191 Name
:= 'mOptionsControlsJoystickMenu';
3192 for i
:= 0 to e_MaxJoys
- 1 do
3193 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3195 Name
:= 'scDeadzone' + IntToStr(i
);
3199 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3200 g_GUI_AddWindow(Menu
);
3202 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3203 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3205 Name
:= 'mOptionsControlsTouchMenu';
3206 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3208 Name
:= 'swTouchAlt';
3209 AddItem(_lc
[I_MENU_NO
]);
3210 AddItem(_lc
[I_MENU_YES
]);
3211 OnChange
:= ProcChangeTouchSettings
;
3213 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3215 Name
:= 'scTouchSize';
3217 OnChange
:= ProcChangeTouchSettings
;
3219 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3221 Name
:= 'swTouchFire';
3222 AddItem(_lc
[I_MENU_NO
]);
3223 AddItem(_lc
[I_MENU_YES
]);
3225 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3227 Name
:= 'scTouchOffset';
3229 OnChange
:= ProcChangeTouchSettings
;
3232 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3233 g_GUI_AddWindow(Menu
);
3235 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3236 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3238 Name
:= 'mOptionsPlayersMenu';
3239 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3240 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3242 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3243 g_GUI_AddWindow(Menu
);
3245 CreatePlayerOptionsMenu('P1');
3246 CreatePlayerOptionsMenu('P2');
3248 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3249 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3251 Name
:= 'mOptionsPlayersMIMenu';
3252 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3257 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3262 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3264 Name
:= 'meComment';
3267 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3268 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3271 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3275 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3276 g_GUI_AddWindow(Menu
);
3278 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3279 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3281 Name
:= 'mOptionsPlayersP1WeaponMenu';
3282 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3284 Name
:= 'swWeaponAutoswitch';
3285 AddItem(_lc
[I_MENU_NO
]);
3286 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3287 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3289 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3291 Name
:= 'swWeaponAllowEmpty';
3292 AddItem(_lc
[I_MENU_YES
]);
3293 AddItem(_lc
[I_MENU_NO
]);
3295 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3297 Name
:= 'swWeaponAllowFist';
3298 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3299 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3301 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3304 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3305 g_GUI_AddWindow(Menu
);
3307 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3308 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3310 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3311 for i
:= WP_FIRST
to WP_LAST
do
3313 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3315 Name
:= IntToStr(i
);
3316 for a
:= WP_FIRST
to WP_LAST
+1 do
3318 AddItem(IntToStr(a
));
3323 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3325 Name
:= IntToStr(WP_LAST
+1);
3326 for a
:= WP_FIRST
to WP_LAST
+1 do
3328 AddItem(IntToStr(a
));
3330 ItemIndex
:= WP_LAST
+ 1;
3333 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3334 g_GUI_AddWindow(Menu
);
3337 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3338 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3340 Name
:= 'mOptionsPlayersP2WeaponMenu';
3341 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3343 Name
:= 'swWeaponAutoswitch';
3344 AddItem(_lc
[I_MENU_NO
]);
3345 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3346 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3348 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3350 Name
:= 'swWeaponAllowEmpty';
3351 AddItem(_lc
[I_MENU_YES
]);
3352 AddItem(_lc
[I_MENU_NO
]);
3354 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3356 Name
:= 'swWeaponAllowFist';
3357 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3358 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3360 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3363 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3364 g_GUI_AddWindow(Menu
);
3366 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3367 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3369 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3370 for i
:= WP_FIRST
to WP_LAST
do
3372 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3374 Name
:= IntToStr(i
);
3375 for a
:= WP_FIRST
to WP_LAST
+1 do
3377 AddItem(IntToStr(a
));
3382 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3384 Name
:= IntToStr(WP_LAST
+1);
3385 for a
:= WP_FIRST
to WP_LAST
+1 do
3387 AddItem(IntToStr(a
));
3389 ItemIndex
:= WP_LAST
+ 1;
3392 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3393 g_GUI_AddWindow(Menu
);
3395 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3396 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3398 Name
:= 'mOptionsLanguageMenu';
3399 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3400 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3403 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3404 g_GUI_AddWindow(Menu
);
3406 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3407 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3408 g_GUI_AddWindow(Menu
);
3410 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3411 Menu
.BackTexture
:= 'INTER';
3412 Menu
.OnClose
:= ProcAuthorsClose
;
3416 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3418 Color
:= _RGB(255, 0, 0);
3419 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3421 _y
:= _y
+GetHeight();
3423 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3425 Color
:= _RGB(255, 0, 0);
3426 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3428 _y
:= _y
+GetHeight()+32;
3430 // ×òî äåëàë: Êòî äåëàë
3431 cx
:= gScreenWidth
div 2 - 320 + 64;
3432 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3434 Color
:= _RGB(255, 0, 0);
3439 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3441 Color
:= _RGB(255, 255, 255);
3446 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3448 Color
:= _RGB(255, 0, 0);
3453 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3455 Color
:= _RGB(255, 255, 255);
3460 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3462 Color
:= _RGB(255, 255, 255);
3467 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3469 Color
:= _RGB(255, 0, 0);
3474 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3476 Color
:= _RGB(255, 255, 255);
3481 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3483 Color
:= _RGB(255, 0, 0);
3488 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3490 Color
:= _RGB(255, 255, 255);
3493 _y
:= gScreenHeight
- 128;
3496 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3498 Color
:= _RGB(255, 0, 0);
3503 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3505 Color
:= _RGB(255, 255, 255);
3508 _y
:= _y
+GetHeight();
3510 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3512 Color
:= _RGB(255, 255, 255);
3515 _y
:= _y
+GetHeight();
3517 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3519 Color
:= _RGB(255, 255, 255);
3522 _y
:= gScreenHeight
- 32;
3524 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3526 Color
:= _RGB(255, 0, 0);
3527 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3530 g_GUI_AddWindow(Menu
);
3532 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3533 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3534 g_GUI_AddWindow(Menu
);
3536 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3537 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3539 Name
:= 'mmGameSingleMenu';
3540 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3541 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3542 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3543 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3544 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3545 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3547 Menu
.DefControl
:= 'mmGameSingleMenu';
3548 Menu
.MainWindow
:= True;
3549 Menu
.OnClose
:= ProcGMClose
;
3550 Menu
.OnShow
:= ProcGMShow
;
3551 g_GUI_AddWindow(Menu
);
3553 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3554 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3555 g_GUI_AddWindow(Menu
);
3557 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3558 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3559 g_GUI_AddWindow(Menu
);
3561 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3562 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3564 Name
:= 'mmGameCustomMenu';
3565 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3566 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3567 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3568 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3569 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3570 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3571 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3573 Menu
.DefControl
:= 'mmGameCustomMenu';
3574 Menu
.MainWindow
:= True;
3575 Menu
.OnClose
:= ProcGMClose
;
3576 Menu
.OnShow
:= ProcGMShow
;
3577 g_GUI_AddWindow(Menu
);
3579 Menu
:= TGUIWindow
.Create('GameServerMenu');
3580 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3582 Name
:= 'mmGameServerMenu';
3583 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3584 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3585 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3586 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3587 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3589 Menu
.DefControl
:= 'mmGameServerMenu';
3590 Menu
.MainWindow
:= True;
3591 Menu
.OnClose
:= ProcGMClose
;
3592 Menu
.OnShow
:= ProcGMShow
;
3593 g_GUI_AddWindow(Menu
);
3595 Menu
:= TGUIWindow
.Create('GameClientMenu');
3596 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3598 Name
:= 'mmGameClientMenu';
3599 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3600 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3601 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3603 Menu
.DefControl
:= 'mmGameClientMenu';
3604 Menu
.MainWindow
:= True;
3605 Menu
.OnClose
:= ProcGMClose
;
3606 Menu
.OnShow
:= ProcGMShow
;
3607 g_GUI_AddWindow(Menu
);
3609 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3610 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3612 Name
:= 'mClientPasswordMenu';
3613 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3621 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3624 Menu
.DefControl
:= 'mClientPasswordMenu';
3625 g_GUI_AddWindow(Menu
);
3627 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3628 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3630 Name
:= 'mGameSetGameMenu';
3631 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3633 Name
:= 'swTeamDamage';
3634 AddItem(_lc
[I_MENU_YES
]);
3635 AddItem(_lc
[I_MENU_NO
]);
3638 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3640 Name
:= 'swTeamHit';
3641 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3642 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3643 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3644 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3647 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3649 Name
:= 'swDeathmatchKeys';
3650 AddItem(_lc
[I_MENU_YES
]);
3651 AddItem(_lc
[I_MENU_NO
]);
3654 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3656 Name
:= 'edTimeLimit';
3661 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3663 Name
:= 'edGoalLimit';
3668 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3670 Name
:= 'edMaxLives';
3675 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3678 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3679 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3680 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3683 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3685 Name
:= 'swFlagDrop';
3686 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3687 AddItem(_lc
[I_MENU_YES
]);
3688 AddItem(_lc
[I_MENU_NO
]);
3694 Menu
.DefControl
:= 'mGameSetGameMenu';
3695 Menu
.OnClose
:= ProcApplyGameSet
;
3696 g_GUI_AddWindow(Menu
);
3698 Menu
:= TGUIWindow
.Create('TeamMenu');
3699 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3701 Name
:= 'mmTeamMenu';
3702 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3703 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3704 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3705 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3706 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3708 Menu
.DefControl
:= 'mmTeamMenu';
3709 Menu
.OnShow
:= ProcChangePlayers
;
3710 g_GUI_AddWindow(Menu
);
3713 procedure g_Menu_Show_SaveMenu();
3715 if g_Game_IsTestMap
then
3717 if gGameSettings
.GameType
= GT_SINGLE
then
3718 g_GUI_ShowWindow('GameSingleMenu')
3721 if g_Game_IsClient
then
3724 if g_Game_IsNet
then
3727 g_GUI_ShowWindow('GameCustomMenu');
3729 g_GUI_ShowWindow('SaveMenu');
3730 g_Sound_PlayEx('MENU_OPEN');
3733 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3735 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3736 if gGameSettings
.GameType
= GT_SINGLE
then
3738 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3742 if g_Game_IsClient
then exit
;
3743 if g_Game_IsNet
then exit
;
3744 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3746 g_GUI_ShowWindow('LoadMenu');
3747 g_Sound_PlayEx('MENU_OPEN');
3750 procedure g_Menu_Show_GameSetGame();
3752 if gGameSettings
.GameType
= GT_SINGLE
then
3753 g_GUI_ShowWindow('GameSingleMenu')
3756 if g_Game_IsClient
then
3759 if g_Game_IsNet
then
3760 g_GUI_ShowWindow('GameServerMenu')
3762 g_GUI_ShowWindow('GameCustomMenu');
3765 g_GUI_ShowWindow('GameSetGameMenu');
3766 g_Sound_PlayEx('MENU_OPEN');
3769 procedure g_Menu_Show_OptionsVideo();
3771 if gGameSettings
.GameType
= GT_SINGLE
then
3772 g_GUI_ShowWindow('GameSingleMenu')
3775 if g_Game_IsClient
then
3776 g_GUI_ShowWindow('GameClientMenu')
3778 if g_Game_IsNet
then
3779 g_GUI_ShowWindow('GameServerMenu')
3781 g_GUI_ShowWindow('GameCustomMenu');
3784 g_GUI_ShowWindow('OptionsMenu');
3785 g_GUI_ShowWindow('OptionsVideoMenu');
3786 g_Sound_PlayEx('MENU_OPEN');
3789 procedure g_Menu_Show_OptionsSound();
3791 if gGameSettings
.GameType
= GT_SINGLE
then
3792 g_GUI_ShowWindow('GameSingleMenu')
3795 if g_Game_IsClient
then
3796 g_GUI_ShowWindow('GameClientMenu')
3798 if g_Game_IsNet
then
3799 g_GUI_ShowWindow('GameServerMenu')
3801 g_GUI_ShowWindow('GameCustomMenu');
3804 g_GUI_ShowWindow('OptionsMenu');
3805 g_GUI_ShowWindow('OptionsSoundMenu');
3806 g_Sound_PlayEx('MENU_OPEN');
3809 procedure g_Menu_Show_EndGameMenu();
3811 g_GUI_ShowWindow('EndGameMenu');
3812 g_Sound_PlayEx('MENU_OPEN');
3815 procedure g_Menu_Show_QuitGameMenu();
3817 g_GUI_ShowWindow('ExitMenu');
3818 g_Sound_PlayEx('MENU_OPEN');
3821 procedure g_Menu_Init();
3828 procedure g_Menu_Free();
3832 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3837 procedure g_Menu_Reset();
3841 g_GUI_SaveMenuPos();
3842 ex
:= g_GUI_Destroy();
3846 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3851 g_Game_SetDebugMode();
3853 g_GUI_LoadMenuPos();