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
;
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 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
377 for i
:= WP_FIRST
to WP_LAST
+1 do
379 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
383 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
385 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
386 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
387 TEAM_RED
, TEAM_BLUE
);
388 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
390 gPlayer2Settings
.Model
:= Model
.Name
;
391 gPlayer2Settings
.Color
:= Model
.Color
;
394 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
395 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
397 if g_Game_IsServer
then
399 if gPlayer1
<> nil then
401 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
402 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
403 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
404 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
406 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
408 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
409 if (gPlayer1
.WeapSwitchMode
= 2) then
410 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
411 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
412 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
415 if gPlayer2
<> nil then
417 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
418 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
419 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
420 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
422 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
424 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
425 if (gPlayer2
.WeapSwitchMode
= 2) then
426 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
427 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
431 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
433 g_Console_WriteGameConfig
;
436 procedure ReadOptions();
441 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
443 with TGUISwitch(menu
.GetControl('swBPP')) do
449 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
450 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
452 with TGUISwitch(menu
.GetControl('swVSync')) do
453 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
455 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
456 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
458 with TGUISwitch(menu
.GetControl('swInterp')) do
459 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
461 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
463 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
464 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
465 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
467 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
468 if gMuteWhenInactive
then
473 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
475 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
476 if gSoundEffectsDF
then
481 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
482 if gUseChatSounds
then
487 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
505 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
506 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
507 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
508 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
509 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
510 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
511 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
512 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
515 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
518 for i
:= WP_FIRST
to WP_LAST
do
520 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
521 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
525 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
541 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
542 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
543 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
544 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
545 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
546 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
547 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
548 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
549 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
550 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
553 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
556 for i
:= WP_FIRST
to WP_LAST
do
558 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
559 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
563 if e_HasJoysticks
then
565 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
568 for i
:= 0 to e_MaxJoys
- 1 do
569 if e_JoystickAvailable
[i
] then
570 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
574 if g_touch_enabled
then
576 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
577 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
578 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
579 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
580 with TGUISwitch(menu
.GetControl('swTouchFire')) do
581 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
582 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
588 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
589 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
590 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
591 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
594 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
596 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
597 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
598 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
599 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
600 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
602 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
605 with TGUISwitch(menu
.GetControl('swBloodType')) do
606 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
608 with TGUISwitch(menu
.GetControl('swCorpseType')) do
609 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
611 with TGUISwitch(menu
.GetControl('swGibsType')) do
612 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
614 with TGUISwitch(menu
.GetControl('swGibsCount')) do
623 with TGUISwitch(menu
.GetControl('swBackGround')) do
624 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
626 with TGUISwitch(menu
.GetControl('swMessages')) do
627 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
629 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
630 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
632 with TGUISwitch(menu
.GetControl('swChatBubble')) do
633 ItemIndex
:= gChatBubble
;
635 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
636 ItemIndex
:= gPlayerIndicator
;
638 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
639 ItemIndex
:= gPlayerIndicatorStyle
;
641 TempScale
:= Round(g_dbg_scale
- 1);
642 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
644 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
646 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
647 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
649 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
650 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
652 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
653 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
654 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
656 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
657 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
658 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
660 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
661 for i
:= WP_FIRST
to WP_LAST
+1 do
663 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
664 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
667 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
668 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
669 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
670 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
671 for i
:= WP_FIRST
to WP_LAST
+1 do
673 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
674 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
677 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
679 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
680 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
682 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
683 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
685 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
686 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
687 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
689 ProcSelectModel(nil);
692 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
694 // don't turn off monsters in DM
696 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
697 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
698 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
700 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
703 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
704 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
705 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
706 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
710 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
712 // don't turn off monsters in DM
714 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
715 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
716 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
718 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
721 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
722 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
723 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
724 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
728 function LatchGameOptions(const MenuName
: string): Byte;
734 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
736 Map
:= TGUILabel(GetControl('lbMap')).Text;
739 if not isWadPath(Map
) then
742 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
743 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
744 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
745 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
746 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
747 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
748 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
752 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
753 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
754 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
755 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
756 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
757 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
758 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
759 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
760 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
761 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
763 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
764 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
765 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
766 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
769 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
770 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
771 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
772 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
775 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
776 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
777 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
778 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
781 // TODO: get this crap out of here
782 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
783 gGameSettings
.WarmupTime
:= gsWarmupTime
;
784 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
788 procedure ProcStartCustomGame();
792 GameMode
:= LatchGameOptions('mCustomGameMenu');
793 if GameMode
= GM_NONE
then Exit
;
795 g_Console_WriteGameConfig
;
796 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
797 gsMaxLives
, gsGameFlags
, gsPlayers
);
801 procedure ProcStartNetGame();
805 GameMode
:= LatchGameOptions('mNetServerMenu');
806 if GameMode
= GM_NONE
then Exit
;
808 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
810 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
811 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
812 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
813 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
814 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
815 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
818 g_Console_WriteGameConfig
;
819 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
820 gsGameFlags
, gsPlayers
, 0, NetPort
);
823 procedure ProcConnectNetGame();
827 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
829 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
830 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
831 PW
:= TGUIEdit(GetControl('edPW')).Text;
834 g_Console_WriteGameConfig
;
835 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
838 procedure ProcEnterPassword();
842 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
844 NetClientIP
:= PromptIP
;
845 NetClientPort
:= PromptPort
;
846 PW
:= TGUIEdit(GetControl('edPW')).Text;
849 g_Console_WriteGameConfig
;
850 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
853 procedure ProcServerlist();
855 if not NetInitDone
then
857 if (not g_Net_Init()) then
859 g_Console_Add('NET: ERROR: Failed to init ENet!');
866 g_Net_Slist_Set(NetMasterList
);
868 gState
:= STATE_SLIST
;
869 g_ActiveWindow
:= nil;
871 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
876 slReturnPressed
:= True;
877 if g_Net_Slist_Fetch(slCurrent
) then
879 if slCurrent
= nil then
880 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
883 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
884 g_Serverlist_GenerateTable(slCurrent
, slTable
);
887 procedure ProcStartCampaign();
893 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
895 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
896 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
898 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
904 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
907 procedure ProcSelectMap(Sender
: TGUIControl
);
911 wad
, map
, res
: String;
913 win
:= g_GUI_GetWindow('SelectMapMenu');
914 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
916 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
917 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
919 if (wad
= '') or (map
= '') then
920 begin // Ýòî íå êàðòà
921 TGUILabel(GetControl('lbMapName')).Text := '';
922 TGUILabel(GetControl('lbMapAuthor')).Text := '';
923 TGUILabel(GetControl('lbMapSize')).Text := '';
924 TGUIMemo(GetControl('meMapDescription')).SetText('');
925 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
926 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
932 a
:= g_Map_GetMapInfo(res
);
934 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
935 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
936 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
937 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
938 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
939 TGUILabel(win
.GetControl('lbMapScale')).Text :=
940 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
945 procedure ProcSelectWAD(Sender
: TGUIControl
);
950 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
952 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
954 with TGUIListBox(GetControl('lsMapRes')) do
960 list
:= g_Map_GetMapsList(wad
);
974 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
980 win
:= g_GUI_GetWindow('CampaignMenu');
981 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
983 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
987 TGUILabel(GetControl('lbWADName')).Text := '';
988 TGUILabel(GetControl('lbWADAuthor')).Text := '';
989 TGUIMemo(GetControl('meWADDescription')).SetText('');
992 a
:= g_Game_GetMegaWADInfo(wad
);
994 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
995 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
996 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
998 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1002 fn
:= g_ExtractWadName(a
.pic
);
1004 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1006 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1011 procedure ProcChangeColor(Sender
: TGUIControl
);
1015 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1016 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1017 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1018 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1019 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1020 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1022 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1023 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1024 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1025 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1026 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1027 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1030 procedure ProcSelectModel(Sender
: TGUIControl
);
1035 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1036 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1037 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1039 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1040 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1041 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1043 ProcChangeColor(nil);
1046 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1058 wad
:= TWADFile
.Create
;
1059 if wad
.ReadFile(GameWAD
) then
1060 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1065 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1067 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1068 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1069 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1070 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1072 if g_Texture_Get('FONT_STD', ID
) then
1073 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1078 if cfglen
<> 0 then FreeMem(cfgdata
);
1081 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1087 cfgdata
, fntdata
: Pointer;
1088 cfglen
, fntlen
: Integer;
1096 wad
:= TWADFile
.Create
;
1097 if wad
.ReadFile(GameWAD
) then
1099 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1100 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1106 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1107 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1108 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1110 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1111 FontID
:= e_CharFont_Create(spc
);
1113 for a
:= 0 to 255 do
1115 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1116 if chrwidth
= 0 then Continue
;
1118 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1120 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1126 if cfglen
<> 0 then FreeMem(cfgdata
);
1127 if fntlen
<> 0 then FreeMem(fntdata
);
1130 procedure MenuLoadData();
1132 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1134 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1135 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1136 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1137 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1138 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1139 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1140 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1141 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1142 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1143 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1144 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1145 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1146 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1147 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1148 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1149 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1150 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1151 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1152 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1153 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1154 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1155 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1156 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1157 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1158 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1160 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1161 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1162 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1163 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1164 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1165 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1166 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1169 procedure MenuFreeData();
1171 e_CharFont_Remove(gMenuFont
);
1172 e_CharFont_Remove(gMenuSmallFont
);
1174 g_Texture_Delete('MAINMENU_LOGO');
1175 g_Texture_Delete('MAINMENU_MARKER1');
1176 g_Texture_Delete('MAINMENU_MARKER2');
1177 g_Texture_Delete('SCROLL_LEFT');
1178 g_Texture_Delete('SCROLL_RIGHT');
1179 g_Texture_Delete('SCROLL_MIDDLE');
1180 g_Texture_Delete('SCROLL_MARKER');
1181 g_Texture_Delete('EDIT_LEFT');
1182 g_Texture_Delete('EDIT_RIGHT');
1183 g_Texture_Delete('EDIT_MIDDLE');
1184 g_Texture_Delete('BOX1');
1185 g_Texture_Delete('BOX2');
1186 g_Texture_Delete('BOX3');
1187 g_Texture_Delete('BOX4');
1188 g_Texture_Delete('BOX5');
1189 g_Texture_Delete('BOX6');
1190 g_Texture_Delete('BOX7');
1191 g_Texture_Delete('BOX8');
1192 g_Texture_Delete('BOX9');
1193 g_Texture_Delete('BSCROLL_UP_A');
1194 g_Texture_Delete('BSCROLL_UP_U');
1195 g_Texture_Delete('BSCROLL_DOWN_A');
1196 g_Texture_Delete('BSCROLL_DOWN_U');
1197 g_Texture_Delete('BSCROLL_MIDDLE');
1198 g_Texture_Delete('NOPIC');
1200 g_Sound_Delete('MENU_SELECT');
1201 g_Sound_Delete('MENU_OPEN');
1202 g_Sound_Delete('MENU_CLOSE');
1203 g_Sound_Delete('MENU_CHANGE');
1204 g_Sound_Delete('SCROLL_ADD');
1205 g_Sound_Delete('SCROLL_SUB');
1206 g_Sound_Delete('SOUND_PLAYER_FALL');
1209 procedure ProcAuthorsMenu();
1211 gMusic
.SetByName('MUSIC_INTERMUS');
1215 procedure ProcExitMenuKeyDown (yes
: Boolean);
1218 snd
: TPlayableSound
;
1223 g_Game_StopAllSounds(True);
1224 case (Random(18)) of
1225 0: s
:= 'SOUND_MONSTER_PAIN';
1226 1: s
:= 'SOUND_MONSTER_DIE_3';
1227 2: s
:= 'SOUND_MONSTER_SLOP';
1228 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1229 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1230 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1231 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1232 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1233 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1234 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1235 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1236 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1237 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1238 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1239 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1240 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1241 else s
:= 'SOUND_PLAYER_FALL';
1243 snd
:= TPlayableSound
.Create();
1244 res
:= snd
.SetByName(s
);
1245 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1249 while snd
.IsPlaying() do begin end;
1257 procedure ProcLoadMenu();
1264 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1265 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1266 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1270 procedure ProcSaveMenu();
1278 name
:= g_GetSaveName(a
, valid
);
1279 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1280 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1284 procedure ProcSaveGame(Sender
: TGUIControl
);
1288 if g_Game_IsNet
then Exit
;
1289 if g_Game_IsTestMap
then Exit
;
1290 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1291 g_Game_PauseAllSounds(True);
1292 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1294 g_ActiveWindow
:= nil;
1295 g_Game_Pause(False);
1298 procedure ProcLoadGame(Sender
: TGUIControl
);
1302 if g_Game_IsNet
then Exit
;
1303 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1304 if g_LoadGame(a
) then
1306 g_Game_PauseAllSounds(False)
1308 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1310 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1311 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1312 //g_ActiveWindow := nil;
1316 procedure ProcSinglePlayer (n
: Integer);
1317 var wad
, map
: AnsiString;
1320 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1321 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1322 if e_FindResource(AllMapDirs
, wad
) then
1324 wad
:= ExpandFileName(wad
);
1325 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1329 procedure ProcSingle1Player
;
1334 procedure ProcSingle2Players
;
1339 procedure ProcSelectMapMenu();
1342 wad_lb
: TGUIFileListBox
;
1343 map_lb
: TGUIListBox
;
1346 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1347 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1348 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1350 if wad_lb
.SelectedItem() <> '' then
1351 map
:= map_lb
.SelectedItem()
1355 wad_lb
.UpdateFileList();
1358 if wad_lb
.SelectedItem() <> '' then
1361 map_lb
.SelectItem(map
);
1363 if map_lb
.SelectedItem() <> '' then
1367 g_GUI_ShowWindow('SelectMapMenu');
1370 procedure ProcSelectCampaignMenu();
1373 wad_lb
: TGUIFileListBox
;
1375 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1376 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1378 wad_lb
.UpdateFileList();
1380 if wad_lb
.SelectedItem() <> '' then
1381 ProcSelectCampaignWAD(nil);
1384 procedure ProcSetMap();
1386 wad
, map
, res
: String;
1388 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1390 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1391 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1394 if (wad
= '') or (map
= '') then
1397 wad
:= e_FindWadRel(MapDirs
, WAD
);
1399 res
:= wad
+':\'+map
;
1401 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1402 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1405 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1409 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1411 g_Sound_SetupAllVolumes(
1412 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1413 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1417 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1421 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1422 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1424 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1425 g_dbg_scale
:= TempScale
+ 1;
1429 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1433 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1434 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1435 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1436 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1439 procedure ProcOptionsPlayersMIMenu();
1444 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1446 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1448 if a
= '' then Exit
;
1450 b
:= g_PlayerModel_GetInfo(a
);
1452 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1454 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1455 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1456 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1458 if b
.HaveWeapon
then
1459 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1461 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1464 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1467 procedure ProcOptionsPlayerP1WeaponMenu();
1471 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1472 if a
= '' then Exit
;
1473 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1476 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1478 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1481 procedure ProcOptionsPlayerP2WeaponMenu();
1485 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1486 if a
= '' then Exit
;
1487 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1490 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1492 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1495 procedure ProcOptionsPlayersAnim();
1499 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1504 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1507 Model
.GetCurrentAnimation
.Loop
:= True;
1508 Model
.GetCurrentAnimationMask
.Loop
:= True;
1512 procedure ProcOptionsPlayersWeap();
1516 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1521 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1525 procedure ProcOptionsPlayersRot();
1529 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1530 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1532 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1536 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1540 g_Options_SetDefault();
1546 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1548 if yes
then ReadOptions();
1552 procedure ProcAuthorsClose();
1554 gMusic
.SetByName('MUSIC_MENU');
1556 gState
:= STATE_MENU
;
1559 procedure ProcGMClose();
1561 g_Game_InGameMenu(False);
1564 procedure ProcGMShow();
1569 if (gGameSettings
.GameType
= GT_SINGLE
) and
1570 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1571 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1572 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1574 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1575 if g_Game_IsTestMap
then
1576 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1577 TGUIMainMenu(g_ActiveWindow
.GetControl(
1578 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1581 procedure ProcChangePlayers();
1583 TeamGame
, Spectator
, AddTwo
: Boolean;
1584 P1Team
{, P2Team}: Byte;
1585 bP2
: TGUITextButton
;
1587 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1588 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1589 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1590 P1Team
:= TEAM_NONE
;
1591 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1593 //P2Team := TEAM_NONE;
1594 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1596 TGUIMainMenu(g_ActiveWindow
.GetControl(
1597 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1598 TGUIMainMenu(g_ActiveWindow
.GetControl(
1599 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1600 TGUIMainMenu(g_ActiveWindow
.GetControl(
1601 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1603 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1604 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1605 bP2
.Enabled
:= AddTwo
and not Spectator
;
1607 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1609 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1610 if gPlayer2
= nil then
1611 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1613 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1615 TGUIMainMenu(g_ActiveWindow
.GetControl(
1616 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1619 procedure ProcJoinRed();
1621 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1623 if g_Game_IsServer
then
1625 if gPlayer1
= nil then
1626 g_Game_AddPlayer(TEAM_RED
)
1629 if gPlayer1
.Team
<> TEAM_RED
then
1631 gPlayer1
.SwitchTeam
;
1632 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1635 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1640 gPlayer1Settings
.Team
:= TEAM_RED
;
1641 MC_SEND_PlayerSettings
;
1642 if gPlayer1
= nil then
1643 g_Game_AddPlayer(TEAM_RED
);
1645 g_ActiveWindow
:= nil;
1646 g_Game_Pause(False);
1649 procedure ProcJoinBlue();
1651 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1653 if g_Game_IsServer
then
1655 if gPlayer1
= nil then
1656 g_Game_AddPlayer(TEAM_BLUE
)
1659 if gPlayer1
.Team
<> TEAM_BLUE
then
1661 gPlayer1
.SwitchTeam
;
1662 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1665 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1670 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1671 MC_SEND_PlayerSettings
;
1672 if gPlayer1
= nil then
1673 g_Game_AddPlayer(TEAM_BLUE
);
1675 g_ActiveWindow
:= nil;
1676 g_Game_Pause(False);
1679 procedure ProcJoinGame();
1681 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1683 if gPlayer1
= nil then
1685 g_ActiveWindow
:= nil;
1686 g_Game_Pause(False);
1689 procedure ProcSwitchP2();
1691 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1693 if gPlayer1
= nil then
1695 if gPlayer2
= nil then
1698 g_Game_RemovePlayer();
1699 g_ActiveWindow
:= nil;
1700 g_Game_Pause(False);
1703 procedure ProcSpectate();
1705 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1708 g_ActiveWindow
:= nil;
1709 g_Game_Pause(False);
1712 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1714 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1717 procedure ProcEndMenuKeyDown (yes
: Boolean);
1719 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1722 procedure ProcSetRussianLanguage
;
1724 if gLanguage
<> LANGUAGE_RUSSIAN
then
1726 gLanguage
:= LANGUAGE_RUSSIAN
;
1727 gLanguageChange
:= True;
1728 gAskLanguage
:= False;
1733 procedure ProcSetEnglishLanguage
;
1735 if gLanguage
<> LANGUAGE_ENGLISH
then
1737 gLanguage
:= LANGUAGE_ENGLISH
;
1738 gLanguageChange
:= True;
1739 gAskLanguage
:= False;
1744 procedure ReadGameSettings();
1748 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1750 with gGameSettings
do
1752 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1753 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1757 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1758 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1760 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1762 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1766 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1767 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1771 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1772 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1774 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1779 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1780 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1781 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1783 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1784 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1785 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1788 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1793 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1795 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1796 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1797 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1799 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1800 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1804 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1805 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1807 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1808 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1809 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1810 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1811 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1812 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1813 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1814 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1818 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1819 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1820 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1821 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1822 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1827 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1828 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1833 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1834 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1839 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1840 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1841 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1846 procedure ProcApplyGameSet();
1850 stat
: TPlayerStatArray
;
1852 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1854 if not g_Game_IsServer
then Exit
;
1856 with gGameSettings
do
1858 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1860 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1861 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1863 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1866 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1868 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1869 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1870 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1871 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1872 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1876 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1878 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1879 Options
:= Options
or GAME_OPTION_DMKEYS
1881 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1884 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1886 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1892 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1894 TimeLimit
:= Max(n
, b
);
1898 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1900 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1907 if GameMode
= GM_DM
then
1909 stat
:= g_Player_GetStats();
1911 for a
:= 0 to High(stat
) do
1912 if stat
[a
].Frags
> b
then
1916 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1918 GoalLimit
:= Max(n
, b
);
1922 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1924 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1925 if n
< 0 then n
:= 0;
1926 if n
> 255 then n
:= 255;
1932 stat
:= g_Player_GetStats();
1934 for a
:= 0 to High(stat
) do
1935 if stat
[a
].Lives
> b
then
1938 MaxLives
:= Max(n
, b
);
1942 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1944 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1947 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1948 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1952 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1953 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1957 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1958 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1963 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1965 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1966 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1967 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1968 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1972 // don't forget to latch this shit
1973 gsGameFlags
:= Options
;
1974 gsMaxLives
:= MaxLives
;
1975 gsGoalLimit
:= GoalLimit
;
1976 gsTimeLimit
:= TimeLimit
;
1979 if g_Game_IsNet
then MH_SEND_GameSettings
;
1982 procedure ProcVideoOptionsRes();
1987 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1989 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1990 IntToStr(gWinSizeX
) +
1991 ' x ' + IntToStr(gWinSizeY
) +
1992 ', ' + IntToStr(gBPP
) + ' bpp';
1994 with TGUIListBox(menu
.GetControl('lsResolution')) do
1996 list
:= sys_GetDisplayModes(gBPP
);
2000 ItemIndex
:= Length(list
)
2008 with TGUISwitch(menu
.GetControl('swFullScreen')) do
2014 TempResScale
:= Round(r_pixel_scale
- 1);
2015 with TGUISwitch(menu
.GetControl('swResFactor')) do
2016 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
2019 procedure ProcApplyVideoOptions();
2022 Fullscreen
: Boolean;
2023 SWidth
, SHeight
: Integer;
2024 ScaleChanged
: Boolean;
2027 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2029 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
2031 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
2034 SWidth
:= gWinSizeX
;
2035 SHeight
:= gWinSizeY
;
2036 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
2039 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
2041 ScaleChanged
:= False;
2042 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
2044 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
2045 r_pixel_scale
:= TempResScale
+ 1;
2046 ScaleChanged
:= True;
2049 if (SWidth
<> gWinSizeX
) or
2050 (SHeight
<> gWinSizeY
) or
2051 (Fullscreen
<> gFullscreen
) or
2054 gResolutionChange
:= True;
2055 gRC_Width
:= SWidth
;
2056 gRC_Height
:= SHeight
;
2057 gRC_FullScreen
:= Fullscreen
;
2058 gRC_Maximized
:= gWinMaximized
;
2061 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
2065 procedure ProcSetFirstRussianLanguage
;
2067 gLanguage
:= LANGUAGE_RUSSIAN
;
2068 gLanguageChange
:= True;
2069 gAskLanguage
:= False;
2072 procedure ProcSetFirstEnglishLanguage
;
2074 gLanguage
:= LANGUAGE_ENGLISH
;
2075 gLanguageChange
:= True;
2076 gAskLanguage
:= False;
2079 procedure ProcRecallAddress();
2081 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2083 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2084 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2088 procedure CreateFirstLanguageMenu();
2092 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2094 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2096 Name
:= 'mmFirstLanguageMenu';
2097 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2098 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2101 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2102 Menu
.MainWindow
:= True;
2103 g_GUI_AddWindow(Menu
);
2106 procedure g_Menu_AskLanguage();
2108 CreateFirstLanguageMenu();
2109 g_GUI_ShowWindow('FirstLanguageMenu');
2112 procedure CreatePlayerOptionsMenu(s
: String);
2117 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2119 a
:= _lc
[I_MENU_PLAYER_1
]
2121 a
:= _lc
[I_MENU_PLAYER_2
];
2122 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2124 Name
:= 'mOptionsPlayers'+s
+'Menu';
2125 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2127 Name
:= 'ed'+s
+'Name';
2131 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2133 Name
:= 'sw'+s
+'Team';
2134 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2135 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2137 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2139 Name
:= 'ls'+s
+'Model';
2141 Items
:= g_PlayerModel_GetNames();
2142 OnChange
:= ProcSelectModel
;
2144 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2146 Name
:= 'sc'+s
+'Red';
2148 OnChange
:= ProcChangeColor
;
2150 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2152 Name
:= 'sc'+s
+'Green';
2154 OnChange
:= ProcChangeColor
;
2156 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2158 Name
:= 'sc'+s
+'Blue';
2160 OnChange
:= ProcChangeColor
;
2163 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2164 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2165 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2166 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2167 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2168 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2169 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2171 Name
:= 'mv'+s
+'Model';
2172 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2173 Y
:= GetControl('ls'+s
+'Model').Y
;
2176 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2177 g_GUI_AddWindow(Menu
);
2180 procedure CreateAllMenus();
2184 a
, cx
, _y
, i
, x
: Integer;
2187 Menu
:= TGUIWindow
.Create('MainMenu');
2188 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2190 Name
:= 'mmMainMenu';
2191 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2192 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2193 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2194 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2195 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2196 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2198 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2200 Color
:= _RGB(255, 255, 255);
2201 X
:= gScreenWidth
-GetWidth
-8;
2202 Y
:= gScreenHeight
-GetHeight
-8;
2204 Menu
.DefControl
:= 'mmMainMenu';
2205 Menu
.MainWindow
:= True;
2206 g_GUI_AddWindow(Menu
);
2208 Menu
:= TGUIWindow
.Create('NewGameMenu');
2209 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2211 Name
:= 'mmNewGameMenu';
2212 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2213 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2214 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2215 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2217 Menu
.DefControl
:= 'mmNewGameMenu';
2218 g_GUI_AddWindow(Menu
);
2220 Menu
:= TGUIWindow
.Create('NetGameMenu');
2221 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2223 Name
:= 'mmNetGameMenu';
2224 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2225 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2227 Menu
.DefControl
:= 'mmNetGameMenu';
2228 g_GUI_AddWindow(Menu
);
2230 Menu
:= TGUIWindow
.Create('NetServerMenu');
2231 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2233 Name
:= 'mNetServerMenu';
2234 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2236 Name
:= 'edSrvName';
2237 OnlyDigits
:= False;
2240 Text := NetServerName
;
2242 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2244 Name
:= 'edSrvPassword';
2245 OnlyDigits
:= False;
2248 Text := NetPassword
;
2250 with AddEdit(_lc
[I_NET_PORT
]) do
2256 Text := IntToStr(NetPort
);
2258 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2260 Name
:= 'edMaxPlayers';
2264 Text := IntToStr(NetMaxClients
);
2266 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2268 Name
:= 'swUseMaster';
2269 AddItem(_lc
[I_MENU_YES
]);
2270 AddItem(_lc
[I_MENU_NO
]);
2271 if NetUseMaster
then
2277 with AddLabel(_lc
[I_MENU_MAP
]) do
2282 OnClick
:= @ProcSelectMapMenu
;
2284 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2286 Name
:= 'swGameMode';
2287 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2288 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2289 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2290 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2291 case g_Game_TextToMode(gsGameMode
) of
2293 GM_DM
: ItemIndex
:= 0;
2294 GM_TDM
: ItemIndex
:= 1;
2295 GM_CTF
: ItemIndex
:= 2;
2297 GM_COOP
: ItemIndex
:= 3;
2299 OnChange
:= ProcSwitchMonstersCustom
;
2301 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2303 Name
:= 'edTimeLimit';
2307 if gsTimeLimit
> 0 then
2308 Text := IntToStr(gsTimeLimit
);
2310 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2312 Name
:= 'edGoalLimit';
2316 if gsGoalLimit
> 0 then
2317 Text := IntToStr(gsGoalLimit
);
2319 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2321 Name
:= 'edMaxLives';
2325 if gsMaxLives
> 0 then
2326 Text := IntToStr(gsMaxLives
);
2328 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2330 Name
:= 'edItemRespawnTime';
2334 if gsItemRespawnTime
> 0 then
2335 Text := IntToStr(gsItemRespawnTime
);
2337 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2339 Name
:= 'swPlayers';
2340 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2341 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2342 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2343 ItemIndex
:= gsPlayers
;
2345 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2347 Name
:= 'swTeamDamage';
2348 AddItem(_lc
[I_MENU_YES
]);
2349 AddItem(_lc
[I_MENU_NO
]);
2350 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2355 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2357 Name
:= 'swTeamHit';
2358 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2359 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2360 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2361 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2362 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2364 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2366 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2371 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2373 Name
:= 'swDeathmatchKeys';
2374 AddItem(_lc
[I_MENU_YES
]);
2375 AddItem(_lc
[I_MENU_NO
]);
2376 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2381 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2383 Name
:= 'swEnableExits';
2384 AddItem(_lc
[I_MENU_YES
]);
2385 AddItem(_lc
[I_MENU_NO
]);
2386 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2391 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2393 Name
:= 'swWeaponStay';
2394 AddItem(_lc
[I_MENU_YES
]);
2395 AddItem(_lc
[I_MENU_NO
]);
2396 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2401 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2403 Name
:= 'swMonsters';
2404 AddItem(_lc
[I_MENU_YES
]);
2405 AddItem(_lc
[I_MENU_NO
]);
2406 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2411 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2414 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2415 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2416 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2418 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2420 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2423 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2425 Name
:= 'swFlagDrop';
2426 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2427 AddItem(_lc
[I_MENU_YES
]);
2428 AddItem(_lc
[I_MENU_NO
]);
2429 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2431 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2437 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2441 Menu
.DefControl
:= 'mNetServerMenu';
2442 g_GUI_AddWindow(Menu
);
2444 Menu
:= TGUIWindow
.Create('NetClientMenu');
2445 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2447 Name
:= 'mNetClientMenu';
2449 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2452 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2458 Text := 'localhost';
2460 with AddEdit(_lc
[I_NET_PORT
]) do
2468 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2471 OnlyDigits
:= False;
2478 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2482 Menu
.DefControl
:= 'mNetClientMenu';
2483 g_GUI_AddWindow(Menu
);
2485 Menu
:= TGUIWindow
.Create('LoadMenu');
2486 Menu
.OnShow
:= ProcLoadMenu
;
2487 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2489 Name
:= 'mmLoadMenu';
2494 Name
:= 'edSlot'+IntToStr(a
);
2497 OnEnter
:= ProcLoadGame
;
2500 Menu
.DefControl
:= 'mmLoadMenu';
2501 g_GUI_AddWindow(Menu
);
2503 Menu
:= TGUIWindow
.Create('SaveMenu');
2504 Menu
.OnShow
:= ProcSaveMenu
;
2505 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2507 Name
:= 'mmSaveMenu';
2512 Name
:= 'edSlot'+IntToStr(a
);
2515 OnChange
:= ProcSaveGame
;
2518 Menu
.DefControl
:= 'mmSaveMenu';
2519 g_GUI_AddWindow(Menu
);
2521 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2522 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2524 Name
:= 'mCustomGameMenu';
2525 with AddLabel(_lc
[I_MENU_MAP
]) do
2530 OnClick
:= @ProcSelectMapMenu
;
2532 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2534 Name
:= 'swGameMode';
2535 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2536 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2537 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2538 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2539 case g_Game_TextToMode(gsGameMode
) of
2541 GM_DM
: ItemIndex
:= 0;
2542 GM_TDM
: ItemIndex
:= 1;
2543 GM_CTF
: ItemIndex
:= 2;
2545 GM_COOP
: ItemIndex
:= 3;
2547 OnChange
:= ProcSwitchMonstersCustom
;
2549 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2551 Name
:= 'edTimeLimit';
2555 if gsTimeLimit
> 0 then
2556 Text := IntToStr(gsTimeLimit
);
2558 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2560 Name
:= 'edGoalLimit';
2564 if gsGoalLimit
> 0 then
2565 Text := IntToStr(gsGoalLimit
);
2567 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2569 Name
:= 'edMaxLives';
2573 if gsMaxLives
> 0 then
2574 Text := IntToStr(gsMaxLives
);
2576 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2578 Name
:= 'edItemRespawnTime';
2582 if gsItemRespawnTime
> 0 then
2583 Text := IntToStr(gsItemRespawnTime
);
2585 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2587 Name
:= 'swPlayers';
2588 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2589 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2590 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2591 ItemIndex
:= gsPlayers
;
2593 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2595 Name
:= 'swTeamDamage';
2596 AddItem(_lc
[I_MENU_YES
]);
2597 AddItem(_lc
[I_MENU_NO
]);
2598 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2603 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2605 Name
:= 'swTeamHit';
2606 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2607 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2608 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2609 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2610 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2612 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2614 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2619 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2621 Name
:= 'swDeathmatchKeys';
2622 AddItem(_lc
[I_MENU_YES
]);
2623 AddItem(_lc
[I_MENU_NO
]);
2624 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2629 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2631 Name
:= 'swEnableExits';
2632 AddItem(_lc
[I_MENU_YES
]);
2633 AddItem(_lc
[I_MENU_NO
]);
2634 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2639 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2641 Name
:= 'swWeaponStay';
2642 AddItem(_lc
[I_MENU_YES
]);
2643 AddItem(_lc
[I_MENU_NO
]);
2644 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2649 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2651 Name
:= 'swMonsters';
2652 AddItem(_lc
[I_MENU_YES
]);
2653 AddItem(_lc
[I_MENU_NO
]);
2654 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2659 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2662 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2663 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2664 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2666 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2668 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2671 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2673 Name
:= 'swFlagDrop';
2674 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2675 AddItem(_lc
[I_MENU_YES
]);
2676 AddItem(_lc
[I_MENU_NO
]);
2677 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2679 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2685 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2689 Menu
.DefControl
:= 'mCustomGameMenu';
2690 g_GUI_AddWindow(Menu
);
2692 Menu
:= TGUIWindow
.Create('CampaignMenu');
2693 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2695 Name
:= 'mCampaignMenu';
2704 with AddFileList('', 15, 4) do
2707 OnChange
:= ProcSelectCampaignWAD
;
2711 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2712 SetBase(MegawadDirs
);
2715 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2717 Name
:= 'lbWADName';
2721 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2723 Name
:= 'lbWADAuthor';
2727 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2728 with AddMemo('', 15, 3) do
2730 Name
:= 'meWADDescription';
2731 Color
:= MENU_ITEMSCTRL_COLOR
;
2733 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2735 Name
:= 'swPlayers';
2736 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2737 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2740 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2744 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2746 Name
:= 'mpWADImage';
2747 DefaultRes
:= 'NOPIC';
2748 X
:= GetControl('lsWAD').X
+4;
2749 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2752 Menu
.DefControl
:= 'mCampaignMenu';
2753 g_GUI_AddWindow(Menu
);
2755 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2756 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2758 Name
:= 'mSelectMapMenu';
2759 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2762 OnChange
:= ProcSelectWAD
;
2766 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2769 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2773 OnChange
:= ProcSelectMap
;
2776 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2778 Name
:= 'lbMapName';
2782 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2784 Name
:= 'lbMapAuthor';
2788 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2790 Name
:= 'lbMapSize';
2794 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2796 Name
:= 'meMapDescription';
2801 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2803 Name
:= 'mpMapPreview';
2804 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2805 Y
:= GetControl('lsMapWAD').Y
;
2807 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2809 Name
:= 'lbMapScale';
2812 Color
:= MENU_ITEMSCTRL_COLOR
;
2813 X
:= GetControl('lsMapWAD').X
+
2814 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2815 2 + MAPPREVIEW_WIDTH
*4;
2816 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2819 Menu
.OnClose
:= ProcSetMap
;
2820 Menu
.DefControl
:= 'mSelectMapMenu';
2821 g_GUI_AddWindow(Menu
);
2823 Menu
:= TGUIWindow
.Create('OptionsMenu');
2824 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2826 Name
:= 'mmOptionsMenu';
2827 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2828 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2829 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2830 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2831 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2832 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2834 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2835 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2837 Menu
.OnClose
:= ProcApplyOptions
;
2838 Menu
.DefControl
:= 'mmOptionsMenu';
2839 g_GUI_AddWindow(Menu
);
2841 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2842 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2846 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2848 Name
:= 'mOptionsVideoMenu';
2849 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2850 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2856 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2859 AddItem(_lc
[I_MENU_YES
]);
2860 AddItem(_lc
[I_MENU_NO
]);
2862 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2864 Name
:= 'swTextureFilter';
2865 AddItem(_lc
[I_MENU_YES
]);
2866 AddItem(_lc
[I_MENU_NO
]);
2868 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2871 AddItem(_lc
[I_MENU_YES
]);
2872 AddItem(_lc
[I_MENU_NO
]);
2874 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2876 Name
:= 'swLegacyNPOT';
2877 AddItem(_lc
[I_MENU_NO
]);
2878 AddItem(_lc
[I_MENU_YES
]);
2881 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2884 Menu
.DefControl
:= 'mOptionsVideoMenu';
2885 g_GUI_AddWindow(Menu
);
2887 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2888 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2890 Name
:= 'mOptionsVideoResMenu';
2891 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2893 Name
:= 'lbCurrentRes';
2897 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2899 Name
:= 'lsResolution';
2902 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2904 Name
:= 'swFullScreen';
2905 AddItem(_lc
[I_MENU_YES
]);
2906 AddItem(_lc
[I_MENU_NO
]);
2908 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2910 Name
:= 'swResFactor';
2912 for i
:= 2 to gRC_Width
div 640 do
2913 AddItem(IntToStr(i
) + 'x');
2916 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2919 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2920 g_GUI_AddWindow(Menu
);
2922 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2923 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2925 Name
:= 'mOptionsSoundMenu';
2926 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2928 Name
:= 'scMusicLevel';
2930 OnChange
:= ProcChangeSoundSettings
;
2932 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2934 Name
:= 'scSoundLevel';
2936 OnChange
:= ProcChangeSoundSettings
;
2938 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2940 Name
:= 'scMaxSimSounds';
2943 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2945 Name
:= 'swAnnouncer';
2946 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2947 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2948 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2949 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2951 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2952 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2954 Name
:= 'swSoundEffects';
2955 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2956 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2958 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2959 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2961 Name
:= 'swChatSpeech';
2962 AddItem(_lc
[I_MENU_YES
]);
2963 AddItem(_lc
[I_MENU_NO
]);
2965 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2967 Name
:= 'swInactiveSounds';
2968 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2969 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2973 Menu
.DefControl
:= 'mOptionsSoundMenu';
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2977 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2979 Name
:= 'mOptionsGameMenu';
2980 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2982 Name
:= 'scParticlesCount';
2985 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2987 Name
:= 'swBloodCount';
2988 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2989 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2990 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2991 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2992 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2994 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2996 Name
:= 'scShellsMax';
2999 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
3001 Name
:= 'scGibsMax';
3004 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
3006 Name
:= 'scCorpsesMax';
3009 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
3011 Name
:= 'swGibsCount';
3012 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3013 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3014 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3015 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3016 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3018 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
3020 Name
:= 'swCorpseType';
3021 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
3022 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
3024 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
3026 Name
:= 'swGibsType';
3027 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
3028 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
3030 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
3032 Name
:= 'swBloodType';
3033 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
3034 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
3036 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
3038 Name
:= 'swScreenFlash';
3039 AddItem(_lc
[I_MENU_NO
]);
3040 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3041 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3043 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
3045 Name
:= 'swBackground';
3046 AddItem(_lc
[I_MENU_YES
]);
3047 AddItem(_lc
[I_MENU_NO
]);
3049 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
3051 Name
:= 'swMessages';
3052 AddItem(_lc
[I_MENU_YES
]);
3053 AddItem(_lc
[I_MENU_NO
]);
3055 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
3057 Name
:= 'swRevertPlayers';
3058 AddItem(_lc
[I_MENU_YES
]);
3059 AddItem(_lc
[I_MENU_NO
]);
3061 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
3063 Name
:= 'swChatBubble';
3064 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
3065 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
3066 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
3067 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
3068 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3070 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3072 Name
:= 'swPlayerIndicator';
3073 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3074 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3075 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3077 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3079 Name
:= 'swPlayerIndicatorStyle';
3080 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3081 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3083 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3085 Name
:= 'scScaleFactor';
3087 OnChange
:= ProcChangeGameSettings
;
3091 Menu
.DefControl
:= 'mOptionsGameMenu';
3092 g_GUI_AddWindow(Menu
);
3094 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3095 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3097 Name
:= 'mOptionsControlsMenu';
3098 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3099 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3100 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3101 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3102 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3104 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3105 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3106 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3107 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3108 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3109 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3110 if e_HasJoysticks
then
3113 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3115 if g_touch_enabled
then
3118 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3121 Menu
.DefControl
:= 'mOptionsControlsMenu';
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3125 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3127 Name
:= 'mOptionsControlsP1Menu';
3128 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3129 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3130 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3131 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3132 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3133 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3134 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3135 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3136 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3137 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3138 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3140 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3141 g_GUI_AddWindow(Menu
);
3143 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3144 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3146 Name
:= 'mOptionsControlsP1MenuWeapons';
3147 for i
:= WP_FIRST
to WP_LAST
do
3148 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3149 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3151 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3152 g_GUI_AddWindow(Menu
);
3154 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3155 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3157 Name
:= 'mOptionsControlsP2Menu';
3158 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3159 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3160 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3161 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3162 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3163 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3164 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3165 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3166 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3167 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3168 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3170 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3171 g_GUI_AddWindow(Menu
);
3173 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3174 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3176 Name
:= 'mOptionsControlsP2MenuWeapons';
3177 for i
:= WP_FIRST
to WP_LAST
do
3178 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3179 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3181 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3182 g_GUI_AddWindow(Menu
);
3184 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3185 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3187 Name
:= 'mOptionsControlsJoystickMenu';
3188 for i
:= 0 to e_MaxJoys
- 1 do
3189 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3191 Name
:= 'scDeadzone' + IntToStr(i
);
3195 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3196 g_GUI_AddWindow(Menu
);
3198 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3199 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3201 Name
:= 'mOptionsControlsTouchMenu';
3202 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3204 Name
:= 'swTouchAlt';
3205 AddItem(_lc
[I_MENU_NO
]);
3206 AddItem(_lc
[I_MENU_YES
]);
3207 OnChange
:= ProcChangeTouchSettings
;
3209 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3211 Name
:= 'scTouchSize';
3213 OnChange
:= ProcChangeTouchSettings
;
3215 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3217 Name
:= 'swTouchFire';
3218 AddItem(_lc
[I_MENU_NO
]);
3219 AddItem(_lc
[I_MENU_YES
]);
3221 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3223 Name
:= 'scTouchOffset';
3225 OnChange
:= ProcChangeTouchSettings
;
3228 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3229 g_GUI_AddWindow(Menu
);
3231 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3232 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3234 Name
:= 'mOptionsPlayersMenu';
3235 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3236 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3238 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3239 g_GUI_AddWindow(Menu
);
3241 CreatePlayerOptionsMenu('P1');
3242 CreatePlayerOptionsMenu('P2');
3244 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3245 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3247 Name
:= 'mOptionsPlayersMIMenu';
3248 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3253 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3258 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3260 Name
:= 'meComment';
3263 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3264 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3267 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3271 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3272 g_GUI_AddWindow(Menu
);
3274 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3275 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3277 Name
:= 'mOptionsPlayersP1WeaponMenu';
3278 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3280 Name
:= 'swWeaponAutoswitch';
3281 AddItem(_lc
[I_MENU_NO
]);
3282 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3283 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3285 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3287 Name
:= 'swWeaponAllowEmpty';
3288 AddItem(_lc
[I_MENU_YES
]);
3289 AddItem(_lc
[I_MENU_NO
]);
3291 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3294 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3295 g_GUI_AddWindow(Menu
);
3297 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3298 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3300 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3301 for i
:= WP_FIRST
to WP_LAST
do
3303 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3305 Name
:= IntToStr(i
);
3306 for a
:= WP_FIRST
to WP_LAST
+1 do
3308 AddItem(IntToStr(a
));
3313 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3315 Name
:= IntToStr(WP_LAST
+1);
3316 for a
:= WP_FIRST
to WP_LAST
+1 do
3318 AddItem(IntToStr(a
));
3320 ItemIndex
:= WP_LAST
+ 1;
3323 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3324 g_GUI_AddWindow(Menu
);
3327 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3328 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3330 Name
:= 'mOptionsPlayersP2WeaponMenu';
3331 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3333 Name
:= 'swWeaponAutoswitch';
3334 AddItem(_lc
[I_MENU_NO
]);
3335 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3336 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3338 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3340 Name
:= 'swWeaponAllowEmpty';
3341 AddItem(_lc
[I_MENU_YES
]);
3342 AddItem(_lc
[I_MENU_NO
]);
3344 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3347 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3348 g_GUI_AddWindow(Menu
);
3350 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3351 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3353 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3354 for i
:= WP_FIRST
to WP_LAST
do
3356 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3358 Name
:= IntToStr(i
);
3359 for a
:= WP_FIRST
to WP_LAST
+1 do
3361 AddItem(IntToStr(a
));
3366 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3368 Name
:= IntToStr(WP_LAST
+1);
3369 for a
:= WP_FIRST
to WP_LAST
+1 do
3371 AddItem(IntToStr(a
));
3373 ItemIndex
:= WP_LAST
+ 1;
3376 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3377 g_GUI_AddWindow(Menu
);
3379 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3380 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3382 Name
:= 'mOptionsLanguageMenu';
3383 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3384 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3387 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3388 g_GUI_AddWindow(Menu
);
3390 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3391 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3392 g_GUI_AddWindow(Menu
);
3394 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3395 Menu
.BackTexture
:= 'INTER';
3396 Menu
.OnClose
:= ProcAuthorsClose
;
3400 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3402 Color
:= _RGB(255, 0, 0);
3403 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3405 _y
:= _y
+GetHeight();
3407 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3409 Color
:= _RGB(255, 0, 0);
3410 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3412 _y
:= _y
+GetHeight()+32;
3414 // ×òî äåëàë: Êòî äåëàë
3415 cx
:= gScreenWidth
div 2 - 320 + 64;
3416 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3418 Color
:= _RGB(255, 0, 0);
3423 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3425 Color
:= _RGB(255, 255, 255);
3430 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3432 Color
:= _RGB(255, 0, 0);
3437 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3439 Color
:= _RGB(255, 255, 255);
3444 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3446 Color
:= _RGB(255, 255, 255);
3451 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3453 Color
:= _RGB(255, 0, 0);
3458 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3460 Color
:= _RGB(255, 255, 255);
3465 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3467 Color
:= _RGB(255, 0, 0);
3472 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3474 Color
:= _RGB(255, 255, 255);
3477 _y
:= gScreenHeight
- 128;
3480 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3482 Color
:= _RGB(255, 0, 0);
3487 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3489 Color
:= _RGB(255, 255, 255);
3492 _y
:= _y
+GetHeight();
3494 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3496 Color
:= _RGB(255, 255, 255);
3499 _y
:= _y
+GetHeight();
3501 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3503 Color
:= _RGB(255, 255, 255);
3506 _y
:= gScreenHeight
- 32;
3508 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3510 Color
:= _RGB(255, 0, 0);
3511 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3514 g_GUI_AddWindow(Menu
);
3516 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3517 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3518 g_GUI_AddWindow(Menu
);
3520 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3521 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3523 Name
:= 'mmGameSingleMenu';
3524 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3525 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3526 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3527 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3528 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3529 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3531 Menu
.DefControl
:= 'mmGameSingleMenu';
3532 Menu
.MainWindow
:= True;
3533 Menu
.OnClose
:= ProcGMClose
;
3534 Menu
.OnShow
:= ProcGMShow
;
3535 g_GUI_AddWindow(Menu
);
3537 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3538 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3539 g_GUI_AddWindow(Menu
);
3541 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3542 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3543 g_GUI_AddWindow(Menu
);
3545 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3546 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3548 Name
:= 'mmGameCustomMenu';
3549 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3550 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3551 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3552 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3553 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3554 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3555 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3557 Menu
.DefControl
:= 'mmGameCustomMenu';
3558 Menu
.MainWindow
:= True;
3559 Menu
.OnClose
:= ProcGMClose
;
3560 Menu
.OnShow
:= ProcGMShow
;
3561 g_GUI_AddWindow(Menu
);
3563 Menu
:= TGUIWindow
.Create('GameServerMenu');
3564 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3566 Name
:= 'mmGameServerMenu';
3567 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3568 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3569 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3570 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3571 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3573 Menu
.DefControl
:= 'mmGameServerMenu';
3574 Menu
.MainWindow
:= True;
3575 Menu
.OnClose
:= ProcGMClose
;
3576 Menu
.OnShow
:= ProcGMShow
;
3577 g_GUI_AddWindow(Menu
);
3579 Menu
:= TGUIWindow
.Create('GameClientMenu');
3580 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3582 Name
:= 'mmGameClientMenu';
3583 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3584 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3585 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3587 Menu
.DefControl
:= 'mmGameClientMenu';
3588 Menu
.MainWindow
:= True;
3589 Menu
.OnClose
:= ProcGMClose
;
3590 Menu
.OnShow
:= ProcGMShow
;
3591 g_GUI_AddWindow(Menu
);
3593 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3594 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3596 Name
:= 'mClientPasswordMenu';
3597 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3605 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3608 Menu
.DefControl
:= 'mClientPasswordMenu';
3609 g_GUI_AddWindow(Menu
);
3611 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3612 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3614 Name
:= 'mGameSetGameMenu';
3615 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3617 Name
:= 'swTeamDamage';
3618 AddItem(_lc
[I_MENU_YES
]);
3619 AddItem(_lc
[I_MENU_NO
]);
3622 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3624 Name
:= 'swTeamHit';
3625 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3626 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3627 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3628 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3631 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3633 Name
:= 'swDeathmatchKeys';
3634 AddItem(_lc
[I_MENU_YES
]);
3635 AddItem(_lc
[I_MENU_NO
]);
3638 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3640 Name
:= 'edTimeLimit';
3645 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3647 Name
:= 'edGoalLimit';
3652 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3654 Name
:= 'edMaxLives';
3659 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3662 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3663 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3664 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3667 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3669 Name
:= 'swFlagDrop';
3670 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3671 AddItem(_lc
[I_MENU_YES
]);
3672 AddItem(_lc
[I_MENU_NO
]);
3678 Menu
.DefControl
:= 'mGameSetGameMenu';
3679 Menu
.OnClose
:= ProcApplyGameSet
;
3680 g_GUI_AddWindow(Menu
);
3682 Menu
:= TGUIWindow
.Create('TeamMenu');
3683 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3685 Name
:= 'mmTeamMenu';
3686 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3687 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3688 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3689 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3690 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3692 Menu
.DefControl
:= 'mmTeamMenu';
3693 Menu
.OnShow
:= ProcChangePlayers
;
3694 g_GUI_AddWindow(Menu
);
3697 procedure g_Menu_Show_SaveMenu();
3699 if g_Game_IsTestMap
then
3701 if gGameSettings
.GameType
= GT_SINGLE
then
3702 g_GUI_ShowWindow('GameSingleMenu')
3705 if g_Game_IsClient
then
3708 if g_Game_IsNet
then
3711 g_GUI_ShowWindow('GameCustomMenu');
3713 g_GUI_ShowWindow('SaveMenu');
3714 g_Sound_PlayEx('MENU_OPEN');
3717 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3719 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3720 if gGameSettings
.GameType
= GT_SINGLE
then
3722 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3726 if g_Game_IsClient
then exit
;
3727 if g_Game_IsNet
then exit
;
3728 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3730 g_GUI_ShowWindow('LoadMenu');
3731 g_Sound_PlayEx('MENU_OPEN');
3734 procedure g_Menu_Show_GameSetGame();
3736 if gGameSettings
.GameType
= GT_SINGLE
then
3737 g_GUI_ShowWindow('GameSingleMenu')
3740 if g_Game_IsClient
then
3743 if g_Game_IsNet
then
3744 g_GUI_ShowWindow('GameServerMenu')
3746 g_GUI_ShowWindow('GameCustomMenu');
3749 g_GUI_ShowWindow('GameSetGameMenu');
3750 g_Sound_PlayEx('MENU_OPEN');
3753 procedure g_Menu_Show_OptionsVideo();
3755 if gGameSettings
.GameType
= GT_SINGLE
then
3756 g_GUI_ShowWindow('GameSingleMenu')
3759 if g_Game_IsClient
then
3760 g_GUI_ShowWindow('GameClientMenu')
3762 if g_Game_IsNet
then
3763 g_GUI_ShowWindow('GameServerMenu')
3765 g_GUI_ShowWindow('GameCustomMenu');
3768 g_GUI_ShowWindow('OptionsMenu');
3769 g_GUI_ShowWindow('OptionsVideoMenu');
3770 g_Sound_PlayEx('MENU_OPEN');
3773 procedure g_Menu_Show_OptionsSound();
3775 if gGameSettings
.GameType
= GT_SINGLE
then
3776 g_GUI_ShowWindow('GameSingleMenu')
3779 if g_Game_IsClient
then
3780 g_GUI_ShowWindow('GameClientMenu')
3782 if g_Game_IsNet
then
3783 g_GUI_ShowWindow('GameServerMenu')
3785 g_GUI_ShowWindow('GameCustomMenu');
3788 g_GUI_ShowWindow('OptionsMenu');
3789 g_GUI_ShowWindow('OptionsSoundMenu');
3790 g_Sound_PlayEx('MENU_OPEN');
3793 procedure g_Menu_Show_EndGameMenu();
3795 g_GUI_ShowWindow('EndGameMenu');
3796 g_Sound_PlayEx('MENU_OPEN');
3799 procedure g_Menu_Show_QuitGameMenu();
3801 g_GUI_ShowWindow('ExitMenu');
3802 g_Sound_PlayEx('MENU_OPEN');
3805 procedure g_Menu_Init();
3812 procedure g_Menu_Free();
3816 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3821 procedure g_Menu_Reset();
3825 g_GUI_SaveMenuPos();
3826 ex
:= g_GUI_Destroy();
3830 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3835 g_Game_SetDebugMode();
3837 g_GUI_LoadMenuPos();