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 g_gui
, g_textures
, r_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_base
, g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
, e_res
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
52 utils
, wadreader
, g_system
, r_game
;
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 if (ovs
<> gVSync
) then
122 sys_EnableVSync(gVSync
);
124 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
125 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
126 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
128 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
130 g_Sound_SetupAllVolumes(
131 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
132 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
135 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
136 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
137 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
138 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
139 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
141 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
143 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
145 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
146 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
148 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
153 else gGibsCount
:= 48;
156 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
157 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
158 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
159 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
160 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
161 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
162 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
163 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
164 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
165 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
166 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
167 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
169 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
170 g_dbg_scale
:= TempScale
+ 1;
174 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
178 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
179 g_Console_BindKey(g_Console_FindBind(1, '+scores', '-scores'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
181 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+scores', '-scores');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
188 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
199 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
201 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
222 g_Console_BindKey(g_Console_FindBind(2, 'p1_dropflag', ''), '');
223 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
224 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
238 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
241 for i
:= WP_FIRST
to WP_LAST
do
243 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
245 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
250 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
261 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
262 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
263 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
284 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
285 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
286 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
300 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
303 for i
:= WP_FIRST
to WP_LAST
do
305 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
307 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
312 if e_HasJoysticks
then
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
317 for i
:= 0 to e_MaxJoys
- 1 do
318 if e_JoystickAvailable
[i
] then
319 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
323 if g_touch_enabled
then
325 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
326 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
327 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
328 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
329 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
333 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
334 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
335 TEAM_RED
, TEAM_BLUE
);
336 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
338 gPlayer1Settings
.Model
:= Model
.Name
;
339 gPlayer1Settings
.Color
:= Model
.Color
;
342 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
343 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
344 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
345 TEAM_RED
, TEAM_BLUE
);
346 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
348 gPlayer2Settings
.Model
:= Model
.Name
;
349 gPlayer2Settings
.Color
:= Model
.Color
;
352 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
353 gPlayer1Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
354 gPlayer1Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
355 gPlayer1Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
356 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
359 for i
:= WP_FIRST
to WP_LAST
+1 do
361 gPlayer1Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
365 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
366 gPlayer2Settings
.WeaponSwitch
:= TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
;
367 gPlayer2Settings
.SwitchToEmpty
:= TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
;
368 gPlayer2Settings
.SkipFist
:= TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
;
369 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
372 for i
:= WP_FIRST
to WP_LAST
+1 do
374 gPlayer2Settings
.WeaponPreferences
[i
] := TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
;
378 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
379 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
381 if g_Game_IsServer
then
383 if gPlayer1
<> nil then
385 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
386 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
387 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
388 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
390 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
392 gPlayer1
.WeapSwitchMode
:= gPlayer1Settings
.WeaponSwitch
;
393 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
394 gPlayer1
.SwitchToEmpty
:= gPlayer1Settings
.SwitchToEmpty
;
395 gPlayer1
.SkipFist
:= gPlayer1Settings
.SkipFist
;
396 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
399 if gPlayer2
<> nil then
401 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
402 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
403 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
404 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
406 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
408 gPlayer2
.WeapSwitchMode
:= gPlayer2Settings
.WeaponSwitch
;
409 gPlayer2
.setWeaponPrefs(gPlayer2Settings
.WeaponPreferences
);
410 gPlayer2
.SwitchToEmpty
:= gPlayer2Settings
.SwitchToEmpty
;
411 gPlayer2
.SkipFist
:= gPlayer2Settings
.SkipFist
;
412 //if g_Game_IsNet then MH_SEND_PlayerSettings(gPlayer2.UID);
416 if g_Game_IsClient
then
418 MC_SEND_PlayerSettings
;
419 gPlayer1
.setWeaponPrefs(gPlayer1Settings
.WeaponPreferences
);
422 g_Console_WriteGameConfig
;
425 procedure ReadOptions();
430 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
432 with TGUISwitch(menu
.GetControl('swBPP')) do
438 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
439 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
441 with TGUISwitch(menu
.GetControl('swVSync')) do
442 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
444 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
445 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
447 with TGUISwitch(menu
.GetControl('swInterp')) do
448 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
450 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
452 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
453 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
454 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
456 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
457 if gMuteWhenInactive
then
462 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
464 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
465 if gSoundEffectsDF
then
470 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
471 if gUseChatSounds
then
476 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
493 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
504 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
507 for i
:= WP_FIRST
to WP_LAST
do
509 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
510 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
517 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
518 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
519 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
520 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
521 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
522 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
523 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
524 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
525 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
526 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
527 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
529 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
530 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
531 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
532 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
533 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
534 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
535 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
536 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
537 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
538 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
539 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
542 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
545 for i
:= WP_FIRST
to WP_LAST
do
547 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
548 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
552 if e_HasJoysticks
then
554 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
557 for i
:= 0 to e_MaxJoys
- 1 do
558 if e_JoystickAvailable
[i
] then
559 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
563 if g_touch_enabled
then
565 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
566 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
567 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
568 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
569 with TGUISwitch(menu
.GetControl('swTouchFire')) do
570 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
571 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
574 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
577 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
578 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+scores', '-scores');
579 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
580 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
583 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
585 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
586 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
587 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
588 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
589 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
591 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
594 with TGUISwitch(menu
.GetControl('swBloodType')) do
595 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
597 with TGUISwitch(menu
.GetControl('swCorpseType')) do
598 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
600 with TGUISwitch(menu
.GetControl('swGibsType')) do
601 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
603 with TGUISwitch(menu
.GetControl('swGibsCount')) do
612 with TGUISwitch(menu
.GetControl('swBackGround')) do
613 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
615 with TGUISwitch(menu
.GetControl('swMessages')) do
616 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
618 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
619 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
621 with TGUISwitch(menu
.GetControl('swChatBubble')) do
622 ItemIndex
:= gChatBubble
;
624 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
625 ItemIndex
:= gPlayerIndicator
;
627 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
628 ItemIndex
:= gPlayerIndicatorStyle
;
630 TempScale
:= Round(g_dbg_scale
- 1);
631 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
633 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
635 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
636 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
638 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
639 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
641 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
642 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
643 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
645 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1WeaponMenu').GetControl('mOptionsPlayersP1WeaponMenu'));
646 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer1Settings
.WeaponSwitch
;
647 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer1Settings
.SwitchToEmpty
;
648 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer1Settings
.SkipFist
;
649 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP1WeaponMenu').GetControl('mOptionsPreferencesP1WeaponMenu'));
650 for i
:= WP_FIRST
to WP_LAST
+1 do
652 if (gPlayer1Settings
.WeaponPreferences
[i
] > 0) and (gPlayer1Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer1Settings
.WeaponPreferences
[i
]
653 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
656 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2WeaponMenu').GetControl('mOptionsPlayersP2WeaponMenu'));
657 TGUISwitch(menu
.GetControl('swWeaponAutoswitch')).ItemIndex
:= gPlayer2Settings
.WeaponSwitch
;
658 TGUISwitch(menu
.GetControl('swWeaponAllowEmpty')).ItemIndex
:= gPlayer2Settings
.SwitchToEmpty
;
659 TGUISwitch(menu
.GetControl('swWeaponAllowFist')).ItemIndex
:= gPlayer2Settings
.SkipFist
;
660 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPreferencesP2WeaponMenu').GetControl('mOptionsPreferencesP2WeaponMenu'));
661 for i
:= WP_FIRST
to WP_LAST
+1 do
663 if (gPlayer2Settings
.WeaponPreferences
[i
] > 0) and (gPlayer2Settings
.WeaponPreferences
[i
] <= WP_LAST
+1) then TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= gPlayer2Settings
.WeaponPreferences
[i
]
664 else TGUISwitch(menu
.GetControl(IntToStr(i
))).ItemIndex
:= 0;
667 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
669 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
670 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
672 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
673 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
675 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
676 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
677 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
679 ProcSelectModel(nil);
682 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
684 // don't turn off monsters in DM
686 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
687 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
688 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
690 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
693 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
694 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
695 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
696 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
700 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
702 // don't turn off monsters in DM
704 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
705 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
706 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
708 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
711 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
712 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
713 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
714 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
718 function LatchGameOptions(const MenuName
: string): Byte;
724 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
726 Map
:= TGUILabel(GetControl('lbMap')).Text;
729 if not isWadPath(Map
) then
732 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
733 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
734 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
735 gsScoreLimit
:= StrToIntDef(TGUIEdit(GetControl('edScoreLimit')).Text, 0);
736 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
737 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).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('swDeathmatchKeys')).ItemIndex
= 0 then
745 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
746 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
747 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
748 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
749 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
750 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
751 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
753 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
754 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
755 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
756 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
759 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
760 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
761 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
762 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
765 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
766 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
767 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
768 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
771 // TODO: get this crap out of here
772 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
773 gGameSettings
.WarmupTime
:= gsWarmupTime
;
774 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
778 procedure ProcStartCustomGame();
782 GameMode
:= LatchGameOptions('mCustomGameMenu');
783 if GameMode
= GM_NONE
then Exit
;
785 g_Console_WriteGameConfig
;
786 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
,
787 gsMaxLives
, gsGameFlags
, gsPlayers
);
791 procedure ProcStartNetGame();
795 GameMode
:= LatchGameOptions('mNetServerMenu');
796 if GameMode
= GM_NONE
then Exit
;
798 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
800 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
801 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
802 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
803 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
804 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
805 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
808 g_Console_WriteGameConfig
;
809 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsScoreLimit
, gsMaxLives
,
810 gsGameFlags
, gsPlayers
, 0, NetPort
);
813 procedure ProcConnectNetGame();
817 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
819 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
820 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
821 PW
:= TGUIEdit(GetControl('edPW')).Text;
824 g_Console_WriteGameConfig
;
825 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
828 procedure ProcEnterPassword();
832 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
834 NetClientIP
:= PromptIP
;
835 NetClientPort
:= PromptPort
;
836 PW
:= TGUIEdit(GetControl('edPW')).Text;
839 g_Console_WriteGameConfig
;
840 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
843 procedure ProcServerlist();
845 if not NetInitDone
then
847 if (not g_Net_Init()) then
849 g_Console_Add('NET: ERROR: Failed to init ENet!');
856 g_Net_Slist_Set(NetMasterList
);
858 gState
:= STATE_SLIST
;
859 g_ActiveWindow
:= nil;
861 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
866 slReturnPressed
:= True;
867 if g_Net_Slist_Fetch(slCurrent
) then
869 if slCurrent
= nil then
870 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
873 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
874 g_Serverlist_GenerateTable(slCurrent
, slTable
);
877 procedure ProcStartCampaign();
883 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
885 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
886 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
888 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
894 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
897 procedure ProcSelectMap(Sender
: TGUIControl
);
901 wad
, map
, res
: String;
903 win
:= g_GUI_GetWindow('SelectMapMenu');
904 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
906 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
907 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
909 if (wad
= '') or (map
= '') then
910 begin // Ýòî íå êàðòà
911 TGUILabel(GetControl('lbMapName')).Text := '';
912 TGUILabel(GetControl('lbMapAuthor')).Text := '';
913 TGUILabel(GetControl('lbMapSize')).Text := '';
914 TGUIMemo(GetControl('meMapDescription')).SetText('');
915 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
916 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
922 a
:= g_Map_GetMapInfo(res
);
924 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
925 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
926 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
927 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
928 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
929 TGUILabel(win
.GetControl('lbMapScale')).Text :=
930 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
935 procedure ProcSelectWAD(Sender
: TGUIControl
);
940 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
942 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
944 with TGUIListBox(GetControl('lsMapRes')) do
950 list
:= g_Map_GetMapsList(wad
);
964 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
970 win
:= g_GUI_GetWindow('CampaignMenu');
971 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
973 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
977 TGUILabel(GetControl('lbWADName')).Text := '';
978 TGUILabel(GetControl('lbWADAuthor')).Text := '';
979 TGUIMemo(GetControl('meWADDescription')).SetText('');
982 a
:= g_Game_GetMegaWADInfo(wad
);
984 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
985 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
986 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
988 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
992 fn
:= g_ExtractWadName(a
.pic
);
994 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
996 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
1001 procedure ProcChangeColor(Sender
: TGUIControl
);
1005 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1006 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
1007 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
1008 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
1009 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
1010 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1012 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1013 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1014 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1015 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1016 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1017 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1020 procedure ProcSelectModel(Sender
: TGUIControl
);
1025 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1026 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1027 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1029 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1030 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1031 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1033 ProcChangeColor(nil);
1036 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1048 wad
:= TWADFile
.Create
;
1049 if wad
.ReadFile(GameWAD
) then
1050 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1055 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1057 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1058 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1059 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1060 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1062 if g_Texture_Get('FONT_STD', ID
) then
1063 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1068 if cfglen
<> 0 then FreeMem(cfgdata
);
1071 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1077 cfgdata
, fntdata
: Pointer;
1078 cfglen
, fntlen
: Integer;
1086 wad
:= TWADFile
.Create
;
1087 if wad
.ReadFile(GameWAD
) then
1089 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1090 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1096 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1097 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1098 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1100 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1101 FontID
:= e_CharFont_Create(spc
);
1103 for a
:= 0 to 255 do
1105 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1106 if chrwidth
= 0 then Continue
;
1108 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1110 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1116 if cfglen
<> 0 then FreeMem(cfgdata
);
1117 if fntlen
<> 0 then FreeMem(fntdata
);
1120 procedure MenuLoadData();
1122 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1124 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1125 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1126 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1127 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1128 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1129 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1130 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1131 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1132 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1133 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1134 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1135 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1136 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1137 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1138 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1139 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1140 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1141 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1142 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1143 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1144 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1145 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1146 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1147 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1148 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1150 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1151 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1152 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1153 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1154 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1155 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1156 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1159 procedure MenuFreeData();
1161 e_CharFont_Remove(gMenuFont
);
1162 e_CharFont_Remove(gMenuSmallFont
);
1164 g_Texture_Delete('MAINMENU_LOGO');
1165 g_Texture_Delete('MAINMENU_MARKER1');
1166 g_Texture_Delete('MAINMENU_MARKER2');
1167 g_Texture_Delete('SCROLL_LEFT');
1168 g_Texture_Delete('SCROLL_RIGHT');
1169 g_Texture_Delete('SCROLL_MIDDLE');
1170 g_Texture_Delete('SCROLL_MARKER');
1171 g_Texture_Delete('EDIT_LEFT');
1172 g_Texture_Delete('EDIT_RIGHT');
1173 g_Texture_Delete('EDIT_MIDDLE');
1174 g_Texture_Delete('BOX1');
1175 g_Texture_Delete('BOX2');
1176 g_Texture_Delete('BOX3');
1177 g_Texture_Delete('BOX4');
1178 g_Texture_Delete('BOX5');
1179 g_Texture_Delete('BOX6');
1180 g_Texture_Delete('BOX7');
1181 g_Texture_Delete('BOX8');
1182 g_Texture_Delete('BOX9');
1183 g_Texture_Delete('BSCROLL_UP_A');
1184 g_Texture_Delete('BSCROLL_UP_U');
1185 g_Texture_Delete('BSCROLL_DOWN_A');
1186 g_Texture_Delete('BSCROLL_DOWN_U');
1187 g_Texture_Delete('BSCROLL_MIDDLE');
1188 g_Texture_Delete('NOPIC');
1190 g_Sound_Delete('MENU_SELECT');
1191 g_Sound_Delete('MENU_OPEN');
1192 g_Sound_Delete('MENU_CLOSE');
1193 g_Sound_Delete('MENU_CHANGE');
1194 g_Sound_Delete('SCROLL_ADD');
1195 g_Sound_Delete('SCROLL_SUB');
1196 g_Sound_Delete('SOUND_PLAYER_FALL');
1199 procedure ProcAuthorsMenu();
1201 gMusic
.SetByName('MUSIC_INTERMUS');
1205 procedure ProcExitMenuKeyDown (yes
: Boolean);
1208 snd
: TPlayableSound
;
1213 g_Game_StopAllSounds(True);
1214 case (Random(18)) of
1215 0: s
:= 'SOUND_MONSTER_PAIN';
1216 1: s
:= 'SOUND_MONSTER_DIE_3';
1217 2: s
:= 'SOUND_MONSTER_SLOP';
1218 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1219 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1220 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1221 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1222 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1223 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1224 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1225 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1226 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1227 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1228 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1229 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1230 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1231 else s
:= 'SOUND_PLAYER_FALL';
1233 snd
:= TPlayableSound
.Create();
1234 res
:= snd
.SetByName(s
);
1235 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1239 while snd
.IsPlaying() do begin end;
1247 procedure ProcLoadMenu();
1254 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1255 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1256 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1260 procedure ProcSaveMenu();
1268 name
:= g_GetSaveName(a
, valid
);
1269 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1270 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1274 procedure ProcSaveGame(Sender
: TGUIControl
);
1278 if g_Game_IsNet
then Exit
;
1279 if g_Game_IsTestMap
then Exit
;
1280 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1281 g_Game_PauseAllSounds(True);
1282 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1284 g_ActiveWindow
:= nil;
1285 g_Game_Pause(False);
1288 procedure ProcLoadGame(Sender
: TGUIControl
);
1292 if g_Game_IsNet
then Exit
;
1293 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1294 if g_LoadGame(a
) then
1296 g_Game_PauseAllSounds(False)
1298 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1300 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1301 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1302 //g_ActiveWindow := nil;
1306 procedure ProcSinglePlayer (n
: Integer);
1307 var wad
, map
: AnsiString;
1310 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1311 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1312 if e_FindResource(AllMapDirs
, wad
) then
1314 wad
:= ExpandFileName(wad
);
1315 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1319 procedure ProcSingle1Player
;
1324 procedure ProcSingle2Players
;
1329 procedure ProcSelectMapMenu();
1332 wad_lb
: TGUIFileListBox
;
1333 map_lb
: TGUIListBox
;
1336 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1337 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1338 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1340 if wad_lb
.SelectedItem() <> '' then
1341 map
:= map_lb
.SelectedItem()
1345 wad_lb
.UpdateFileList();
1348 if wad_lb
.SelectedItem() <> '' then
1351 map_lb
.SelectItem(map
);
1353 if map_lb
.SelectedItem() <> '' then
1357 g_GUI_ShowWindow('SelectMapMenu');
1360 procedure ProcSelectCampaignMenu();
1363 wad_lb
: TGUIFileListBox
;
1365 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1366 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1368 wad_lb
.UpdateFileList();
1370 if wad_lb
.SelectedItem() <> '' then
1371 ProcSelectCampaignWAD(nil);
1374 procedure ProcSetMap();
1376 wad
, map
, res
: String;
1378 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1380 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1381 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1384 if (wad
= '') or (map
= '') then
1387 wad
:= e_FindWadRel(MapDirs
, WAD
);
1389 res
:= wad
+':\'+map
;
1391 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1392 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1395 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1399 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1401 g_Sound_SetupAllVolumes(
1402 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1403 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1407 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1412 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1414 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1415 g_dbg_scale
:= TempScale
+ 1;
1419 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1423 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1424 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1425 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1426 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1429 procedure ProcOptionsPlayersMIMenu();
1434 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1436 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1438 if a
= '' then Exit
;
1440 b
:= g_PlayerModel_GetInfo(a
);
1442 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1444 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1445 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1446 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1448 if b
.HaveWeapon
then
1449 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1451 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1454 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1457 procedure ProcOptionsPlayerP1WeaponMenu();
1461 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P1'+'Menu')).GetControl('ls'+'P1'+'Model')).SelectedItem
;
1462 if a
= '' then Exit
;
1463 g_GUI_ShowWindow('OptionsPlayersP1WeaponMenu');
1466 procedure ProcOptionsPlayerP1WeaponPreferencesMenu();
1468 g_GUI_ShowWindow('OptionsPreferencesP1WeaponMenu');
1471 procedure ProcOptionsPlayerP2WeaponMenu();
1475 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+'P2'+'Menu')).GetControl('ls'+'P2'+'Model')).SelectedItem
;
1476 if a
= '' then Exit
;
1477 g_GUI_ShowWindow('OptionsPlayersP2WeaponMenu');
1480 procedure ProcOptionsPlayerP2WeaponPreferencesMenu();
1482 g_GUI_ShowWindow('OptionsPreferencesP2WeaponMenu');
1485 procedure ProcOptionsPlayersAnim();
1489 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1494 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1497 Model
.GetCurrentAnimation
.Loop
:= True;
1498 Model
.GetCurrentAnimationMask
.Loop
:= True;
1502 procedure ProcOptionsPlayersWeap();
1506 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1511 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1515 procedure ProcOptionsPlayersRot();
1519 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1520 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1522 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1526 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1530 g_Options_SetDefault();
1536 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1538 if yes
then ReadOptions();
1542 procedure ProcAuthorsClose();
1544 gMusic
.SetByName('MUSIC_MENU');
1546 gState
:= STATE_MENU
;
1549 procedure ProcGMClose();
1551 g_Game_InGameMenu(False);
1554 procedure ProcGMShow();
1559 if (gGameSettings
.GameType
= GT_SINGLE
) and
1560 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1561 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1562 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1564 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1565 if g_Game_IsTestMap
then
1566 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1567 TGUIMainMenu(g_ActiveWindow
.GetControl(
1568 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1571 procedure ProcChangePlayers();
1573 TeamGame
, Spectator
, AddTwo
: Boolean;
1574 P1Team
{, P2Team}: Byte;
1575 bP2
: TGUITextButton
;
1577 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1578 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1579 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1580 P1Team
:= TEAM_NONE
;
1581 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1583 //P2Team := TEAM_NONE;
1584 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1586 TGUIMainMenu(g_ActiveWindow
.GetControl(
1587 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1588 TGUIMainMenu(g_ActiveWindow
.GetControl(
1589 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1590 TGUIMainMenu(g_ActiveWindow
.GetControl(
1591 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1593 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1594 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1595 bP2
.Enabled
:= AddTwo
and not Spectator
;
1597 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1599 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1600 if gPlayer2
= nil then
1601 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1603 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1605 TGUIMainMenu(g_ActiveWindow
.GetControl(
1606 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1609 procedure ProcJoinRed();
1611 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1613 if g_Game_IsServer
then
1615 if gPlayer1
= nil then
1616 g_Game_AddPlayer(TEAM_RED
)
1619 if gPlayer1
.Team
<> TEAM_RED
then
1621 gPlayer1
.SwitchTeam
;
1622 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1625 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1630 gPlayer1Settings
.Team
:= TEAM_RED
;
1631 MC_SEND_PlayerSettings
;
1632 if gPlayer1
= nil then
1633 g_Game_AddPlayer(TEAM_RED
);
1635 g_ActiveWindow
:= nil;
1636 g_Game_Pause(False);
1639 procedure ProcJoinBlue();
1641 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1643 if g_Game_IsServer
then
1645 if gPlayer1
= nil then
1646 g_Game_AddPlayer(TEAM_BLUE
)
1649 if gPlayer1
.Team
<> TEAM_BLUE
then
1651 gPlayer1
.SwitchTeam
;
1652 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1655 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1660 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1661 MC_SEND_PlayerSettings
;
1662 if gPlayer1
= nil then
1663 g_Game_AddPlayer(TEAM_BLUE
);
1665 g_ActiveWindow
:= nil;
1666 g_Game_Pause(False);
1669 procedure ProcJoinGame();
1671 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1673 if gPlayer1
= nil then
1675 g_ActiveWindow
:= nil;
1676 g_Game_Pause(False);
1679 procedure ProcSwitchP2();
1681 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1683 if gPlayer1
= nil then
1685 if gPlayer2
= nil then
1688 g_Game_RemovePlayer();
1689 g_ActiveWindow
:= nil;
1690 g_Game_Pause(False);
1693 procedure ProcSpectate();
1695 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1698 g_ActiveWindow
:= nil;
1699 g_Game_Pause(False);
1702 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1704 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1707 procedure ProcEndMenuKeyDown (yes
: Boolean);
1709 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1712 procedure ProcSetRussianLanguage
;
1714 if gLanguage
<> LANGUAGE_RUSSIAN
then
1716 gLanguage
:= LANGUAGE_RUSSIAN
;
1717 gLanguageChange
:= True;
1718 gAskLanguage
:= False;
1723 procedure ProcSetEnglishLanguage
;
1725 if gLanguage
<> LANGUAGE_ENGLISH
then
1727 gLanguage
:= LANGUAGE_ENGLISH
;
1728 gLanguageChange
:= True;
1729 gAskLanguage
:= False;
1734 procedure ReadGameSettings();
1738 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1740 with gGameSettings
do
1742 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1743 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1747 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1748 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1750 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1752 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1756 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1757 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1761 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1762 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1764 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1769 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1770 TGUIEdit(menu
.GetControl('edScoreLimit')).Text := IntToStr(ScoreLimit
);
1771 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1773 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1774 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1775 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1778 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1783 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1785 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1786 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1787 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1789 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1790 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1794 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1795 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1797 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1798 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1799 TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
:= True;
1800 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1801 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1802 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1803 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1804 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1808 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1809 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1810 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1811 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1812 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1817 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1818 with TGUIEdit(menu
.GetControl('edScoreLimit')) do
1823 TGUILabel(menu
.GetControlsText('edScoreLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1824 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1829 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1830 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1831 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1836 procedure ProcApplyGameSet();
1840 stat
: TPlayerStatArray
;
1842 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1844 if not g_Game_IsServer
then Exit
;
1846 with gGameSettings
do
1848 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1850 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1851 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1853 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1856 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1858 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1859 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1860 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1861 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1862 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1866 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1868 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1869 Options
:= Options
or GAME_OPTION_DMKEYS
1871 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1874 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1876 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1882 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1884 TimeLimit
:= Max(n
, b
);
1888 if TGUIEdit(menu
.GetControl('edScoreLimit')).Enabled
then
1890 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edScoreLimit')).Text, ScoreLimit
);
1897 if GameMode
= GM_DM
then
1899 stat
:= g_Player_GetStats();
1901 for a
:= 0 to High(stat
) do
1902 if stat
[a
].Frags
> b
then
1906 b
:= Max(gTeamStat
[TEAM_RED
].Score
, gTeamStat
[TEAM_BLUE
].Score
);
1908 ScoreLimit
:= Max(n
, b
);
1912 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1914 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, MaxLives
);
1915 if n
< 0 then n
:= 0;
1916 if n
> 255 then n
:= 255;
1922 stat
:= g_Player_GetStats();
1924 for a
:= 0 to High(stat
) do
1925 if stat
[a
].Lives
> b
then
1928 MaxLives
:= Max(n
, b
);
1932 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1934 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1937 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1938 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1942 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1943 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1947 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1948 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1953 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1955 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1956 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1957 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1958 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1962 // don't forget to latch this shit
1963 gsGameFlags
:= Options
;
1964 gsMaxLives
:= MaxLives
;
1965 gsScoreLimit
:= ScoreLimit
;
1966 gsTimeLimit
:= TimeLimit
;
1969 if g_Game_IsNet
then MH_SEND_GameSettings
;
1972 procedure ProcVideoOptionsRes();
1977 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1979 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1980 IntToStr(gWinSizeX
) +
1981 ' x ' + IntToStr(gWinSizeY
) +
1982 ', ' + IntToStr(gBPP
) + ' bpp';
1984 with TGUIListBox(menu
.GetControl('lsResolution')) do
1986 list
:= sys_GetDisplayModes(gBPP
);
1990 ItemIndex
:= Length(list
)
1998 with TGUISwitch(menu
.GetControl('swFullScreen')) do
2004 TempResScale
:= Round(r_pixel_scale
- 1);
2005 with TGUISwitch(menu
.GetControl('swResFactor')) do
2006 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
2009 procedure ProcApplyVideoOptions();
2012 Fullscreen
: Boolean;
2013 SWidth
, SHeight
: Integer;
2014 ScaleChanged
: Boolean;
2017 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
2019 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
2021 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
2024 SWidth
:= gWinSizeX
;
2025 SHeight
:= gWinSizeY
;
2026 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
2029 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
2031 ScaleChanged
:= False;
2032 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
2034 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
2035 r_pixel_scale
:= TempResScale
+ 1;
2036 ScaleChanged
:= True;
2039 if (SWidth
<> gWinSizeX
) or
2040 (SHeight
<> gWinSizeY
) or
2041 (Fullscreen
<> gFullscreen
) or
2044 gResolutionChange
:= True;
2045 gRC_Width
:= SWidth
;
2046 gRC_Height
:= SHeight
;
2047 gRC_FullScreen
:= Fullscreen
;
2048 gRC_Maximized
:= gWinMaximized
;
2051 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
2055 procedure ProcSetFirstRussianLanguage
;
2057 gLanguage
:= LANGUAGE_RUSSIAN
;
2058 gLanguageChange
:= True;
2059 gAskLanguage
:= False;
2062 procedure ProcSetFirstEnglishLanguage
;
2064 gLanguage
:= LANGUAGE_ENGLISH
;
2065 gLanguageChange
:= True;
2066 gAskLanguage
:= False;
2069 procedure ProcRecallAddress();
2071 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
2073 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
2074 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
2078 procedure CreateFirstLanguageMenu();
2082 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
2084 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2086 Name
:= 'mmFirstLanguageMenu';
2087 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2088 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2091 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2092 Menu
.MainWindow
:= True;
2093 g_GUI_AddWindow(Menu
);
2096 procedure g_Menu_AskLanguage();
2098 CreateFirstLanguageMenu();
2099 g_GUI_ShowWindow('FirstLanguageMenu');
2102 procedure CreatePlayerOptionsMenu(s
: String);
2107 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2109 a
:= _lc
[I_MENU_PLAYER_1
]
2111 a
:= _lc
[I_MENU_PLAYER_2
];
2112 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2114 Name
:= 'mOptionsPlayers'+s
+'Menu';
2115 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2117 Name
:= 'ed'+s
+'Name';
2121 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2123 Name
:= 'sw'+s
+'Team';
2124 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2125 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2127 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2129 Name
:= 'ls'+s
+'Model';
2131 Items
:= g_PlayerModel_GetNames();
2132 OnChange
:= ProcSelectModel
;
2134 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2136 Name
:= 'sc'+s
+'Red';
2138 OnChange
:= ProcChangeColor
;
2140 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2142 Name
:= 'sc'+s
+'Green';
2144 OnChange
:= ProcChangeColor
;
2146 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2148 Name
:= 'sc'+s
+'Blue';
2150 OnChange
:= ProcChangeColor
;
2153 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2154 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2155 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2156 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2157 if s
= 'P1' then AddButton(@ProcOptionsPlayerP1WeaponMenu
, _lc
[I_MENU_WEAPON
])
2158 else AddButton(@ProcOptionsPlayerP2WeaponMenu
, _lc
[I_MENU_WEAPON
]);
2159 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2161 Name
:= 'mv'+s
+'Model';
2162 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2163 Y
:= GetControl('ls'+s
+'Model').Y
;
2166 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2167 g_GUI_AddWindow(Menu
);
2170 procedure CreateAllMenus();
2174 a
, cx
, _y
, i
: Integer;
2177 Menu
:= TGUIWindow
.Create('MainMenu');
2178 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2180 Name
:= 'mmMainMenu';
2181 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2182 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2183 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2184 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2185 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2186 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2188 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2190 Color
:= _RGB(255, 255, 255);
2191 X
:= gScreenWidth
-GetWidth
-8;
2192 Y
:= gScreenHeight
-GetHeight
-8;
2194 Menu
.DefControl
:= 'mmMainMenu';
2195 Menu
.MainWindow
:= True;
2196 g_GUI_AddWindow(Menu
);
2198 Menu
:= TGUIWindow
.Create('NewGameMenu');
2199 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2201 Name
:= 'mmNewGameMenu';
2202 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2203 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2204 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2205 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2207 Menu
.DefControl
:= 'mmNewGameMenu';
2208 g_GUI_AddWindow(Menu
);
2210 Menu
:= TGUIWindow
.Create('NetGameMenu');
2211 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2213 Name
:= 'mmNetGameMenu';
2214 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2215 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2217 Menu
.DefControl
:= 'mmNetGameMenu';
2218 g_GUI_AddWindow(Menu
);
2220 Menu
:= TGUIWindow
.Create('NetServerMenu');
2221 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2223 Name
:= 'mNetServerMenu';
2224 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2226 Name
:= 'edSrvName';
2227 OnlyDigits
:= False;
2230 Text := NetServerName
;
2232 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2234 Name
:= 'edSrvPassword';
2235 OnlyDigits
:= False;
2238 Text := NetPassword
;
2240 with AddEdit(_lc
[I_NET_PORT
]) do
2246 Text := IntToStr(NetPort
);
2248 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2250 Name
:= 'edMaxPlayers';
2254 Text := IntToStr(NetMaxClients
);
2256 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2258 Name
:= 'swUseMaster';
2259 AddItem(_lc
[I_MENU_YES
]);
2260 AddItem(_lc
[I_MENU_NO
]);
2261 if NetUseMaster
then
2267 with AddLabel(_lc
[I_MENU_MAP
]) do
2272 OnClick
:= @ProcSelectMapMenu
;
2274 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2276 Name
:= 'swGameMode';
2277 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2278 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2279 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2280 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2281 case g_Game_TextToMode(gsGameMode
) of
2283 GM_DM
: ItemIndex
:= 0;
2284 GM_TDM
: ItemIndex
:= 1;
2285 GM_CTF
: ItemIndex
:= 2;
2287 GM_COOP
: ItemIndex
:= 3;
2289 OnChange
:= ProcSwitchMonstersCustom
;
2291 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2293 Name
:= 'edTimeLimit';
2297 if gsTimeLimit
> 0 then
2298 Text := IntToStr(gsTimeLimit
);
2300 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2302 Name
:= 'edScoreLimit';
2306 if gsScoreLimit
> 0 then
2307 Text := IntToStr(gsScoreLimit
);
2309 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2311 Name
:= 'edMaxLives';
2315 if gsMaxLives
> 0 then
2316 Text := IntToStr(gsMaxLives
);
2318 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2320 Name
:= 'edItemRespawnTime';
2324 if gsItemRespawnTime
> 0 then
2325 Text := IntToStr(gsItemRespawnTime
);
2327 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2329 Name
:= 'swPlayers';
2330 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2331 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2332 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2333 ItemIndex
:= gsPlayers
;
2335 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2337 Name
:= 'swTeamDamage';
2338 AddItem(_lc
[I_MENU_YES
]);
2339 AddItem(_lc
[I_MENU_NO
]);
2340 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2345 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2347 Name
:= 'swTeamHit';
2348 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2349 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2350 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2351 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2352 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2354 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2356 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2361 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2363 Name
:= 'swDeathmatchKeys';
2364 AddItem(_lc
[I_MENU_YES
]);
2365 AddItem(_lc
[I_MENU_NO
]);
2366 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2371 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2373 Name
:= 'swEnableExits';
2374 AddItem(_lc
[I_MENU_YES
]);
2375 AddItem(_lc
[I_MENU_NO
]);
2376 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2381 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2383 Name
:= 'swWeaponStay';
2384 AddItem(_lc
[I_MENU_YES
]);
2385 AddItem(_lc
[I_MENU_NO
]);
2386 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2391 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2393 Name
:= 'swMonsters';
2394 AddItem(_lc
[I_MENU_YES
]);
2395 AddItem(_lc
[I_MENU_NO
]);
2396 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2401 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2404 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2405 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2406 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2408 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2410 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2413 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2415 Name
:= 'swFlagDrop';
2416 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2417 AddItem(_lc
[I_MENU_YES
]);
2418 AddItem(_lc
[I_MENU_NO
]);
2419 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2421 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2427 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2431 Menu
.DefControl
:= 'mNetServerMenu';
2432 g_GUI_AddWindow(Menu
);
2434 Menu
:= TGUIWindow
.Create('NetClientMenu');
2435 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2437 Name
:= 'mNetClientMenu';
2439 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2442 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2448 Text := 'localhost';
2450 with AddEdit(_lc
[I_NET_PORT
]) do
2458 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2461 OnlyDigits
:= False;
2468 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2472 Menu
.DefControl
:= 'mNetClientMenu';
2473 g_GUI_AddWindow(Menu
);
2475 Menu
:= TGUIWindow
.Create('LoadMenu');
2476 Menu
.OnShow
:= ProcLoadMenu
;
2477 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2479 Name
:= 'mmLoadMenu';
2484 Name
:= 'edSlot'+IntToStr(a
);
2487 OnEnter
:= ProcLoadGame
;
2490 Menu
.DefControl
:= 'mmLoadMenu';
2491 g_GUI_AddWindow(Menu
);
2493 Menu
:= TGUIWindow
.Create('SaveMenu');
2494 Menu
.OnShow
:= ProcSaveMenu
;
2495 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2497 Name
:= 'mmSaveMenu';
2502 Name
:= 'edSlot'+IntToStr(a
);
2505 OnChange
:= ProcSaveGame
;
2508 Menu
.DefControl
:= 'mmSaveMenu';
2509 g_GUI_AddWindow(Menu
);
2511 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2512 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2514 Name
:= 'mCustomGameMenu';
2515 with AddLabel(_lc
[I_MENU_MAP
]) do
2520 OnClick
:= @ProcSelectMapMenu
;
2522 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2524 Name
:= 'swGameMode';
2525 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2526 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2527 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2528 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2529 case g_Game_TextToMode(gsGameMode
) of
2531 GM_DM
: ItemIndex
:= 0;
2532 GM_TDM
: ItemIndex
:= 1;
2533 GM_CTF
: ItemIndex
:= 2;
2535 GM_COOP
: ItemIndex
:= 3;
2537 OnChange
:= ProcSwitchMonstersCustom
;
2539 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2541 Name
:= 'edTimeLimit';
2545 if gsTimeLimit
> 0 then
2546 Text := IntToStr(gsTimeLimit
);
2548 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
2550 Name
:= 'edScoreLimit';
2554 if gsScoreLimit
> 0 then
2555 Text := IntToStr(gsScoreLimit
);
2557 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2559 Name
:= 'edMaxLives';
2563 if gsMaxLives
> 0 then
2564 Text := IntToStr(gsMaxLives
);
2566 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2568 Name
:= 'edItemRespawnTime';
2572 if gsItemRespawnTime
> 0 then
2573 Text := IntToStr(gsItemRespawnTime
);
2575 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2577 Name
:= 'swPlayers';
2578 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2579 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2580 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2581 ItemIndex
:= gsPlayers
;
2583 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2585 Name
:= 'swTeamDamage';
2586 AddItem(_lc
[I_MENU_YES
]);
2587 AddItem(_lc
[I_MENU_NO
]);
2588 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2593 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2595 Name
:= 'swTeamHit';
2596 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2597 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2598 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2599 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2600 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2602 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2604 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2609 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2611 Name
:= 'swDeathmatchKeys';
2612 AddItem(_lc
[I_MENU_YES
]);
2613 AddItem(_lc
[I_MENU_NO
]);
2614 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2619 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2621 Name
:= 'swEnableExits';
2622 AddItem(_lc
[I_MENU_YES
]);
2623 AddItem(_lc
[I_MENU_NO
]);
2624 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2629 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2631 Name
:= 'swWeaponStay';
2632 AddItem(_lc
[I_MENU_YES
]);
2633 AddItem(_lc
[I_MENU_NO
]);
2634 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2639 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2641 Name
:= 'swMonsters';
2642 AddItem(_lc
[I_MENU_YES
]);
2643 AddItem(_lc
[I_MENU_NO
]);
2644 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2649 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2652 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2653 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2654 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2656 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2658 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2661 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2663 Name
:= 'swFlagDrop';
2664 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2665 AddItem(_lc
[I_MENU_YES
]);
2666 AddItem(_lc
[I_MENU_NO
]);
2667 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2669 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2675 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2679 Menu
.DefControl
:= 'mCustomGameMenu';
2680 g_GUI_AddWindow(Menu
);
2682 Menu
:= TGUIWindow
.Create('CampaignMenu');
2683 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2685 Name
:= 'mCampaignMenu';
2694 with AddFileList('', 15, 4) do
2697 OnChange
:= ProcSelectCampaignWAD
;
2701 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2702 SetBase(MegawadDirs
);
2705 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2707 Name
:= 'lbWADName';
2711 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2713 Name
:= 'lbWADAuthor';
2717 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2718 with AddMemo('', 15, 3) do
2720 Name
:= 'meWADDescription';
2721 Color
:= MENU_ITEMSCTRL_COLOR
;
2723 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2725 Name
:= 'swPlayers';
2726 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2727 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2730 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2734 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2736 Name
:= 'mpWADImage';
2737 DefaultRes
:= 'NOPIC';
2738 X
:= GetControl('lsWAD').X
+4;
2739 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2742 Menu
.DefControl
:= 'mCampaignMenu';
2743 g_GUI_AddWindow(Menu
);
2745 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2746 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2748 Name
:= 'mSelectMapMenu';
2749 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2752 OnChange
:= ProcSelectWAD
;
2756 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2759 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2763 OnChange
:= ProcSelectMap
;
2766 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2768 Name
:= 'lbMapName';
2772 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2774 Name
:= 'lbMapAuthor';
2778 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2780 Name
:= 'lbMapSize';
2784 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 20, 4) do
2786 Name
:= 'meMapDescription';
2791 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2793 Name
:= 'mpMapPreview';
2794 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2795 Y
:= GetControl('lsMapWAD').Y
;
2797 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2799 Name
:= 'lbMapScale';
2802 Color
:= MENU_ITEMSCTRL_COLOR
;
2803 X
:= GetControl('lsMapWAD').X
+
2804 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2805 2 + MAPPREVIEW_WIDTH
*4;
2806 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2809 Menu
.OnClose
:= ProcSetMap
;
2810 Menu
.DefControl
:= 'mSelectMapMenu';
2811 g_GUI_AddWindow(Menu
);
2813 Menu
:= TGUIWindow
.Create('OptionsMenu');
2814 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2816 Name
:= 'mmOptionsMenu';
2817 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2818 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2819 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2820 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2821 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2822 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2824 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2825 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2827 Menu
.OnClose
:= ProcApplyOptions
;
2828 Menu
.DefControl
:= 'mmOptionsMenu';
2829 g_GUI_AddWindow(Menu
);
2831 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2832 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2833 g_GUI_AddWindow(Menu
);
2835 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2836 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2838 Name
:= 'mOptionsVideoMenu';
2839 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2840 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2846 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2849 AddItem(_lc
[I_MENU_YES
]);
2850 AddItem(_lc
[I_MENU_NO
]);
2852 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2854 Name
:= 'swTextureFilter';
2855 AddItem(_lc
[I_MENU_YES
]);
2856 AddItem(_lc
[I_MENU_NO
]);
2858 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2861 AddItem(_lc
[I_MENU_YES
]);
2862 AddItem(_lc
[I_MENU_NO
]);
2864 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2866 Name
:= 'swLegacyNPOT';
2867 AddItem(_lc
[I_MENU_NO
]);
2868 AddItem(_lc
[I_MENU_YES
]);
2871 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2874 Menu
.DefControl
:= 'mOptionsVideoMenu';
2875 g_GUI_AddWindow(Menu
);
2877 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2878 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2880 Name
:= 'mOptionsVideoResMenu';
2881 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2883 Name
:= 'lbCurrentRes';
2887 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2889 Name
:= 'lsResolution';
2892 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2894 Name
:= 'swFullScreen';
2895 AddItem(_lc
[I_MENU_YES
]);
2896 AddItem(_lc
[I_MENU_NO
]);
2898 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2900 Name
:= 'swResFactor';
2902 for i
:= 2 to gRC_Width
div 640 do
2903 AddItem(IntToStr(i
) + 'x');
2906 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2909 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2910 g_GUI_AddWindow(Menu
);
2912 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2913 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2915 Name
:= 'mOptionsSoundMenu';
2916 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2918 Name
:= 'scMusicLevel';
2920 OnChange
:= ProcChangeSoundSettings
;
2922 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2924 Name
:= 'scSoundLevel';
2926 OnChange
:= ProcChangeSoundSettings
;
2928 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2930 Name
:= 'scMaxSimSounds';
2933 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2935 Name
:= 'swAnnouncer';
2936 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2937 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2938 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2939 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2941 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2942 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2944 Name
:= 'swSoundEffects';
2945 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2946 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2948 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2949 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2951 Name
:= 'swChatSpeech';
2952 AddItem(_lc
[I_MENU_YES
]);
2953 AddItem(_lc
[I_MENU_NO
]);
2955 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2957 Name
:= 'swInactiveSounds';
2958 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2959 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2963 Menu
.DefControl
:= 'mOptionsSoundMenu';
2964 g_GUI_AddWindow(Menu
);
2966 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2967 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2969 Name
:= 'mOptionsGameMenu';
2970 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2972 Name
:= 'scParticlesCount';
2975 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2977 Name
:= 'swBloodCount';
2978 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2979 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2980 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2981 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2982 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2984 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2986 Name
:= 'scShellsMax';
2989 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2991 Name
:= 'scGibsMax';
2994 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2996 Name
:= 'scCorpsesMax';
2999 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
3001 Name
:= 'swGibsCount';
3002 AddItem(_lc
[I_MENU_COUNT_NONE
]);
3003 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
3004 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
3005 AddItem(_lc
[I_MENU_COUNT_BIG
]);
3006 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
3008 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
3010 Name
:= 'swCorpseType';
3011 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
3012 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
3014 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
3016 Name
:= 'swGibsType';
3017 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
3018 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
3020 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
3022 Name
:= 'swBloodType';
3023 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
3024 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
3026 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
3028 Name
:= 'swScreenFlash';
3029 AddItem(_lc
[I_MENU_NO
]);
3030 AddItem(_lc
[I_MENU_COMPAT_DF
]);
3031 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
3033 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
3035 Name
:= 'swBackground';
3036 AddItem(_lc
[I_MENU_YES
]);
3037 AddItem(_lc
[I_MENU_NO
]);
3039 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
3041 Name
:= 'swMessages';
3042 AddItem(_lc
[I_MENU_YES
]);
3043 AddItem(_lc
[I_MENU_NO
]);
3045 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
3047 Name
:= 'swRevertPlayers';
3048 AddItem(_lc
[I_MENU_YES
]);
3049 AddItem(_lc
[I_MENU_NO
]);
3051 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
3053 Name
:= 'swChatBubble';
3054 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
3055 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
3056 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
3057 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
3058 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
3060 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
3062 Name
:= 'swPlayerIndicator';
3063 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
3064 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
3065 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
3067 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
3069 Name
:= 'swPlayerIndicatorStyle';
3070 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
3071 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
3073 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
3075 Name
:= 'scScaleFactor';
3077 OnChange
:= ProcChangeGameSettings
;
3081 Menu
.DefControl
:= 'mOptionsGameMenu';
3082 g_GUI_AddWindow(Menu
);
3084 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
3085 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3087 Name
:= 'mOptionsControlsMenu';
3088 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3089 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3090 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3091 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3092 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3094 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3095 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3096 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3097 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3098 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3099 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3100 if e_HasJoysticks
then
3103 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3105 if g_touch_enabled
then
3108 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3111 Menu
.DefControl
:= 'mOptionsControlsMenu';
3112 g_GUI_AddWindow(Menu
);
3114 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3117 Name
:= 'mOptionsControlsP1Menu';
3118 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3119 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3120 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3121 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3122 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3123 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3124 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3125 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3126 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3127 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3128 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3130 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3131 g_GUI_AddWindow(Menu
);
3133 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3134 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3136 Name
:= 'mOptionsControlsP1MenuWeapons';
3137 for i
:= WP_FIRST
to WP_LAST
do
3138 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3139 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3141 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3142 g_GUI_AddWindow(Menu
);
3144 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3145 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3147 Name
:= 'mOptionsControlsP2Menu';
3148 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3149 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3150 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3151 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3152 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3153 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3154 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3155 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3156 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3157 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3158 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3160 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3161 g_GUI_AddWindow(Menu
);
3163 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3164 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3166 Name
:= 'mOptionsControlsP2MenuWeapons';
3167 for i
:= WP_FIRST
to WP_LAST
do
3168 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3169 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3171 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3172 g_GUI_AddWindow(Menu
);
3174 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3175 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3177 Name
:= 'mOptionsControlsJoystickMenu';
3178 for i
:= 0 to e_MaxJoys
- 1 do
3179 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3181 Name
:= 'scDeadzone' + IntToStr(i
);
3185 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3186 g_GUI_AddWindow(Menu
);
3188 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3189 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3191 Name
:= 'mOptionsControlsTouchMenu';
3192 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3194 Name
:= 'swTouchAlt';
3195 AddItem(_lc
[I_MENU_NO
]);
3196 AddItem(_lc
[I_MENU_YES
]);
3197 OnChange
:= ProcChangeTouchSettings
;
3199 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3201 Name
:= 'scTouchSize';
3203 OnChange
:= ProcChangeTouchSettings
;
3205 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3207 Name
:= 'swTouchFire';
3208 AddItem(_lc
[I_MENU_NO
]);
3209 AddItem(_lc
[I_MENU_YES
]);
3211 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3213 Name
:= 'scTouchOffset';
3215 OnChange
:= ProcChangeTouchSettings
;
3218 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3219 g_GUI_AddWindow(Menu
);
3221 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3222 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3224 Name
:= 'mOptionsPlayersMenu';
3225 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3226 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3228 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3229 g_GUI_AddWindow(Menu
);
3231 CreatePlayerOptionsMenu('P1');
3232 CreatePlayerOptionsMenu('P2');
3234 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3235 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3237 Name
:= 'mOptionsPlayersMIMenu';
3238 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3243 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3248 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3250 Name
:= 'meComment';
3253 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3254 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3257 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3261 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3262 g_GUI_AddWindow(Menu
);
3264 Menu
:= TGUIWindow
.Create('OptionsPlayersP1WeaponMenu');
3265 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3267 Name
:= 'mOptionsPlayersP1WeaponMenu';
3268 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3270 Name
:= 'swWeaponAutoswitch';
3271 AddItem(_lc
[I_MENU_NO
]);
3272 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3273 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3275 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3277 Name
:= 'swWeaponAllowEmpty';
3278 AddItem(_lc
[I_MENU_YES
]);
3279 AddItem(_lc
[I_MENU_NO
]);
3281 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3283 Name
:= 'swWeaponAllowFist';
3284 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3285 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3287 AddButton(@ProcOptionsPlayerP1WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3290 Menu
.DefControl
:= 'mOptionsPlayersP1WeaponMenu';
3291 g_GUI_AddWindow(Menu
);
3293 Menu
:= TGUIWindow
.Create('OptionsPreferencesP1WeaponMenu');
3294 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_1
]))) do
3296 Name
:= 'mOptionsPreferencesP1WeaponMenu';
3297 for i
:= WP_FIRST
to WP_LAST
do
3299 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3301 Name
:= IntToStr(i
);
3302 for a
:= WP_FIRST
to WP_LAST
+1 do
3304 AddItem(IntToStr(a
));
3309 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3311 Name
:= IntToStr(WP_LAST
+1);
3312 for a
:= WP_FIRST
to WP_LAST
+1 do
3314 AddItem(IntToStr(a
));
3316 ItemIndex
:= WP_LAST
+ 1;
3319 Menu
.DefControl
:= 'mOptionsPreferencesP1WeaponMenu';
3320 g_GUI_AddWindow(Menu
);
3323 Menu
:= TGUIWindow
.Create('OptionsPlayersP2WeaponMenu');
3324 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON
]))) do
3326 Name
:= 'mOptionsPlayersP2WeaponMenu';
3327 with AddSwitch(_lc
[I_MENU_WEAPON_SWITCH
]) do
3329 Name
:= 'swWeaponAutoswitch';
3330 AddItem(_lc
[I_MENU_NO
]);
3331 AddItem(_lc
[I_MENU_WEAPON_SWITCH_LINEAR
]);
3332 AddItem(_lc
[I_MENU_WEAPON_SWITCH_PREFERENCE
]);
3334 with AddSwitch(_lc
[I_MENU_WEAPON_ALLOW_EMPTY
]) do
3336 Name
:= 'swWeaponAllowEmpty';
3337 AddItem(_lc
[I_MENU_YES
]);
3338 AddItem(_lc
[I_MENU_NO
]);
3340 with AddSwitch(_lc
[I_MENU_KASTET_ALLOW
]) do
3342 Name
:= 'swWeaponAllowFist';
3343 AddItem(_lc
[I_MENU_KASTET_ALLOW_ALWAYS
]);
3344 AddItem(_lc
[I_MENU_KASTET_ALLOW_BERSERK
]);
3346 AddButton(@ProcOptionsPlayerP2WeaponPreferencesMenu
, _lc
[I_MENU_WEAPON_SWITCH_PRIORITY
]);
3349 Menu
.DefControl
:= 'mOptionsPlayersP2WeaponMenu';
3350 g_GUI_AddWindow(Menu
);
3352 Menu
:= TGUIWindow
.Create('OptionsPreferencesP2WeaponMenu');
3353 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_WEAPON_PRIORITY_PLAYER_2
]))) do
3355 Name
:= 'mOptionsPreferencesP2WeaponMenu';
3356 for i
:= WP_FIRST
to WP_LAST
do
3358 with AddSwitch(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]) do
3360 Name
:= IntToStr(i
);
3361 for a
:= WP_FIRST
to WP_LAST
+1 do
3363 AddItem(IntToStr(a
));
3368 with AddSwitch(_lc
[I_GAME_WEAPON_BERSERK
]) do
3370 Name
:= IntToStr(WP_LAST
+1);
3371 for a
:= WP_FIRST
to WP_LAST
+1 do
3373 AddItem(IntToStr(a
));
3375 ItemIndex
:= WP_LAST
+ 1;
3378 Menu
.DefControl
:= 'mOptionsPreferencesP2WeaponMenu';
3379 g_GUI_AddWindow(Menu
);
3381 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3382 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3384 Name
:= 'mOptionsLanguageMenu';
3385 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3386 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3389 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3390 g_GUI_AddWindow(Menu
);
3392 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3393 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3394 g_GUI_AddWindow(Menu
);
3396 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3397 Menu
.BackTexture
:= 'INTER';
3398 Menu
.OnClose
:= ProcAuthorsClose
;
3402 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3404 Color
:= _RGB(255, 0, 0);
3405 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3407 _y
:= _y
+GetHeight();
3409 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3411 Color
:= _RGB(255, 0, 0);
3412 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3414 _y
:= _y
+GetHeight()+32;
3416 // ×òî äåëàë: Êòî äåëàë
3417 cx
:= gScreenWidth
div 2 - 320 + 64;
3418 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3420 Color
:= _RGB(255, 0, 0);
3425 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3427 Color
:= _RGB(255, 255, 255);
3432 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3434 Color
:= _RGB(255, 0, 0);
3439 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3441 Color
:= _RGB(255, 255, 255);
3446 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3448 Color
:= _RGB(255, 255, 255);
3453 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3455 Color
:= _RGB(255, 0, 0);
3460 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3462 Color
:= _RGB(255, 255, 255);
3467 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3469 Color
:= _RGB(255, 0, 0);
3474 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3476 Color
:= _RGB(255, 255, 255);
3479 _y
:= gScreenHeight
- 128;
3482 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3484 Color
:= _RGB(255, 0, 0);
3489 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3491 Color
:= _RGB(255, 255, 255);
3494 _y
:= _y
+GetHeight();
3496 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3498 Color
:= _RGB(255, 255, 255);
3501 _y
:= _y
+GetHeight();
3503 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3505 Color
:= _RGB(255, 255, 255);
3508 _y
:= gScreenHeight
- 32;
3510 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3512 Color
:= _RGB(255, 0, 0);
3513 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3516 g_GUI_AddWindow(Menu
);
3518 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3519 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3520 g_GUI_AddWindow(Menu
);
3522 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3523 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3525 Name
:= 'mmGameSingleMenu';
3526 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3527 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3528 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3529 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3530 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3531 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3533 Menu
.DefControl
:= 'mmGameSingleMenu';
3534 Menu
.MainWindow
:= True;
3535 Menu
.OnClose
:= ProcGMClose
;
3536 Menu
.OnShow
:= ProcGMShow
;
3537 g_GUI_AddWindow(Menu
);
3539 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3540 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3541 g_GUI_AddWindow(Menu
);
3543 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3544 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3545 g_GUI_AddWindow(Menu
);
3547 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3548 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3550 Name
:= 'mmGameCustomMenu';
3551 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3552 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3553 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3554 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3555 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3556 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3557 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3559 Menu
.DefControl
:= 'mmGameCustomMenu';
3560 Menu
.MainWindow
:= True;
3561 Menu
.OnClose
:= ProcGMClose
;
3562 Menu
.OnShow
:= ProcGMShow
;
3563 g_GUI_AddWindow(Menu
);
3565 Menu
:= TGUIWindow
.Create('GameServerMenu');
3566 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3568 Name
:= 'mmGameServerMenu';
3569 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3570 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3571 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3572 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3573 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3575 Menu
.DefControl
:= 'mmGameServerMenu';
3576 Menu
.MainWindow
:= True;
3577 Menu
.OnClose
:= ProcGMClose
;
3578 Menu
.OnShow
:= ProcGMShow
;
3579 g_GUI_AddWindow(Menu
);
3581 Menu
:= TGUIWindow
.Create('GameClientMenu');
3582 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3584 Name
:= 'mmGameClientMenu';
3585 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3586 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3587 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3589 Menu
.DefControl
:= 'mmGameClientMenu';
3590 Menu
.MainWindow
:= True;
3591 Menu
.OnClose
:= ProcGMClose
;
3592 Menu
.OnShow
:= ProcGMShow
;
3593 g_GUI_AddWindow(Menu
);
3595 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3596 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3598 Name
:= 'mClientPasswordMenu';
3599 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3607 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3610 Menu
.DefControl
:= 'mClientPasswordMenu';
3611 g_GUI_AddWindow(Menu
);
3613 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3614 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3616 Name
:= 'mGameSetGameMenu';
3617 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3619 Name
:= 'swTeamDamage';
3620 AddItem(_lc
[I_MENU_YES
]);
3621 AddItem(_lc
[I_MENU_NO
]);
3624 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3626 Name
:= 'swTeamHit';
3627 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3628 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3629 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3630 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3633 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3635 Name
:= 'swDeathmatchKeys';
3636 AddItem(_lc
[I_MENU_YES
]);
3637 AddItem(_lc
[I_MENU_NO
]);
3640 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3642 Name
:= 'edTimeLimit';
3647 with AddEdit(_lc
[I_MENU_SCORE_LIMIT
]) do
3649 Name
:= 'edScoreLimit';
3654 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3656 Name
:= 'edMaxLives';
3661 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3664 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3665 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3666 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3669 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3671 Name
:= 'swFlagDrop';
3672 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3673 AddItem(_lc
[I_MENU_YES
]);
3674 AddItem(_lc
[I_MENU_NO
]);
3680 Menu
.DefControl
:= 'mGameSetGameMenu';
3681 Menu
.OnClose
:= ProcApplyGameSet
;
3682 g_GUI_AddWindow(Menu
);
3684 Menu
:= TGUIWindow
.Create('TeamMenu');
3685 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3687 Name
:= 'mmTeamMenu';
3688 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3689 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3690 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3691 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3692 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3694 Menu
.DefControl
:= 'mmTeamMenu';
3695 Menu
.OnShow
:= ProcChangePlayers
;
3696 g_GUI_AddWindow(Menu
);
3699 procedure g_Menu_Show_SaveMenu();
3701 if g_Game_IsTestMap
then
3703 if gGameSettings
.GameType
= GT_SINGLE
then
3704 g_GUI_ShowWindow('GameSingleMenu')
3707 if g_Game_IsClient
then
3710 if g_Game_IsNet
then
3713 g_GUI_ShowWindow('GameCustomMenu');
3715 g_GUI_ShowWindow('SaveMenu');
3716 g_Sound_PlayEx('MENU_OPEN');
3719 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3721 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3722 if gGameSettings
.GameType
= GT_SINGLE
then
3724 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3728 if g_Game_IsClient
then exit
;
3729 if g_Game_IsNet
then exit
;
3730 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3732 g_GUI_ShowWindow('LoadMenu');
3733 g_Sound_PlayEx('MENU_OPEN');
3736 procedure g_Menu_Show_GameSetGame();
3738 if gGameSettings
.GameType
= GT_SINGLE
then
3739 g_GUI_ShowWindow('GameSingleMenu')
3742 if g_Game_IsClient
then
3745 if g_Game_IsNet
then
3746 g_GUI_ShowWindow('GameServerMenu')
3748 g_GUI_ShowWindow('GameCustomMenu');
3751 g_GUI_ShowWindow('GameSetGameMenu');
3752 g_Sound_PlayEx('MENU_OPEN');
3755 procedure g_Menu_Show_OptionsVideo();
3757 if gGameSettings
.GameType
= GT_SINGLE
then
3758 g_GUI_ShowWindow('GameSingleMenu')
3761 if g_Game_IsClient
then
3762 g_GUI_ShowWindow('GameClientMenu')
3764 if g_Game_IsNet
then
3765 g_GUI_ShowWindow('GameServerMenu')
3767 g_GUI_ShowWindow('GameCustomMenu');
3770 g_GUI_ShowWindow('OptionsMenu');
3771 g_GUI_ShowWindow('OptionsVideoMenu');
3772 g_Sound_PlayEx('MENU_OPEN');
3775 procedure g_Menu_Show_OptionsSound();
3777 if gGameSettings
.GameType
= GT_SINGLE
then
3778 g_GUI_ShowWindow('GameSingleMenu')
3781 if g_Game_IsClient
then
3782 g_GUI_ShowWindow('GameClientMenu')
3784 if g_Game_IsNet
then
3785 g_GUI_ShowWindow('GameServerMenu')
3787 g_GUI_ShowWindow('GameCustomMenu');
3790 g_GUI_ShowWindow('OptionsMenu');
3791 g_GUI_ShowWindow('OptionsSoundMenu');
3792 g_Sound_PlayEx('MENU_OPEN');
3795 procedure g_Menu_Show_EndGameMenu();
3797 g_GUI_ShowWindow('EndGameMenu');
3798 g_Sound_PlayEx('MENU_OPEN');
3801 procedure g_Menu_Show_QuitGameMenu();
3803 g_GUI_ShowWindow('ExitMenu');
3804 g_Sound_PlayEx('MENU_OPEN');
3807 procedure g_Menu_Init();
3814 procedure g_Menu_Free();
3818 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3823 procedure g_Menu_Reset();
3827 g_GUI_SaveMenuPos();
3828 ex
:= g_GUI_Destroy();
3832 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3837 g_Game_SetDebugMode();
3839 g_GUI_LoadMenuPos();