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 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
411 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
412 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
413 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
416 if gPlayer2
<> nil then
418 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
419 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
420 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
421 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
423 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
425 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
426 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
427 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
428 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
432 if g_Game_IsClient
then
434 MC_SEND_PlayerSettings
;
435 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
438 g_Console_WriteGameConfig
;
441 procedure ReadOptions();
446 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
448 with TGUISwitch(menu
.GetControl('swBPP')) do
454 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
455 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
457 with TGUISwitch(menu
.GetControl('swVSync')) do
458 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
460 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
461 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
463 with TGUISwitch(menu
.GetControl('swInterp')) do
464 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
466 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
468 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
469 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
470 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
472 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
473 if gMuteWhenInactive
then
478 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
480 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
481 if gSoundEffectsDF
then
486 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
487 if gUseChatSounds
then
492 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
513 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
514 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
515 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
516 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
520 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
523 for i
:= WP_FIRST
to WP_LAST
do
525 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
526 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
530 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
548 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
551 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
552 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
553 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
554 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
555 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
558 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
561 for i
:= WP_FIRST
to WP_LAST
do
563 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
564 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
568 if e_HasJoysticks
then
570 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
573 for i
:= 0 to e_MaxJoys
- 1 do
574 if e_JoystickAvailable
[i
] then
575 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
579 if g_touch_enabled
then
581 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
582 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
583 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
584 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
585 with TGUISwitch(menu
.GetControl('swTouchFire')) do
586 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
587 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
590 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
593 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
594 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
595 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
596 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
599 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
601 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
602 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
603 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
604 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
605 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
607 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
610 with TGUISwitch(menu
.GetControl('swBloodType')) do
611 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
613 with TGUISwitch(menu
.GetControl('swCorpseType')) do
614 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
616 with TGUISwitch(menu
.GetControl('swGibsType')) do
617 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
619 with TGUISwitch(menu
.GetControl('swGibsCount')) do
628 with TGUISwitch(menu
.GetControl('swBackGround')) do
629 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
631 with TGUISwitch(menu
.GetControl('swMessages')) do
632 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
634 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
635 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
637 with TGUISwitch(menu
.GetControl('swChatBubble')) do
638 ItemIndex
:= gChatBubble
;
640 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
641 ItemIndex
:= gPlayerIndicator
;
643 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
644 ItemIndex
:= gPlayerIndicatorStyle
;
646 TempScale
:= Round(g_dbg_scale
- 1);
647 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
649 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
651 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
652 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
654 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
655 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
657 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
658 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
659 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
661 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
662 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
663 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
664 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
665 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
666 for i
:= WP_FIRST
to WP_LAST
+1 do
668 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
669 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
672 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
673 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
674 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
675 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
676 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
677 for i
:= WP_FIRST
to WP_LAST
+1 do
679 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
680 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
683 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
685 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
686 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
688 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
689 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
691 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
692 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
693 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
695 ProcSelectModel(nil);
698 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
700 // don't turn off monsters in DM
702 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
703 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
704 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
706 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
709 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
710 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
711 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
712 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
716 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
718 // don't turn off monsters in DM
720 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
721 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
724 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
727 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
728 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
729 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
730 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
734 function LatchGameOptions(const MenuName
: string): Byte;
740 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
742 Map
:= TGUILabel(GetControl('lbMap')).Text;
745 if not isWadPath(Map
) then
748 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
749 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
750 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
751 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
752 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
753 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
754 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
758 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
759 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
760 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
761 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
762 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
763 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
764 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
765 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
766 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
767 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
769 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
770 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
771 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
772 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
775 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
776 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
777 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
778 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
781 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
782 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
783 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
784 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
787 // TODO: get this crap out of here
788 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
789 gGameSettings
.WarmupTime
:= gsWarmupTime
;
790 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
794 procedure ProcStartCustomGame();
798 GameMode
:= LatchGameOptions('mCustomGameMenu');
799 if GameMode
= GM_NONE
then Exit
;
801 g_Console_WriteGameConfig
;
802 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
803 gsMaxLives
, gsGameFlags
, gsPlayers
);
807 procedure ProcStartNetGame();
811 GameMode
:= LatchGameOptions('mNetServerMenu');
812 if GameMode
= GM_NONE
then Exit
;
814 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
816 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
817 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
818 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
819 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
820 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
821 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
824 g_Console_WriteGameConfig
;
825 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
826 gsGameFlags
, gsPlayers
, 0, NetPort
);
829 procedure ProcConnectNetGame();
833 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
835 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
836 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
837 PW
:= TGUIEdit(GetControl('edPW')).Text;
840 g_Console_WriteGameConfig
;
841 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
844 procedure ProcEnterPassword();
848 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
850 NetClientIP
:= PromptIP
;
851 NetClientPort
:= PromptPort
;
852 PW
:= TGUIEdit(GetControl('edPW')).Text;
855 g_Console_WriteGameConfig
;
856 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
859 procedure ProcServerlist();
861 if not NetInitDone
then
863 if (not g_Net_Init()) then
865 g_Console_Add('NET: ERROR: Failed to init ENet!');
872 g_Net_Slist_Set(NetMasterList
);
874 gState
:= STATE_SLIST
;
875 g_ActiveWindow
:= nil;
877 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
882 slReturnPressed
:= True;
883 if g_Net_Slist_Fetch(slCurrent
) then
885 if slCurrent
= nil then
886 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
889 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
890 g_Serverlist_GenerateTable(slCurrent
, slTable
);
893 procedure ProcStartCampaign();
899 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
901 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
902 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
904 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
910 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
913 procedure ProcSelectMap(Sender
: TGUIControl
);
917 wad
, map
, res
: String;
919 win
:= g_GUI_GetWindow('SelectMapMenu');
920 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
922 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
923 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
925 if (wad
= '') or (map
= '') then
926 begin // Ýòî íå êàðòà
927 TGUILabel(GetControl('lbMapName')).Text := '';
928 TGUILabel(GetControl('lbMapAuthor')).Text := '';
929 TGUILabel(GetControl('lbMapSize')).Text := '';
930 TGUIMemo(GetControl('meMapDescription')).SetText('');
931 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
932 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
938 a
:= g_Map_GetMapInfo(res
);
940 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
941 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
942 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
943 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
944 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
945 TGUILabel(win
.GetControl('lbMapScale')).Text :=
946 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
951 procedure ProcSelectWAD(Sender
: TGUIControl
);
956 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
958 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
960 with TGUIListBox(GetControl('lsMapRes')) do
966 list
:= g_Map_GetMapsList(wad
);
980 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
986 win
:= g_GUI_GetWindow('CampaignMenu');
987 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
989 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
993 TGUILabel(GetControl('lbWADName')).Text := '';
994 TGUILabel(GetControl('lbWADAuthor')).Text := '';
995 TGUIMemo(GetControl('meWADDescription')).SetText('');
998 a
:= g_Game_GetMegaWADInfo(wad
);
1000 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1001 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1002 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1004 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1008 fn
:= g_ExtractWadName(a
.pic
);
1010 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1012 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1017 procedure ProcChangeColor(Sender
: TGUIControl
);
1021 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1022 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1023 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1024 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1025 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1026 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1028 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1029 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1030 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1031 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1032 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1033 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1036 procedure ProcSelectModel(Sender
: TGUIControl
);
1041 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1042 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1043 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1045 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1046 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1047 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1049 ProcChangeColor(nil);
1052 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1064 wad
:= TWADFile
.Create
;
1065 if wad
.ReadFile(GameWAD
) then
1066 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1071 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1073 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1074 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1075 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1076 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1078 if g_Texture_Get('FONT_STD', ID
) then
1079 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1084 if cfglen
<> 0 then FreeMem(cfgdata
);
1087 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1093 cfgdata
, fntdata
: Pointer;
1094 cfglen
, fntlen
: Integer;
1102 wad
:= TWADFile
.Create
;
1103 if wad
.ReadFile(GameWAD
) then
1105 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1106 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1112 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1113 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1114 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1116 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1117 FontID
:= e_CharFont_Create(spc
);
1119 for a
:= 0 to 255 do
1121 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1122 if chrwidth
= 0 then Continue
;
1124 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1126 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1132 if cfglen
<> 0 then FreeMem(cfgdata
);
1133 if fntlen
<> 0 then FreeMem(fntdata
);
1136 procedure MenuLoadData();
1138 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1140 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1141 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1142 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1143 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1144 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1145 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1146 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1147 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1148 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1149 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1150 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1151 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1152 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1153 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1154 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1155 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1156 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1157 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1158 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1159 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1160 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1161 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1162 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1163 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1164 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1166 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1167 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1168 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1169 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1170 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1171 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1172 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1175 procedure MenuFreeData();
1177 e_CharFont_Remove(gMenuFont
);
1178 e_CharFont_Remove(gMenuSmallFont
);
1180 g_Texture_Delete('MAINMENU_LOGO');
1181 g_Texture_Delete('MAINMENU_MARKER1');
1182 g_Texture_Delete('MAINMENU_MARKER2');
1183 g_Texture_Delete('SCROLL_LEFT');
1184 g_Texture_Delete('SCROLL_RIGHT');
1185 g_Texture_Delete('SCROLL_MIDDLE');
1186 g_Texture_Delete('SCROLL_MARKER');
1187 g_Texture_Delete('EDIT_LEFT');
1188 g_Texture_Delete('EDIT_RIGHT');
1189 g_Texture_Delete('EDIT_MIDDLE');
1190 g_Texture_Delete('BOX1');
1191 g_Texture_Delete('BOX2');
1192 g_Texture_Delete('BOX3');
1193 g_Texture_Delete('BOX4');
1194 g_Texture_Delete('BOX5');
1195 g_Texture_Delete('BOX6');
1196 g_Texture_Delete('BOX7');
1197 g_Texture_Delete('BOX8');
1198 g_Texture_Delete('BOX9');
1199 g_Texture_Delete('BSCROLL_UP_A');
1200 g_Texture_Delete('BSCROLL_UP_U');
1201 g_Texture_Delete('BSCROLL_DOWN_A');
1202 g_Texture_Delete('BSCROLL_DOWN_U');
1203 g_Texture_Delete('BSCROLL_MIDDLE');
1204 g_Texture_Delete('NOPIC');
1206 g_Sound_Delete('MENU_SELECT');
1207 g_Sound_Delete('MENU_OPEN');
1208 g_Sound_Delete('MENU_CLOSE');
1209 g_Sound_Delete('MENU_CHANGE');
1210 g_Sound_Delete('SCROLL_ADD');
1211 g_Sound_Delete('SCROLL_SUB');
1212 g_Sound_Delete('SOUND_PLAYER_FALL');
1215 procedure ProcAuthorsMenu();
1217 gMusic
.SetByName('MUSIC_INTERMUS');
1221 procedure ProcExitMenuKeyDown (yes
: Boolean);
1224 snd
: TPlayableSound
;
1229 g_Game_StopAllSounds(True);
1230 case (Random(18)) of
1231 0: s
:= 'SOUND_MONSTER_PAIN';
1232 1: s
:= 'SOUND_MONSTER_DIE_3';
1233 2: s
:= 'SOUND_MONSTER_SLOP';
1234 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1235 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1236 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1237 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1238 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1239 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1240 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1241 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1242 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1243 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1244 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1245 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1246 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1247 else s
:= 'SOUND_PLAYER_FALL';
1249 snd
:= TPlayableSound
.Create();
1250 res
:= snd
.SetByName(s
);
1251 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1255 while snd
.IsPlaying() do begin end;
1263 procedure ProcLoadMenu();
1270 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1271 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1272 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1276 procedure ProcSaveMenu();
1284 name
:= g_GetSaveName(a
, valid
);
1285 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1286 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1290 procedure ProcSaveGame(Sender
: TGUIControl
);
1294 if g_Game_IsNet
then Exit
;
1295 if g_Game_IsTestMap
then Exit
;
1296 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1297 g_Game_PauseAllSounds(True);
1298 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1300 g_ActiveWindow
:= nil;
1301 g_Game_Pause(False);
1304 procedure ProcLoadGame(Sender
: TGUIControl
);
1308 if g_Game_IsNet
then Exit
;
1309 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1310 if g_LoadGame(a
) then
1312 g_Game_PauseAllSounds(False)
1314 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1316 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1317 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1318 //g_ActiveWindow := nil;
1322 procedure ProcSinglePlayer (n
: Integer);
1323 var wad
, map
: AnsiString;
1326 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1327 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1328 if e_FindResource(AllMapDirs
, wad
) then
1330 wad
:= ExpandFileName(wad
);
1331 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1335 procedure ProcSingle1Player
;
1340 procedure ProcSingle2Players
;
1345 procedure ProcSelectMapMenu();
1348 wad_lb
: TGUIFileListBox
;
1349 map_lb
: TGUIListBox
;
1352 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1353 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1354 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1356 if wad_lb
.SelectedItem() <> '' then
1357 map
:= map_lb
.SelectedItem()
1361 wad_lb
.UpdateFileList();
1364 if wad_lb
.SelectedItem() <> '' then
1367 map_lb
.SelectItem(map
);
1369 if map_lb
.SelectedItem() <> '' then
1373 g_GUI_ShowWindow('SelectMapMenu');
1376 procedure ProcSelectCampaignMenu();
1379 wad_lb
: TGUIFileListBox
;
1381 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1382 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1384 wad_lb
.UpdateFileList();
1386 if wad_lb
.SelectedItem() <> '' then
1387 ProcSelectCampaignWAD(nil);
1390 procedure ProcSetMap();
1392 wad
, map
, res
: String;
1394 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1396 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1397 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1400 if (wad
= '') or (map
= '') then
1403 wad
:= e_FindWadRel(MapDirs
, WAD
);
1405 res
:= wad
+':\'+map
;
1407 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1408 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1411 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1415 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1417 g_Sound_SetupAllVolumes(
1418 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1419 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1423 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1427 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1428 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1430 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1431 g_dbg_scale
:= TempScale
+ 1;
1435 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1439 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1440 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1441 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1442 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1445 procedure ProcOptionsPlayersMIMenu();
1450 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1452 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1454 if a
= '' then Exit
;
1456 b
:= g_PlayerModel_GetInfo(a
);
1458 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1460 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1461 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1462 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1464 if b
.HaveWeapon
then
1465 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1467 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1470 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1473 procedure ProcOptionsPlayerP1WeaponMenu();
1477 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1478 if a
= '' then Exit
;
1479 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1482 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1484 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1487 procedure ProcOptionsPlayerP2WeaponMenu();
1491 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1492 if a
= '' then Exit
;
1493 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1496 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1498 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1501 procedure ProcOptionsPlayersAnim();
1505 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1510 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1513 Model
.GetCurrentAnimation
.Loop
:= True;
1514 Model
.GetCurrentAnimationMask
.Loop
:= True;
1518 procedure ProcOptionsPlayersWeap();
1522 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1527 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1531 procedure ProcOptionsPlayersRot();
1535 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1536 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1538 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1542 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1546 g_Options_SetDefault();
1552 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1554 if yes
then ReadOptions();
1558 procedure ProcAuthorsClose();
1560 gMusic
.SetByName('MUSIC_MENU');
1562 gState
:= STATE_MENU
;
1565 procedure ProcGMClose();
1567 g_Game_InGameMenu(False);
1570 procedure ProcGMShow();
1575 if (gGameSettings
.GameType
= GT_SINGLE
) and
1576 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1577 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1578 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1580 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1581 if g_Game_IsTestMap
then
1582 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1583 TGUIMainMenu(g_ActiveWindow
.GetControl(
1584 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1587 procedure ProcChangePlayers();
1589 TeamGame
, Spectator
, AddTwo
: Boolean;
1590 P1Team
{, P2Team}: Byte;
1591 bP2
: TGUITextButton
;
1593 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1594 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1595 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1596 P1Team
:= TEAM_NONE
;
1597 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1599 //P2Team := TEAM_NONE;
1600 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1602 TGUIMainMenu(g_ActiveWindow
.GetControl(
1603 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1604 TGUIMainMenu(g_ActiveWindow
.GetControl(
1605 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1606 TGUIMainMenu(g_ActiveWindow
.GetControl(
1607 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1609 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1610 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1611 bP2
.Enabled
:= AddTwo
and not Spectator
;
1613 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1615 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1616 if gPlayer2
= nil then
1617 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1619 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1621 TGUIMainMenu(g_ActiveWindow
.GetControl(
1622 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1625 procedure ProcJoinRed();
1627 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1629 if g_Game_IsServer
then
1631 if gPlayer1
= nil then
1632 g_Game_AddPlayer(TEAM_RED
)
1635 if gPlayer1
.Team
<> TEAM_RED
then
1637 gPlayer1
.SwitchTeam
;
1638 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1641 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1646 gPlayer1Settings
.Team
:= TEAM_RED
;
1647 MC_SEND_PlayerSettings
;
1648 if gPlayer1
= nil then
1649 g_Game_AddPlayer(TEAM_RED
);
1651 g_ActiveWindow
:= nil;
1652 g_Game_Pause(False);
1655 procedure ProcJoinBlue();
1657 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1659 if g_Game_IsServer
then
1661 if gPlayer1
= nil then
1662 g_Game_AddPlayer(TEAM_BLUE
)
1665 if gPlayer1
.Team
<> TEAM_BLUE
then
1667 gPlayer1
.SwitchTeam
;
1668 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1671 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1676 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1677 MC_SEND_PlayerSettings
;
1678 if gPlayer1
= nil then
1679 g_Game_AddPlayer(TEAM_BLUE
);
1681 g_ActiveWindow
:= nil;
1682 g_Game_Pause(False);
1685 procedure ProcJoinGame();
1687 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1689 if gPlayer1
= nil then
1691 g_ActiveWindow
:= nil;
1692 g_Game_Pause(False);
1695 procedure ProcSwitchP2();
1697 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1699 if gPlayer1
= nil then
1701 if gPlayer2
= nil then
1704 g_Game_RemovePlayer();
1705 g_ActiveWindow
:= nil;
1706 g_Game_Pause(False);
1709 procedure ProcSpectate();
1711 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1714 g_ActiveWindow
:= nil;
1715 g_Game_Pause(False);
1718 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1720 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1723 procedure ProcEndMenuKeyDown (yes
: Boolean);
1725 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1728 procedure ProcSetRussianLanguage
;
1730 if gLanguage
<> LANGUAGE_RUSSIAN
then
1732 gLanguage
:= LANGUAGE_RUSSIAN
;
1733 gLanguageChange
:= True;
1734 gAskLanguage
:= False;
1739 procedure ProcSetEnglishLanguage
;
1741 if gLanguage
<> LANGUAGE_ENGLISH
then
1743 gLanguage
:= LANGUAGE_ENGLISH
;
1744 gLanguageChange
:= True;
1745 gAskLanguage
:= False;
1750 procedure ReadGameSettings();
1754 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1756 with gGameSettings
do
1758 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1759 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1763 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1764 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1766 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1768 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1772 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1773 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1777 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1778 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1780 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1785 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1786 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1787 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1789 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1790 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1791 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1794 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1799 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1801 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1802 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1803 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1805 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1806 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1810 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1811 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1813 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1814 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1815 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1816 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1817 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1818 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1819 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1820 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1824 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1825 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1826 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1827 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1828 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1833 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1834 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1839 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1840 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1845 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1846 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1847 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1852 procedure ProcApplyGameSet();
1856 stat
: TPlayerStatArray
;
1858 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1860 if not g_Game_IsServer
then Exit
;
1862 with gGameSettings
do
1864 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1866 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1867 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1869 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1872 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1874 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1875 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1876 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1877 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1878 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1882 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1884 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1885 Options
:= Options
or GAME_OPTION_DMKEYS
1887 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1890 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1892 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1898 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1900 TimeLimit
:= Max(n
, b
);
1904 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1906 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1913 if GameMode
= GM_DM
then
1915 stat
:= g_Player_GetStats();
1917 for a
:= 0 to High(stat
) do
1918 if stat
[a
].Frags
> b
then
1922 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1924 GoalLimit
:= Max(n
, b
);
1928 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1930 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1931 if n
< 0 then n
:= 0;
1932 if n
> 255 then n
:= 255;
1938 stat
:= g_Player_GetStats();
1940 for a
:= 0 to High(stat
) do
1941 if stat
[a
].Lives
> b
then
1944 MaxLives
:= Max(n
, b
);
1948 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1950 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1953 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1954 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1958 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1959 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1963 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1964 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1969 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1971 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1972 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1973 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1974 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1978 // don't forget to latch this shit
1979 gsGameFlags
:= Options
;
1980 gsMaxLives
:= MaxLives
;
1981 gsGoalLimit
:= GoalLimit
;
1982 gsTimeLimit
:= TimeLimit
;
1985 if g_Game_IsNet
then MH_SEND_GameSettings
;
1988 procedure ProcVideoOptionsRes();
1993 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1995 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1996 IntToStr(gWinSizeX
) +
1997 ' x ' + IntToStr(gWinSizeY
) +
1998 ', ' + IntToStr(gBPP
) + ' bpp';
2000 with TGUIListBox(menu
.GetControl('lsResolution')) do
2002 list
:= sys_GetDisplayModes(gBPP
);
2006 ItemIndex
:= Length(list
)
2014 with TGUISwitch(menu
.GetControl('swFullScreen')) do
2020 TempResScale
:= Round(r_pixel_scale
- 1);
2021 with TGUISwitch(menu
.GetControl('swResFactor')) do
2022 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
2025 procedure ProcApplyVideoOptions();
2028 Fullscreen
: Boolean;
2029 SWidth
, SHeight
: Integer;
2030 ScaleChanged
: Boolean;
2033 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2035 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
2037 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
2040 SWidth
:= gWinSizeX
;
2041 SHeight
:= gWinSizeY
;
2042 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
2045 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
2047 ScaleChanged
:= False;
2048 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
2050 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
2051 r_pixel_scale
:= TempResScale
+ 1;
2052 ScaleChanged
:= True;
2055 if (SWidth
<> gWinSizeX
) or
2056 (SHeight
<> gWinSizeY
) or
2057 (Fullscreen
<> gFullscreen
) or
2060 gResolutionChange
:= True;
2061 gRC_Width
:= SWidth
;
2062 gRC_Height
:= SHeight
;
2063 gRC_FullScreen
:= Fullscreen
;
2064 gRC_Maximized
:= gWinMaximized
;
2067 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
2071 procedure ProcSetFirstRussianLanguage
;
2073 gLanguage
:= LANGUAGE_RUSSIAN
;
2074 gLanguageChange
:= True;
2075 gAskLanguage
:= False;
2078 procedure ProcSetFirstEnglishLanguage
;
2080 gLanguage
:= LANGUAGE_ENGLISH
;
2081 gLanguageChange
:= True;
2082 gAskLanguage
:= False;
2085 procedure ProcRecallAddress();
2087 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2089 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2090 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2094 procedure CreateFirstLanguageMenu();
2098 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2100 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2102 Name
:= 'mmFirstLanguageMenu';
2103 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2104 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2107 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2108 Menu
.MainWindow
:= True;
2109 g_GUI_AddWindow(Menu
);
2112 procedure g_Menu_AskLanguage();
2114 CreateFirstLanguageMenu();
2115 g_GUI_ShowWindow('FirstLanguageMenu');
2118 procedure CreatePlayerOptionsMenu(s
: String);
2123 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2125 a
:= _lc
[I_MENU_PLAYER_1
]
2127 a
:= _lc
[I_MENU_PLAYER_2
];
2128 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2130 Name
:= 'mOptionsPlayers'+s
+'Menu';
2131 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2133 Name
:= 'ed'+s
+'Name';
2137 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2139 Name
:= 'sw'+s
+'Team';
2140 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2141 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2143 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2145 Name
:= 'ls'+s
+'Model';
2147 Items
:= g_PlayerModel_GetNames();
2148 OnChange
:= ProcSelectModel
;
2150 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2152 Name
:= 'sc'+s
+'Red';
2154 OnChange
:= ProcChangeColor
;
2156 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2158 Name
:= 'sc'+s
+'Green';
2160 OnChange
:= ProcChangeColor
;
2162 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2164 Name
:= 'sc'+s
+'Blue';
2166 OnChange
:= ProcChangeColor
;
2169 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2170 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2171 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2172 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2173 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2174 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2175 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2177 Name
:= 'mv'+s
+'Model';
2178 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2179 Y
:= GetControl('ls'+s
+'Model').Y
;
2182 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2183 g_GUI_AddWindow(Menu
);
2186 procedure CreateAllMenus();
2190 a
, cx
, _y
, i
: Integer;
2193 Menu
:= TGUIWindow
.Create('MainMenu');
2194 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2196 Name
:= 'mmMainMenu';
2197 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2198 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2199 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2200 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2201 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2202 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2204 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2206 Color
:= _RGB(255, 255, 255);
2207 X
:= gScreenWidth
-GetWidth
-8;
2208 Y
:= gScreenHeight
-GetHeight
-8;
2210 Menu
.DefControl
:= 'mmMainMenu';
2211 Menu
.MainWindow
:= True;
2212 g_GUI_AddWindow(Menu
);
2214 Menu
:= TGUIWindow
.Create('NewGameMenu');
2215 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2217 Name
:= 'mmNewGameMenu';
2218 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2219 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2220 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2221 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2223 Menu
.DefControl
:= 'mmNewGameMenu';
2224 g_GUI_AddWindow(Menu
);
2226 Menu
:= TGUIWindow
.Create('NetGameMenu');
2227 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2229 Name
:= 'mmNetGameMenu';
2230 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2231 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2233 Menu
.DefControl
:= 'mmNetGameMenu';
2234 g_GUI_AddWindow(Menu
);
2236 Menu
:= TGUIWindow
.Create('NetServerMenu');
2237 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2239 Name
:= 'mNetServerMenu';
2240 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2242 Name
:= 'edSrvName';
2243 OnlyDigits
:= False;
2246 Text := NetServerName
;
2248 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2250 Name
:= 'edSrvPassword';
2251 OnlyDigits
:= False;
2254 Text := NetPassword
;
2256 with AddEdit(_lc
[I_NET_PORT
]) do
2262 Text := IntToStr(NetPort
);
2264 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2266 Name
:= 'edMaxPlayers';
2270 Text := IntToStr(NetMaxClients
);
2272 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2274 Name
:= 'swUseMaster';
2275 AddItem(_lc
[I_MENU_YES
]);
2276 AddItem(_lc
[I_MENU_NO
]);
2277 if NetUseMaster
then
2283 with AddLabel(_lc
[I_MENU_MAP
]) do
2288 OnClick
:= @ProcSelectMapMenu
;
2290 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2292 Name
:= 'swGameMode';
2293 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2294 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2295 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2296 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2297 case g_Game_TextToMode(gsGameMode
) of
2299 GM_DM
: ItemIndex
:= 0;
2300 GM_TDM
: ItemIndex
:= 1;
2301 GM_CTF
: ItemIndex
:= 2;
2303 GM_COOP
: ItemIndex
:= 3;
2305 OnChange
:= ProcSwitchMonstersCustom
;
2307 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2309 Name
:= 'edTimeLimit';
2313 if gsTimeLimit
> 0 then
2314 Text := IntToStr(gsTimeLimit
);
2316 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2318 Name
:= 'edGoalLimit';
2322 if gsGoalLimit
> 0 then
2323 Text := IntToStr(gsGoalLimit
);
2325 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2327 Name
:= 'edMaxLives';
2331 if gsMaxLives
> 0 then
2332 Text := IntToStr(gsMaxLives
);
2334 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2336 Name
:= 'edItemRespawnTime';
2340 if gsItemRespawnTime
> 0 then
2341 Text := IntToStr(gsItemRespawnTime
);
2343 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2345 Name
:= 'swPlayers';
2346 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2347 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2348 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2349 ItemIndex
:= gsPlayers
;
2351 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2353 Name
:= 'swTeamDamage';
2354 AddItem(_lc
[I_MENU_YES
]);
2355 AddItem(_lc
[I_MENU_NO
]);
2356 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2361 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2363 Name
:= 'swTeamHit';
2364 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2365 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2366 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2367 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2368 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2370 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2372 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2377 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2379 Name
:= 'swDeathmatchKeys';
2380 AddItem(_lc
[I_MENU_YES
]);
2381 AddItem(_lc
[I_MENU_NO
]);
2382 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2387 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2389 Name
:= 'swEnableExits';
2390 AddItem(_lc
[I_MENU_YES
]);
2391 AddItem(_lc
[I_MENU_NO
]);
2392 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2397 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2399 Name
:= 'swWeaponStay';
2400 AddItem(_lc
[I_MENU_YES
]);
2401 AddItem(_lc
[I_MENU_NO
]);
2402 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2407 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2409 Name
:= 'swMonsters';
2410 AddItem(_lc
[I_MENU_YES
]);
2411 AddItem(_lc
[I_MENU_NO
]);
2412 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2417 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2420 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2421 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2422 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2424 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2426 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2429 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2431 Name
:= 'swFlagDrop';
2432 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2433 AddItem(_lc
[I_MENU_YES
]);
2434 AddItem(_lc
[I_MENU_NO
]);
2435 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2437 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2443 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2447 Menu
.DefControl
:= 'mNetServerMenu';
2448 g_GUI_AddWindow(Menu
);
2450 Menu
:= TGUIWindow
.Create('NetClientMenu');
2451 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2453 Name
:= 'mNetClientMenu';
2455 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2458 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2464 Text := 'localhost';
2466 with AddEdit(_lc
[I_NET_PORT
]) do
2474 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2477 OnlyDigits
:= False;
2484 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2488 Menu
.DefControl
:= 'mNetClientMenu';
2489 g_GUI_AddWindow(Menu
);
2491 Menu
:= TGUIWindow
.Create('LoadMenu');
2492 Menu
.OnShow
:= ProcLoadMenu
;
2493 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2495 Name
:= 'mmLoadMenu';
2500 Name
:= 'edSlot'+IntToStr(a
);
2503 OnEnter
:= ProcLoadGame
;
2506 Menu
.DefControl
:= 'mmLoadMenu';
2507 g_GUI_AddWindow(Menu
);
2509 Menu
:= TGUIWindow
.Create('SaveMenu');
2510 Menu
.OnShow
:= ProcSaveMenu
;
2511 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2513 Name
:= 'mmSaveMenu';
2518 Name
:= 'edSlot'+IntToStr(a
);
2521 OnChange
:= ProcSaveGame
;
2524 Menu
.DefControl
:= 'mmSaveMenu';
2525 g_GUI_AddWindow(Menu
);
2527 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2528 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2530 Name
:= 'mCustomGameMenu';
2531 with AddLabel(_lc
[I_MENU_MAP
]) do
2536 OnClick
:= @ProcSelectMapMenu
;
2538 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2540 Name
:= 'swGameMode';
2541 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2542 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2543 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2544 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2545 case g_Game_TextToMode(gsGameMode
) of
2547 GM_DM
: ItemIndex
:= 0;
2548 GM_TDM
: ItemIndex
:= 1;
2549 GM_CTF
: ItemIndex
:= 2;
2551 GM_COOP
: ItemIndex
:= 3;
2553 OnChange
:= ProcSwitchMonstersCustom
;
2555 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2557 Name
:= 'edTimeLimit';
2561 if gsTimeLimit
> 0 then
2562 Text := IntToStr(gsTimeLimit
);
2564 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2566 Name
:= 'edGoalLimit';
2570 if gsGoalLimit
> 0 then
2571 Text := IntToStr(gsGoalLimit
);
2573 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2575 Name
:= 'edMaxLives';
2579 if gsMaxLives
> 0 then
2580 Text := IntToStr(gsMaxLives
);
2582 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2584 Name
:= 'edItemRespawnTime';
2588 if gsItemRespawnTime
> 0 then
2589 Text := IntToStr(gsItemRespawnTime
);
2591 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2593 Name
:= 'swPlayers';
2594 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2595 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2596 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2597 ItemIndex
:= gsPlayers
;
2599 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2601 Name
:= 'swTeamDamage';
2602 AddItem(_lc
[I_MENU_YES
]);
2603 AddItem(_lc
[I_MENU_NO
]);
2604 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2609 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2611 Name
:= 'swTeamHit';
2612 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2613 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2614 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2615 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2616 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2618 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2620 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2625 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2627 Name
:= 'swDeathmatchKeys';
2628 AddItem(_lc
[I_MENU_YES
]);
2629 AddItem(_lc
[I_MENU_NO
]);
2630 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2635 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2637 Name
:= 'swEnableExits';
2638 AddItem(_lc
[I_MENU_YES
]);
2639 AddItem(_lc
[I_MENU_NO
]);
2640 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2645 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2647 Name
:= 'swWeaponStay';
2648 AddItem(_lc
[I_MENU_YES
]);
2649 AddItem(_lc
[I_MENU_NO
]);
2650 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2655 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2657 Name
:= 'swMonsters';
2658 AddItem(_lc
[I_MENU_YES
]);
2659 AddItem(_lc
[I_MENU_NO
]);
2660 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2665 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2668 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2669 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2670 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2672 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2674 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2677 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2679 Name
:= 'swFlagDrop';
2680 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2681 AddItem(_lc
[I_MENU_YES
]);
2682 AddItem(_lc
[I_MENU_NO
]);
2683 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2685 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2691 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2695 Menu
.DefControl
:= 'mCustomGameMenu';
2696 g_GUI_AddWindow(Menu
);
2698 Menu
:= TGUIWindow
.Create('CampaignMenu');
2699 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2701 Name
:= 'mCampaignMenu';
2710 with AddFileList('', 15, 4) do
2713 OnChange
:= ProcSelectCampaignWAD
;
2717 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2718 SetBase(MegawadDirs
);
2721 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2723 Name
:= 'lbWADName';
2727 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2729 Name
:= 'lbWADAuthor';
2733 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2734 with AddMemo('', 15, 3) do
2736 Name
:= 'meWADDescription';
2737 Color
:= MENU_ITEMSCTRL_COLOR
;
2739 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2741 Name
:= 'swPlayers';
2742 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2743 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2746 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2750 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2752 Name
:= 'mpWADImage';
2753 DefaultRes
:= 'NOPIC';
2754 X
:= GetControl('lsWAD').X
+4;
2755 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2758 Menu
.DefControl
:= 'mCampaignMenu';
2759 g_GUI_AddWindow(Menu
);
2761 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2762 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2764 Name
:= 'mSelectMapMenu';
2765 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2768 OnChange
:= ProcSelectWAD
;
2772 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2775 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2779 OnChange
:= ProcSelectMap
;
2782 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2784 Name
:= 'lbMapName';
2788 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2790 Name
:= 'lbMapAuthor';
2794 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2796 Name
:= 'lbMapSize';
2800 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2802 Name
:= 'meMapDescription';
2807 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2809 Name
:= 'mpMapPreview';
2810 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2811 Y
:= GetControl('lsMapWAD').Y
;
2813 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2815 Name
:= 'lbMapScale';
2818 Color
:= MENU_ITEMSCTRL_COLOR
;
2819 X
:= GetControl('lsMapWAD').X
+
2820 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2821 2 + MAPPREVIEW_WIDTH
*4;
2822 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2825 Menu
.OnClose
:= ProcSetMap
;
2826 Menu
.DefControl
:= 'mSelectMapMenu';
2827 g_GUI_AddWindow(Menu
);
2829 Menu
:= TGUIWindow
.Create('OptionsMenu');
2830 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2832 Name
:= 'mmOptionsMenu';
2833 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2834 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2835 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2836 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2837 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2838 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2840 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2841 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2843 Menu
.OnClose
:= ProcApplyOptions
;
2844 Menu
.DefControl
:= 'mmOptionsMenu';
2845 g_GUI_AddWindow(Menu
);
2847 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2848 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2849 g_GUI_AddWindow(Menu
);
2851 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2852 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2854 Name
:= 'mOptionsVideoMenu';
2855 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2856 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2862 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2865 AddItem(_lc
[I_MENU_YES
]);
2866 AddItem(_lc
[I_MENU_NO
]);
2868 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2870 Name
:= 'swTextureFilter';
2871 AddItem(_lc
[I_MENU_YES
]);
2872 AddItem(_lc
[I_MENU_NO
]);
2874 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2877 AddItem(_lc
[I_MENU_YES
]);
2878 AddItem(_lc
[I_MENU_NO
]);
2880 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2882 Name
:= 'swLegacyNPOT';
2883 AddItem(_lc
[I_MENU_NO
]);
2884 AddItem(_lc
[I_MENU_YES
]);
2887 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2890 Menu
.DefControl
:= 'mOptionsVideoMenu';
2891 g_GUI_AddWindow(Menu
);
2893 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2894 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2896 Name
:= 'mOptionsVideoResMenu';
2897 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2899 Name
:= 'lbCurrentRes';
2903 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2905 Name
:= 'lsResolution';
2908 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2910 Name
:= 'swFullScreen';
2911 AddItem(_lc
[I_MENU_YES
]);
2912 AddItem(_lc
[I_MENU_NO
]);
2914 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2916 Name
:= 'swResFactor';
2918 for i
:= 2 to gRC_Width
div 640 do
2919 AddItem(IntToStr(i
) + 'x');
2922 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2925 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2926 g_GUI_AddWindow(Menu
);
2928 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2929 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2931 Name
:= 'mOptionsSoundMenu';
2932 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2934 Name
:= 'scMusicLevel';
2936 OnChange
:= ProcChangeSoundSettings
;
2938 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2940 Name
:= 'scSoundLevel';
2942 OnChange
:= ProcChangeSoundSettings
;
2944 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2946 Name
:= 'scMaxSimSounds';
2949 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2951 Name
:= 'swAnnouncer';
2952 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2953 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2954 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2955 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2957 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2958 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2960 Name
:= 'swSoundEffects';
2961 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2962 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2964 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2965 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2967 Name
:= 'swChatSpeech';
2968 AddItem(_lc
[I_MENU_YES
]);
2969 AddItem(_lc
[I_MENU_NO
]);
2971 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2973 Name
:= 'swInactiveSounds';
2974 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2975 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2979 Menu
.DefControl
:= 'mOptionsSoundMenu';
2980 g_GUI_AddWindow(Menu
);
2982 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2983 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2985 Name
:= 'mOptionsGameMenu';
2986 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2988 Name
:= 'scParticlesCount';
2991 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2993 Name
:= 'swBloodCount';
2994 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2995 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2996 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2997 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2998 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3000 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
3002 Name
:= 'scShellsMax';
3005 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
3007 Name
:= 'scGibsMax';
3010 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
3012 Name
:= 'scCorpsesMax';
3015 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
3017 Name
:= 'swGibsCount';
3018 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3019 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3020 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3021 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3022 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3024 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
3026 Name
:= 'swCorpseType';
3027 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
3028 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
3030 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
3032 Name
:= 'swGibsType';
3033 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
3034 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
3036 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
3038 Name
:= 'swBloodType';
3039 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
3040 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
3042 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
3044 Name
:= 'swScreenFlash';
3045 AddItem(_lc
[I_MENU_NO
]);
3046 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3047 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3049 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
3051 Name
:= 'swBackground';
3052 AddItem(_lc
[I_MENU_YES
]);
3053 AddItem(_lc
[I_MENU_NO
]);
3055 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
3057 Name
:= 'swMessages';
3058 AddItem(_lc
[I_MENU_YES
]);
3059 AddItem(_lc
[I_MENU_NO
]);
3061 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
3063 Name
:= 'swRevertPlayers';
3064 AddItem(_lc
[I_MENU_YES
]);
3065 AddItem(_lc
[I_MENU_NO
]);
3067 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
3069 Name
:= 'swChatBubble';
3070 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
3071 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
3072 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
3073 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
3074 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3076 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3078 Name
:= 'swPlayerIndicator';
3079 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3080 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3081 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3083 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3085 Name
:= 'swPlayerIndicatorStyle';
3086 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3087 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3089 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3091 Name
:= 'scScaleFactor';
3093 OnChange
:= ProcChangeGameSettings
;
3097 Menu
.DefControl
:= 'mOptionsGameMenu';
3098 g_GUI_AddWindow(Menu
);
3100 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3101 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3103 Name
:= 'mOptionsControlsMenu';
3104 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3105 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3106 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3107 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3108 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3110 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3111 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3112 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3113 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3114 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3115 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3116 if e_HasJoysticks
then
3119 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3121 if g_touch_enabled
then
3124 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3127 Menu
.DefControl
:= 'mOptionsControlsMenu';
3128 g_GUI_AddWindow(Menu
);
3130 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3131 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3133 Name
:= 'mOptionsControlsP1Menu';
3134 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3135 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3136 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3137 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3138 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3139 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3140 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3141 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3142 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3143 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3144 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3146 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3147 g_GUI_AddWindow(Menu
);
3149 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3150 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3152 Name
:= 'mOptionsControlsP1MenuWeapons';
3153 for i
:= WP_FIRST
to WP_LAST
do
3154 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3155 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3157 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3158 g_GUI_AddWindow(Menu
);
3160 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3161 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3163 Name
:= 'mOptionsControlsP2Menu';
3164 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3165 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3166 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3167 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3168 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3169 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3170 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3171 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3172 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3173 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3174 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3176 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3177 g_GUI_AddWindow(Menu
);
3179 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3180 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3182 Name
:= 'mOptionsControlsP2MenuWeapons';
3183 for i
:= WP_FIRST
to WP_LAST
do
3184 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3185 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3187 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3188 g_GUI_AddWindow(Menu
);
3190 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3191 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3193 Name
:= 'mOptionsControlsJoystickMenu';
3194 for i
:= 0 to e_MaxJoys
- 1 do
3195 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3197 Name
:= 'scDeadzone' + IntToStr(i
);
3201 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3202 g_GUI_AddWindow(Menu
);
3204 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3205 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3207 Name
:= 'mOptionsControlsTouchMenu';
3208 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3210 Name
:= 'swTouchAlt';
3211 AddItem(_lc
[I_MENU_NO
]);
3212 AddItem(_lc
[I_MENU_YES
]);
3213 OnChange
:= ProcChangeTouchSettings
;
3215 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3217 Name
:= 'scTouchSize';
3219 OnChange
:= ProcChangeTouchSettings
;
3221 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3223 Name
:= 'swTouchFire';
3224 AddItem(_lc
[I_MENU_NO
]);
3225 AddItem(_lc
[I_MENU_YES
]);
3227 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3229 Name
:= 'scTouchOffset';
3231 OnChange
:= ProcChangeTouchSettings
;
3234 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3235 g_GUI_AddWindow(Menu
);
3237 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3238 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3240 Name
:= 'mOptionsPlayersMenu';
3241 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3242 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3244 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3245 g_GUI_AddWindow(Menu
);
3247 CreatePlayerOptionsMenu('P1');
3248 CreatePlayerOptionsMenu('P2');
3250 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3251 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3253 Name
:= 'mOptionsPlayersMIMenu';
3254 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3259 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3264 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3266 Name
:= 'meComment';
3269 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3270 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3273 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3277 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3278 g_GUI_AddWindow(Menu
);
3280 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3281 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3283 Name
:= 'mOptionsPlayersP1WeaponMenu';
3284 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3286 Name
:= 'swWeaponAutoswitch';
3287 AddItem(_lc
[I_MENU_NO
]);
3288 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3289 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3291 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3293 Name
:= 'swWeaponAllowEmpty';
3294 AddItem(_lc
[I_MENU_YES
]);
3295 AddItem(_lc
[I_MENU_NO
]);
3297 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3299 Name
:= 'swWeaponAllowFist';
3300 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3301 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3303 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3306 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3307 g_GUI_AddWindow(Menu
);
3309 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3310 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3312 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3313 for i
:= WP_FIRST
to WP_LAST
do
3315 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3317 Name
:= IntToStr(i
);
3318 for a
:= WP_FIRST
to WP_LAST
+1 do
3320 AddItem(IntToStr(a
));
3325 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3327 Name
:= IntToStr(WP_LAST
+1);
3328 for a
:= WP_FIRST
to WP_LAST
+1 do
3330 AddItem(IntToStr(a
));
3332 ItemIndex
:= WP_LAST
+ 1;
3335 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3336 g_GUI_AddWindow(Menu
);
3339 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3340 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3342 Name
:= 'mOptionsPlayersP2WeaponMenu';
3343 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3345 Name
:= 'swWeaponAutoswitch';
3346 AddItem(_lc
[I_MENU_NO
]);
3347 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3348 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3350 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3352 Name
:= 'swWeaponAllowEmpty';
3353 AddItem(_lc
[I_MENU_YES
]);
3354 AddItem(_lc
[I_MENU_NO
]);
3356 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3358 Name
:= 'swWeaponAllowFist';
3359 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3360 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3362 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3365 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3366 g_GUI_AddWindow(Menu
);
3368 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3369 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3371 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3372 for i
:= WP_FIRST
to WP_LAST
do
3374 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3376 Name
:= IntToStr(i
);
3377 for a
:= WP_FIRST
to WP_LAST
+1 do
3379 AddItem(IntToStr(a
));
3384 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3386 Name
:= IntToStr(WP_LAST
+1);
3387 for a
:= WP_FIRST
to WP_LAST
+1 do
3389 AddItem(IntToStr(a
));
3391 ItemIndex
:= WP_LAST
+ 1;
3394 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3395 g_GUI_AddWindow(Menu
);
3397 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3398 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3400 Name
:= 'mOptionsLanguageMenu';
3401 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3402 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3405 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3406 g_GUI_AddWindow(Menu
);
3408 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3409 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3410 g_GUI_AddWindow(Menu
);
3412 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3413 Menu
.BackTexture
:= 'INTER';
3414 Menu
.OnClose
:= ProcAuthorsClose
;
3418 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3420 Color
:= _RGB(255, 0, 0);
3421 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3423 _y
:= _y
+GetHeight();
3425 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3427 Color
:= _RGB(255, 0, 0);
3428 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3430 _y
:= _y
+GetHeight()+32;
3432 // ×òî äåëàë: Êòî äåëàë
3433 cx
:= gScreenWidth
div 2 - 320 + 64;
3434 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3436 Color
:= _RGB(255, 0, 0);
3441 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3443 Color
:= _RGB(255, 255, 255);
3448 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3450 Color
:= _RGB(255, 0, 0);
3455 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3457 Color
:= _RGB(255, 255, 255);
3462 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3464 Color
:= _RGB(255, 255, 255);
3469 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3471 Color
:= _RGB(255, 0, 0);
3476 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3478 Color
:= _RGB(255, 255, 255);
3483 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3485 Color
:= _RGB(255, 0, 0);
3490 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3492 Color
:= _RGB(255, 255, 255);
3495 _y
:= gScreenHeight
- 128;
3498 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3500 Color
:= _RGB(255, 0, 0);
3505 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3507 Color
:= _RGB(255, 255, 255);
3510 _y
:= _y
+GetHeight();
3512 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3514 Color
:= _RGB(255, 255, 255);
3517 _y
:= _y
+GetHeight();
3519 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3521 Color
:= _RGB(255, 255, 255);
3524 _y
:= gScreenHeight
- 32;
3526 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3528 Color
:= _RGB(255, 0, 0);
3529 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3532 g_GUI_AddWindow(Menu
);
3534 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3535 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3536 g_GUI_AddWindow(Menu
);
3538 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3539 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3541 Name
:= 'mmGameSingleMenu';
3542 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3543 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3544 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3545 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3546 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3547 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3549 Menu
.DefControl
:= 'mmGameSingleMenu';
3550 Menu
.MainWindow
:= True;
3551 Menu
.OnClose
:= ProcGMClose
;
3552 Menu
.OnShow
:= ProcGMShow
;
3553 g_GUI_AddWindow(Menu
);
3555 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3556 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3557 g_GUI_AddWindow(Menu
);
3559 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3560 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3561 g_GUI_AddWindow(Menu
);
3563 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3564 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3566 Name
:= 'mmGameCustomMenu';
3567 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3568 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3569 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3570 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3571 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3572 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3573 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3575 Menu
.DefControl
:= 'mmGameCustomMenu';
3576 Menu
.MainWindow
:= True;
3577 Menu
.OnClose
:= ProcGMClose
;
3578 Menu
.OnShow
:= ProcGMShow
;
3579 g_GUI_AddWindow(Menu
);
3581 Menu
:= TGUIWindow
.Create('GameServerMenu');
3582 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3584 Name
:= 'mmGameServerMenu';
3585 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3586 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3587 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3588 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3589 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3591 Menu
.DefControl
:= 'mmGameServerMenu';
3592 Menu
.MainWindow
:= True;
3593 Menu
.OnClose
:= ProcGMClose
;
3594 Menu
.OnShow
:= ProcGMShow
;
3595 g_GUI_AddWindow(Menu
);
3597 Menu
:= TGUIWindow
.Create('GameClientMenu');
3598 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3600 Name
:= 'mmGameClientMenu';
3601 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3602 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3603 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3605 Menu
.DefControl
:= 'mmGameClientMenu';
3606 Menu
.MainWindow
:= True;
3607 Menu
.OnClose
:= ProcGMClose
;
3608 Menu
.OnShow
:= ProcGMShow
;
3609 g_GUI_AddWindow(Menu
);
3611 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3612 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3614 Name
:= 'mClientPasswordMenu';
3615 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3623 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3626 Menu
.DefControl
:= 'mClientPasswordMenu';
3627 g_GUI_AddWindow(Menu
);
3629 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3630 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3632 Name
:= 'mGameSetGameMenu';
3633 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3635 Name
:= 'swTeamDamage';
3636 AddItem(_lc
[I_MENU_YES
]);
3637 AddItem(_lc
[I_MENU_NO
]);
3640 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3642 Name
:= 'swTeamHit';
3643 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3644 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3645 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3646 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3649 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3651 Name
:= 'swDeathmatchKeys';
3652 AddItem(_lc
[I_MENU_YES
]);
3653 AddItem(_lc
[I_MENU_NO
]);
3656 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3658 Name
:= 'edTimeLimit';
3663 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3665 Name
:= 'edGoalLimit';
3670 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3672 Name
:= 'edMaxLives';
3677 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3680 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3681 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3682 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3685 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3687 Name
:= 'swFlagDrop';
3688 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3689 AddItem(_lc
[I_MENU_YES
]);
3690 AddItem(_lc
[I_MENU_NO
]);
3696 Menu
.DefControl
:= 'mGameSetGameMenu';
3697 Menu
.OnClose
:= ProcApplyGameSet
;
3698 g_GUI_AddWindow(Menu
);
3700 Menu
:= TGUIWindow
.Create('TeamMenu');
3701 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3703 Name
:= 'mmTeamMenu';
3704 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3705 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3706 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3707 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3708 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3710 Menu
.DefControl
:= 'mmTeamMenu';
3711 Menu
.OnShow
:= ProcChangePlayers
;
3712 g_GUI_AddWindow(Menu
);
3715 procedure g_Menu_Show_SaveMenu();
3717 if g_Game_IsTestMap
then
3719 if gGameSettings
.GameType
= GT_SINGLE
then
3720 g_GUI_ShowWindow('GameSingleMenu')
3723 if g_Game_IsClient
then
3726 if g_Game_IsNet
then
3729 g_GUI_ShowWindow('GameCustomMenu');
3731 g_GUI_ShowWindow('SaveMenu');
3732 g_Sound_PlayEx('MENU_OPEN');
3735 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3737 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3738 if gGameSettings
.GameType
= GT_SINGLE
then
3740 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3744 if g_Game_IsClient
then exit
;
3745 if g_Game_IsNet
then exit
;
3746 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3748 g_GUI_ShowWindow('LoadMenu');
3749 g_Sound_PlayEx('MENU_OPEN');
3752 procedure g_Menu_Show_GameSetGame();
3754 if gGameSettings
.GameType
= GT_SINGLE
then
3755 g_GUI_ShowWindow('GameSingleMenu')
3758 if g_Game_IsClient
then
3761 if g_Game_IsNet
then
3762 g_GUI_ShowWindow('GameServerMenu')
3764 g_GUI_ShowWindow('GameCustomMenu');
3767 g_GUI_ShowWindow('GameSetGameMenu');
3768 g_Sound_PlayEx('MENU_OPEN');
3771 procedure g_Menu_Show_OptionsVideo();
3773 if gGameSettings
.GameType
= GT_SINGLE
then
3774 g_GUI_ShowWindow('GameSingleMenu')
3777 if g_Game_IsClient
then
3778 g_GUI_ShowWindow('GameClientMenu')
3780 if g_Game_IsNet
then
3781 g_GUI_ShowWindow('GameServerMenu')
3783 g_GUI_ShowWindow('GameCustomMenu');
3786 g_GUI_ShowWindow('OptionsMenu');
3787 g_GUI_ShowWindow('OptionsVideoMenu');
3788 g_Sound_PlayEx('MENU_OPEN');
3791 procedure g_Menu_Show_OptionsSound();
3793 if gGameSettings
.GameType
= GT_SINGLE
then
3794 g_GUI_ShowWindow('GameSingleMenu')
3797 if g_Game_IsClient
then
3798 g_GUI_ShowWindow('GameClientMenu')
3800 if g_Game_IsNet
then
3801 g_GUI_ShowWindow('GameServerMenu')
3803 g_GUI_ShowWindow('GameCustomMenu');
3806 g_GUI_ShowWindow('OptionsMenu');
3807 g_GUI_ShowWindow('OptionsSoundMenu');
3808 g_Sound_PlayEx('MENU_OPEN');
3811 procedure g_Menu_Show_EndGameMenu();
3813 g_GUI_ShowWindow('EndGameMenu');
3814 g_Sound_PlayEx('MENU_OPEN');
3817 procedure g_Menu_Show_QuitGameMenu();
3819 g_GUI_ShowWindow('ExitMenu');
3820 g_Sound_PlayEx('MENU_OPEN');
3823 procedure g_Menu_Init();
3830 procedure g_Menu_Free();
3834 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3839 procedure g_Menu_Reset();
3843 g_GUI_SaveMenuPos();
3844 ex
:= g_GUI_Destroy();
3848 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3853 g_Game_SetDebugMode();
3855 g_GUI_LoadMenuPos();