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
, r_textures
, r_graphics
, 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
,
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();
111 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
113 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
118 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
120 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
121 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
122 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
124 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
126 g_Sound_SetupAllVolumes(
127 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
128 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
131 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
132 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
133 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
134 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
135 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
137 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
139 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
140 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
141 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
142 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
144 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
149 else gGibsCount
:= 48;
152 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
153 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
154 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
155 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
156 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
157 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
158 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
159 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
160 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
161 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
162 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
163 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
165 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
166 g_dbg_scale
:= TempScale
+ 1;
169 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
173 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
174 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
175 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
176 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
178 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
183 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
229 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
232 for i
:= WP_FIRST
to WP_LAST
do
234 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
236 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
241 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
287 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
290 for i
:= WP_FIRST
to WP_LAST
do
292 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
294 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
299 if e_HasJoysticks
then
301 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
304 for i
:= 0 to e_MaxJoys
- 1 do
305 if e_JoystickAvailable
[i
] then
306 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
310 if g_touch_enabled
then
312 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
313 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
314 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
315 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
316 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
321 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
322 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
323 TEAM_RED
, TEAM_BLUE
);
325 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
327 gPlayer1Settings
.Model
:= Model
.GetName();
328 gPlayer1Settings
.Color
:= Model
.Color
;
331 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
333 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
334 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
335 TEAM_RED
, TEAM_BLUE
);
336 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
338 gPlayer2Settings
.Model
:= Model
.GetName();
339 gPlayer2Settings
.Color
:= Model
.Color
;
342 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
343 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
345 if g_Game_IsServer
then
347 if gPlayer1
<> nil then
349 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
350 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
351 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
352 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
354 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
357 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
360 if gPlayer2
<> nil then
362 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
363 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
364 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
365 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
367 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
372 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
374 g_Console_WriteGameConfig
;
377 procedure ReadOptions();
382 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
384 with TGUISwitch(menu
.GetControl('swBPP')) do
390 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
391 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
393 with TGUISwitch(menu
.GetControl('swVSync')) do
394 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
396 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
397 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
399 with TGUISwitch(menu
.GetControl('swInterp')) do
400 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
404 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
405 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
406 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
408 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
409 if gMuteWhenInactive
then
414 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
416 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
417 if gSoundEffectsDF
then
422 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
423 if gUseChatSounds
then
428 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
454 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
457 for i
:= WP_FIRST
to WP_LAST
do
459 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
490 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
493 for i
:= WP_FIRST
to WP_LAST
do
495 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
500 if e_HasJoysticks
then
502 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
505 for i
:= 0 to e_MaxJoys
- 1 do
506 if e_JoystickAvailable
[i
] then
507 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
511 if g_touch_enabled
then
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
514 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
515 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
516 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
517 with TGUISwitch(menu
.GetControl('swTouchFire')) do
518 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
519 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
522 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
525 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
531 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
533 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
534 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
535 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
536 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
537 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
539 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
542 with TGUISwitch(menu
.GetControl('swBloodType')) do
543 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
545 with TGUISwitch(menu
.GetControl('swCorpseType')) do
546 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
548 with TGUISwitch(menu
.GetControl('swGibsType')) do
549 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
551 with TGUISwitch(menu
.GetControl('swGibsCount')) do
560 with TGUISwitch(menu
.GetControl('swBackGround')) do
561 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
563 with TGUISwitch(menu
.GetControl('swMessages')) do
564 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
566 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
567 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
569 with TGUISwitch(menu
.GetControl('swChatBubble')) do
570 ItemIndex
:= gChatBubble
;
572 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
573 ItemIndex
:= gPlayerIndicator
;
575 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
576 ItemIndex
:= gPlayerIndicatorStyle
;
578 TempScale
:= Round(g_dbg_scale
- 1);
579 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
581 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
583 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
584 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
586 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
587 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
589 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
590 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
591 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
593 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
595 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
596 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
598 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
599 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
601 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
602 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
603 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
605 ProcSelectModel(nil);
608 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
610 // don't turn off monsters in DM
612 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
613 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
614 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
616 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
619 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
622 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
626 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
628 // don't turn off monsters in DM
630 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
631 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
632 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
634 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
637 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
640 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
644 function LatchGameOptions(const MenuName
: string): Byte;
650 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
652 Map
:= TGUILabel(GetControl('lbMap')).Text;
655 if not isWadPath(Map
) then
658 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
659 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
660 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
661 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
662 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
663 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
664 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
668 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
669 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
670 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
671 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
672 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
673 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
674 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
675 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
676 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
677 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
679 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
680 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
681 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
682 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
685 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
686 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
687 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
688 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
691 // TODO: get this crap out of here
692 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
693 gGameSettings
.WarmupTime
:= gsWarmupTime
;
694 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
698 procedure ProcStartCustomGame();
702 GameMode
:= LatchGameOptions('mCustomGameMenu');
703 if GameMode
= GM_NONE
then Exit
;
705 g_Console_WriteGameConfig
;
706 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
707 gsMaxLives
, gsGameFlags
, gsPlayers
);
711 procedure ProcStartNetGame();
715 GameMode
:= LatchGameOptions('mNetServerMenu');
716 if GameMode
= GM_NONE
then Exit
;
718 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
720 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
721 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
722 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
723 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
724 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
725 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
728 g_Console_WriteGameConfig
;
729 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
730 gsGameFlags
, gsPlayers
, 0, NetPort
);
733 procedure ProcConnectNetGame();
737 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
739 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
740 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
741 PW
:= TGUIEdit(GetControl('edPW')).Text;
744 g_Console_WriteGameConfig
;
745 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
748 procedure ProcEnterPassword();
752 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
754 NetClientIP
:= PromptIP
;
755 NetClientPort
:= PromptPort
;
756 PW
:= TGUIEdit(GetControl('edPW')).Text;
759 g_Console_WriteGameConfig
;
760 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
763 procedure ProcServerlist();
765 if not NetInitDone
then
767 if (not g_Net_Init()) then
769 g_Console_Add('NET: ERROR: Failed to init ENet!');
776 g_Net_Slist_Set(NetMasterList
);
778 gState
:= STATE_SLIST
;
779 g_ActiveWindow
:= nil;
781 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
786 slReturnPressed
:= True;
787 if g_Net_Slist_Fetch(slCurrent
) then
789 if slCurrent
= nil then
790 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
793 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
794 g_Serverlist_GenerateTable(slCurrent
, slTable
);
797 procedure ProcStartCampaign();
803 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
805 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
806 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
808 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
814 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
817 procedure ProcSelectMap(Sender
: TGUIControl
);
821 wad
, map
, res
: String;
823 win
:= g_GUI_GetWindow('SelectMapMenu');
824 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
826 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
827 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
829 if (wad
= '') or (map
= '') then
830 begin // Ýòî íå êàðòà
831 TGUILabel(GetControl('lbMapName')).Text := '';
832 TGUILabel(GetControl('lbMapAuthor')).Text := '';
833 TGUILabel(GetControl('lbMapSize')).Text := '';
834 TGUIMemo(GetControl('meMapDescription')).SetText('');
835 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
836 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
842 a
:= g_Map_GetMapInfo(res
);
844 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
845 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
846 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
847 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
848 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
849 TGUILabel(win
.GetControl('lbMapScale')).Text :=
850 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
855 procedure ProcSelectWAD(Sender
: TGUIControl
);
860 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
862 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
864 with TGUIListBox(GetControl('lsMapRes')) do
870 list
:= g_Map_GetMapsList(wad
);
884 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
890 win
:= g_GUI_GetWindow('CampaignMenu');
891 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
893 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
897 TGUILabel(GetControl('lbWADName')).Text := '';
898 TGUILabel(GetControl('lbWADAuthor')).Text := '';
899 TGUIMemo(GetControl('meWADDescription')).SetText('');
902 a
:= g_Game_GetMegaWADInfo(wad
);
904 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
905 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
906 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
908 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
912 fn
:= g_ExtractWadName(a
.pic
);
914 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
916 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
921 procedure ProcChangeColor(Sender
: TGUIControl
);
925 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
926 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
927 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
928 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
929 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
930 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
932 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
933 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
934 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
935 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
936 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
937 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
940 procedure ProcSelectModel(Sender
: TGUIControl
);
945 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
946 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
947 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
949 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
950 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
951 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
953 ProcChangeColor(nil);
956 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
968 wad
:= TWADFile
.Create
;
969 if wad
.ReadFile(GameWAD
) then
970 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
975 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
977 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
978 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
979 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
980 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
982 if g_Texture_Get('FONT_STD', ID
) then
983 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
988 if cfglen
<> 0 then FreeMem(cfgdata
);
991 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
997 cfgdata
, fntdata
: Pointer;
998 cfglen
, fntlen
: Integer;
1006 wad
:= TWADFile
.Create
;
1007 if wad
.ReadFile(GameWAD
) then
1009 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1010 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1016 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1017 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1018 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1020 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1021 FontID
:= e_CharFont_Create(spc
);
1023 for a
:= 0 to 255 do
1025 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1026 if chrwidth
= 0 then Continue
;
1028 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1030 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1036 if cfglen
<> 0 then FreeMem(cfgdata
);
1037 if fntlen
<> 0 then FreeMem(fntdata
);
1040 procedure MenuLoadData();
1042 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1044 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1045 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1046 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1047 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1048 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1049 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1050 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1051 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1052 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1053 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1054 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1055 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1056 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1057 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1058 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1059 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1060 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1061 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1062 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1063 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1064 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1065 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1066 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1067 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1068 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1070 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1071 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1072 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1073 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1074 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1075 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1076 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1079 procedure MenuFreeData();
1081 e_CharFont_Remove(gMenuFont
);
1082 e_CharFont_Remove(gMenuSmallFont
);
1084 g_Texture_Delete('MAINMENU_LOGO');
1085 g_Texture_Delete('MAINMENU_MARKER1');
1086 g_Texture_Delete('MAINMENU_MARKER2');
1087 g_Texture_Delete('SCROLL_LEFT');
1088 g_Texture_Delete('SCROLL_RIGHT');
1089 g_Texture_Delete('SCROLL_MIDDLE');
1090 g_Texture_Delete('SCROLL_MARKER');
1091 g_Texture_Delete('EDIT_LEFT');
1092 g_Texture_Delete('EDIT_RIGHT');
1093 g_Texture_Delete('EDIT_MIDDLE');
1094 g_Texture_Delete('BOX1');
1095 g_Texture_Delete('BOX2');
1096 g_Texture_Delete('BOX3');
1097 g_Texture_Delete('BOX4');
1098 g_Texture_Delete('BOX5');
1099 g_Texture_Delete('BOX6');
1100 g_Texture_Delete('BOX7');
1101 g_Texture_Delete('BOX8');
1102 g_Texture_Delete('BOX9');
1103 g_Texture_Delete('BSCROLL_UP_A');
1104 g_Texture_Delete('BSCROLL_UP_U');
1105 g_Texture_Delete('BSCROLL_DOWN_A');
1106 g_Texture_Delete('BSCROLL_DOWN_U');
1107 g_Texture_Delete('BSCROLL_MIDDLE');
1108 g_Texture_Delete('NOPIC');
1110 g_Sound_Delete('MENU_SELECT');
1111 g_Sound_Delete('MENU_OPEN');
1112 g_Sound_Delete('MENU_CLOSE');
1113 g_Sound_Delete('MENU_CHANGE');
1114 g_Sound_Delete('SCROLL_ADD');
1115 g_Sound_Delete('SCROLL_SUB');
1116 g_Sound_Delete('SOUND_PLAYER_FALL');
1119 procedure ProcAuthorsMenu();
1121 gMusic
.SetByName('MUSIC_INTERMUS');
1125 procedure ProcExitMenuKeyDown (yes
: Boolean);
1128 snd
: TPlayableSound
;
1133 g_Game_StopAllSounds(True);
1134 case (Random(18)) of
1135 0: s
:= 'SOUND_MONSTER_PAIN';
1136 1: s
:= 'SOUND_MONSTER_DIE_3';
1137 2: s
:= 'SOUND_MONSTER_SLOP';
1138 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1139 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1140 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1141 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1142 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1143 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1144 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1145 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1146 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1147 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1148 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1149 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1150 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1151 else s
:= 'SOUND_PLAYER_FALL';
1153 snd
:= TPlayableSound
.Create();
1154 res
:= snd
.SetByName(s
);
1155 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1159 while snd
.IsPlaying() do begin end;
1167 procedure ProcLoadMenu();
1174 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1175 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1176 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1180 procedure ProcSaveMenu();
1188 name
:= g_GetSaveName(a
, valid
);
1189 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1190 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1194 procedure ProcSaveGame(Sender
: TGUIControl
);
1198 if g_Game_IsNet
then Exit
;
1199 if g_Game_IsTestMap
then Exit
;
1200 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1201 g_Game_PauseAllSounds(True);
1202 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1204 g_ActiveWindow
:= nil;
1205 g_Game_Pause(False);
1208 procedure ProcLoadGame(Sender
: TGUIControl
);
1212 if g_Game_IsNet
then Exit
;
1213 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1214 if g_LoadGame(a
) then
1216 g_Game_PauseAllSounds(False)
1218 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1220 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1221 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1222 //g_ActiveWindow := nil;
1226 procedure ProcSinglePlayer (n
: Integer);
1227 var wad
, map
: AnsiString;
1230 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1231 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1232 if e_FindResource(AllMapDirs
, wad
) then
1234 wad
:= ExpandFileName(wad
);
1235 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1239 procedure ProcSingle1Player
;
1244 procedure ProcSingle2Players
;
1249 procedure ProcSelectMapMenu();
1252 wad_lb
: TGUIFileListBox
;
1253 map_lb
: TGUIListBox
;
1256 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1257 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1258 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1260 if wad_lb
.SelectedItem() <> '' then
1261 map
:= map_lb
.SelectedItem()
1265 wad_lb
.UpdateFileList();
1268 if wad_lb
.SelectedItem() <> '' then
1271 map_lb
.SelectItem(map
);
1273 if map_lb
.SelectedItem() <> '' then
1277 g_GUI_ShowWindow('SelectMapMenu');
1280 procedure ProcSelectCampaignMenu();
1283 wad_lb
: TGUIFileListBox
;
1285 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1286 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1288 wad_lb
.UpdateFileList();
1290 if wad_lb
.SelectedItem() <> '' then
1291 ProcSelectCampaignWAD(nil);
1294 procedure ProcSetMap();
1296 wad
, map
, res
: String;
1298 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1300 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1301 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1304 if (wad
= '') or (map
= '') then
1307 wad
:= e_FindWadRel(MapDirs
, WAD
);
1309 res
:= wad
+':\'+map
;
1311 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1312 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1315 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1321 g_Sound_SetupAllVolumes(
1322 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1323 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1327 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1331 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1332 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1334 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1335 g_dbg_scale
:= TempScale
+ 1;
1339 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1343 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1344 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1345 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1346 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1349 procedure ProcOptionsPlayersMIMenu();
1354 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1356 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1358 if a
= '' then Exit
;
1360 b
:= g_PlayerModel_GetInfo(a
);
1362 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1364 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1365 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1366 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1368 if b
.HaveWeapon
then
1369 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1371 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1374 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1377 procedure ProcOptionsPlayersAnim();
1381 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1386 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1389 Model
.AnimState
.Loop
:= True;
1393 procedure ProcOptionsPlayersWeap();
1397 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1402 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1406 procedure ProcOptionsPlayersRot();
1410 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1411 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1413 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1417 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1421 g_Options_SetDefault();
1427 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1429 if yes
then ReadOptions();
1433 procedure ProcAuthorsClose();
1435 gMusic
.SetByName('MUSIC_MENU');
1437 gState
:= STATE_MENU
;
1440 procedure ProcGMClose();
1442 g_Game_InGameMenu(False);
1445 procedure ProcGMShow();
1450 if (gGameSettings
.GameType
= GT_SINGLE
) and
1451 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1452 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1453 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1455 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1456 if g_Game_IsTestMap
then
1457 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1458 TGUIMainMenu(g_ActiveWindow
.GetControl(
1459 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1462 procedure ProcChangePlayers();
1464 TeamGame
, Spectator
, AddTwo
: Boolean;
1465 P1Team
{, P2Team}: Byte;
1466 bP2
: TGUITextButton
;
1468 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1469 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1470 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1471 P1Team
:= TEAM_NONE
;
1472 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1474 //P2Team := TEAM_NONE;
1475 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1477 TGUIMainMenu(g_ActiveWindow
.GetControl(
1478 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1479 TGUIMainMenu(g_ActiveWindow
.GetControl(
1480 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1481 TGUIMainMenu(g_ActiveWindow
.GetControl(
1482 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1484 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1485 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1486 bP2
.Enabled
:= AddTwo
and not Spectator
;
1488 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1490 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1491 if gPlayer2
= nil then
1492 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1494 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1496 TGUIMainMenu(g_ActiveWindow
.GetControl(
1497 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1500 procedure ProcJoinRed();
1502 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1504 if g_Game_IsServer
then
1506 if gPlayer1
= nil then
1507 g_Game_AddPlayer(TEAM_RED
)
1510 if gPlayer1
.Team
<> TEAM_RED
then
1512 gPlayer1
.SwitchTeam
;
1513 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1516 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1521 gPlayer1Settings
.Team
:= TEAM_RED
;
1522 MC_SEND_PlayerSettings
;
1523 if gPlayer1
= nil then
1524 g_Game_AddPlayer(TEAM_RED
);
1526 g_ActiveWindow
:= nil;
1527 g_Game_Pause(False);
1530 procedure ProcJoinBlue();
1532 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1534 if g_Game_IsServer
then
1536 if gPlayer1
= nil then
1537 g_Game_AddPlayer(TEAM_BLUE
)
1540 if gPlayer1
.Team
<> TEAM_BLUE
then
1542 gPlayer1
.SwitchTeam
;
1543 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1546 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1551 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1552 MC_SEND_PlayerSettings
;
1553 if gPlayer1
= nil then
1554 g_Game_AddPlayer(TEAM_BLUE
);
1556 g_ActiveWindow
:= nil;
1557 g_Game_Pause(False);
1560 procedure ProcJoinGame();
1562 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1564 if gPlayer1
= nil then
1566 g_ActiveWindow
:= nil;
1567 g_Game_Pause(False);
1570 procedure ProcSwitchP2();
1572 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1574 if gPlayer1
= nil then
1576 if gPlayer2
= nil then
1579 g_Game_RemovePlayer();
1580 g_ActiveWindow
:= nil;
1581 g_Game_Pause(False);
1584 procedure ProcSpectate();
1586 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1589 g_ActiveWindow
:= nil;
1590 g_Game_Pause(False);
1593 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1595 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1598 procedure ProcEndMenuKeyDown (yes
: Boolean);
1600 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1603 procedure ProcSetRussianLanguage
;
1605 if gLanguage
<> LANGUAGE_RUSSIAN
then
1607 gLanguage
:= LANGUAGE_RUSSIAN
;
1608 gLanguageChange
:= True;
1609 gAskLanguage
:= False;
1614 procedure ProcSetEnglishLanguage
;
1616 if gLanguage
<> LANGUAGE_ENGLISH
then
1618 gLanguage
:= LANGUAGE_ENGLISH
;
1619 gLanguageChange
:= True;
1620 gAskLanguage
:= False;
1625 procedure ReadGameSettings();
1629 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1631 with gGameSettings
do
1633 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1634 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1638 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1639 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1641 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1643 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1647 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1648 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1653 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1654 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1655 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1657 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1658 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1659 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1662 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1667 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1669 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1670 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1671 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1673 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1674 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1678 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1679 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1681 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1682 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1683 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1684 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1685 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1686 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1687 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1691 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1692 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1693 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1694 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1695 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1700 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1701 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1706 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1707 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1712 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1713 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1718 procedure ProcApplyGameSet();
1722 stat
: TPlayerStatArray
;
1724 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1726 if not g_Game_IsServer
then Exit
;
1728 with gGameSettings
do
1730 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1732 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1733 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1735 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1738 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1740 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1741 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1742 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1743 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1744 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1748 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1750 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1751 Options
:= Options
or GAME_OPTION_DMKEYS
1753 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1756 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1758 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1764 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1766 TimeLimit
:= Max(n
, b
);
1770 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1772 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1779 if GameMode
= GM_DM
then
1781 stat
:= g_Player_GetStats();
1783 for a
:= 0 to High(stat
) do
1784 if stat
[a
].Frags
> b
then
1788 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1790 GoalLimit
:= Max(n
, b
);
1794 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1796 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1797 if n
< 0 then n
:= 0;
1798 if n
> 255 then n
:= 255;
1804 stat
:= g_Player_GetStats();
1806 for a
:= 0 to High(stat
) do
1807 if stat
[a
].Lives
> b
then
1810 MaxLives
:= Max(n
, b
);
1814 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1816 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1819 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1820 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1824 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1825 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1829 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1830 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1835 // don't forget to latch this shit
1836 gsGameFlags
:= Options
;
1837 gsMaxLives
:= MaxLives
;
1838 gsGoalLimit
:= GoalLimit
;
1839 gsTimeLimit
:= TimeLimit
;
1842 if g_Game_IsNet
then MH_SEND_GameSettings
;
1845 procedure ProcVideoOptionsRes();
1850 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1852 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1853 IntToStr(gWinSizeX
) +
1854 ' x ' + IntToStr(gWinSizeY
) +
1855 ', ' + IntToStr(gBPP
) + ' bpp';
1857 with TGUIListBox(menu
.GetControl('lsResolution')) do
1859 list
:= sys_GetDisplayModes(gBPP
);
1863 ItemIndex
:= Length(list
)
1871 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1877 TempResScale
:= Round(r_pixel_scale
- 1);
1878 with TGUISwitch(menu
.GetControl('swResFactor')) do
1879 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1882 procedure ProcApplyVideoOptions();
1885 Fullscreen
: Boolean;
1886 SWidth
, SHeight
: Integer;
1887 ScaleChanged
: Boolean;
1890 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1892 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1894 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1897 SWidth
:= gWinSizeX
;
1898 SHeight
:= gWinSizeY
;
1899 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1902 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1904 ScaleChanged
:= False;
1905 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1907 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1908 r_pixel_scale
:= TempResScale
+ 1;
1909 ScaleChanged
:= True;
1912 if (SWidth
<> gWinSizeX
) or
1913 (SHeight
<> gWinSizeY
) or
1914 (Fullscreen
<> gFullscreen
) or
1917 gResolutionChange
:= True;
1918 gRC_Width
:= SWidth
;
1919 gRC_Height
:= SHeight
;
1920 gRC_FullScreen
:= Fullscreen
;
1921 gRC_Maximized
:= gWinMaximized
;
1924 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1928 procedure ProcSetFirstRussianLanguage
;
1930 gLanguage
:= LANGUAGE_RUSSIAN
;
1931 gLanguageChange
:= True;
1932 gAskLanguage
:= False;
1935 procedure ProcSetFirstEnglishLanguage
;
1937 gLanguage
:= LANGUAGE_ENGLISH
;
1938 gLanguageChange
:= True;
1939 gAskLanguage
:= False;
1942 procedure ProcRecallAddress();
1944 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1946 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1947 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1951 procedure CreateFirstLanguageMenu();
1955 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1957 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1959 Name
:= 'mmFirstLanguageMenu';
1960 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1961 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1964 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1965 Menu
.MainWindow
:= True;
1966 g_GUI_AddWindow(Menu
);
1969 procedure g_Menu_AskLanguage();
1971 CreateFirstLanguageMenu();
1972 g_GUI_ShowWindow('FirstLanguageMenu');
1975 procedure CreatePlayerOptionsMenu(s
: String);
1980 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1982 a
:= _lc
[I_MENU_PLAYER_1
]
1984 a
:= _lc
[I_MENU_PLAYER_2
];
1985 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1987 Name
:= 'mOptionsPlayers'+s
+'Menu';
1988 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1990 Name
:= 'ed'+s
+'Name';
1994 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1996 Name
:= 'sw'+s
+'Team';
1997 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1998 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2000 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2002 Name
:= 'ls'+s
+'Model';
2004 Items
:= g_PlayerModel_GetNames();
2005 OnChange
:= ProcSelectModel
;
2007 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2009 Name
:= 'sc'+s
+'Red';
2011 OnChange
:= ProcChangeColor
;
2013 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2015 Name
:= 'sc'+s
+'Green';
2017 OnChange
:= ProcChangeColor
;
2019 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2021 Name
:= 'sc'+s
+'Blue';
2023 OnChange
:= ProcChangeColor
;
2026 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2027 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2028 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2029 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2031 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2033 Name
:= 'mv'+s
+'Model';
2034 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2035 Y
:= GetControl('ls'+s
+'Model').Y
;
2038 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2039 g_GUI_AddWindow(Menu
);
2042 procedure CreateAllMenus();
2046 a
, cx
, _y
, i
: Integer;
2049 Menu
:= TGUIWindow
.Create('MainMenu');
2050 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2052 Name
:= 'mmMainMenu';
2053 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2054 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2055 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2056 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2057 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2058 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2060 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2062 Color
:= _RGB(255, 255, 255);
2063 X
:= gScreenWidth
-GetWidth
-8;
2064 Y
:= gScreenHeight
-GetHeight
-8;
2066 Menu
.DefControl
:= 'mmMainMenu';
2067 Menu
.MainWindow
:= True;
2068 g_GUI_AddWindow(Menu
);
2070 Menu
:= TGUIWindow
.Create('NewGameMenu');
2071 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2073 Name
:= 'mmNewGameMenu';
2074 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2075 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2076 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2077 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2079 Menu
.DefControl
:= 'mmNewGameMenu';
2080 g_GUI_AddWindow(Menu
);
2082 Menu
:= TGUIWindow
.Create('NetGameMenu');
2083 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2085 Name
:= 'mmNetGameMenu';
2086 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2087 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2089 Menu
.DefControl
:= 'mmNetGameMenu';
2090 g_GUI_AddWindow(Menu
);
2092 Menu
:= TGUIWindow
.Create('NetServerMenu');
2093 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2095 Name
:= 'mNetServerMenu';
2096 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2098 Name
:= 'edSrvName';
2099 OnlyDigits
:= False;
2102 Text := NetServerName
;
2104 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2106 Name
:= 'edSrvPassword';
2107 OnlyDigits
:= False;
2110 Text := NetPassword
;
2112 with AddEdit(_lc
[I_NET_PORT
]) do
2118 Text := IntToStr(NetPort
);
2120 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2122 Name
:= 'edMaxPlayers';
2126 Text := IntToStr(NetMaxClients
);
2128 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2130 Name
:= 'swUseMaster';
2131 AddItem(_lc
[I_MENU_YES
]);
2132 AddItem(_lc
[I_MENU_NO
]);
2133 if NetUseMaster
then
2139 with AddLabel(_lc
[I_MENU_MAP
]) do
2144 OnClick
:= @ProcSelectMapMenu
;
2146 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2148 Name
:= 'swGameMode';
2149 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2150 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2151 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2152 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2153 case g_Game_TextToMode(gsGameMode
) of
2155 GM_DM
: ItemIndex
:= 0;
2156 GM_TDM
: ItemIndex
:= 1;
2157 GM_CTF
: ItemIndex
:= 2;
2159 GM_COOP
: ItemIndex
:= 3;
2161 OnChange
:= ProcSwitchMonstersCustom
;
2163 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2165 Name
:= 'edTimeLimit';
2169 if gsTimeLimit
> 0 then
2170 Text := IntToStr(gsTimeLimit
);
2172 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2174 Name
:= 'edGoalLimit';
2178 if gsGoalLimit
> 0 then
2179 Text := IntToStr(gsGoalLimit
);
2181 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2183 Name
:= 'edMaxLives';
2187 if gsMaxLives
> 0 then
2188 Text := IntToStr(gsMaxLives
);
2190 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2192 Name
:= 'edItemRespawnTime';
2196 if gsItemRespawnTime
> 0 then
2197 Text := IntToStr(gsItemRespawnTime
);
2199 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2201 Name
:= 'swPlayers';
2202 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2203 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2204 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2205 ItemIndex
:= gsPlayers
;
2207 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2209 Name
:= 'swTeamDamage';
2210 AddItem(_lc
[I_MENU_YES
]);
2211 AddItem(_lc
[I_MENU_NO
]);
2212 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2217 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2219 Name
:= 'swTeamHit';
2220 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2221 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2222 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2223 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2224 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2226 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2228 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2233 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2235 Name
:= 'swDeathmatchKeys';
2236 AddItem(_lc
[I_MENU_YES
]);
2237 AddItem(_lc
[I_MENU_NO
]);
2238 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2243 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2245 Name
:= 'swEnableExits';
2246 AddItem(_lc
[I_MENU_YES
]);
2247 AddItem(_lc
[I_MENU_NO
]);
2248 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2253 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2255 Name
:= 'swWeaponStay';
2256 AddItem(_lc
[I_MENU_YES
]);
2257 AddItem(_lc
[I_MENU_NO
]);
2258 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2263 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2265 Name
:= 'swMonsters';
2266 AddItem(_lc
[I_MENU_YES
]);
2267 AddItem(_lc
[I_MENU_NO
]);
2268 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2273 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2276 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2277 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2278 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2280 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2282 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2286 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2290 Menu
.DefControl
:= 'mNetServerMenu';
2291 g_GUI_AddWindow(Menu
);
2293 Menu
:= TGUIWindow
.Create('NetClientMenu');
2294 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2296 Name
:= 'mNetClientMenu';
2298 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2301 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2307 Text := 'localhost';
2309 with AddEdit(_lc
[I_NET_PORT
]) do
2317 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2320 OnlyDigits
:= False;
2327 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2331 Menu
.DefControl
:= 'mNetClientMenu';
2332 g_GUI_AddWindow(Menu
);
2334 Menu
:= TGUIWindow
.Create('LoadMenu');
2335 Menu
.OnShow
:= ProcLoadMenu
;
2336 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2338 Name
:= 'mmLoadMenu';
2343 Name
:= 'edSlot'+IntToStr(a
);
2346 OnEnter
:= ProcLoadGame
;
2349 Menu
.DefControl
:= 'mmLoadMenu';
2350 g_GUI_AddWindow(Menu
);
2352 Menu
:= TGUIWindow
.Create('SaveMenu');
2353 Menu
.OnShow
:= ProcSaveMenu
;
2354 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2356 Name
:= 'mmSaveMenu';
2361 Name
:= 'edSlot'+IntToStr(a
);
2364 OnChange
:= ProcSaveGame
;
2367 Menu
.DefControl
:= 'mmSaveMenu';
2368 g_GUI_AddWindow(Menu
);
2370 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2371 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2373 Name
:= 'mCustomGameMenu';
2374 with AddLabel(_lc
[I_MENU_MAP
]) do
2379 OnClick
:= @ProcSelectMapMenu
;
2381 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2383 Name
:= 'swGameMode';
2384 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2385 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2386 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2387 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2388 case g_Game_TextToMode(gsGameMode
) of
2390 GM_DM
: ItemIndex
:= 0;
2391 GM_TDM
: ItemIndex
:= 1;
2392 GM_CTF
: ItemIndex
:= 2;
2394 GM_COOP
: ItemIndex
:= 3;
2396 OnChange
:= ProcSwitchMonstersCustom
;
2398 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2400 Name
:= 'edTimeLimit';
2404 if gsTimeLimit
> 0 then
2405 Text := IntToStr(gsTimeLimit
);
2407 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2409 Name
:= 'edGoalLimit';
2413 if gsGoalLimit
> 0 then
2414 Text := IntToStr(gsGoalLimit
);
2416 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2418 Name
:= 'edMaxLives';
2422 if gsMaxLives
> 0 then
2423 Text := IntToStr(gsMaxLives
);
2425 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2427 Name
:= 'edItemRespawnTime';
2431 if gsItemRespawnTime
> 0 then
2432 Text := IntToStr(gsItemRespawnTime
);
2434 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2436 Name
:= 'swPlayers';
2437 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2438 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2439 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2440 ItemIndex
:= gsPlayers
;
2442 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2444 Name
:= 'swTeamDamage';
2445 AddItem(_lc
[I_MENU_YES
]);
2446 AddItem(_lc
[I_MENU_NO
]);
2447 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2452 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2454 Name
:= 'swTeamHit';
2455 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2456 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2457 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2458 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2459 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2461 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2463 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2468 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2470 Name
:= 'swDeathmatchKeys';
2471 AddItem(_lc
[I_MENU_YES
]);
2472 AddItem(_lc
[I_MENU_NO
]);
2473 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2478 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2480 Name
:= 'swEnableExits';
2481 AddItem(_lc
[I_MENU_YES
]);
2482 AddItem(_lc
[I_MENU_NO
]);
2483 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2488 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2490 Name
:= 'swWeaponStay';
2491 AddItem(_lc
[I_MENU_YES
]);
2492 AddItem(_lc
[I_MENU_NO
]);
2493 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2498 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2500 Name
:= 'swMonsters';
2501 AddItem(_lc
[I_MENU_YES
]);
2502 AddItem(_lc
[I_MENU_NO
]);
2503 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2508 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2511 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2512 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2513 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2515 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2517 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2521 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2525 Menu
.DefControl
:= 'mCustomGameMenu';
2526 g_GUI_AddWindow(Menu
);
2528 Menu
:= TGUIWindow
.Create('CampaignMenu');
2529 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2531 Name
:= 'mCampaignMenu';
2540 with AddFileList('', 15, 4) do
2543 OnChange
:= ProcSelectCampaignWAD
;
2547 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2548 SetBase(MegawadDirs
);
2551 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2553 Name
:= 'lbWADName';
2557 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2559 Name
:= 'lbWADAuthor';
2563 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2564 with AddMemo('', 15, 3) do
2566 Name
:= 'meWADDescription';
2567 Color
:= MENU_ITEMSCTRL_COLOR
;
2569 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2571 Name
:= 'swPlayers';
2572 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2573 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2576 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2580 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2582 Name
:= 'mpWADImage';
2583 DefaultRes
:= 'NOPIC';
2584 X
:= GetControl('lsWAD').X
+4;
2585 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2588 Menu
.DefControl
:= 'mCampaignMenu';
2589 g_GUI_AddWindow(Menu
);
2591 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2592 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2594 Name
:= 'mSelectMapMenu';
2595 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2598 OnChange
:= ProcSelectWAD
;
2602 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2605 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2609 OnChange
:= ProcSelectMap
;
2612 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2614 Name
:= 'lbMapName';
2618 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2620 Name
:= 'lbMapAuthor';
2624 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2626 Name
:= 'lbMapSize';
2630 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2632 Name
:= 'meMapDescription';
2637 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2639 Name
:= 'mpMapPreview';
2640 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2641 Y
:= GetControl('lsMapWAD').Y
;
2643 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2645 Name
:= 'lbMapScale';
2648 Color
:= MENU_ITEMSCTRL_COLOR
;
2649 X
:= GetControl('lsMapWAD').X
+
2650 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2651 2 + MAPPREVIEW_WIDTH
*4;
2652 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2655 Menu
.OnClose
:= ProcSetMap
;
2656 Menu
.DefControl
:= 'mSelectMapMenu';
2657 g_GUI_AddWindow(Menu
);
2659 Menu
:= TGUIWindow
.Create('OptionsMenu');
2660 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2662 Name
:= 'mmOptionsMenu';
2663 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2664 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2665 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2666 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2667 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2668 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2670 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2671 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2673 Menu
.OnClose
:= ProcApplyOptions
;
2674 Menu
.DefControl
:= 'mmOptionsMenu';
2675 g_GUI_AddWindow(Menu
);
2677 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2678 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2679 g_GUI_AddWindow(Menu
);
2681 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2682 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2684 Name
:= 'mOptionsVideoMenu';
2685 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2686 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2692 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2695 AddItem(_lc
[I_MENU_YES
]);
2696 AddItem(_lc
[I_MENU_NO
]);
2698 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2700 Name
:= 'swTextureFilter';
2701 AddItem(_lc
[I_MENU_YES
]);
2702 AddItem(_lc
[I_MENU_NO
]);
2704 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2707 AddItem(_lc
[I_MENU_YES
]);
2708 AddItem(_lc
[I_MENU_NO
]);
2710 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2712 Name
:= 'swLegacyNPOT';
2713 AddItem(_lc
[I_MENU_NO
]);
2714 AddItem(_lc
[I_MENU_YES
]);
2717 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2720 Menu
.DefControl
:= 'mOptionsVideoMenu';
2721 g_GUI_AddWindow(Menu
);
2723 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2724 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2726 Name
:= 'mOptionsVideoResMenu';
2727 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2729 Name
:= 'lbCurrentRes';
2733 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2735 Name
:= 'lsResolution';
2738 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2740 Name
:= 'swFullScreen';
2741 AddItem(_lc
[I_MENU_YES
]);
2742 AddItem(_lc
[I_MENU_NO
]);
2744 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2746 Name
:= 'swResFactor';
2748 for i
:= 2 to gRC_Width
div 640 do
2749 AddItem(IntToStr(i
) + 'x');
2752 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2755 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2756 g_GUI_AddWindow(Menu
);
2758 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2759 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2761 Name
:= 'mOptionsSoundMenu';
2762 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2764 Name
:= 'scMusicLevel';
2766 OnChange
:= ProcChangeSoundSettings
;
2768 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2770 Name
:= 'scSoundLevel';
2772 OnChange
:= ProcChangeSoundSettings
;
2774 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2776 Name
:= 'scMaxSimSounds';
2779 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2781 Name
:= 'swAnnouncer';
2782 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2783 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2784 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2785 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2787 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2788 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2790 Name
:= 'swSoundEffects';
2791 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2792 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2794 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2795 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2797 Name
:= 'swChatSpeech';
2798 AddItem(_lc
[I_MENU_YES
]);
2799 AddItem(_lc
[I_MENU_NO
]);
2801 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2803 Name
:= 'swInactiveSounds';
2804 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2805 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2809 Menu
.DefControl
:= 'mOptionsSoundMenu';
2810 g_GUI_AddWindow(Menu
);
2812 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2813 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2815 Name
:= 'mOptionsGameMenu';
2816 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2818 Name
:= 'scParticlesCount';
2821 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2823 Name
:= 'swBloodCount';
2824 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2825 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2826 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2827 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2828 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2830 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2832 Name
:= 'scShellsMax';
2835 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2837 Name
:= 'scGibsMax';
2840 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2842 Name
:= 'scCorpsesMax';
2845 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2847 Name
:= 'swGibsCount';
2848 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2849 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2850 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2851 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2852 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2854 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2856 Name
:= 'swCorpseType';
2857 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2858 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2860 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2862 Name
:= 'swGibsType';
2863 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2864 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2866 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2868 Name
:= 'swBloodType';
2869 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2870 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2872 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2874 Name
:= 'swScreenFlash';
2875 AddItem(_lc
[I_MENU_NO
]);
2876 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2877 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2879 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2881 Name
:= 'swBackground';
2882 AddItem(_lc
[I_MENU_YES
]);
2883 AddItem(_lc
[I_MENU_NO
]);
2885 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2887 Name
:= 'swMessages';
2888 AddItem(_lc
[I_MENU_YES
]);
2889 AddItem(_lc
[I_MENU_NO
]);
2891 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2893 Name
:= 'swRevertPlayers';
2894 AddItem(_lc
[I_MENU_YES
]);
2895 AddItem(_lc
[I_MENU_NO
]);
2897 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2899 Name
:= 'swChatBubble';
2900 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2901 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2902 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2903 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2904 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2906 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2908 Name
:= 'swPlayerIndicator';
2909 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2910 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2911 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2913 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2915 Name
:= 'swPlayerIndicatorStyle';
2916 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2917 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2919 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2921 Name
:= 'scScaleFactor';
2923 OnChange
:= ProcChangeGameSettings
;
2927 Menu
.DefControl
:= 'mOptionsGameMenu';
2928 g_GUI_AddWindow(Menu
);
2930 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2931 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2933 Name
:= 'mOptionsControlsMenu';
2934 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2935 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2936 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2937 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2938 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2940 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2941 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2942 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2943 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2944 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2945 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2946 if e_HasJoysticks
then
2949 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2951 if g_touch_enabled
then
2954 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2957 Menu
.DefControl
:= 'mOptionsControlsMenu';
2958 g_GUI_AddWindow(Menu
);
2960 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2961 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2963 Name
:= 'mOptionsControlsP1Menu';
2964 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2965 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2966 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2967 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2968 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2975 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2976 g_GUI_AddWindow(Menu
);
2978 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2979 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2981 Name
:= 'mOptionsControlsP1MenuWeapons';
2982 for i
:= WP_FIRST
to WP_LAST
do
2983 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2984 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2986 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2987 g_GUI_AddWindow(Menu
);
2989 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2990 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2992 Name
:= 'mOptionsControlsP2Menu';
2993 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2994 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2995 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2996 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2997 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2998 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3002 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3004 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3005 g_GUI_AddWindow(Menu
);
3007 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3008 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3010 Name
:= 'mOptionsControlsP2MenuWeapons';
3011 for i
:= WP_FIRST
to WP_LAST
do
3012 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3013 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3015 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3016 g_GUI_AddWindow(Menu
);
3018 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3019 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3021 Name
:= 'mOptionsControlsJoystickMenu';
3022 for i
:= 0 to e_MaxJoys
- 1 do
3023 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3025 Name
:= 'scDeadzone' + IntToStr(i
);
3029 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3030 g_GUI_AddWindow(Menu
);
3032 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3033 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3035 Name
:= 'mOptionsControlsTouchMenu';
3036 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3038 Name
:= 'swTouchAlt';
3039 AddItem(_lc
[I_MENU_NO
]);
3040 AddItem(_lc
[I_MENU_YES
]);
3041 OnChange
:= ProcChangeTouchSettings
;
3043 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3045 Name
:= 'scTouchSize';
3047 OnChange
:= ProcChangeTouchSettings
;
3049 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3051 Name
:= 'swTouchFire';
3052 AddItem(_lc
[I_MENU_NO
]);
3053 AddItem(_lc
[I_MENU_YES
]);
3055 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3057 Name
:= 'scTouchOffset';
3059 OnChange
:= ProcChangeTouchSettings
;
3062 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3063 g_GUI_AddWindow(Menu
);
3065 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3066 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3068 Name
:= 'mOptionsPlayersMenu';
3069 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3070 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3072 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3073 g_GUI_AddWindow(Menu
);
3075 CreatePlayerOptionsMenu('P1');
3076 CreatePlayerOptionsMenu('P2');
3078 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3079 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3081 Name
:= 'mOptionsPlayersMIMenu';
3082 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3087 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3092 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3094 Name
:= 'meComment';
3097 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3098 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3101 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3105 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3106 g_GUI_AddWindow(Menu
);
3108 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3109 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3111 Name
:= 'mOptionsLanguageMenu';
3112 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3113 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3116 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3117 g_GUI_AddWindow(Menu
);
3119 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3120 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3121 g_GUI_AddWindow(Menu
);
3123 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3124 Menu
.BackTexture
:= 'INTER';
3125 Menu
.OnClose
:= ProcAuthorsClose
;
3129 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3131 Color
:= _RGB(255, 0, 0);
3132 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3134 _y
:= _y
+GetHeight();
3136 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3138 Color
:= _RGB(255, 0, 0);
3139 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3141 _y
:= _y
+GetHeight()+32;
3143 // ×òî äåëàë: Êòî äåëàë
3144 cx
:= gScreenWidth
div 2 - 320 + 64;
3145 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3147 Color
:= _RGB(255, 0, 0);
3152 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3154 Color
:= _RGB(255, 255, 255);
3159 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3161 Color
:= _RGB(255, 0, 0);
3166 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3168 Color
:= _RGB(255, 255, 255);
3173 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3175 Color
:= _RGB(255, 255, 255);
3180 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3182 Color
:= _RGB(255, 0, 0);
3187 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3189 Color
:= _RGB(255, 255, 255);
3194 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3196 Color
:= _RGB(255, 0, 0);
3201 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3203 Color
:= _RGB(255, 255, 255);
3206 _y
:= gScreenHeight
- 128;
3209 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3211 Color
:= _RGB(255, 0, 0);
3216 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3218 Color
:= _RGB(255, 255, 255);
3221 _y
:= _y
+GetHeight();
3223 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3225 Color
:= _RGB(255, 255, 255);
3228 _y
:= _y
+GetHeight();
3230 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3232 Color
:= _RGB(255, 255, 255);
3235 _y
:= gScreenHeight
- 32;
3237 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3239 Color
:= _RGB(255, 0, 0);
3240 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3243 g_GUI_AddWindow(Menu
);
3245 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3246 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3247 g_GUI_AddWindow(Menu
);
3249 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3250 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3252 Name
:= 'mmGameSingleMenu';
3253 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3254 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3255 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3256 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3257 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3258 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3260 Menu
.DefControl
:= 'mmGameSingleMenu';
3261 Menu
.MainWindow
:= True;
3262 Menu
.OnClose
:= ProcGMClose
;
3263 Menu
.OnShow
:= ProcGMShow
;
3264 g_GUI_AddWindow(Menu
);
3266 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3267 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3268 g_GUI_AddWindow(Menu
);
3270 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3271 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3272 g_GUI_AddWindow(Menu
);
3274 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3275 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3277 Name
:= 'mmGameCustomMenu';
3278 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3279 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3280 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3281 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3282 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3283 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3284 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3286 Menu
.DefControl
:= 'mmGameCustomMenu';
3287 Menu
.MainWindow
:= True;
3288 Menu
.OnClose
:= ProcGMClose
;
3289 Menu
.OnShow
:= ProcGMShow
;
3290 g_GUI_AddWindow(Menu
);
3292 Menu
:= TGUIWindow
.Create('GameServerMenu');
3293 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3295 Name
:= 'mmGameServerMenu';
3296 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3297 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3298 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3299 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3300 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3302 Menu
.DefControl
:= 'mmGameServerMenu';
3303 Menu
.MainWindow
:= True;
3304 Menu
.OnClose
:= ProcGMClose
;
3305 Menu
.OnShow
:= ProcGMShow
;
3306 g_GUI_AddWindow(Menu
);
3308 Menu
:= TGUIWindow
.Create('GameClientMenu');
3309 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3311 Name
:= 'mmGameClientMenu';
3312 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3313 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3314 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3316 Menu
.DefControl
:= 'mmGameClientMenu';
3317 Menu
.MainWindow
:= True;
3318 Menu
.OnClose
:= ProcGMClose
;
3319 Menu
.OnShow
:= ProcGMShow
;
3320 g_GUI_AddWindow(Menu
);
3322 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3323 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3325 Name
:= 'mClientPasswordMenu';
3326 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3334 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3337 Menu
.DefControl
:= 'mClientPasswordMenu';
3338 g_GUI_AddWindow(Menu
);
3340 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3341 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3343 Name
:= 'mGameSetGameMenu';
3344 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3346 Name
:= 'swTeamDamage';
3347 AddItem(_lc
[I_MENU_YES
]);
3348 AddItem(_lc
[I_MENU_NO
]);
3351 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3353 Name
:= 'swTeamHit';
3354 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3355 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3356 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3357 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3360 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3362 Name
:= 'swDeathmatchKeys';
3363 AddItem(_lc
[I_MENU_YES
]);
3364 AddItem(_lc
[I_MENU_NO
]);
3367 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3369 Name
:= 'edTimeLimit';
3374 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3376 Name
:= 'edGoalLimit';
3381 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3383 Name
:= 'edMaxLives';
3388 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3391 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3392 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3393 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3399 Menu
.DefControl
:= 'mGameSetGameMenu';
3400 Menu
.OnClose
:= ProcApplyGameSet
;
3401 g_GUI_AddWindow(Menu
);
3403 Menu
:= TGUIWindow
.Create('TeamMenu');
3404 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3406 Name
:= 'mmTeamMenu';
3407 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3408 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3409 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3410 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3411 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3413 Menu
.DefControl
:= 'mmTeamMenu';
3414 Menu
.OnShow
:= ProcChangePlayers
;
3415 g_GUI_AddWindow(Menu
);
3418 procedure g_Menu_Show_SaveMenu();
3420 if g_Game_IsTestMap
then
3422 if gGameSettings
.GameType
= GT_SINGLE
then
3423 g_GUI_ShowWindow('GameSingleMenu')
3426 if g_Game_IsClient
then
3429 if g_Game_IsNet
then
3432 g_GUI_ShowWindow('GameCustomMenu');
3434 g_GUI_ShowWindow('SaveMenu');
3435 g_Sound_PlayEx('MENU_OPEN');
3438 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3440 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3441 if gGameSettings
.GameType
= GT_SINGLE
then
3443 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3447 if g_Game_IsClient
then exit
;
3448 if g_Game_IsNet
then exit
;
3449 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3451 g_GUI_ShowWindow('LoadMenu');
3452 g_Sound_PlayEx('MENU_OPEN');
3455 procedure g_Menu_Show_GameSetGame();
3457 if gGameSettings
.GameType
= GT_SINGLE
then
3458 g_GUI_ShowWindow('GameSingleMenu')
3461 if g_Game_IsClient
then
3464 if g_Game_IsNet
then
3465 g_GUI_ShowWindow('GameServerMenu')
3467 g_GUI_ShowWindow('GameCustomMenu');
3470 g_GUI_ShowWindow('GameSetGameMenu');
3471 g_Sound_PlayEx('MENU_OPEN');
3474 procedure g_Menu_Show_OptionsVideo();
3476 if gGameSettings
.GameType
= GT_SINGLE
then
3477 g_GUI_ShowWindow('GameSingleMenu')
3480 if g_Game_IsClient
then
3481 g_GUI_ShowWindow('GameClientMenu')
3483 if g_Game_IsNet
then
3484 g_GUI_ShowWindow('GameServerMenu')
3486 g_GUI_ShowWindow('GameCustomMenu');
3489 g_GUI_ShowWindow('OptionsMenu');
3490 g_GUI_ShowWindow('OptionsVideoMenu');
3491 g_Sound_PlayEx('MENU_OPEN');
3494 procedure g_Menu_Show_OptionsSound();
3496 if gGameSettings
.GameType
= GT_SINGLE
then
3497 g_GUI_ShowWindow('GameSingleMenu')
3500 if g_Game_IsClient
then
3501 g_GUI_ShowWindow('GameClientMenu')
3503 if g_Game_IsNet
then
3504 g_GUI_ShowWindow('GameServerMenu')
3506 g_GUI_ShowWindow('GameCustomMenu');
3509 g_GUI_ShowWindow('OptionsMenu');
3510 g_GUI_ShowWindow('OptionsSoundMenu');
3511 g_Sound_PlayEx('MENU_OPEN');
3514 procedure g_Menu_Show_EndGameMenu();
3516 g_GUI_ShowWindow('EndGameMenu');
3517 g_Sound_PlayEx('MENU_OPEN');
3520 procedure g_Menu_Show_QuitGameMenu();
3522 g_GUI_ShowWindow('ExitMenu');
3523 g_Sound_PlayEx('MENU_OPEN');
3526 procedure g_Menu_Init();
3532 procedure g_Menu_Free();
3537 procedure g_Menu_Reset();
3541 g_GUI_SaveMenuPos();
3542 ex
:= g_GUI_Destroy();
3546 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3551 g_Game_SetDebugMode();
3553 g_GUI_LoadMenuPos();