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, '+scores', '-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
, '+scores', '-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'));
334 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
335 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
336 TEAM_RED
, TEAM_BLUE
);
337 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
339 gPlayer1Settings
.Model
:= Model
.Name
;
340 gPlayer1Settings
.Color
:= Model
.Color
;
343 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
344 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
345 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
346 TEAM_RED
, TEAM_BLUE
);
347 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
349 gPlayer2Settings
.Model
:= Model
.Name
;
350 gPlayer2Settings
.Color
:= Model
.Color
;
353 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
354 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
355 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
356 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
357 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
360 for i
:= WP_FIRST
to WP_LAST
+1 do
362 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
366 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
367 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
368 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
369 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
370 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
373 for i
:= WP_FIRST
to WP_LAST
+1 do
375 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
379 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
380 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
382 if g_Game_IsServer
then
384 if gPlayer1
<> nil then
386 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
387 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
388 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
389 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
391 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
393 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
394 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
395 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
396 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
397 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
400 if gPlayer2
<> nil then
402 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
403 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
404 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
405 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
407 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
409 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
410 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
411 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
412 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
413 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
417 if g_Game_IsClient
then
419 MC_SEND_PlayerSettings
;
420 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
423 g_Console_WriteGameConfig
;
426 procedure ReadOptions();
431 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
433 with TGUISwitch(menu
.GetControl('swBPP')) do
439 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
440 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
442 with TGUISwitch(menu
.GetControl('swVSync')) do
443 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
445 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
446 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
448 with TGUISwitch(menu
.GetControl('swInterp')) do
449 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
451 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
453 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
454 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
455 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
457 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
458 if gMuteWhenInactive
then
463 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
465 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
466 if gSoundEffectsDF
then
471 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
472 if gUseChatSounds
then
477 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
505 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
508 for i
:= WP_FIRST
to WP_LAST
do
510 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
511 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
515 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
520 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
522 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
523 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
524 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
525 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
528 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
540 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
543 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
546 for i
:= WP_FIRST
to WP_LAST
do
548 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
549 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
553 if e_HasJoysticks
then
555 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
558 for i
:= 0 to e_MaxJoys
- 1 do
559 if e_JoystickAvailable
[i
] then
560 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
564 if g_touch_enabled
then
566 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
567 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
568 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
569 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
570 with TGUISwitch(menu
.GetControl('swTouchFire')) do
571 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
572 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
575 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
578 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
579 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
580 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
581 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
584 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
586 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
587 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
588 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
589 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
590 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
592 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
595 with TGUISwitch(menu
.GetControl('swBloodType')) do
596 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
598 with TGUISwitch(menu
.GetControl('swCorpseType')) do
599 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
601 with TGUISwitch(menu
.GetControl('swGibsType')) do
602 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
604 with TGUISwitch(menu
.GetControl('swGibsCount')) do
613 with TGUISwitch(menu
.GetControl('swBackGround')) do
614 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
616 with TGUISwitch(menu
.GetControl('swMessages')) do
617 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
619 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
620 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
622 with TGUISwitch(menu
.GetControl('swChatBubble')) do
623 ItemIndex
:= gChatBubble
;
625 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
626 ItemIndex
:= gPlayerIndicator
;
628 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
629 ItemIndex
:= gPlayerIndicatorStyle
;
631 TempScale
:= Round(g_dbg_scale
- 1);
632 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
634 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
636 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
637 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
639 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
640 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
642 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
643 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
644 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
646 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
647 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
648 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
649 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
650 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
651 for i
:= WP_FIRST
to WP_LAST
+1 do
653 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
654 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
657 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
658 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
659 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
660 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
661 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
662 for i
:= WP_FIRST
to WP_LAST
+1 do
664 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
665 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
668 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
670 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
671 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
673 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
674 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
676 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
677 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
678 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
680 ProcSelectModel(nil);
683 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
685 // don't turn off monsters in DM
687 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
688 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
689 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
691 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
694 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
695 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
696 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
697 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
701 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
703 // don't turn off monsters in DM
705 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
706 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
707 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
709 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
712 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
713 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
714 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
715 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
719 function LatchGameOptions(const MenuName
: string): Byte;
725 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
727 Map
:= TGUILabel(GetControl('lbMap')).Text;
730 if not isWadPath(Map
) then
733 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
734 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
735 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
736 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
737 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
738 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
742 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
743 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
744 if TGUISwitch(GetControl('swTeamAbsorbDamage')).ItemIndex
= 0 then
745 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMABSORBDAMAGE
;
746 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
747 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
748 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
749 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
750 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
751 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
752 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
753 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
755 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
756 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
757 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
758 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
761 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
762 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
763 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
764 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
767 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
768 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
769 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
770 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
773 // TODO: get this crap out of here
774 gGameSettings
.WarmupTime
:= gsWarmupTime
;
775 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
778 // HACK: We keep the variables for the items in a different menu
779 with TGUIMenu(g_GUI_GetWindow('ItemsRespawnMenu').GetControl('mItemsRespawnMenu')) do
781 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
782 gsItemRespawnRandom
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnRandom')).Text, 0);
783 gsRulezRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edRulezRespawnTime')).Text, 0);
784 gsRulezRespawnRandom
:= StrToIntDef(TGUIEdit(GetControl('edRulezRespawnRandom')).Text, 0);
786 if TGUISwitch(GetControl('swRulezRandom')).ItemIndex
= 0 then
787 gsGameFlags
:= gsGameFlags
or GAME_OPTION_RULEZRANDOM
;
789 case TGUISwitch(GetControl('swItemsRandom')).ItemIndex
of
790 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMHELPRANDOM
;
791 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMAMMORANDOM
;
792 3: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMWEAPONRANDOM
;
793 4: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMAMMORANDOM
;
794 5: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
;
795 6: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMAMMORANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
;
796 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ITEMALLRANDOM
;
799 // TODO: get this crap out of here
800 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
801 gGameSettings
.ItemRespawnRandom
:= gsItemRespawnRandom
;
802 gGameSettings
.RulezRespawnTime
:= gsRulezRespawnTime
;
803 gGameSettings
.RulezRespawnRandom
:= gsRulezRespawnRandom
;
807 procedure ProcStartCustomGame();
811 GameMode
:= LatchGameOptions('mCustomGameMenu');
812 if GameMode
= GM_NONE
then Exit
;
814 g_Console_WriteGameConfig
;
815 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
816 gsMaxLives
, gsGameFlags
, gsPlayers
);
820 procedure ProcStartNetGame();
824 GameMode
:= LatchGameOptions('mNetServerMenu');
825 if GameMode
= GM_NONE
then Exit
;
827 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
829 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
830 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
831 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
832 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
833 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
834 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
837 g_Console_WriteGameConfig
;
838 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
839 gsGameFlags
, gsPlayers
, 0, NetPort
);
842 procedure ProcConnectNetGame();
846 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
848 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
849 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
850 PW
:= TGUIEdit(GetControl('edPW')).Text;
853 g_Console_WriteGameConfig
;
854 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
857 procedure ProcEnterPassword();
861 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
863 NetClientIP
:= PromptIP
;
864 NetClientPort
:= PromptPort
;
865 PW
:= TGUIEdit(GetControl('edPW')).Text;
868 g_Console_WriteGameConfig
;
869 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
872 procedure ProcServerlist();
874 if not NetInitDone
then
876 if (not g_Net_Init()) then
878 g_Console_Add('NET: ERROR: Failed to init ENet!');
885 g_Net_Slist_Set(NetMasterList
);
887 gState
:= STATE_SLIST
;
888 g_ActiveWindow
:= nil;
890 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
895 slReturnPressed
:= True;
896 if g_Net_Slist_Fetch(slCurrent
) then
898 if slCurrent
= nil then
899 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
902 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
903 g_Serverlist_GenerateTable(slCurrent
, slTable
);
906 procedure ProcStartCampaign();
912 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
914 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
915 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
917 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
923 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
926 procedure ProcSelectMap(Sender
: TGUIControl
);
930 wad
, map
, res
: String;
932 win
:= g_GUI_GetWindow('SelectMapMenu');
933 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
935 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
936 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
938 if (wad
= '') or (map
= '') then
939 begin // Ýòî íå êàðòà
940 TGUILabel(GetControl('lbMapName')).Text := '';
941 TGUILabel(GetControl('lbMapAuthor')).Text := '';
942 TGUILabel(GetControl('lbMapSize')).Text := '';
943 TGUIMemo(GetControl('meMapDescription')).SetText('');
944 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
945 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
951 a
:= g_Map_GetMapInfo(res
);
953 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
954 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
955 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
956 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
957 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
958 TGUILabel(win
.GetControl('lbMapScale')).Text :=
959 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
964 procedure ProcSelectWAD(Sender
: TGUIControl
);
969 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
971 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
973 with TGUIListBox(GetControl('lsMapRes')) do
979 list
:= g_Map_GetMapsList(wad
);
993 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
999 win
:= g_GUI_GetWindow('CampaignMenu');
1000 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
1002 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
1006 TGUILabel(GetControl('lbWADName')).Text := '';
1007 TGUILabel(GetControl('lbWADAuthor')).Text := '';
1008 TGUIMemo(GetControl('meWADDescription')).SetText('');
1011 a
:= g_Game_GetMegaWADInfo(wad
);
1013 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
1014 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
1015 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
1017 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
1021 fn
:= g_ExtractWadName(a
.pic
);
1023 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
1025 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1030 procedure ProcChangeColor(Sender
: TGUIControl
);
1034 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1035 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1036 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1037 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1038 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1039 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1041 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1042 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1043 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1044 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1045 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1046 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1049 procedure ProcSelectModel(Sender
: TGUIControl
);
1054 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1055 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1056 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1058 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1059 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1060 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1062 ProcChangeColor(nil);
1065 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1077 wad
:= TWADFile
.Create
;
1078 if wad
.ReadFile(GameWAD
) then
1079 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1084 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1086 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1087 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1088 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1089 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1091 if g_Texture_Get('FONT_STD', ID
) then
1092 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1097 if cfglen
<> 0 then FreeMem(cfgdata
);
1100 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1106 cfgdata
, fntdata
: Pointer;
1107 cfglen
, fntlen
: Integer;
1115 wad
:= TWADFile
.Create
;
1116 if wad
.ReadFile(GameWAD
) then
1118 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1119 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1125 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1126 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1127 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1129 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1130 FontID
:= e_CharFont_Create(spc
);
1132 for a
:= 0 to 255 do
1134 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1135 if chrwidth
= 0 then Continue
;
1137 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1139 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1145 if cfglen
<> 0 then FreeMem(cfgdata
);
1146 if fntlen
<> 0 then FreeMem(fntdata
);
1149 procedure MenuLoadData();
1151 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1153 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1154 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1155 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1156 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1157 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1158 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1159 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1160 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1161 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1162 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1163 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1164 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1165 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1166 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1167 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1168 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1169 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1170 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1171 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1172 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1173 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1174 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1175 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1176 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1177 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1179 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1180 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1181 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1182 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1183 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1184 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1185 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1188 procedure MenuFreeData();
1190 e_CharFont_Remove(gMenuFont
);
1191 e_CharFont_Remove(gMenuSmallFont
);
1193 g_Texture_Delete('MAINMENU_LOGO');
1194 g_Texture_Delete('MAINMENU_MARKER1');
1195 g_Texture_Delete('MAINMENU_MARKER2');
1196 g_Texture_Delete('SCROLL_LEFT');
1197 g_Texture_Delete('SCROLL_RIGHT');
1198 g_Texture_Delete('SCROLL_MIDDLE');
1199 g_Texture_Delete('SCROLL_MARKER');
1200 g_Texture_Delete('EDIT_LEFT');
1201 g_Texture_Delete('EDIT_RIGHT');
1202 g_Texture_Delete('EDIT_MIDDLE');
1203 g_Texture_Delete('BOX1');
1204 g_Texture_Delete('BOX2');
1205 g_Texture_Delete('BOX3');
1206 g_Texture_Delete('BOX4');
1207 g_Texture_Delete('BOX5');
1208 g_Texture_Delete('BOX6');
1209 g_Texture_Delete('BOX7');
1210 g_Texture_Delete('BOX8');
1211 g_Texture_Delete('BOX9');
1212 g_Texture_Delete('BSCROLL_UP_A');
1213 g_Texture_Delete('BSCROLL_UP_U');
1214 g_Texture_Delete('BSCROLL_DOWN_A');
1215 g_Texture_Delete('BSCROLL_DOWN_U');
1216 g_Texture_Delete('BSCROLL_MIDDLE');
1217 g_Texture_Delete('NOPIC');
1219 g_Sound_Delete('MENU_SELECT');
1220 g_Sound_Delete('MENU_OPEN');
1221 g_Sound_Delete('MENU_CLOSE');
1222 g_Sound_Delete('MENU_CHANGE');
1223 g_Sound_Delete('SCROLL_ADD');
1224 g_Sound_Delete('SCROLL_SUB');
1225 g_Sound_Delete('SOUND_PLAYER_FALL');
1228 procedure ProcAuthorsMenu();
1230 gMusic
.SetByName('MUSIC_INTERMUS');
1234 procedure ProcExitMenuKeyDown (yes
: Boolean);
1237 snd
: TPlayableSound
;
1242 g_Game_StopAllSounds(True);
1243 case (Random(18)) of
1244 0: s
:= 'SOUND_MONSTER_PAIN';
1245 1: s
:= 'SOUND_MONSTER_DIE_3';
1246 2: s
:= 'SOUND_MONSTER_SLOP';
1247 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1248 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1249 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1250 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1251 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1252 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1253 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1254 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1255 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1256 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1257 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1258 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1259 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1260 else s
:= 'SOUND_PLAYER_FALL';
1262 snd
:= TPlayableSound
.Create();
1263 res
:= snd
.SetByName(s
);
1264 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1268 while snd
.IsPlaying() do begin end;
1276 procedure ProcLoadMenu();
1283 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1284 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1285 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1289 procedure ProcSaveMenu();
1297 name
:= g_GetSaveName(a
, valid
);
1298 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1299 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1303 procedure ProcSaveGame(Sender
: TGUIControl
);
1307 if g_Game_IsNet
then Exit
;
1308 if g_Game_IsTestMap
then Exit
;
1309 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1310 g_Game_PauseAllSounds(True);
1311 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1313 g_ActiveWindow
:= nil;
1314 g_Game_Pause(False);
1317 procedure ProcLoadGame(Sender
: TGUIControl
);
1321 if g_Game_IsNet
then Exit
;
1322 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1323 if g_LoadGame(a
) then
1325 g_Game_PauseAllSounds(False)
1327 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1329 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1330 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1331 //g_ActiveWindow := nil;
1335 procedure ProcSinglePlayer (n
: Integer);
1336 var wad
, map
: AnsiString
;
1339 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1340 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1341 if e_FindResource(AllMapDirs
, wad
) then
1343 wad
:= ExpandFileName(wad
);
1344 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1348 procedure ProcSingle1Player
;
1353 procedure ProcSingle2Players
;
1358 procedure ProcSelectMapMenu();
1361 wad_lb
: TGUIFileListBox
;
1362 map_lb
: TGUIListBox
;
1365 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1366 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1367 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1369 if wad_lb
.SelectedItem() <> '' then
1370 map
:= map_lb
.SelectedItem()
1374 wad_lb
.UpdateFileList();
1377 if wad_lb
.SelectedItem() <> '' then
1380 map_lb
.SelectItem(map
);
1382 if map_lb
.SelectedItem() <> '' then
1386 g_GUI_ShowWindow('SelectMapMenu');
1389 procedure ProcSelectCampaignMenu();
1392 wad_lb
: TGUIFileListBox
;
1394 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1395 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1397 wad_lb
.UpdateFileList();
1399 if wad_lb
.SelectedItem() <> '' then
1400 ProcSelectCampaignWAD(nil);
1403 procedure ProcSetMap();
1405 wad
, map
, res
: String;
1407 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1409 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1410 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1413 if (wad
= '') or (map
= '') then
1416 wad
:= e_FindWadRel(MapDirs
, WAD
);
1418 res
:= wad
+':\'+map
;
1420 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1421 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1424 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1428 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1430 g_Sound_SetupAllVolumes(
1431 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1432 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1436 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1440 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1441 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1443 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1444 g_dbg_scale
:= TempScale
+ 1;
1448 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1452 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1453 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1454 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1455 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1458 procedure ProcOptionsPlayersMIMenu();
1463 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1465 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1467 if a
= '' then Exit
;
1469 b
:= g_PlayerModel_GetInfo(a
);
1471 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1473 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1474 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1475 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1477 if b
.HaveWeapon
then
1478 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1480 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1483 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1486 procedure ProcOptionsPlayerP1WeaponMenu();
1490 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1491 if a
= '' then Exit
;
1492 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1495 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1497 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1500 procedure ProcOptionsPlayerP2WeaponMenu();
1504 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1505 if a
= '' then Exit
;
1506 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1509 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1511 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1514 procedure ProcOptionsPlayersAnim();
1518 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1523 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1526 Model
.GetCurrentAnimation
.Loop
:= True;
1527 Model
.GetCurrentAnimationMask
.Loop
:= True;
1531 procedure ProcOptionsPlayersWeap();
1535 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1540 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1544 procedure ProcOptionsPlayersRot();
1548 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1549 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1551 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1555 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1559 g_Options_SetDefault();
1565 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1567 if yes
then ReadOptions();
1571 procedure ProcAuthorsClose();
1573 gMusic
.SetByName('MUSIC_MENU');
1575 gState
:= STATE_MENU
;
1578 procedure ProcGMClose();
1580 g_Game_InGameMenu(False);
1583 procedure ProcGMShow();
1588 if (gGameSettings
.GameType
= GT_SINGLE
) and
1589 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1590 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1591 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1593 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1594 if g_Game_IsTestMap
then
1595 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1596 TGUIMainMenu(g_ActiveWindow
.GetControl(
1597 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1600 procedure ProcChangePlayers();
1602 TeamGame
, Spectator
, AddTwo
: Boolean;
1603 P1Team
{, P2Team}: Byte;
1604 bP2
: TGUITextButton
;
1606 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1607 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1608 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1609 P1Team
:= TEAM_NONE
;
1610 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1612 //P2Team := TEAM_NONE;
1613 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1615 TGUIMainMenu(g_ActiveWindow
.GetControl(
1616 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1617 TGUIMainMenu(g_ActiveWindow
.GetControl(
1618 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1619 TGUIMainMenu(g_ActiveWindow
.GetControl(
1620 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1622 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1623 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1624 bP2
.Enabled
:= AddTwo
and not Spectator
;
1626 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1628 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1629 if gPlayer2
= nil then
1630 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1632 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1634 TGUIMainMenu(g_ActiveWindow
.GetControl(
1635 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1638 procedure ProcJoinRed();
1640 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1642 if g_Game_IsServer
then
1644 if gPlayer1
= nil then
1645 g_Game_AddPlayer(TEAM_RED
)
1648 if gPlayer1
.Team
<> TEAM_RED
then
1650 gPlayer1
.SwitchTeam
;
1651 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1654 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1659 gPlayer1Settings
.Team
:= TEAM_RED
;
1660 MC_SEND_PlayerSettings
;
1661 if gPlayer1
= nil then
1662 g_Game_AddPlayer(TEAM_RED
);
1664 g_ActiveWindow
:= nil;
1665 g_Game_Pause(False);
1668 procedure ProcJoinBlue();
1670 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1672 if g_Game_IsServer
then
1674 if gPlayer1
= nil then
1675 g_Game_AddPlayer(TEAM_BLUE
)
1678 if gPlayer1
.Team
<> TEAM_BLUE
then
1680 gPlayer1
.SwitchTeam
;
1681 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1684 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1689 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1690 MC_SEND_PlayerSettings
;
1691 if gPlayer1
= nil then
1692 g_Game_AddPlayer(TEAM_BLUE
);
1694 g_ActiveWindow
:= nil;
1695 g_Game_Pause(False);
1698 procedure ProcJoinGame();
1700 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1702 if gPlayer1
= nil then
1704 g_ActiveWindow
:= nil;
1705 g_Game_Pause(False);
1708 procedure ProcSwitchP2();
1710 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1712 if gPlayer1
= nil then
1714 if gPlayer2
= nil then
1717 g_Game_RemovePlayer();
1718 g_ActiveWindow
:= nil;
1719 g_Game_Pause(False);
1722 procedure ProcSpectate();
1724 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1727 g_ActiveWindow
:= nil;
1728 g_Game_Pause(False);
1731 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1733 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1736 procedure ProcEndMenuKeyDown (yes
: Boolean);
1738 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1741 procedure ProcSetRussianLanguage
;
1743 if gLanguage
<> LANGUAGE_RUSSIAN
then
1745 gLanguage
:= LANGUAGE_RUSSIAN
;
1746 gLanguageChange
:= True;
1747 gAskLanguage
:= False;
1752 procedure ProcSetEnglishLanguage
;
1754 if gLanguage
<> LANGUAGE_ENGLISH
then
1756 gLanguage
:= LANGUAGE_ENGLISH
;
1757 gLanguageChange
:= True;
1758 gAskLanguage
:= False;
1763 procedure ProcItemsRespawnMenu();
1767 menu
:= TGUIMenu(g_GUI_GetWindow('ItemsRespawnMenu').GetControl('mItemsRespawnMenu'));
1769 g_GUI_ShowWindow('ItemsRespawnMenu');
1772 procedure ReadGameSettings();
1776 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1778 with gGameSettings
do
1780 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1781 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1785 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1786 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1788 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1790 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1794 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1795 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1799 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1800 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1802 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1807 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1808 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1809 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1811 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1812 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1813 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1816 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1821 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1823 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1824 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1825 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1827 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1828 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1832 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1833 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1835 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1836 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1837 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1838 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1839 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1840 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1841 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1842 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1846 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1847 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1848 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1849 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1850 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1855 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1856 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1861 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1862 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1867 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1868 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1869 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1874 procedure ProcApplyGameSet();
1878 stat
: TPlayerStatArray
;
1880 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1882 if not g_Game_IsServer
then Exit
;
1884 with gGameSettings
do
1886 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1888 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1889 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1891 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1894 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1896 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1897 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1898 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1899 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1900 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1904 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1906 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1907 Options
:= Options
or GAME_OPTION_DMKEYS
1909 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1912 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1914 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1920 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1922 TimeLimit
:= Max(n
, b
);
1926 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1928 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1935 if GameMode
= GM_DM
then
1937 stat
:= g_Player_GetStats();
1939 for a
:= 0 to High(stat
) do
1940 if stat
[a
].Frags
> b
then
1944 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1946 ScoreLimit
:= Max(n
, b
);
1950 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1952 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1953 if n
< 0 then n
:= 0;
1954 if n
> 255 then n
:= 255;
1960 stat
:= g_Player_GetStats();
1962 for a
:= 0 to High(stat
) do
1963 if stat
[a
].Lives
> b
then
1966 MaxLives
:= Max(n
, b
);
1970 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1972 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1975 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1976 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1980 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1981 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1985 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1986 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1991 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1993 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1994 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1995 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1996 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
2000 // don't forget to latch this shit
2001 gsGameFlags
:= Options
;
2002 gsMaxLives
:= MaxLives
;
2003 gsScoreLimit
:= ScoreLimit
;
2004 gsTimeLimit
:= TimeLimit
;
2007 if g_Game_IsNet
then MH_SEND_GameSettings
;
2010 procedure ProcVideoOptionsRes();
2015 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2017 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
2018 IntToStr(gWinSizeX
) +
2019 ' x ' + IntToStr(gWinSizeY
) +
2020 ', ' + IntToStr(gBPP
) + ' bpp';
2022 with TGUIListBox(menu
.GetControl('lsResolution')) do
2024 list
:= sys_GetDisplayModes(gBPP
);
2028 ItemIndex
:= -1; (* nothing selected *)
2036 with TGUISwitch(menu
.GetControl('swFullScreen')) do
2042 TempResScale
:= Round(r_pixel_scale
- 1);
2043 with TGUISwitch(menu
.GetControl('swResFactor')) do
2044 ItemIndex
:= Max(Min(TempResScale
, gRC_Width
div 640 - 1), 0);
2047 procedure ProcApplyVideoOptions();
2050 Fullscreen
: Boolean;
2051 SWidth
, SHeight
: Integer;
2052 ScaleChanged
: Boolean;
2055 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2057 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
2059 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
2062 SWidth
:= gWinSizeX
;
2063 SHeight
:= gWinSizeY
;
2064 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
2067 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
2069 ScaleChanged
:= False;
2070 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
2072 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
2073 r_pixel_scale
:= TempResScale
+ 1;
2074 ScaleChanged
:= True;
2077 if (SWidth
<> gWinSizeX
) or
2078 (SHeight
<> gWinSizeY
) or
2079 (Fullscreen
<> gFullscreen
) or
2082 gResolutionChange
:= True;
2083 gRC_Width
:= SWidth
;
2084 gRC_Height
:= SHeight
;
2085 gRC_FullScreen
:= Fullscreen
;
2086 gRC_Maximized
:= gWinMaximized
;
2089 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
2093 procedure ProcSetFirstRussianLanguage
;
2095 gLanguage
:= LANGUAGE_RUSSIAN
;
2096 gLanguageChange
:= True;
2097 gAskLanguage
:= False;
2100 procedure ProcSetFirstEnglishLanguage
;
2102 gLanguage
:= LANGUAGE_ENGLISH
;
2103 gLanguageChange
:= True;
2104 gAskLanguage
:= False;
2107 procedure ProcRecallAddress();
2109 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2111 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2112 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2116 procedure CreateFirstLanguageMenu();
2120 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2122 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2124 Name
:= 'mmFirstLanguageMenu';
2125 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2126 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2129 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2130 Menu
.MainWindow
:= True;
2131 g_GUI_AddWindow(Menu
);
2134 procedure g_Menu_AskLanguage();
2136 CreateFirstLanguageMenu();
2137 g_GUI_ShowWindow('FirstLanguageMenu');
2140 procedure CreatePlayerOptionsMenu(s
: String);
2145 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2147 a
:= _lc
[I_MENU_PLAYER_1
]
2149 a
:= _lc
[I_MENU_PLAYER_2
];
2150 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2152 Name
:= 'mOptionsPlayers'+s
+'Menu';
2153 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2155 Name
:= 'ed'+s
+'Name';
2159 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2161 Name
:= 'sw'+s
+'Team';
2162 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2163 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2165 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2167 Name
:= 'ls'+s
+'Model';
2169 Items
:= g_PlayerModel_GetNames();
2170 OnChange
:= ProcSelectModel
;
2172 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2174 Name
:= 'sc'+s
+'Red';
2176 OnChange
:= ProcChangeColor
;
2178 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2180 Name
:= 'sc'+s
+'Green';
2182 OnChange
:= ProcChangeColor
;
2184 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2186 Name
:= 'sc'+s
+'Blue';
2188 OnChange
:= ProcChangeColor
;
2191 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2192 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2193 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2194 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2195 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2196 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2197 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2199 Name
:= 'mv'+s
+'Model';
2200 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2201 Y
:= GetControl('ls'+s
+'Model').Y
;
2204 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2205 g_GUI_AddWindow(Menu
);
2208 procedure CreateAllMenus();
2212 a
, cx
, _y
, i
: Integer;
2215 Menu
:= TGUIWindow
.Create('MainMenu');
2216 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2218 Name
:= 'mmMainMenu';
2219 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2220 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2221 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2222 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2223 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2224 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2226 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2228 Color
:= _RGB(255, 255, 255);
2229 X
:= gScreenWidth
-GetWidth
-8;
2230 Y
:= gScreenHeight
-GetHeight
-8;
2232 Menu
.DefControl
:= 'mmMainMenu';
2233 Menu
.MainWindow
:= True;
2234 g_GUI_AddWindow(Menu
);
2236 Menu
:= TGUIWindow
.Create('NewGameMenu');
2237 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2239 Name
:= 'mmNewGameMenu';
2240 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2241 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2242 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2243 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2245 Menu
.DefControl
:= 'mmNewGameMenu';
2246 g_GUI_AddWindow(Menu
);
2248 Menu
:= TGUIWindow
.Create('NetGameMenu');
2249 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2251 Name
:= 'mmNetGameMenu';
2252 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2253 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2255 Menu
.DefControl
:= 'mmNetGameMenu';
2256 g_GUI_AddWindow(Menu
);
2258 Menu
:= TGUIWindow
.Create('NetServerMenu');
2259 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2261 Name
:= 'mNetServerMenu';
2262 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2264 Name
:= 'edSrvName';
2265 OnlyDigits
:= False;
2268 Text := NetServerName
;
2270 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2272 Name
:= 'edSrvPassword';
2273 OnlyDigits
:= False;
2276 Text := NetPassword
;
2278 with AddEdit(_lc
[I_NET_PORT
]) do
2284 Text := IntToStr(NetPort
);
2286 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2288 Name
:= 'edMaxPlayers';
2292 Text := IntToStr(NetMaxClients
);
2294 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2296 Name
:= 'swUseMaster';
2297 AddItem(_lc
[I_MENU_YES
]);
2298 AddItem(_lc
[I_MENU_NO
]);
2299 if NetUseMaster
then
2305 with AddLabel(_lc
[I_MENU_MAP
]) do
2310 OnClick
:= @ProcSelectMapMenu
;
2312 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2314 Name
:= 'swGameMode';
2315 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2316 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2317 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2318 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2319 case g_Game_TextToMode(gsGameMode
) of
2321 GM_DM
: ItemIndex
:= 0;
2322 GM_TDM
: ItemIndex
:= 1;
2323 GM_CTF
: ItemIndex
:= 2;
2325 GM_COOP
: ItemIndex
:= 3;
2327 OnChange
:= ProcSwitchMonstersCustom
;
2329 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2331 Name
:= 'edTimeLimit';
2335 if gsTimeLimit
> 0 then
2336 Text := IntToStr(gsTimeLimit
);
2338 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2340 Name
:= 'edScoreLimit';
2344 if gsScoreLimit
> 0 then
2345 Text := IntToStr(gsScoreLimit
);
2347 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2349 Name
:= 'edMaxLives';
2353 if gsMaxLives
> 0 then
2354 Text := IntToStr(gsMaxLives
);
2356 with AddLabel(_lc
[I_MENU_SELECT_ITEM_RESPAWN
]) do
2358 Name
:= 'lbItemsRespawn';
2360 OnClick
:= @ProcItemsRespawnMenu
;
2363 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2365 Name
:= 'swPlayers';
2366 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2367 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2368 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2369 ItemIndex
:= gsPlayers
;
2371 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2373 Name
:= 'swTeamDamage';
2374 AddItem(_lc
[I_MENU_YES
]);
2375 AddItem(_lc
[I_MENU_NO
]);
2376 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2381 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2383 Name
:= 'swTeamHit';
2384 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2385 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2386 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2387 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2388 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2390 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2392 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2397 with AddSwitch(_lc
[I_MENU_ENABLE_TEAM_DAMAGE_ABSOBR
]) do
2399 Name
:= 'swTeamAbsorbDamage';
2400 AddItem(_lc
[I_MENU_YES
]);
2401 AddItem(_lc
[I_MENU_NO
]);
2402 if LongBool(gsGameFlags
and GAME_OPTION_TEAMABSORBDAMAGE
) then
2407 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2409 Name
:= 'swDeathmatchKeys';
2410 AddItem(_lc
[I_MENU_YES
]);
2411 AddItem(_lc
[I_MENU_NO
]);
2412 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2417 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2419 Name
:= 'swEnableExits';
2420 AddItem(_lc
[I_MENU_YES
]);
2421 AddItem(_lc
[I_MENU_NO
]);
2422 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2427 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2429 Name
:= 'swWeaponStay';
2430 AddItem(_lc
[I_MENU_YES
]);
2431 AddItem(_lc
[I_MENU_NO
]);
2432 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2437 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2439 Name
:= 'swMonsters';
2440 AddItem(_lc
[I_MENU_YES
]);
2441 AddItem(_lc
[I_MENU_NO
]);
2442 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2447 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2450 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2451 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2452 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2454 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2456 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2459 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2461 Name
:= 'swFlagDrop';
2462 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2463 AddItem(_lc
[I_MENU_YES
]);
2464 AddItem(_lc
[I_MENU_NO
]);
2465 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2467 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2473 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2477 Menu
.DefControl
:= 'mNetServerMenu';
2478 g_GUI_AddWindow(Menu
);
2480 Menu
:= TGUIWindow
.Create('NetClientMenu');
2481 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2483 Name
:= 'mNetClientMenu';
2485 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2488 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2494 Text := 'localhost';
2496 with AddEdit(_lc
[I_NET_PORT
]) do
2504 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2507 OnlyDigits
:= False;
2514 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2518 Menu
.DefControl
:= 'mNetClientMenu';
2519 g_GUI_AddWindow(Menu
);
2521 Menu
:= TGUIWindow
.Create('LoadMenu');
2522 Menu
.OnShow
:= ProcLoadMenu
;
2523 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2525 Name
:= 'mmLoadMenu';
2530 Name
:= 'edSlot'+IntToStr(a
);
2533 OnEnter
:= ProcLoadGame
;
2536 Menu
.DefControl
:= 'mmLoadMenu';
2537 g_GUI_AddWindow(Menu
);
2539 Menu
:= TGUIWindow
.Create('SaveMenu');
2540 Menu
.OnShow
:= ProcSaveMenu
;
2541 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2543 Name
:= 'mmSaveMenu';
2548 Name
:= 'edSlot'+IntToStr(a
);
2551 OnChange
:= ProcSaveGame
;
2554 Menu
.DefControl
:= 'mmSaveMenu';
2555 g_GUI_AddWindow(Menu
);
2557 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2558 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2560 Name
:= 'mCustomGameMenu';
2561 with AddLabel(_lc
[I_MENU_MAP
]) do
2566 OnClick
:= @ProcSelectMapMenu
;
2568 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2570 Name
:= 'swGameMode';
2571 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2572 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2573 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2574 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2575 case g_Game_TextToMode(gsGameMode
) of
2577 GM_DM
: ItemIndex
:= 0;
2578 GM_TDM
: ItemIndex
:= 1;
2579 GM_CTF
: ItemIndex
:= 2;
2581 GM_COOP
: ItemIndex
:= 3;
2583 OnChange
:= ProcSwitchMonstersCustom
;
2585 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2587 Name
:= 'edTimeLimit';
2591 if gsTimeLimit
> 0 then
2592 Text := IntToStr(gsTimeLimit
);
2594 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2596 Name
:= 'edScoreLimit';
2600 if gsScoreLimit
> 0 then
2601 Text := IntToStr(gsScoreLimit
);
2603 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2605 Name
:= 'edMaxLives';
2609 if gsMaxLives
> 0 then
2610 Text := IntToStr(gsMaxLives
);
2612 with AddLabel(_lc
[I_MENU_SELECT_ITEM_RESPAWN
]) do
2614 Name
:= 'lbItemsRespawn';
2616 OnClick
:= @ProcItemsRespawnMenu
;
2619 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2621 Name
:= 'swPlayers';
2622 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2623 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2624 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2625 ItemIndex
:= gsPlayers
;
2627 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2629 Name
:= 'swTeamDamage';
2630 AddItem(_lc
[I_MENU_YES
]);
2631 AddItem(_lc
[I_MENU_NO
]);
2632 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2637 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2639 Name
:= 'swTeamHit';
2640 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2641 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2642 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2643 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2644 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2646 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2648 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2653 with AddSwitch(_lc
[I_MENU_ENABLE_TEAM_DAMAGE_ABSOBR
]) do
2655 Name
:= 'swTeamAbsorbDamage';
2656 AddItem(_lc
[I_MENU_YES
]);
2657 AddItem(_lc
[I_MENU_NO
]);
2658 if LongBool(gsGameFlags
and GAME_OPTION_TEAMABSORBDAMAGE
) then
2663 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2665 Name
:= 'swDeathmatchKeys';
2666 AddItem(_lc
[I_MENU_YES
]);
2667 AddItem(_lc
[I_MENU_NO
]);
2668 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2673 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2675 Name
:= 'swEnableExits';
2676 AddItem(_lc
[I_MENU_YES
]);
2677 AddItem(_lc
[I_MENU_NO
]);
2678 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2683 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2685 Name
:= 'swWeaponStay';
2686 AddItem(_lc
[I_MENU_YES
]);
2687 AddItem(_lc
[I_MENU_NO
]);
2688 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2693 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2695 Name
:= 'swMonsters';
2696 AddItem(_lc
[I_MENU_YES
]);
2697 AddItem(_lc
[I_MENU_NO
]);
2698 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2703 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2706 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2707 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2708 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2710 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2712 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2715 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2717 Name
:= 'swFlagDrop';
2718 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2719 AddItem(_lc
[I_MENU_YES
]);
2720 AddItem(_lc
[I_MENU_NO
]);
2721 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2723 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2729 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2733 Menu
.DefControl
:= 'mCustomGameMenu';
2734 g_GUI_AddWindow(Menu
);
2736 Menu
:= TGUIWindow
.Create('CampaignMenu');
2737 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2739 Name
:= 'mCampaignMenu';
2748 with AddFileList('', 15, 4) do
2751 OnChange
:= ProcSelectCampaignWAD
;
2755 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2756 SetBase(MegawadDirs
);
2759 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2761 Name
:= 'lbWADName';
2765 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2767 Name
:= 'lbWADAuthor';
2771 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2772 with AddMemo('', 15, 3) do
2774 Name
:= 'meWADDescription';
2775 Color
:= MENU_ITEMSCTRL_COLOR
;
2777 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2779 Name
:= 'swPlayers';
2780 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2781 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2784 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2788 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2790 Name
:= 'mpWADImage';
2791 DefaultRes
:= 'NOPIC';
2792 X
:= GetControl('lsWAD').X
+4;
2793 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2796 Menu
.DefControl
:= 'mCampaignMenu';
2797 g_GUI_AddWindow(Menu
);
2799 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2800 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2802 Name
:= 'mSelectMapMenu';
2803 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2806 OnChange
:= ProcSelectWAD
;
2810 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2813 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2817 OnChange
:= ProcSelectMap
;
2820 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2822 Name
:= 'lbMapName';
2826 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2828 Name
:= 'lbMapAuthor';
2832 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2834 Name
:= 'lbMapSize';
2838 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2840 Name
:= 'meMapDescription';
2845 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2847 Name
:= 'mpMapPreview';
2848 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2849 Y
:= GetControl('lsMapWAD').Y
;
2851 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2853 Name
:= 'lbMapScale';
2856 Color
:= MENU_ITEMSCTRL_COLOR
;
2857 X
:= GetControl('lsMapWAD').X
+
2858 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2859 2 + MAPPREVIEW_WIDTH
*4;
2860 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2863 Menu
.OnClose
:= ProcSetMap
;
2864 Menu
.DefControl
:= 'mSelectMapMenu';
2865 g_GUI_AddWindow(Menu
);
2867 Menu
:= TGUIWindow
.Create('ItemsRespawnMenu');
2868 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_ITEM_RESPAWN
]))) do
2870 Name
:= 'mItemsRespawnMenu';
2872 // Switches separate from the time entry fields
2873 with AddSwitch(_lc
[I_MENU_ENABLE_RULEZ_RANDOM
]) do
2875 Name
:= 'swRulezRandom';
2876 AddItem(_lc
[I_MENU_YES
]);
2877 AddItem(_lc
[I_MENU_NO
]);
2878 if LongBool(gsGameFlags
and GAME_OPTION_RULEZRANDOM
) then
2883 with AddSwitch(_lc
[I_MENU_ENABLE_ITEM_RANDOM
]) do
2885 Name
:= 'swItemsRandom';
2886 AddItem(_lc
[I_MENU_ITEM_RANDOM_ALL
]);
2887 AddItem(_lc
[I_MENU_ITEM_RANDOM_HELP_ONLY
]);
2888 AddItem(_lc
[I_MENU_ITEM_RANDOM_AMMO_ONLY
]);
2889 AddItem(_lc
[I_MENU_ITEM_RANDOM_WEAPON_ONLY
]);
2890 AddItem(_lc
[I_MENU_ITEM_RANDOM_HELP_AMMO
]);
2891 AddItem(_lc
[I_MENU_ITEM_RANDOM_HELP_WEAPON
]);
2892 AddItem(_lc
[I_MENU_ITEM_RANDOM_WEAPON_AMMO
]);
2893 AddItem(_lc
[I_MENU_ITEM_RANDOM_NOTHING
]);
2894 if LongBool(gsGameFlags
and GAME_OPTION_ITEMALLRANDOM
) then
2896 else if LongBool(gsGameFlags
and GAME_OPTION_ITEMHELPRANDOM
) then
2898 else if LongBool(gsGameFlags
and GAME_OPTION_ITEMAMMORANDOM
) then
2900 else if LongBool(gsGameFlags
and GAME_OPTION_ITEMWEAPONRANDOM
) then
2902 else if (gsGameFlags
and (GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMAMMORANDOM
)) = (GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMAMMORANDOM
) then
2904 else if (gsGameFlags
and (GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
)) = (GAME_OPTION_ITEMHELPRANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
) then
2906 else if (gsGameFlags
and (GAME_OPTION_ITEMAMMORANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
)) = (GAME_OPTION_ITEMAMMORANDOM
or GAME_OPTION_ITEMWEAPONRANDOM
) then
2911 AddSpace();// Items Respawn block
2912 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2914 Name
:= 'edItemRespawnTime';
2918 if gsItemRespawnTime
> 0 then
2919 Text := IntToStr(gsItemRespawnTime
);
2921 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_RANDOM
]) do
2923 Name
:= 'edItemRespawnRandom';
2927 if gsItemRespawnTime
> 0 then
2928 Text := IntToStr(gsItemRespawnRandom
);
2930 // Rulez Respawn block
2931 with AddEdit(_lc
[I_MENU_RULEZ_RESPAWN_TIME
]) do
2933 Name
:= 'edRulezRespawnTime';
2937 if gsRulezRespawnTime
> 0 then
2938 Text := IntToStr(gsRulezRespawnTime
);
2940 with AddEdit(_lc
[I_MENU_RULEZ_RESPAWN_RANDOM
]) do
2942 Name
:= 'edRulezRespawnRandom';
2946 if gsRulezRespawnRandom
> 0 then
2947 Text := IntToStr(gsRulezRespawnRandom
);
2951 Menu
.DefControl
:= 'mItemsRespawnMenu';
2952 g_GUI_AddWindow(Menu
);
2954 Menu
:= TGUIWindow
.Create('OptionsMenu');
2955 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2957 Name
:= 'mmOptionsMenu';
2958 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2959 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2960 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2961 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2962 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2963 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2965 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2966 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2968 Menu
.OnClose
:= ProcApplyOptions
;
2969 Menu
.DefControl
:= 'mmOptionsMenu';
2970 g_GUI_AddWindow(Menu
);
2972 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2973 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2977 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2979 Name
:= 'mOptionsVideoMenu';
2980 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2981 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2987 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2990 AddItem(_lc
[I_MENU_YES
]);
2991 AddItem(_lc
[I_MENU_NO
]);
2993 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2995 Name
:= 'swTextureFilter';
2996 AddItem(_lc
[I_MENU_YES
]);
2997 AddItem(_lc
[I_MENU_NO
]);
2999 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
3002 AddItem(_lc
[I_MENU_YES
]);
3003 AddItem(_lc
[I_MENU_NO
]);
3005 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
3007 Name
:= 'swLegacyNPOT';
3008 AddItem(_lc
[I_MENU_NO
]);
3009 AddItem(_lc
[I_MENU_YES
]);
3012 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
3015 Menu
.DefControl
:= 'mOptionsVideoMenu';
3016 g_GUI_AddWindow(Menu
);
3018 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
3019 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
3021 Name
:= 'mOptionsVideoResMenu';
3022 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
3024 Name
:= 'lbCurrentRes';
3028 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
3030 Name
:= 'lsResolution';
3033 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
3035 Name
:= 'swFullScreen';
3036 AddItem(_lc
[I_MENU_YES
]);
3037 AddItem(_lc
[I_MENU_NO
]);
3039 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3041 Name
:= 'swResFactor';
3043 for i
:= 2 to gRC_Width
div 640 do
3044 AddItem(IntToStr(i
) + 'x');
3047 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
3050 Menu
.DefControl
:= 'mOptionsVideoResMenu';
3051 g_GUI_AddWindow(Menu
);
3053 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
3054 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
3056 Name
:= 'mOptionsSoundMenu';
3057 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
3059 Name
:= 'scMusicLevel';
3061 OnChange
:= ProcChangeSoundSettings
;
3063 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
3065 Name
:= 'scSoundLevel';
3067 OnChange
:= ProcChangeSoundSettings
;
3069 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
3071 Name
:= 'scMaxSimSounds';
3074 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
3076 Name
:= 'swAnnouncer';
3077 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
3078 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
3079 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
3080 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
3082 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
3083 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
3085 Name
:= 'swSoundEffects';
3086 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3087 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3089 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
3090 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
3092 Name
:= 'swChatSpeech';
3093 AddItem(_lc
[I_MENU_YES
]);
3094 AddItem(_lc
[I_MENU_NO
]);
3096 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
3098 Name
:= 'swInactiveSounds';
3099 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
3100 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
3104 Menu
.DefControl
:= 'mOptionsSoundMenu';
3105 g_GUI_AddWindow(Menu
);
3107 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
3108 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
3110 Name
:= 'mOptionsGameMenu';
3111 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
3113 Name
:= 'scParticlesCount';
3116 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
3118 Name
:= 'swBloodCount';
3119 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3120 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3121 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3122 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3123 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3125 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
3127 Name
:= 'scShellsMax';
3130 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
3132 Name
:= 'scGibsMax';
3135 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
3137 Name
:= 'scCorpsesMax';
3140 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
3142 Name
:= 'swGibsCount';
3143 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3144 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3145 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3146 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3147 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3149 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
3151 Name
:= 'swCorpseType';
3152 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
3153 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
3155 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
3157 Name
:= 'swGibsType';
3158 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
3159 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
3161 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
3163 Name
:= 'swBloodType';
3164 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
3165 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
3167 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
3169 Name
:= 'swScreenFlash';
3170 AddItem(_lc
[I_MENU_NO
]);
3171 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3172 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3174 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
3176 Name
:= 'swBackground';
3177 AddItem(_lc
[I_MENU_YES
]);
3178 AddItem(_lc
[I_MENU_NO
]);
3180 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
3182 Name
:= 'swMessages';
3183 AddItem(_lc
[I_MENU_YES
]);
3184 AddItem(_lc
[I_MENU_NO
]);
3186 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
3188 Name
:= 'swRevertPlayers';
3189 AddItem(_lc
[I_MENU_YES
]);
3190 AddItem(_lc
[I_MENU_NO
]);
3192 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
3194 Name
:= 'swChatBubble';
3195 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
3196 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
3197 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
3198 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
3199 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3201 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3203 Name
:= 'swPlayerIndicator';
3204 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3205 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3206 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3208 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3210 Name
:= 'swPlayerIndicatorStyle';
3211 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3212 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3214 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3216 Name
:= 'scScaleFactor';
3218 OnChange
:= ProcChangeGameSettings
;
3222 Menu
.DefControl
:= 'mOptionsGameMenu';
3223 g_GUI_AddWindow(Menu
);
3225 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3226 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3228 Name
:= 'mOptionsControlsMenu';
3229 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3230 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3231 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3232 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3233 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3235 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3236 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3237 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3238 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3239 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3240 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3241 if e_HasJoysticks
then
3244 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3246 if g_touch_enabled
then
3249 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3252 Menu
.DefControl
:= 'mOptionsControlsMenu';
3253 g_GUI_AddWindow(Menu
);
3255 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3256 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3258 Name
:= 'mOptionsControlsP1Menu';
3259 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3260 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3261 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3262 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3263 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3264 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3265 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3266 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3267 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3268 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3269 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3271 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3272 g_GUI_AddWindow(Menu
);
3274 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3275 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3277 Name
:= 'mOptionsControlsP1MenuWeapons';
3278 for i
:= WP_FIRST
to WP_LAST
do
3279 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3280 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3282 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3283 g_GUI_AddWindow(Menu
);
3285 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3286 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3288 Name
:= 'mOptionsControlsP2Menu';
3289 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3290 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3291 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3292 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3293 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3294 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3295 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3296 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3297 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3298 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3299 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3301 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3302 g_GUI_AddWindow(Menu
);
3304 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3305 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3307 Name
:= 'mOptionsControlsP2MenuWeapons';
3308 for i
:= WP_FIRST
to WP_LAST
do
3309 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3310 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3312 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3313 g_GUI_AddWindow(Menu
);
3315 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3316 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3318 Name
:= 'mOptionsControlsJoystickMenu';
3319 for i
:= 0 to e_MaxJoys
- 1 do
3320 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3322 Name
:= 'scDeadzone' + IntToStr(i
);
3326 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3327 g_GUI_AddWindow(Menu
);
3329 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3330 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3332 Name
:= 'mOptionsControlsTouchMenu';
3333 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3335 Name
:= 'swTouchAlt';
3336 AddItem(_lc
[I_MENU_NO
]);
3337 AddItem(_lc
[I_MENU_YES
]);
3338 OnChange
:= ProcChangeTouchSettings
;
3340 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3342 Name
:= 'scTouchSize';
3344 OnChange
:= ProcChangeTouchSettings
;
3346 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3348 Name
:= 'swTouchFire';
3349 AddItem(_lc
[I_MENU_NO
]);
3350 AddItem(_lc
[I_MENU_YES
]);
3352 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3354 Name
:= 'scTouchOffset';
3356 OnChange
:= ProcChangeTouchSettings
;
3359 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3360 g_GUI_AddWindow(Menu
);
3362 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3363 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3365 Name
:= 'mOptionsPlayersMenu';
3366 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3367 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3369 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3370 g_GUI_AddWindow(Menu
);
3372 CreatePlayerOptionsMenu('P1');
3373 CreatePlayerOptionsMenu('P2');
3375 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3376 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3378 Name
:= 'mOptionsPlayersMIMenu';
3379 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3384 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3389 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3391 Name
:= 'meComment';
3394 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3395 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3398 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3402 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3403 g_GUI_AddWindow(Menu
);
3405 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3406 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3408 Name
:= 'mOptionsPlayersP1WeaponMenu';
3409 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3411 Name
:= 'swWeaponAutoswitch';
3412 AddItem(_lc
[I_MENU_NO
]);
3413 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3414 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3416 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3418 Name
:= 'swWeaponAllowEmpty';
3419 AddItem(_lc
[I_MENU_YES
]);
3420 AddItem(_lc
[I_MENU_NO
]);
3422 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3424 Name
:= 'swWeaponAllowFist';
3425 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3426 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3428 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3431 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3432 g_GUI_AddWindow(Menu
);
3434 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3435 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3437 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3438 for i
:= WP_FIRST
to WP_LAST
do
3440 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3442 Name
:= IntToStr(i
);
3443 for a
:= WP_FIRST
to WP_LAST
+1 do
3445 AddItem(IntToStr(a
));
3450 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3452 Name
:= IntToStr(WP_LAST
+1);
3453 for a
:= WP_FIRST
to WP_LAST
+1 do
3455 AddItem(IntToStr(a
));
3457 ItemIndex
:= WP_LAST
+ 1;
3460 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3461 g_GUI_AddWindow(Menu
);
3464 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3465 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3467 Name
:= 'mOptionsPlayersP2WeaponMenu';
3468 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3470 Name
:= 'swWeaponAutoswitch';
3471 AddItem(_lc
[I_MENU_NO
]);
3472 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3473 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3475 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3477 Name
:= 'swWeaponAllowEmpty';
3478 AddItem(_lc
[I_MENU_YES
]);
3479 AddItem(_lc
[I_MENU_NO
]);
3481 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3483 Name
:= 'swWeaponAllowFist';
3484 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3485 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3487 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3490 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3491 g_GUI_AddWindow(Menu
);
3493 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3494 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3496 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3497 for i
:= WP_FIRST
to WP_LAST
do
3499 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3501 Name
:= IntToStr(i
);
3502 for a
:= WP_FIRST
to WP_LAST
+1 do
3504 AddItem(IntToStr(a
));
3509 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3511 Name
:= IntToStr(WP_LAST
+1);
3512 for a
:= WP_FIRST
to WP_LAST
+1 do
3514 AddItem(IntToStr(a
));
3516 ItemIndex
:= WP_LAST
+ 1;
3519 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3520 g_GUI_AddWindow(Menu
);
3522 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3523 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3525 Name
:= 'mOptionsLanguageMenu';
3526 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3527 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3530 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3531 g_GUI_AddWindow(Menu
);
3533 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3534 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3535 g_GUI_AddWindow(Menu
);
3537 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3538 Menu
.BackTexture
:= 'INTER';
3539 Menu
.OnClose
:= ProcAuthorsClose
;
3543 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3545 Color
:= _RGB(255, 0, 0);
3546 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3548 _y
:= _y
+GetHeight();
3550 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3552 Color
:= _RGB(255, 0, 0);
3553 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3555 _y
:= _y
+GetHeight()+32;
3557 // ×òî äåëàë: Êòî äåëàë
3558 cx
:= gScreenWidth
div 2 - 320 + 64;
3559 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3561 Color
:= _RGB(255, 0, 0);
3566 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3568 Color
:= _RGB(255, 255, 255);
3573 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3575 Color
:= _RGB(255, 0, 0);
3580 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3582 Color
:= _RGB(255, 255, 255);
3587 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3589 Color
:= _RGB(255, 255, 255);
3594 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3596 Color
:= _RGB(255, 0, 0);
3601 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3603 Color
:= _RGB(255, 255, 255);
3608 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3610 Color
:= _RGB(255, 0, 0);
3615 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3617 Color
:= _RGB(255, 255, 255);
3620 _y
:= gScreenHeight
- 128;
3623 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3625 Color
:= _RGB(255, 0, 0);
3630 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3632 Color
:= _RGB(255, 255, 255);
3635 _y
:= _y
+GetHeight();
3637 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3639 Color
:= _RGB(255, 255, 255);
3642 _y
:= _y
+GetHeight();
3644 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3646 Color
:= _RGB(255, 255, 255);
3649 _y
:= gScreenHeight
- 32;
3651 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3653 Color
:= _RGB(255, 0, 0);
3654 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3657 g_GUI_AddWindow(Menu
);
3659 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3660 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3661 g_GUI_AddWindow(Menu
);
3663 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3664 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3666 Name
:= 'mmGameSingleMenu';
3667 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3668 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3669 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3670 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3671 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3672 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3674 Menu
.DefControl
:= 'mmGameSingleMenu';
3675 Menu
.MainWindow
:= True;
3676 Menu
.OnClose
:= ProcGMClose
;
3677 Menu
.OnShow
:= ProcGMShow
;
3678 g_GUI_AddWindow(Menu
);
3680 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3681 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3682 g_GUI_AddWindow(Menu
);
3684 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3685 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3686 g_GUI_AddWindow(Menu
);
3688 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3689 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3691 Name
:= 'mmGameCustomMenu';
3692 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3693 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3694 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3695 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3696 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3697 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3698 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3700 Menu
.DefControl
:= 'mmGameCustomMenu';
3701 Menu
.MainWindow
:= True;
3702 Menu
.OnClose
:= ProcGMClose
;
3703 Menu
.OnShow
:= ProcGMShow
;
3704 g_GUI_AddWindow(Menu
);
3706 Menu
:= TGUIWindow
.Create('GameServerMenu');
3707 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3709 Name
:= 'mmGameServerMenu';
3710 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3711 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3712 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3713 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3714 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3716 Menu
.DefControl
:= 'mmGameServerMenu';
3717 Menu
.MainWindow
:= True;
3718 Menu
.OnClose
:= ProcGMClose
;
3719 Menu
.OnShow
:= ProcGMShow
;
3720 g_GUI_AddWindow(Menu
);
3722 Menu
:= TGUIWindow
.Create('GameClientMenu');
3723 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3725 Name
:= 'mmGameClientMenu';
3726 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3727 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3728 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3730 Menu
.DefControl
:= 'mmGameClientMenu';
3731 Menu
.MainWindow
:= True;
3732 Menu
.OnClose
:= ProcGMClose
;
3733 Menu
.OnShow
:= ProcGMShow
;
3734 g_GUI_AddWindow(Menu
);
3736 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3737 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3739 Name
:= 'mClientPasswordMenu';
3740 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3748 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3751 Menu
.DefControl
:= 'mClientPasswordMenu';
3752 g_GUI_AddWindow(Menu
);
3754 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3755 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3757 Name
:= 'mGameSetGameMenu';
3758 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3760 Name
:= 'swTeamDamage';
3761 AddItem(_lc
[I_MENU_YES
]);
3762 AddItem(_lc
[I_MENU_NO
]);
3765 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3767 Name
:= 'swTeamHit';
3768 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3769 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3770 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3771 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3774 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3776 Name
:= 'swDeathmatchKeys';
3777 AddItem(_lc
[I_MENU_YES
]);
3778 AddItem(_lc
[I_MENU_NO
]);
3781 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3783 Name
:= 'edTimeLimit';
3788 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3790 Name
:= 'edScoreLimit';
3795 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3797 Name
:= 'edMaxLives';
3802 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3805 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3806 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3807 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3810 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3812 Name
:= 'swFlagDrop';
3813 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3814 AddItem(_lc
[I_MENU_YES
]);
3815 AddItem(_lc
[I_MENU_NO
]);
3821 Menu
.DefControl
:= 'mGameSetGameMenu';
3822 Menu
.OnClose
:= ProcApplyGameSet
;
3823 g_GUI_AddWindow(Menu
);
3825 Menu
:= TGUIWindow
.Create('TeamMenu');
3826 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3828 Name
:= 'mmTeamMenu';
3829 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3830 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3831 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3832 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3833 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3835 Menu
.DefControl
:= 'mmTeamMenu';
3836 Menu
.OnShow
:= ProcChangePlayers
;
3837 g_GUI_AddWindow(Menu
);
3840 procedure g_Menu_Show_SaveMenu();
3842 if g_Game_IsTestMap
then
3844 if gGameSettings
.GameType
= GT_SINGLE
then
3845 g_GUI_ShowWindow('GameSingleMenu')
3848 if g_Game_IsClient
then
3851 if g_Game_IsNet
then
3854 g_GUI_ShowWindow('GameCustomMenu');
3856 g_GUI_ShowWindow('SaveMenu');
3857 g_Sound_PlayEx('MENU_OPEN');
3860 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3862 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3863 if gGameSettings
.GameType
= GT_SINGLE
then
3865 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3869 if g_Game_IsClient
then exit
;
3870 if g_Game_IsNet
then exit
;
3871 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3873 g_GUI_ShowWindow('LoadMenu');
3874 g_Sound_PlayEx('MENU_OPEN');
3877 procedure g_Menu_Show_GameSetGame();
3879 if gGameSettings
.GameType
= GT_SINGLE
then
3880 g_GUI_ShowWindow('GameSingleMenu')
3883 if g_Game_IsClient
then
3886 if g_Game_IsNet
then
3887 g_GUI_ShowWindow('GameServerMenu')
3889 g_GUI_ShowWindow('GameCustomMenu');
3892 g_GUI_ShowWindow('GameSetGameMenu');
3893 g_Sound_PlayEx('MENU_OPEN');
3896 procedure g_Menu_Show_OptionsVideo();
3898 if gGameSettings
.GameType
= GT_SINGLE
then
3899 g_GUI_ShowWindow('GameSingleMenu')
3902 if g_Game_IsClient
then
3903 g_GUI_ShowWindow('GameClientMenu')
3905 if g_Game_IsNet
then
3906 g_GUI_ShowWindow('GameServerMenu')
3908 g_GUI_ShowWindow('GameCustomMenu');
3911 g_GUI_ShowWindow('OptionsMenu');
3912 g_GUI_ShowWindow('OptionsVideoMenu');
3913 g_Sound_PlayEx('MENU_OPEN');
3916 procedure g_Menu_Show_OptionsSound();
3918 if gGameSettings
.GameType
= GT_SINGLE
then
3919 g_GUI_ShowWindow('GameSingleMenu')
3922 if g_Game_IsClient
then
3923 g_GUI_ShowWindow('GameClientMenu')
3925 if g_Game_IsNet
then
3926 g_GUI_ShowWindow('GameServerMenu')
3928 g_GUI_ShowWindow('GameCustomMenu');
3931 g_GUI_ShowWindow('OptionsMenu');
3932 g_GUI_ShowWindow('OptionsSoundMenu');
3933 g_Sound_PlayEx('MENU_OPEN');
3936 procedure g_Menu_Show_EndGameMenu();
3938 g_GUI_ShowWindow('EndGameMenu');
3939 g_Sound_PlayEx('MENU_OPEN');
3942 procedure g_Menu_Show_QuitGameMenu();
3944 g_GUI_ShowWindow('ExitMenu');
3945 g_Sound_PlayEx('MENU_OPEN');
3948 procedure g_Menu_Init();
3955 procedure g_Menu_Free();
3959 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3964 procedure g_Menu_Reset();
3968 g_GUI_SaveMenuPos();
3969 ex
:= g_GUI_Destroy();
3973 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3978 g_Game_SetDebugMode();
3980 g_GUI_LoadMenuPos();