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
.Name
;
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
.Name
;
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
.GetCurrentAnimation
.Loop
:= True;
1390 Model
.GetCurrentAnimationMask
.Loop
:= True;
1394 procedure ProcOptionsPlayersWeap();
1398 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1403 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1407 procedure ProcOptionsPlayersRot();
1411 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1412 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1414 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1418 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1422 g_Options_SetDefault();
1428 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1430 if yes
then ReadOptions();
1434 procedure ProcAuthorsClose();
1436 gMusic
.SetByName('MUSIC_MENU');
1438 gState
:= STATE_MENU
;
1441 procedure ProcGMClose();
1443 g_Game_InGameMenu(False);
1446 procedure ProcGMShow();
1451 if (gGameSettings
.GameType
= GT_SINGLE
) and
1452 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1453 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1454 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1456 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1457 if g_Game_IsTestMap
then
1458 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1459 TGUIMainMenu(g_ActiveWindow
.GetControl(
1460 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1463 procedure ProcChangePlayers();
1465 TeamGame
, Spectator
, AddTwo
: Boolean;
1466 P1Team
{, P2Team}: Byte;
1467 bP2
: TGUITextButton
;
1469 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1470 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1471 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1472 P1Team
:= TEAM_NONE
;
1473 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1475 //P2Team := TEAM_NONE;
1476 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1478 TGUIMainMenu(g_ActiveWindow
.GetControl(
1479 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1480 TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1482 TGUIMainMenu(g_ActiveWindow
.GetControl(
1483 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1485 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1486 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1487 bP2
.Enabled
:= AddTwo
and not Spectator
;
1489 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1491 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1492 if gPlayer2
= nil then
1493 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1495 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1497 TGUIMainMenu(g_ActiveWindow
.GetControl(
1498 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1501 procedure ProcJoinRed();
1503 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1505 if g_Game_IsServer
then
1507 if gPlayer1
= nil then
1508 g_Game_AddPlayer(TEAM_RED
)
1511 if gPlayer1
.Team
<> TEAM_RED
then
1513 gPlayer1
.SwitchTeam
;
1514 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1517 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1522 gPlayer1Settings
.Team
:= TEAM_RED
;
1523 MC_SEND_PlayerSettings
;
1524 if gPlayer1
= nil then
1525 g_Game_AddPlayer(TEAM_RED
);
1527 g_ActiveWindow
:= nil;
1528 g_Game_Pause(False);
1531 procedure ProcJoinBlue();
1533 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1535 if g_Game_IsServer
then
1537 if gPlayer1
= nil then
1538 g_Game_AddPlayer(TEAM_BLUE
)
1541 if gPlayer1
.Team
<> TEAM_BLUE
then
1543 gPlayer1
.SwitchTeam
;
1544 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1547 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1552 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1553 MC_SEND_PlayerSettings
;
1554 if gPlayer1
= nil then
1555 g_Game_AddPlayer(TEAM_BLUE
);
1557 g_ActiveWindow
:= nil;
1558 g_Game_Pause(False);
1561 procedure ProcJoinGame();
1563 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1565 if gPlayer1
= nil then
1567 g_ActiveWindow
:= nil;
1568 g_Game_Pause(False);
1571 procedure ProcSwitchP2();
1573 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1575 if gPlayer1
= nil then
1577 if gPlayer2
= nil then
1580 g_Game_RemovePlayer();
1581 g_ActiveWindow
:= nil;
1582 g_Game_Pause(False);
1585 procedure ProcSpectate();
1587 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1590 g_ActiveWindow
:= nil;
1591 g_Game_Pause(False);
1594 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1596 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1599 procedure ProcEndMenuKeyDown (yes
: Boolean);
1601 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1604 procedure ProcSetRussianLanguage
;
1606 if gLanguage
<> LANGUAGE_RUSSIAN
then
1608 gLanguage
:= LANGUAGE_RUSSIAN
;
1609 gLanguageChange
:= True;
1610 gAskLanguage
:= False;
1615 procedure ProcSetEnglishLanguage
;
1617 if gLanguage
<> LANGUAGE_ENGLISH
then
1619 gLanguage
:= LANGUAGE_ENGLISH
;
1620 gLanguageChange
:= True;
1621 gAskLanguage
:= False;
1626 procedure ReadGameSettings();
1630 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1632 with gGameSettings
do
1634 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1635 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1639 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1640 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1642 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1644 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1648 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1649 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1654 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1655 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1656 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1658 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1659 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1660 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1663 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1668 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1670 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1671 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1672 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1674 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1675 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1679 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1680 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1682 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1683 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1684 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1685 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1686 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1687 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1688 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1692 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1693 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1694 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1695 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1696 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1701 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1702 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1707 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1708 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1713 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1714 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1719 procedure ProcApplyGameSet();
1723 stat
: TPlayerStatArray
;
1725 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1727 if not g_Game_IsServer
then Exit
;
1729 with gGameSettings
do
1731 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1733 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1734 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1736 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1739 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1741 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1742 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1743 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1744 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1745 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1749 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1751 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1752 Options
:= Options
or GAME_OPTION_DMKEYS
1754 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1757 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1759 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1765 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1767 TimeLimit
:= Max(n
, b
);
1771 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1773 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1780 if GameMode
= GM_DM
then
1782 stat
:= g_Player_GetStats();
1784 for a
:= 0 to High(stat
) do
1785 if stat
[a
].Frags
> b
then
1789 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1791 GoalLimit
:= Max(n
, b
);
1795 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1797 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1798 if n
< 0 then n
:= 0;
1799 if n
> 255 then n
:= 255;
1805 stat
:= g_Player_GetStats();
1807 for a
:= 0 to High(stat
) do
1808 if stat
[a
].Lives
> b
then
1811 MaxLives
:= Max(n
, b
);
1815 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1817 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1820 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1821 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1825 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1826 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1830 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1831 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1836 // don't forget to latch this shit
1837 gsGameFlags
:= Options
;
1838 gsMaxLives
:= MaxLives
;
1839 gsGoalLimit
:= GoalLimit
;
1840 gsTimeLimit
:= TimeLimit
;
1843 if g_Game_IsNet
then MH_SEND_GameSettings
;
1846 procedure ProcVideoOptionsRes();
1851 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1853 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1854 IntToStr(gWinSizeX
) +
1855 ' x ' + IntToStr(gWinSizeY
) +
1856 ', ' + IntToStr(gBPP
) + ' bpp';
1858 with TGUIListBox(menu
.GetControl('lsResolution')) do
1860 list
:= sys_GetDisplayModes(gBPP
);
1864 ItemIndex
:= Length(list
)
1872 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1878 TempResScale
:= Round(r_pixel_scale
- 1);
1879 with TGUISwitch(menu
.GetControl('swResFactor')) do
1880 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1883 procedure ProcApplyVideoOptions();
1886 Fullscreen
: Boolean;
1887 SWidth
, SHeight
: Integer;
1888 ScaleChanged
: Boolean;
1891 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1893 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1895 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1898 SWidth
:= gWinSizeX
;
1899 SHeight
:= gWinSizeY
;
1900 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1903 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1905 ScaleChanged
:= False;
1906 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1908 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1909 r_pixel_scale
:= TempResScale
+ 1;
1910 ScaleChanged
:= True;
1913 if (SWidth
<> gWinSizeX
) or
1914 (SHeight
<> gWinSizeY
) or
1915 (Fullscreen
<> gFullscreen
) or
1918 gResolutionChange
:= True;
1919 gRC_Width
:= SWidth
;
1920 gRC_Height
:= SHeight
;
1921 gRC_FullScreen
:= Fullscreen
;
1922 gRC_Maximized
:= gWinMaximized
;
1925 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1929 procedure ProcSetFirstRussianLanguage
;
1931 gLanguage
:= LANGUAGE_RUSSIAN
;
1932 gLanguageChange
:= True;
1933 gAskLanguage
:= False;
1936 procedure ProcSetFirstEnglishLanguage
;
1938 gLanguage
:= LANGUAGE_ENGLISH
;
1939 gLanguageChange
:= True;
1940 gAskLanguage
:= False;
1943 procedure ProcRecallAddress();
1945 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1947 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1948 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1952 procedure CreateFirstLanguageMenu();
1956 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1958 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1960 Name
:= 'mmFirstLanguageMenu';
1961 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1962 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1965 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1966 Menu
.MainWindow
:= True;
1967 g_GUI_AddWindow(Menu
);
1970 procedure g_Menu_AskLanguage();
1972 CreateFirstLanguageMenu();
1973 g_GUI_ShowWindow('FirstLanguageMenu');
1976 procedure CreatePlayerOptionsMenu(s
: String);
1981 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1983 a
:= _lc
[I_MENU_PLAYER_1
]
1985 a
:= _lc
[I_MENU_PLAYER_2
];
1986 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1988 Name
:= 'mOptionsPlayers'+s
+'Menu';
1989 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1991 Name
:= 'ed'+s
+'Name';
1995 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1997 Name
:= 'sw'+s
+'Team';
1998 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1999 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2001 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2003 Name
:= 'ls'+s
+'Model';
2005 Items
:= g_PlayerModel_GetNames();
2006 OnChange
:= ProcSelectModel
;
2008 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2010 Name
:= 'sc'+s
+'Red';
2012 OnChange
:= ProcChangeColor
;
2014 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2016 Name
:= 'sc'+s
+'Green';
2018 OnChange
:= ProcChangeColor
;
2020 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2022 Name
:= 'sc'+s
+'Blue';
2024 OnChange
:= ProcChangeColor
;
2027 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2028 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2029 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2030 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2032 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2034 Name
:= 'mv'+s
+'Model';
2035 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2036 Y
:= GetControl('ls'+s
+'Model').Y
;
2039 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2040 g_GUI_AddWindow(Menu
);
2043 procedure CreateAllMenus();
2047 a
, cx
, _y
, i
: Integer;
2050 Menu
:= TGUIWindow
.Create('MainMenu');
2051 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2053 Name
:= 'mmMainMenu';
2054 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2055 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2056 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2057 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2058 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2059 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2061 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2063 Color
:= _RGB(255, 255, 255);
2064 X
:= gScreenWidth
-GetWidth
-8;
2065 Y
:= gScreenHeight
-GetHeight
-8;
2067 Menu
.DefControl
:= 'mmMainMenu';
2068 Menu
.MainWindow
:= True;
2069 g_GUI_AddWindow(Menu
);
2071 Menu
:= TGUIWindow
.Create('NewGameMenu');
2072 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2074 Name
:= 'mmNewGameMenu';
2075 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2076 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2077 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2078 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2080 Menu
.DefControl
:= 'mmNewGameMenu';
2081 g_GUI_AddWindow(Menu
);
2083 Menu
:= TGUIWindow
.Create('NetGameMenu');
2084 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2086 Name
:= 'mmNetGameMenu';
2087 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2088 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2090 Menu
.DefControl
:= 'mmNetGameMenu';
2091 g_GUI_AddWindow(Menu
);
2093 Menu
:= TGUIWindow
.Create('NetServerMenu');
2094 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2096 Name
:= 'mNetServerMenu';
2097 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2099 Name
:= 'edSrvName';
2100 OnlyDigits
:= False;
2103 Text := NetServerName
;
2105 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2107 Name
:= 'edSrvPassword';
2108 OnlyDigits
:= False;
2111 Text := NetPassword
;
2113 with AddEdit(_lc
[I_NET_PORT
]) do
2119 Text := IntToStr(NetPort
);
2121 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2123 Name
:= 'edMaxPlayers';
2127 Text := IntToStr(NetMaxClients
);
2129 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2131 Name
:= 'swUseMaster';
2132 AddItem(_lc
[I_MENU_YES
]);
2133 AddItem(_lc
[I_MENU_NO
]);
2134 if NetUseMaster
then
2140 with AddLabel(_lc
[I_MENU_MAP
]) do
2145 OnClick
:= @ProcSelectMapMenu
;
2147 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2149 Name
:= 'swGameMode';
2150 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2151 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2152 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2153 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2154 case g_Game_TextToMode(gsGameMode
) of
2156 GM_DM
: ItemIndex
:= 0;
2157 GM_TDM
: ItemIndex
:= 1;
2158 GM_CTF
: ItemIndex
:= 2;
2160 GM_COOP
: ItemIndex
:= 3;
2162 OnChange
:= ProcSwitchMonstersCustom
;
2164 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2166 Name
:= 'edTimeLimit';
2170 if gsTimeLimit
> 0 then
2171 Text := IntToStr(gsTimeLimit
);
2173 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2175 Name
:= 'edGoalLimit';
2179 if gsGoalLimit
> 0 then
2180 Text := IntToStr(gsGoalLimit
);
2182 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2184 Name
:= 'edMaxLives';
2188 if gsMaxLives
> 0 then
2189 Text := IntToStr(gsMaxLives
);
2191 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2193 Name
:= 'edItemRespawnTime';
2197 if gsItemRespawnTime
> 0 then
2198 Text := IntToStr(gsItemRespawnTime
);
2200 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2202 Name
:= 'swPlayers';
2203 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2204 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2205 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2206 ItemIndex
:= gsPlayers
;
2208 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2210 Name
:= 'swTeamDamage';
2211 AddItem(_lc
[I_MENU_YES
]);
2212 AddItem(_lc
[I_MENU_NO
]);
2213 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2218 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2220 Name
:= 'swTeamHit';
2221 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2222 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2223 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2224 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2225 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2227 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2229 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2234 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2236 Name
:= 'swDeathmatchKeys';
2237 AddItem(_lc
[I_MENU_YES
]);
2238 AddItem(_lc
[I_MENU_NO
]);
2239 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2244 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2246 Name
:= 'swEnableExits';
2247 AddItem(_lc
[I_MENU_YES
]);
2248 AddItem(_lc
[I_MENU_NO
]);
2249 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2254 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2256 Name
:= 'swWeaponStay';
2257 AddItem(_lc
[I_MENU_YES
]);
2258 AddItem(_lc
[I_MENU_NO
]);
2259 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2264 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2266 Name
:= 'swMonsters';
2267 AddItem(_lc
[I_MENU_YES
]);
2268 AddItem(_lc
[I_MENU_NO
]);
2269 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2274 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2277 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2278 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2279 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2281 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2283 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2287 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2291 Menu
.DefControl
:= 'mNetServerMenu';
2292 g_GUI_AddWindow(Menu
);
2294 Menu
:= TGUIWindow
.Create('NetClientMenu');
2295 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2297 Name
:= 'mNetClientMenu';
2299 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2302 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2308 Text := 'localhost';
2310 with AddEdit(_lc
[I_NET_PORT
]) do
2318 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2321 OnlyDigits
:= False;
2328 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2332 Menu
.DefControl
:= 'mNetClientMenu';
2333 g_GUI_AddWindow(Menu
);
2335 Menu
:= TGUIWindow
.Create('LoadMenu');
2336 Menu
.OnShow
:= ProcLoadMenu
;
2337 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2339 Name
:= 'mmLoadMenu';
2344 Name
:= 'edSlot'+IntToStr(a
);
2347 OnEnter
:= ProcLoadGame
;
2350 Menu
.DefControl
:= 'mmLoadMenu';
2351 g_GUI_AddWindow(Menu
);
2353 Menu
:= TGUIWindow
.Create('SaveMenu');
2354 Menu
.OnShow
:= ProcSaveMenu
;
2355 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2357 Name
:= 'mmSaveMenu';
2362 Name
:= 'edSlot'+IntToStr(a
);
2365 OnChange
:= ProcSaveGame
;
2368 Menu
.DefControl
:= 'mmSaveMenu';
2369 g_GUI_AddWindow(Menu
);
2371 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2372 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2374 Name
:= 'mCustomGameMenu';
2375 with AddLabel(_lc
[I_MENU_MAP
]) do
2380 OnClick
:= @ProcSelectMapMenu
;
2382 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2384 Name
:= 'swGameMode';
2385 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2386 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2387 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2388 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2389 case g_Game_TextToMode(gsGameMode
) of
2391 GM_DM
: ItemIndex
:= 0;
2392 GM_TDM
: ItemIndex
:= 1;
2393 GM_CTF
: ItemIndex
:= 2;
2395 GM_COOP
: ItemIndex
:= 3;
2397 OnChange
:= ProcSwitchMonstersCustom
;
2399 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2401 Name
:= 'edTimeLimit';
2405 if gsTimeLimit
> 0 then
2406 Text := IntToStr(gsTimeLimit
);
2408 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2410 Name
:= 'edGoalLimit';
2414 if gsGoalLimit
> 0 then
2415 Text := IntToStr(gsGoalLimit
);
2417 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2419 Name
:= 'edMaxLives';
2423 if gsMaxLives
> 0 then
2424 Text := IntToStr(gsMaxLives
);
2426 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2428 Name
:= 'edItemRespawnTime';
2432 if gsItemRespawnTime
> 0 then
2433 Text := IntToStr(gsItemRespawnTime
);
2435 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2437 Name
:= 'swPlayers';
2438 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2439 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2440 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2441 ItemIndex
:= gsPlayers
;
2443 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2445 Name
:= 'swTeamDamage';
2446 AddItem(_lc
[I_MENU_YES
]);
2447 AddItem(_lc
[I_MENU_NO
]);
2448 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2453 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2455 Name
:= 'swTeamHit';
2456 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2457 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2458 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2459 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2460 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2462 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2464 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2469 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2471 Name
:= 'swDeathmatchKeys';
2472 AddItem(_lc
[I_MENU_YES
]);
2473 AddItem(_lc
[I_MENU_NO
]);
2474 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2479 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2481 Name
:= 'swEnableExits';
2482 AddItem(_lc
[I_MENU_YES
]);
2483 AddItem(_lc
[I_MENU_NO
]);
2484 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2489 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2491 Name
:= 'swWeaponStay';
2492 AddItem(_lc
[I_MENU_YES
]);
2493 AddItem(_lc
[I_MENU_NO
]);
2494 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2499 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2501 Name
:= 'swMonsters';
2502 AddItem(_lc
[I_MENU_YES
]);
2503 AddItem(_lc
[I_MENU_NO
]);
2504 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2509 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2512 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2513 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2514 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2516 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2518 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2522 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2526 Menu
.DefControl
:= 'mCustomGameMenu';
2527 g_GUI_AddWindow(Menu
);
2529 Menu
:= TGUIWindow
.Create('CampaignMenu');
2530 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2532 Name
:= 'mCampaignMenu';
2541 with AddFileList('', 15, 4) do
2544 OnChange
:= ProcSelectCampaignWAD
;
2548 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2549 SetBase(MegawadDirs
);
2552 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2554 Name
:= 'lbWADName';
2558 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2560 Name
:= 'lbWADAuthor';
2564 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2565 with AddMemo('', 15, 3) do
2567 Name
:= 'meWADDescription';
2568 Color
:= MENU_ITEMSCTRL_COLOR
;
2570 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2572 Name
:= 'swPlayers';
2573 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2574 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2577 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2581 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2583 Name
:= 'mpWADImage';
2584 DefaultRes
:= 'NOPIC';
2585 X
:= GetControl('lsWAD').X
+4;
2586 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2589 Menu
.DefControl
:= 'mCampaignMenu';
2590 g_GUI_AddWindow(Menu
);
2592 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2593 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2595 Name
:= 'mSelectMapMenu';
2596 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2599 OnChange
:= ProcSelectWAD
;
2603 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2606 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2610 OnChange
:= ProcSelectMap
;
2613 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2615 Name
:= 'lbMapName';
2619 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2621 Name
:= 'lbMapAuthor';
2625 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2627 Name
:= 'lbMapSize';
2631 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2633 Name
:= 'meMapDescription';
2638 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2640 Name
:= 'mpMapPreview';
2641 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2642 Y
:= GetControl('lsMapWAD').Y
;
2644 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2646 Name
:= 'lbMapScale';
2649 Color
:= MENU_ITEMSCTRL_COLOR
;
2650 X
:= GetControl('lsMapWAD').X
+
2651 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2652 2 + MAPPREVIEW_WIDTH
*4;
2653 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2656 Menu
.OnClose
:= ProcSetMap
;
2657 Menu
.DefControl
:= 'mSelectMapMenu';
2658 g_GUI_AddWindow(Menu
);
2660 Menu
:= TGUIWindow
.Create('OptionsMenu');
2661 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2663 Name
:= 'mmOptionsMenu';
2664 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2665 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2666 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2667 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2668 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2669 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2671 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2672 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2674 Menu
.OnClose
:= ProcApplyOptions
;
2675 Menu
.DefControl
:= 'mmOptionsMenu';
2676 g_GUI_AddWindow(Menu
);
2678 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2679 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2680 g_GUI_AddWindow(Menu
);
2682 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2683 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2685 Name
:= 'mOptionsVideoMenu';
2686 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2687 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2693 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2696 AddItem(_lc
[I_MENU_YES
]);
2697 AddItem(_lc
[I_MENU_NO
]);
2699 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2701 Name
:= 'swTextureFilter';
2702 AddItem(_lc
[I_MENU_YES
]);
2703 AddItem(_lc
[I_MENU_NO
]);
2705 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2708 AddItem(_lc
[I_MENU_YES
]);
2709 AddItem(_lc
[I_MENU_NO
]);
2711 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2713 Name
:= 'swLegacyNPOT';
2714 AddItem(_lc
[I_MENU_NO
]);
2715 AddItem(_lc
[I_MENU_YES
]);
2718 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2721 Menu
.DefControl
:= 'mOptionsVideoMenu';
2722 g_GUI_AddWindow(Menu
);
2724 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2725 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2727 Name
:= 'mOptionsVideoResMenu';
2728 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2730 Name
:= 'lbCurrentRes';
2734 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2736 Name
:= 'lsResolution';
2739 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2741 Name
:= 'swFullScreen';
2742 AddItem(_lc
[I_MENU_YES
]);
2743 AddItem(_lc
[I_MENU_NO
]);
2745 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2747 Name
:= 'swResFactor';
2749 for i
:= 2 to gRC_Width
div 640 do
2750 AddItem(IntToStr(i
) + 'x');
2753 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2756 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2757 g_GUI_AddWindow(Menu
);
2759 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2760 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2762 Name
:= 'mOptionsSoundMenu';
2763 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2765 Name
:= 'scMusicLevel';
2767 OnChange
:= ProcChangeSoundSettings
;
2769 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2771 Name
:= 'scSoundLevel';
2773 OnChange
:= ProcChangeSoundSettings
;
2775 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2777 Name
:= 'scMaxSimSounds';
2780 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2782 Name
:= 'swAnnouncer';
2783 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2784 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2785 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2786 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2788 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2789 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2791 Name
:= 'swSoundEffects';
2792 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2793 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2795 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2796 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2798 Name
:= 'swChatSpeech';
2799 AddItem(_lc
[I_MENU_YES
]);
2800 AddItem(_lc
[I_MENU_NO
]);
2802 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2804 Name
:= 'swInactiveSounds';
2805 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2806 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2810 Menu
.DefControl
:= 'mOptionsSoundMenu';
2811 g_GUI_AddWindow(Menu
);
2813 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2814 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2816 Name
:= 'mOptionsGameMenu';
2817 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2819 Name
:= 'scParticlesCount';
2822 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2824 Name
:= 'swBloodCount';
2825 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2826 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2827 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2828 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2829 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2831 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2833 Name
:= 'scShellsMax';
2836 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2838 Name
:= 'scGibsMax';
2841 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2843 Name
:= 'scCorpsesMax';
2846 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2848 Name
:= 'swGibsCount';
2849 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2850 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2851 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2852 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2853 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2855 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2857 Name
:= 'swCorpseType';
2858 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2859 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2861 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2863 Name
:= 'swGibsType';
2864 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2865 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2867 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2869 Name
:= 'swBloodType';
2870 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2871 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2873 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2875 Name
:= 'swScreenFlash';
2876 AddItem(_lc
[I_MENU_NO
]);
2877 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2878 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2880 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2882 Name
:= 'swBackground';
2883 AddItem(_lc
[I_MENU_YES
]);
2884 AddItem(_lc
[I_MENU_NO
]);
2886 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2888 Name
:= 'swMessages';
2889 AddItem(_lc
[I_MENU_YES
]);
2890 AddItem(_lc
[I_MENU_NO
]);
2892 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2894 Name
:= 'swRevertPlayers';
2895 AddItem(_lc
[I_MENU_YES
]);
2896 AddItem(_lc
[I_MENU_NO
]);
2898 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2900 Name
:= 'swChatBubble';
2901 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2902 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2903 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2904 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2905 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2907 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2909 Name
:= 'swPlayerIndicator';
2910 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2911 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2912 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2914 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2916 Name
:= 'swPlayerIndicatorStyle';
2917 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2918 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2920 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2922 Name
:= 'scScaleFactor';
2924 OnChange
:= ProcChangeGameSettings
;
2928 Menu
.DefControl
:= 'mOptionsGameMenu';
2929 g_GUI_AddWindow(Menu
);
2931 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2932 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2934 Name
:= 'mOptionsControlsMenu';
2935 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2936 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2937 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2938 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2939 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2941 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2942 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2943 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2944 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2945 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2946 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2947 if e_HasJoysticks
then
2950 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2952 if g_touch_enabled
then
2955 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2958 Menu
.DefControl
:= 'mOptionsControlsMenu';
2959 g_GUI_AddWindow(Menu
);
2961 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2962 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2964 Name
:= 'mOptionsControlsP1Menu';
2965 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2966 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2967 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2968 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2974 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2976 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2977 g_GUI_AddWindow(Menu
);
2979 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2980 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2982 Name
:= 'mOptionsControlsP1MenuWeapons';
2983 for i
:= WP_FIRST
to WP_LAST
do
2984 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2985 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2987 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2988 g_GUI_AddWindow(Menu
);
2990 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2991 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2993 Name
:= 'mOptionsControlsP2Menu';
2994 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2995 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2996 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2997 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2998 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3002 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3003 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3005 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3006 g_GUI_AddWindow(Menu
);
3008 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3009 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3011 Name
:= 'mOptionsControlsP2MenuWeapons';
3012 for i
:= WP_FIRST
to WP_LAST
do
3013 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3014 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3016 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3017 g_GUI_AddWindow(Menu
);
3019 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3020 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3022 Name
:= 'mOptionsControlsJoystickMenu';
3023 for i
:= 0 to e_MaxJoys
- 1 do
3024 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3026 Name
:= 'scDeadzone' + IntToStr(i
);
3030 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3031 g_GUI_AddWindow(Menu
);
3033 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3034 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3036 Name
:= 'mOptionsControlsTouchMenu';
3037 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3039 Name
:= 'swTouchAlt';
3040 AddItem(_lc
[I_MENU_NO
]);
3041 AddItem(_lc
[I_MENU_YES
]);
3042 OnChange
:= ProcChangeTouchSettings
;
3044 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3046 Name
:= 'scTouchSize';
3048 OnChange
:= ProcChangeTouchSettings
;
3050 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3052 Name
:= 'swTouchFire';
3053 AddItem(_lc
[I_MENU_NO
]);
3054 AddItem(_lc
[I_MENU_YES
]);
3056 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3058 Name
:= 'scTouchOffset';
3060 OnChange
:= ProcChangeTouchSettings
;
3063 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3064 g_GUI_AddWindow(Menu
);
3066 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3067 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3069 Name
:= 'mOptionsPlayersMenu';
3070 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3071 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3073 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3074 g_GUI_AddWindow(Menu
);
3076 CreatePlayerOptionsMenu('P1');
3077 CreatePlayerOptionsMenu('P2');
3079 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3080 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3082 Name
:= 'mOptionsPlayersMIMenu';
3083 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3088 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3093 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3095 Name
:= 'meComment';
3098 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3099 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3102 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3106 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3107 g_GUI_AddWindow(Menu
);
3109 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3110 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3112 Name
:= 'mOptionsLanguageMenu';
3113 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3114 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3117 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3118 g_GUI_AddWindow(Menu
);
3120 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3121 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3125 Menu
.BackTexture
:= 'INTER';
3126 Menu
.OnClose
:= ProcAuthorsClose
;
3130 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3132 Color
:= _RGB(255, 0, 0);
3133 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3135 _y
:= _y
+GetHeight();
3137 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3139 Color
:= _RGB(255, 0, 0);
3140 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3142 _y
:= _y
+GetHeight()+32;
3144 // ×òî äåëàë: Êòî äåëàë
3145 cx
:= gScreenWidth
div 2 - 320 + 64;
3146 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3148 Color
:= _RGB(255, 0, 0);
3153 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3155 Color
:= _RGB(255, 255, 255);
3160 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3162 Color
:= _RGB(255, 0, 0);
3167 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3169 Color
:= _RGB(255, 255, 255);
3174 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3176 Color
:= _RGB(255, 255, 255);
3181 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3183 Color
:= _RGB(255, 0, 0);
3188 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3190 Color
:= _RGB(255, 255, 255);
3195 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3197 Color
:= _RGB(255, 0, 0);
3202 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3204 Color
:= _RGB(255, 255, 255);
3207 _y
:= gScreenHeight
- 128;
3210 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3212 Color
:= _RGB(255, 0, 0);
3217 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3219 Color
:= _RGB(255, 255, 255);
3222 _y
:= _y
+GetHeight();
3224 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3226 Color
:= _RGB(255, 255, 255);
3229 _y
:= _y
+GetHeight();
3231 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3233 Color
:= _RGB(255, 255, 255);
3236 _y
:= gScreenHeight
- 32;
3238 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3240 Color
:= _RGB(255, 0, 0);
3241 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3244 g_GUI_AddWindow(Menu
);
3246 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3247 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3248 g_GUI_AddWindow(Menu
);
3250 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3251 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3253 Name
:= 'mmGameSingleMenu';
3254 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3255 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3256 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3257 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3258 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3259 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3261 Menu
.DefControl
:= 'mmGameSingleMenu';
3262 Menu
.MainWindow
:= True;
3263 Menu
.OnClose
:= ProcGMClose
;
3264 Menu
.OnShow
:= ProcGMShow
;
3265 g_GUI_AddWindow(Menu
);
3267 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3268 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3269 g_GUI_AddWindow(Menu
);
3271 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3272 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3273 g_GUI_AddWindow(Menu
);
3275 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3276 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3278 Name
:= 'mmGameCustomMenu';
3279 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3280 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3281 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3282 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3283 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3284 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3285 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3287 Menu
.DefControl
:= 'mmGameCustomMenu';
3288 Menu
.MainWindow
:= True;
3289 Menu
.OnClose
:= ProcGMClose
;
3290 Menu
.OnShow
:= ProcGMShow
;
3291 g_GUI_AddWindow(Menu
);
3293 Menu
:= TGUIWindow
.Create('GameServerMenu');
3294 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3296 Name
:= 'mmGameServerMenu';
3297 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3298 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3299 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3300 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3301 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3303 Menu
.DefControl
:= 'mmGameServerMenu';
3304 Menu
.MainWindow
:= True;
3305 Menu
.OnClose
:= ProcGMClose
;
3306 Menu
.OnShow
:= ProcGMShow
;
3307 g_GUI_AddWindow(Menu
);
3309 Menu
:= TGUIWindow
.Create('GameClientMenu');
3310 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3312 Name
:= 'mmGameClientMenu';
3313 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3314 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3315 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3317 Menu
.DefControl
:= 'mmGameClientMenu';
3318 Menu
.MainWindow
:= True;
3319 Menu
.OnClose
:= ProcGMClose
;
3320 Menu
.OnShow
:= ProcGMShow
;
3321 g_GUI_AddWindow(Menu
);
3323 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3324 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3326 Name
:= 'mClientPasswordMenu';
3327 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3335 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3338 Menu
.DefControl
:= 'mClientPasswordMenu';
3339 g_GUI_AddWindow(Menu
);
3341 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3342 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3344 Name
:= 'mGameSetGameMenu';
3345 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3347 Name
:= 'swTeamDamage';
3348 AddItem(_lc
[I_MENU_YES
]);
3349 AddItem(_lc
[I_MENU_NO
]);
3352 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3354 Name
:= 'swTeamHit';
3355 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3356 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3357 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3358 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3361 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3363 Name
:= 'swDeathmatchKeys';
3364 AddItem(_lc
[I_MENU_YES
]);
3365 AddItem(_lc
[I_MENU_NO
]);
3368 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3370 Name
:= 'edTimeLimit';
3375 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3377 Name
:= 'edGoalLimit';
3382 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3384 Name
:= 'edMaxLives';
3389 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3392 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3393 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3394 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3400 Menu
.DefControl
:= 'mGameSetGameMenu';
3401 Menu
.OnClose
:= ProcApplyGameSet
;
3402 g_GUI_AddWindow(Menu
);
3404 Menu
:= TGUIWindow
.Create('TeamMenu');
3405 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3407 Name
:= 'mmTeamMenu';
3408 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3409 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3410 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3411 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3412 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3414 Menu
.DefControl
:= 'mmTeamMenu';
3415 Menu
.OnShow
:= ProcChangePlayers
;
3416 g_GUI_AddWindow(Menu
);
3419 procedure g_Menu_Show_SaveMenu();
3421 if g_Game_IsTestMap
then
3423 if gGameSettings
.GameType
= GT_SINGLE
then
3424 g_GUI_ShowWindow('GameSingleMenu')
3427 if g_Game_IsClient
then
3430 if g_Game_IsNet
then
3433 g_GUI_ShowWindow('GameCustomMenu');
3435 g_GUI_ShowWindow('SaveMenu');
3436 g_Sound_PlayEx('MENU_OPEN');
3439 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3441 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3442 if gGameSettings
.GameType
= GT_SINGLE
then
3444 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3448 if g_Game_IsClient
then exit
;
3449 if g_Game_IsNet
then exit
;
3450 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3452 g_GUI_ShowWindow('LoadMenu');
3453 g_Sound_PlayEx('MENU_OPEN');
3456 procedure g_Menu_Show_GameSetGame();
3458 if gGameSettings
.GameType
= GT_SINGLE
then
3459 g_GUI_ShowWindow('GameSingleMenu')
3462 if g_Game_IsClient
then
3465 if g_Game_IsNet
then
3466 g_GUI_ShowWindow('GameServerMenu')
3468 g_GUI_ShowWindow('GameCustomMenu');
3471 g_GUI_ShowWindow('GameSetGameMenu');
3472 g_Sound_PlayEx('MENU_OPEN');
3475 procedure g_Menu_Show_OptionsVideo();
3477 if gGameSettings
.GameType
= GT_SINGLE
then
3478 g_GUI_ShowWindow('GameSingleMenu')
3481 if g_Game_IsClient
then
3482 g_GUI_ShowWindow('GameClientMenu')
3484 if g_Game_IsNet
then
3485 g_GUI_ShowWindow('GameServerMenu')
3487 g_GUI_ShowWindow('GameCustomMenu');
3490 g_GUI_ShowWindow('OptionsMenu');
3491 g_GUI_ShowWindow('OptionsVideoMenu');
3492 g_Sound_PlayEx('MENU_OPEN');
3495 procedure g_Menu_Show_OptionsSound();
3497 if gGameSettings
.GameType
= GT_SINGLE
then
3498 g_GUI_ShowWindow('GameSingleMenu')
3501 if g_Game_IsClient
then
3502 g_GUI_ShowWindow('GameClientMenu')
3504 if g_Game_IsNet
then
3505 g_GUI_ShowWindow('GameServerMenu')
3507 g_GUI_ShowWindow('GameCustomMenu');
3510 g_GUI_ShowWindow('OptionsMenu');
3511 g_GUI_ShowWindow('OptionsSoundMenu');
3512 g_Sound_PlayEx('MENU_OPEN');
3515 procedure g_Menu_Show_EndGameMenu();
3517 g_GUI_ShowWindow('EndGameMenu');
3518 g_Sound_PlayEx('MENU_OPEN');
3521 procedure g_Menu_Show_QuitGameMenu();
3523 g_GUI_ShowWindow('ExitMenu');
3524 g_Sound_PlayEx('MENU_OPEN');
3527 procedure g_Menu_Init();
3533 procedure g_Menu_Free();
3538 procedure g_Menu_Reset();
3542 g_GUI_SaveMenuPos();
3543 ex
:= g_GUI_Destroy();
3547 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3552 g_Game_SetDebugMode();
3554 g_GUI_LoadMenuPos();