1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
47 g_base
, g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
49 MAPDEF
, Math
, g_saveload
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
52 utils
, wadreader
, g_system
, r_game
;
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
111 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
113 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
118 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
120 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
121 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
122 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
124 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
126 g_Sound_SetupAllVolumes(
127 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
128 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
131 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
132 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
133 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
134 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
135 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
137 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
139 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
140 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
141 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
142 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
144 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
149 else gGibsCount
:= 48;
152 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
153 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
154 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
155 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
156 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
157 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
158 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
159 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
160 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
161 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
162 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
163 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
165 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
166 g_dbg_scale
:= TempScale
+ 1;
169 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
173 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
174 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
175 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
176 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
178 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
183 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
229 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
232 for i
:= WP_FIRST
to WP_LAST
do
234 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
236 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
241 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
287 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
290 for i
:= WP_FIRST
to WP_LAST
do
292 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
294 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
299 if e_HasJoysticks
then
301 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
304 for i
:= 0 to e_MaxJoys
- 1 do
305 if e_JoystickAvailable
[i
] then
306 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
310 if g_touch_enabled
then
312 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
313 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
314 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
315 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
316 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
321 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
322 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
323 TEAM_RED
, TEAM_BLUE
);
325 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
327 gPlayer1Settings
.Model
:= Model
.GetName();
328 gPlayer1Settings
.Color
:= Model
.Color
;
331 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
333 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
334 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
335 TEAM_RED
, TEAM_BLUE
);
336 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
338 gPlayer2Settings
.Model
:= Model
.GetName();
339 gPlayer2Settings
.Color
:= Model
.Color
;
342 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
343 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
345 if g_Game_IsServer
then
347 if gPlayer1
<> nil then
349 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
350 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
351 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
352 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
354 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
357 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
360 if gPlayer2
<> nil then
362 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
363 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
364 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
365 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
367 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
372 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
374 g_Console_WriteGameConfig
;
377 procedure ReadOptions();
382 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
384 with TGUISwitch(menu
.GetControl('swBPP')) do
390 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
391 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
393 with TGUISwitch(menu
.GetControl('swVSync')) do
394 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
396 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
397 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
399 with TGUISwitch(menu
.GetControl('swInterp')) do
400 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
404 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
405 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
406 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
408 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
409 if gMuteWhenInactive
then
414 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
416 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
417 if gSoundEffectsDF
then
422 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
423 if gUseChatSounds
then
428 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
454 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
457 for i
:= WP_FIRST
to WP_LAST
do
459 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
490 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
493 for i
:= WP_FIRST
to WP_LAST
do
495 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
500 if e_HasJoysticks
then
502 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
505 for i
:= 0 to e_MaxJoys
- 1 do
506 if e_JoystickAvailable
[i
] then
507 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
511 if g_touch_enabled
then
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
514 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
515 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
516 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
517 with TGUISwitch(menu
.GetControl('swTouchFire')) do
518 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
519 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
522 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
525 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
531 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
533 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
534 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
535 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
536 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
537 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
539 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
542 with TGUISwitch(menu
.GetControl('swBloodType')) do
543 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
545 with TGUISwitch(menu
.GetControl('swCorpseType')) do
546 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
548 with TGUISwitch(menu
.GetControl('swGibsType')) do
549 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
551 with TGUISwitch(menu
.GetControl('swGibsCount')) do
560 with TGUISwitch(menu
.GetControl('swBackGround')) do
561 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
563 with TGUISwitch(menu
.GetControl('swMessages')) do
564 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
566 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
567 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
569 with TGUISwitch(menu
.GetControl('swChatBubble')) do
570 ItemIndex
:= gChatBubble
;
572 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
573 ItemIndex
:= gPlayerIndicator
;
575 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
576 ItemIndex
:= gPlayerIndicatorStyle
;
578 TempScale
:= Round(g_dbg_scale
- 1);
579 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
581 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
583 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
584 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
586 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
587 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
589 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
590 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
591 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
593 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
595 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
596 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
598 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
599 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
601 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
602 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
603 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
605 ProcSelectModel(nil);
608 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
610 // don't turn off monsters in DM
612 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
613 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
614 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
616 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
619 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
622 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
626 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
628 // don't turn off monsters in DM
630 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
631 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
632 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
634 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
637 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
640 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
644 function LatchGameOptions(const MenuName
: string): Byte;
650 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
652 Map
:= TGUILabel(GetControl('lbMap')).Text;
655 if not isWadPath(Map
) then
658 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
659 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
660 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
661 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
662 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
663 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
664 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
668 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
669 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
670 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
671 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
672 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
673 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
674 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
675 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
676 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
677 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
679 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
680 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
681 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
682 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
685 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
686 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
687 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
688 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
691 // TODO: get this crap out of here
692 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
693 gGameSettings
.WarmupTime
:= gsWarmupTime
;
694 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
698 procedure ProcStartCustomGame();
702 GameMode
:= LatchGameOptions('mCustomGameMenu');
703 if GameMode
= GM_NONE
then Exit
;
705 g_Console_WriteGameConfig
;
706 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
707 gsMaxLives
, gsGameFlags
, gsPlayers
);
711 procedure ProcStartNetGame();
715 GameMode
:= LatchGameOptions('mNetServerMenu');
716 if GameMode
= GM_NONE
then Exit
;
718 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
720 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
721 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
722 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
723 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
724 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
725 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
728 g_Console_WriteGameConfig
;
729 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
730 gsGameFlags
, gsPlayers
, 0, NetPort
);
733 procedure ProcConnectNetGame();
737 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
739 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
740 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
741 PW
:= TGUIEdit(GetControl('edPW')).Text;
744 g_Console_WriteGameConfig
;
745 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
748 procedure ProcEnterPassword();
752 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
754 NetClientIP
:= PromptIP
;
755 NetClientPort
:= PromptPort
;
756 PW
:= TGUIEdit(GetControl('edPW')).Text;
759 g_Console_WriteGameConfig
;
760 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
763 procedure ProcServerlist();
765 if not NetInitDone
then
767 if (not g_Net_Init()) then
769 g_Console_Add('NET: ERROR: Failed to init ENet!');
776 g_Net_Slist_Set(NetMasterList
);
778 gState
:= STATE_SLIST
;
779 g_ActiveWindow
:= nil;
781 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
786 slReturnPressed
:= True;
787 if g_Net_Slist_Fetch(slCurrent
) then
789 if slCurrent
= nil then
790 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
793 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
794 g_Serverlist_GenerateTable(slCurrent
, slTable
);
797 procedure ProcStartCampaign();
803 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
805 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
806 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
808 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
814 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
817 procedure ProcSelectMap(Sender
: TGUIControl
);
821 wad
, map
, res
: String;
823 win
:= g_GUI_GetWindow('SelectMapMenu');
824 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
826 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
827 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
829 if (wad
= '') or (map
= '') then
830 begin // Ýòî íå êàðòà
831 TGUILabel(GetControl('lbMapName')).Text := '';
832 TGUILabel(GetControl('lbMapAuthor')).Text := '';
833 TGUILabel(GetControl('lbMapSize')).Text := '';
834 TGUIMemo(GetControl('meMapDescription')).SetText('');
835 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
836 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
842 a
:= g_Map_GetMapInfo(res
);
844 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
845 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
846 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
847 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
848 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
849 TGUILabel(win
.GetControl('lbMapScale')).Text :=
850 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
855 procedure ProcSelectWAD(Sender
: TGUIControl
);
860 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
862 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
864 with TGUIListBox(GetControl('lsMapRes')) do
870 list
:= g_Map_GetMapsList(wad
);
884 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
890 win
:= g_GUI_GetWindow('CampaignMenu');
891 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
893 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
897 TGUILabel(GetControl('lbWADName')).Text := '';
898 TGUILabel(GetControl('lbWADAuthor')).Text := '';
899 TGUIMemo(GetControl('meWADDescription')).SetText('');
902 a
:= g_Game_GetMegaWADInfo(wad
);
904 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
905 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
906 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
908 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
912 fn
:= g_ExtractWadName(a
.pic
);
914 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
916 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
921 procedure ProcChangeColor(Sender
: TGUIControl
);
925 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
926 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
927 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
928 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
929 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
930 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
932 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
933 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
934 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
935 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
936 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
937 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
940 procedure ProcSelectModel(Sender
: TGUIControl
);
945 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
946 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
947 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
949 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
950 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
951 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
953 ProcChangeColor(nil);
956 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
968 wad
:= TWADFile
.Create
;
969 if wad
.ReadFile(GameWAD
) then
970 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
975 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
977 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
978 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
979 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
980 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
982 if g_Texture_Get('FONT_STD', ID
) then
983 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
988 if cfglen
<> 0 then FreeMem(cfgdata
);
991 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
997 cfgdata
, fntdata
: Pointer;
998 cfglen
, fntlen
: Integer;
1006 wad
:= TWADFile
.Create
;
1007 if wad
.ReadFile(GameWAD
) then
1009 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1010 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1016 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1017 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1018 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1020 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1021 FontID
:= e_CharFont_Create(spc
);
1023 for a
:= 0 to 255 do
1025 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1026 if chrwidth
= 0 then Continue
;
1028 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1030 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1036 if cfglen
<> 0 then FreeMem(cfgdata
);
1037 if fntlen
<> 0 then FreeMem(fntdata
);
1040 procedure MenuLoadData();
1042 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1044 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1045 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1046 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1047 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1048 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1049 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1050 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1051 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1052 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1053 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1054 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1055 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1056 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1057 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1058 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1059 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1060 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1061 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1062 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1063 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1064 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1065 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1066 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1067 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1068 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1070 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1071 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1072 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1073 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1074 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1075 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1076 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1079 procedure MenuFreeData();
1081 e_CharFont_Remove(gMenuFont
);
1082 e_CharFont_Remove(gMenuSmallFont
);
1084 g_Texture_Delete('MAINMENU_LOGO');
1085 g_Texture_Delete('MAINMENU_MARKER1');
1086 g_Texture_Delete('MAINMENU_MARKER2');
1087 g_Texture_Delete('SCROLL_LEFT');
1088 g_Texture_Delete('SCROLL_RIGHT');
1089 g_Texture_Delete('SCROLL_MIDDLE');
1090 g_Texture_Delete('SCROLL_MARKER');
1091 g_Texture_Delete('EDIT_LEFT');
1092 g_Texture_Delete('EDIT_RIGHT');
1093 g_Texture_Delete('EDIT_MIDDLE');
1094 g_Texture_Delete('BOX1');
1095 g_Texture_Delete('BOX2');
1096 g_Texture_Delete('BOX3');
1097 g_Texture_Delete('BOX4');
1098 g_Texture_Delete('BOX5');
1099 g_Texture_Delete('BOX6');
1100 g_Texture_Delete('BOX7');
1101 g_Texture_Delete('BOX8');
1102 g_Texture_Delete('BOX9');
1103 g_Texture_Delete('BSCROLL_UP_A');
1104 g_Texture_Delete('BSCROLL_UP_U');
1105 g_Texture_Delete('BSCROLL_DOWN_A');
1106 g_Texture_Delete('BSCROLL_DOWN_U');
1107 g_Texture_Delete('BSCROLL_MIDDLE');
1108 g_Texture_Delete('NOPIC');
1110 g_Sound_Delete('MENU_SELECT');
1111 g_Sound_Delete('MENU_OPEN');
1112 g_Sound_Delete('MENU_CLOSE');
1113 g_Sound_Delete('MENU_CHANGE');
1114 g_Sound_Delete('SCROLL_ADD');
1115 g_Sound_Delete('SCROLL_SUB');
1116 g_Sound_Delete('SOUND_PLAYER_FALL');
1119 procedure ProcAuthorsMenu();
1121 gMusic
.SetByName('MUSIC_INTERMUS');
1125 procedure ProcExitMenuKeyDown (yes
: Boolean);
1128 snd
: TPlayableSound
;
1133 g_Game_StopAllSounds(True);
1134 case (Random(18)) of
1135 0: s
:= 'SOUND_MONSTER_PAIN';
1136 1: s
:= 'SOUND_MONSTER_DIE_3';
1137 2: s
:= 'SOUND_MONSTER_SLOP';
1138 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1139 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1140 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1141 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1142 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1143 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1144 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1145 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1146 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1147 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1148 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1149 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1150 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1151 else s
:= 'SOUND_PLAYER_FALL';
1153 snd
:= TPlayableSound
.Create();
1154 res
:= snd
.SetByName(s
);
1155 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1159 while snd
.IsPlaying() do begin end;
1167 procedure ProcLoadMenu();
1174 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1175 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1176 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1180 procedure ProcSaveMenu();
1188 name
:= g_GetSaveName(a
, valid
);
1189 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1190 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1194 procedure ProcSaveGame(Sender
: TGUIControl
);
1198 if g_Game_IsNet
then Exit
;
1199 if g_Game_IsTestMap
then Exit
;
1200 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1201 g_Game_PauseAllSounds(True);
1202 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1204 g_ActiveWindow
:= nil;
1205 g_Game_Pause(False);
1208 procedure ProcLoadGame(Sender
: TGUIControl
);
1212 if g_Game_IsNet
then Exit
;
1213 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1214 if g_LoadGame(a
) then
1216 g_Game_PauseAllSounds(False)
1218 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1220 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1221 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1222 //g_ActiveWindow := nil;
1226 procedure ProcSinglePlayer (n
: Integer);
1227 var wad
, map
: AnsiString;
1230 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1231 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1232 if e_FindResource(AllMapDirs
, wad
) then
1234 wad
:= ExpandFileName(wad
);
1235 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1239 procedure ProcSingle1Player
;
1244 procedure ProcSingle2Players
;
1249 procedure ProcSelectMapMenu();
1252 wad_lb
: TGUIFileListBox
;
1253 map_lb
: TGUIListBox
;
1256 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1257 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1258 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1260 if wad_lb
.SelectedItem() <> '' then
1261 map
:= map_lb
.SelectedItem()
1265 wad_lb
.UpdateFileList();
1268 if wad_lb
.SelectedItem() <> '' then
1271 map_lb
.SelectItem(map
);
1273 if map_lb
.SelectedItem() <> '' then
1277 g_GUI_ShowWindow('SelectMapMenu');
1280 procedure ProcSelectCampaignMenu();
1283 wad_lb
: TGUIFileListBox
;
1285 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1286 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1288 wad_lb
.UpdateFileList();
1290 if wad_lb
.SelectedItem() <> '' then
1291 ProcSelectCampaignWAD(nil);
1294 procedure ProcSetMap();
1296 wad
, map
, res
: String;
1298 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1300 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1301 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1304 if (wad
= '') or (map
= '') then
1307 wad
:= e_FindWadRel(MapDirs
, WAD
);
1309 res
:= wad
+':\'+map
;
1311 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1312 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1315 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1319 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1321 g_Sound_SetupAllVolumes(
1322 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1323 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1327 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1331 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1332 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1334 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1335 g_dbg_scale
:= TempScale
+ 1;
1339 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1343 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1344 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1345 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1346 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1349 procedure ProcOptionsPlayersMIMenu();
1354 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1356 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1358 if a
= '' then Exit
;
1360 i
:= g_PlayerModel_GetIndex(a
);
1361 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1363 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1364 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1365 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1367 if PlayerModelsArray
[i
].HaveWeapon
then
1368 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1370 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1373 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1376 procedure ProcOptionsPlayersAnim();
1380 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1385 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1388 Model
.AnimState
.Loop
:= True;
1392 procedure ProcOptionsPlayersWeap();
1396 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1401 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1405 procedure ProcOptionsPlayersRot();
1409 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1410 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1412 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1416 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1420 g_Options_SetDefault();
1426 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1428 if yes
then ReadOptions();
1432 procedure ProcAuthorsClose();
1434 gMusic
.SetByName('MUSIC_MENU');
1436 gState
:= STATE_MENU
;
1439 procedure ProcGMClose();
1441 g_Game_InGameMenu(False);
1444 procedure ProcGMShow();
1449 if (gGameSettings
.GameType
= GT_SINGLE
) and
1450 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1451 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1452 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1454 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1455 if g_Game_IsTestMap
then
1456 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1457 TGUIMainMenu(g_ActiveWindow
.GetControl(
1458 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1461 procedure ProcChangePlayers();
1463 TeamGame
, Spectator
, AddTwo
: Boolean;
1464 P1Team
{, P2Team}: Byte;
1465 bP2
: TGUITextButton
;
1467 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1468 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1469 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1470 P1Team
:= TEAM_NONE
;
1471 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1473 //P2Team := TEAM_NONE;
1474 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1476 TGUIMainMenu(g_ActiveWindow
.GetControl(
1477 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1478 TGUIMainMenu(g_ActiveWindow
.GetControl(
1479 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1480 TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1483 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1484 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1485 bP2
.Enabled
:= AddTwo
and not Spectator
;
1487 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1489 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1490 if gPlayer2
= nil then
1491 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1493 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1495 TGUIMainMenu(g_ActiveWindow
.GetControl(
1496 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1499 procedure ProcJoinRed();
1501 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1503 if g_Game_IsServer
then
1505 if gPlayer1
= nil then
1506 g_Game_AddPlayer(TEAM_RED
)
1509 if gPlayer1
.Team
<> TEAM_RED
then
1511 gPlayer1
.SwitchTeam
;
1512 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1515 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1520 gPlayer1Settings
.Team
:= TEAM_RED
;
1521 MC_SEND_PlayerSettings
;
1522 if gPlayer1
= nil then
1523 g_Game_AddPlayer(TEAM_RED
);
1525 g_ActiveWindow
:= nil;
1526 g_Game_Pause(False);
1529 procedure ProcJoinBlue();
1531 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1533 if g_Game_IsServer
then
1535 if gPlayer1
= nil then
1536 g_Game_AddPlayer(TEAM_BLUE
)
1539 if gPlayer1
.Team
<> TEAM_BLUE
then
1541 gPlayer1
.SwitchTeam
;
1542 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1545 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1550 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1551 MC_SEND_PlayerSettings
;
1552 if gPlayer1
= nil then
1553 g_Game_AddPlayer(TEAM_BLUE
);
1555 g_ActiveWindow
:= nil;
1556 g_Game_Pause(False);
1559 procedure ProcJoinGame();
1561 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1563 if gPlayer1
= nil then
1565 g_ActiveWindow
:= nil;
1566 g_Game_Pause(False);
1569 procedure ProcSwitchP2();
1571 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1573 if gPlayer1
= nil then
1575 if gPlayer2
= nil then
1578 g_Game_RemovePlayer();
1579 g_ActiveWindow
:= nil;
1580 g_Game_Pause(False);
1583 procedure ProcSpectate();
1585 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1588 g_ActiveWindow
:= nil;
1589 g_Game_Pause(False);
1592 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1594 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1597 procedure ProcEndMenuKeyDown (yes
: Boolean);
1599 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1602 procedure ProcSetRussianLanguage
;
1604 if gLanguage
<> LANGUAGE_RUSSIAN
then
1606 gLanguage
:= LANGUAGE_RUSSIAN
;
1607 gLanguageChange
:= True;
1608 gAskLanguage
:= False;
1613 procedure ProcSetEnglishLanguage
;
1615 if gLanguage
<> LANGUAGE_ENGLISH
then
1617 gLanguage
:= LANGUAGE_ENGLISH
;
1618 gLanguageChange
:= True;
1619 gAskLanguage
:= False;
1624 procedure ReadGameSettings();
1628 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1630 with gGameSettings
do
1632 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1633 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1637 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1638 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1640 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1642 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1646 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1647 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1652 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1653 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1654 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1656 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1657 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1658 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1661 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1666 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1668 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1669 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1670 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1672 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1673 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1677 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1678 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1680 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1681 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1682 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1683 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1684 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1685 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1686 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1690 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1691 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1692 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1693 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1694 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1699 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1700 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1705 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1706 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1711 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1712 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1717 procedure ProcApplyGameSet();
1721 stat
: TPlayerStatArray
;
1723 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1725 if not g_Game_IsServer
then Exit
;
1727 with gGameSettings
do
1729 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1731 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1732 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1734 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1737 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1739 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1740 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1741 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1742 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1743 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1747 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1749 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1750 Options
:= Options
or GAME_OPTION_DMKEYS
1752 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1755 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1757 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1763 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1765 TimeLimit
:= Max(n
, b
);
1769 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1771 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1778 if GameMode
= GM_DM
then
1780 stat
:= g_Player_GetStats();
1782 for a
:= 0 to High(stat
) do
1783 if stat
[a
].Frags
> b
then
1787 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1789 GoalLimit
:= Max(n
, b
);
1793 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1795 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1796 if n
< 0 then n
:= 0;
1797 if n
> 255 then n
:= 255;
1803 stat
:= g_Player_GetStats();
1805 for a
:= 0 to High(stat
) do
1806 if stat
[a
].Lives
> b
then
1809 MaxLives
:= Max(n
, b
);
1813 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1815 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1818 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1819 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1823 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1824 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1828 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1829 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1834 // don't forget to latch this shit
1835 gsGameFlags
:= Options
;
1836 gsMaxLives
:= MaxLives
;
1837 gsGoalLimit
:= GoalLimit
;
1838 gsTimeLimit
:= TimeLimit
;
1841 if g_Game_IsNet
then MH_SEND_GameSettings
;
1844 procedure ProcVideoOptionsRes();
1849 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1851 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1852 IntToStr(gWinSizeX
) +
1853 ' x ' + IntToStr(gWinSizeY
) +
1854 ', ' + IntToStr(gBPP
) + ' bpp';
1856 with TGUIListBox(menu
.GetControl('lsResolution')) do
1858 list
:= sys_GetDisplayModes(gBPP
);
1862 ItemIndex
:= Length(list
)
1870 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1876 TempResScale
:= Round(r_pixel_scale
- 1);
1877 with TGUISwitch(menu
.GetControl('swResFactor')) do
1878 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1881 procedure ProcApplyVideoOptions();
1884 Fullscreen
: Boolean;
1885 SWidth
, SHeight
: Integer;
1886 ScaleChanged
: Boolean;
1889 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1891 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1893 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1896 SWidth
:= gWinSizeX
;
1897 SHeight
:= gWinSizeY
;
1898 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1901 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1903 ScaleChanged
:= False;
1904 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1906 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1907 r_pixel_scale
:= TempResScale
+ 1;
1908 ScaleChanged
:= True;
1911 if (SWidth
<> gWinSizeX
) or
1912 (SHeight
<> gWinSizeY
) or
1913 (Fullscreen
<> gFullscreen
) or
1916 gResolutionChange
:= True;
1917 gRC_Width
:= SWidth
;
1918 gRC_Height
:= SHeight
;
1919 gRC_FullScreen
:= Fullscreen
;
1920 gRC_Maximized
:= gWinMaximized
;
1923 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1927 procedure ProcSetFirstRussianLanguage
;
1929 gLanguage
:= LANGUAGE_RUSSIAN
;
1930 gLanguageChange
:= True;
1931 gAskLanguage
:= False;
1934 procedure ProcSetFirstEnglishLanguage
;
1936 gLanguage
:= LANGUAGE_ENGLISH
;
1937 gLanguageChange
:= True;
1938 gAskLanguage
:= False;
1941 procedure ProcRecallAddress();
1943 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1945 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1946 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1950 procedure CreateFirstLanguageMenu();
1954 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1956 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1958 Name
:= 'mmFirstLanguageMenu';
1959 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1960 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1963 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1964 Menu
.MainWindow
:= True;
1965 g_GUI_AddWindow(Menu
);
1968 procedure g_Menu_AskLanguage();
1970 CreateFirstLanguageMenu();
1971 g_GUI_ShowWindow('FirstLanguageMenu');
1974 procedure CreatePlayerOptionsMenu(s
: String);
1979 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1981 a
:= _lc
[I_MENU_PLAYER_1
]
1983 a
:= _lc
[I_MENU_PLAYER_2
];
1984 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1986 Name
:= 'mOptionsPlayers'+s
+'Menu';
1987 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1989 Name
:= 'ed'+s
+'Name';
1993 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1995 Name
:= 'sw'+s
+'Team';
1996 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1997 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1999 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2001 Name
:= 'ls'+s
+'Model';
2003 Items
:= g_PlayerModel_GetNames();
2004 OnChange
:= ProcSelectModel
;
2006 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2008 Name
:= 'sc'+s
+'Red';
2010 OnChange
:= ProcChangeColor
;
2012 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2014 Name
:= 'sc'+s
+'Green';
2016 OnChange
:= ProcChangeColor
;
2018 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2020 Name
:= 'sc'+s
+'Blue';
2022 OnChange
:= ProcChangeColor
;
2025 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2026 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2027 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2028 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2030 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2032 Name
:= 'mv'+s
+'Model';
2033 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2034 Y
:= GetControl('ls'+s
+'Model').Y
;
2037 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2038 g_GUI_AddWindow(Menu
);
2041 procedure CreateAllMenus();
2045 a
, cx
, _y
, i
: Integer;
2048 Menu
:= TGUIWindow
.Create('MainMenu');
2049 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2051 Name
:= 'mmMainMenu';
2052 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2053 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2054 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2055 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2056 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2057 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2059 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2061 Color
:= _RGB(255, 255, 255);
2062 X
:= gScreenWidth
-GetWidth
-8;
2063 Y
:= gScreenHeight
-GetHeight
-8;
2065 Menu
.DefControl
:= 'mmMainMenu';
2066 Menu
.MainWindow
:= True;
2067 g_GUI_AddWindow(Menu
);
2069 Menu
:= TGUIWindow
.Create('NewGameMenu');
2070 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2072 Name
:= 'mmNewGameMenu';
2073 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2074 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2075 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2076 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2078 Menu
.DefControl
:= 'mmNewGameMenu';
2079 g_GUI_AddWindow(Menu
);
2081 Menu
:= TGUIWindow
.Create('NetGameMenu');
2082 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2084 Name
:= 'mmNetGameMenu';
2085 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2086 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2088 Menu
.DefControl
:= 'mmNetGameMenu';
2089 g_GUI_AddWindow(Menu
);
2091 Menu
:= TGUIWindow
.Create('NetServerMenu');
2092 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2094 Name
:= 'mNetServerMenu';
2095 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2097 Name
:= 'edSrvName';
2098 OnlyDigits
:= False;
2101 Text := NetServerName
;
2103 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2105 Name
:= 'edSrvPassword';
2106 OnlyDigits
:= False;
2109 Text := NetPassword
;
2111 with AddEdit(_lc
[I_NET_PORT
]) do
2117 Text := IntToStr(NetPort
);
2119 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2121 Name
:= 'edMaxPlayers';
2125 Text := IntToStr(NetMaxClients
);
2127 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2129 Name
:= 'swUseMaster';
2130 AddItem(_lc
[I_MENU_YES
]);
2131 AddItem(_lc
[I_MENU_NO
]);
2132 if NetUseMaster
then
2138 with AddLabel(_lc
[I_MENU_MAP
]) do
2143 OnClick
:= @ProcSelectMapMenu
;
2145 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2147 Name
:= 'swGameMode';
2148 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2149 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2150 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2151 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2152 case g_Game_TextToMode(gsGameMode
) of
2154 GM_DM
: ItemIndex
:= 0;
2155 GM_TDM
: ItemIndex
:= 1;
2156 GM_CTF
: ItemIndex
:= 2;
2158 GM_COOP
: ItemIndex
:= 3;
2160 OnChange
:= ProcSwitchMonstersCustom
;
2162 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2164 Name
:= 'edTimeLimit';
2168 if gsTimeLimit
> 0 then
2169 Text := IntToStr(gsTimeLimit
);
2171 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2173 Name
:= 'edGoalLimit';
2177 if gsGoalLimit
> 0 then
2178 Text := IntToStr(gsGoalLimit
);
2180 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2182 Name
:= 'edMaxLives';
2186 if gsMaxLives
> 0 then
2187 Text := IntToStr(gsMaxLives
);
2189 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2191 Name
:= 'edItemRespawnTime';
2195 if gsItemRespawnTime
> 0 then
2196 Text := IntToStr(gsItemRespawnTime
);
2198 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2200 Name
:= 'swPlayers';
2201 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2202 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2203 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2204 ItemIndex
:= gsPlayers
;
2206 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2208 Name
:= 'swTeamDamage';
2209 AddItem(_lc
[I_MENU_YES
]);
2210 AddItem(_lc
[I_MENU_NO
]);
2211 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2216 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2218 Name
:= 'swTeamHit';
2219 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2220 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2221 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2222 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2223 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2225 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2227 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2232 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2234 Name
:= 'swDeathmatchKeys';
2235 AddItem(_lc
[I_MENU_YES
]);
2236 AddItem(_lc
[I_MENU_NO
]);
2237 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2242 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2244 Name
:= 'swEnableExits';
2245 AddItem(_lc
[I_MENU_YES
]);
2246 AddItem(_lc
[I_MENU_NO
]);
2247 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2252 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2254 Name
:= 'swWeaponStay';
2255 AddItem(_lc
[I_MENU_YES
]);
2256 AddItem(_lc
[I_MENU_NO
]);
2257 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2262 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2264 Name
:= 'swMonsters';
2265 AddItem(_lc
[I_MENU_YES
]);
2266 AddItem(_lc
[I_MENU_NO
]);
2267 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2272 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2275 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2276 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2277 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2279 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2281 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2285 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2289 Menu
.DefControl
:= 'mNetServerMenu';
2290 g_GUI_AddWindow(Menu
);
2292 Menu
:= TGUIWindow
.Create('NetClientMenu');
2293 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2295 Name
:= 'mNetClientMenu';
2297 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2300 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2306 Text := 'localhost';
2308 with AddEdit(_lc
[I_NET_PORT
]) do
2316 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2319 OnlyDigits
:= False;
2326 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2330 Menu
.DefControl
:= 'mNetClientMenu';
2331 g_GUI_AddWindow(Menu
);
2333 Menu
:= TGUIWindow
.Create('LoadMenu');
2334 Menu
.OnShow
:= ProcLoadMenu
;
2335 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2337 Name
:= 'mmLoadMenu';
2342 Name
:= 'edSlot'+IntToStr(a
);
2345 OnEnter
:= ProcLoadGame
;
2348 Menu
.DefControl
:= 'mmLoadMenu';
2349 g_GUI_AddWindow(Menu
);
2351 Menu
:= TGUIWindow
.Create('SaveMenu');
2352 Menu
.OnShow
:= ProcSaveMenu
;
2353 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2355 Name
:= 'mmSaveMenu';
2360 Name
:= 'edSlot'+IntToStr(a
);
2363 OnChange
:= ProcSaveGame
;
2366 Menu
.DefControl
:= 'mmSaveMenu';
2367 g_GUI_AddWindow(Menu
);
2369 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2370 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2372 Name
:= 'mCustomGameMenu';
2373 with AddLabel(_lc
[I_MENU_MAP
]) do
2378 OnClick
:= @ProcSelectMapMenu
;
2380 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2382 Name
:= 'swGameMode';
2383 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2384 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2385 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2386 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2387 case g_Game_TextToMode(gsGameMode
) of
2389 GM_DM
: ItemIndex
:= 0;
2390 GM_TDM
: ItemIndex
:= 1;
2391 GM_CTF
: ItemIndex
:= 2;
2393 GM_COOP
: ItemIndex
:= 3;
2395 OnChange
:= ProcSwitchMonstersCustom
;
2397 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2399 Name
:= 'edTimeLimit';
2403 if gsTimeLimit
> 0 then
2404 Text := IntToStr(gsTimeLimit
);
2406 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2408 Name
:= 'edGoalLimit';
2412 if gsGoalLimit
> 0 then
2413 Text := IntToStr(gsGoalLimit
);
2415 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2417 Name
:= 'edMaxLives';
2421 if gsMaxLives
> 0 then
2422 Text := IntToStr(gsMaxLives
);
2424 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2426 Name
:= 'edItemRespawnTime';
2430 if gsItemRespawnTime
> 0 then
2431 Text := IntToStr(gsItemRespawnTime
);
2433 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2435 Name
:= 'swPlayers';
2436 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2437 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2438 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2439 ItemIndex
:= gsPlayers
;
2441 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2443 Name
:= 'swTeamDamage';
2444 AddItem(_lc
[I_MENU_YES
]);
2445 AddItem(_lc
[I_MENU_NO
]);
2446 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2451 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2453 Name
:= 'swTeamHit';
2454 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2455 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2456 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2457 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2458 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2460 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2462 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2467 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2469 Name
:= 'swDeathmatchKeys';
2470 AddItem(_lc
[I_MENU_YES
]);
2471 AddItem(_lc
[I_MENU_NO
]);
2472 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2477 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2479 Name
:= 'swEnableExits';
2480 AddItem(_lc
[I_MENU_YES
]);
2481 AddItem(_lc
[I_MENU_NO
]);
2482 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2487 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2489 Name
:= 'swWeaponStay';
2490 AddItem(_lc
[I_MENU_YES
]);
2491 AddItem(_lc
[I_MENU_NO
]);
2492 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2497 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2499 Name
:= 'swMonsters';
2500 AddItem(_lc
[I_MENU_YES
]);
2501 AddItem(_lc
[I_MENU_NO
]);
2502 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2507 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2510 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2511 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2512 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2514 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2516 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2520 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2524 Menu
.DefControl
:= 'mCustomGameMenu';
2525 g_GUI_AddWindow(Menu
);
2527 Menu
:= TGUIWindow
.Create('CampaignMenu');
2528 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2530 Name
:= 'mCampaignMenu';
2539 with AddFileList('', 15, 4) do
2542 OnChange
:= ProcSelectCampaignWAD
;
2546 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2547 SetBase(MegawadDirs
);
2550 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2552 Name
:= 'lbWADName';
2556 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2558 Name
:= 'lbWADAuthor';
2562 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2563 with AddMemo('', 15, 3) do
2565 Name
:= 'meWADDescription';
2566 Color
:= MENU_ITEMSCTRL_COLOR
;
2568 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2570 Name
:= 'swPlayers';
2571 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2572 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2575 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2579 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2581 Name
:= 'mpWADImage';
2582 DefaultRes
:= 'NOPIC';
2583 X
:= GetControl('lsWAD').X
+4;
2584 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2587 Menu
.DefControl
:= 'mCampaignMenu';
2588 g_GUI_AddWindow(Menu
);
2590 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2591 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2593 Name
:= 'mSelectMapMenu';
2594 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2597 OnChange
:= ProcSelectWAD
;
2601 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2604 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2608 OnChange
:= ProcSelectMap
;
2611 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2613 Name
:= 'lbMapName';
2617 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2619 Name
:= 'lbMapAuthor';
2623 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2625 Name
:= 'lbMapSize';
2629 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2631 Name
:= 'meMapDescription';
2636 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2638 Name
:= 'mpMapPreview';
2639 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2640 Y
:= GetControl('lsMapWAD').Y
;
2642 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2644 Name
:= 'lbMapScale';
2647 Color
:= MENU_ITEMSCTRL_COLOR
;
2648 X
:= GetControl('lsMapWAD').X
+
2649 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2650 2 + MAPPREVIEW_WIDTH
*4;
2651 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2654 Menu
.OnClose
:= ProcSetMap
;
2655 Menu
.DefControl
:= 'mSelectMapMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= TGUIWindow
.Create('OptionsMenu');
2659 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2661 Name
:= 'mmOptionsMenu';
2662 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2663 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2664 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2665 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2666 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2667 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2669 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2670 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2672 Menu
.OnClose
:= ProcApplyOptions
;
2673 Menu
.DefControl
:= 'mmOptionsMenu';
2674 g_GUI_AddWindow(Menu
);
2676 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2677 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2678 g_GUI_AddWindow(Menu
);
2680 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2681 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2683 Name
:= 'mOptionsVideoMenu';
2684 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2685 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2691 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2694 AddItem(_lc
[I_MENU_YES
]);
2695 AddItem(_lc
[I_MENU_NO
]);
2697 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2699 Name
:= 'swTextureFilter';
2700 AddItem(_lc
[I_MENU_YES
]);
2701 AddItem(_lc
[I_MENU_NO
]);
2703 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2706 AddItem(_lc
[I_MENU_YES
]);
2707 AddItem(_lc
[I_MENU_NO
]);
2709 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2711 Name
:= 'swLegacyNPOT';
2712 AddItem(_lc
[I_MENU_NO
]);
2713 AddItem(_lc
[I_MENU_YES
]);
2716 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2719 Menu
.DefControl
:= 'mOptionsVideoMenu';
2720 g_GUI_AddWindow(Menu
);
2722 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2723 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2725 Name
:= 'mOptionsVideoResMenu';
2726 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2728 Name
:= 'lbCurrentRes';
2732 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2734 Name
:= 'lsResolution';
2737 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2739 Name
:= 'swFullScreen';
2740 AddItem(_lc
[I_MENU_YES
]);
2741 AddItem(_lc
[I_MENU_NO
]);
2743 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2745 Name
:= 'swResFactor';
2747 for i
:= 2 to gRC_Width
div 640 do
2748 AddItem(IntToStr(i
) + 'x');
2751 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2754 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2755 g_GUI_AddWindow(Menu
);
2757 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2758 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2760 Name
:= 'mOptionsSoundMenu';
2761 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2763 Name
:= 'scMusicLevel';
2765 OnChange
:= ProcChangeSoundSettings
;
2767 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2769 Name
:= 'scSoundLevel';
2771 OnChange
:= ProcChangeSoundSettings
;
2773 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2775 Name
:= 'scMaxSimSounds';
2778 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2780 Name
:= 'swAnnouncer';
2781 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2782 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2783 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2784 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2786 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2787 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2789 Name
:= 'swSoundEffects';
2790 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2791 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2793 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2794 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2796 Name
:= 'swChatSpeech';
2797 AddItem(_lc
[I_MENU_YES
]);
2798 AddItem(_lc
[I_MENU_NO
]);
2800 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2802 Name
:= 'swInactiveSounds';
2803 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2804 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2808 Menu
.DefControl
:= 'mOptionsSoundMenu';
2809 g_GUI_AddWindow(Menu
);
2811 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2812 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2814 Name
:= 'mOptionsGameMenu';
2815 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2817 Name
:= 'scParticlesCount';
2820 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2822 Name
:= 'swBloodCount';
2823 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2824 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2825 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2826 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2827 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2829 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2831 Name
:= 'scShellsMax';
2834 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2836 Name
:= 'scGibsMax';
2839 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2841 Name
:= 'scCorpsesMax';
2844 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2846 Name
:= 'swGibsCount';
2847 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2848 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2849 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2850 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2851 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2853 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2855 Name
:= 'swCorpseType';
2856 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2857 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2859 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2861 Name
:= 'swGibsType';
2862 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2863 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2865 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2867 Name
:= 'swBloodType';
2868 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2869 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2871 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2873 Name
:= 'swScreenFlash';
2874 AddItem(_lc
[I_MENU_NO
]);
2875 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2876 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2878 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2880 Name
:= 'swBackground';
2881 AddItem(_lc
[I_MENU_YES
]);
2882 AddItem(_lc
[I_MENU_NO
]);
2884 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2886 Name
:= 'swMessages';
2887 AddItem(_lc
[I_MENU_YES
]);
2888 AddItem(_lc
[I_MENU_NO
]);
2890 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2892 Name
:= 'swRevertPlayers';
2893 AddItem(_lc
[I_MENU_YES
]);
2894 AddItem(_lc
[I_MENU_NO
]);
2896 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2898 Name
:= 'swChatBubble';
2899 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2900 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2901 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2902 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2903 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2905 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2907 Name
:= 'swPlayerIndicator';
2908 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2909 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2910 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2912 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2914 Name
:= 'swPlayerIndicatorStyle';
2915 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2916 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2918 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2920 Name
:= 'scScaleFactor';
2922 OnChange
:= ProcChangeGameSettings
;
2926 Menu
.DefControl
:= 'mOptionsGameMenu';
2927 g_GUI_AddWindow(Menu
);
2929 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2930 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2932 Name
:= 'mOptionsControlsMenu';
2933 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2934 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2935 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2936 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2937 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2939 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2940 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2941 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2942 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2943 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2944 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2945 if e_HasJoysticks
then
2948 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2950 if g_touch_enabled
then
2953 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2956 Menu
.DefControl
:= 'mOptionsControlsMenu';
2957 g_GUI_AddWindow(Menu
);
2959 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2960 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2962 Name
:= 'mOptionsControlsP1Menu';
2963 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2964 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2965 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2966 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2967 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2968 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2974 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2975 g_GUI_AddWindow(Menu
);
2977 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2978 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2980 Name
:= 'mOptionsControlsP1MenuWeapons';
2981 for i
:= WP_FIRST
to WP_LAST
do
2982 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2983 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2985 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2986 g_GUI_AddWindow(Menu
);
2988 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2989 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2991 Name
:= 'mOptionsControlsP2Menu';
2992 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2993 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2994 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2995 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2996 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2997 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2998 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3003 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3004 g_GUI_AddWindow(Menu
);
3006 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3007 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3009 Name
:= 'mOptionsControlsP2MenuWeapons';
3010 for i
:= WP_FIRST
to WP_LAST
do
3011 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3012 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3014 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3015 g_GUI_AddWindow(Menu
);
3017 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3018 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3020 Name
:= 'mOptionsControlsJoystickMenu';
3021 for i
:= 0 to e_MaxJoys
- 1 do
3022 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3024 Name
:= 'scDeadzone' + IntToStr(i
);
3028 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3029 g_GUI_AddWindow(Menu
);
3031 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3032 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3034 Name
:= 'mOptionsControlsTouchMenu';
3035 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3037 Name
:= 'swTouchAlt';
3038 AddItem(_lc
[I_MENU_NO
]);
3039 AddItem(_lc
[I_MENU_YES
]);
3040 OnChange
:= ProcChangeTouchSettings
;
3042 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3044 Name
:= 'scTouchSize';
3046 OnChange
:= ProcChangeTouchSettings
;
3048 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3050 Name
:= 'swTouchFire';
3051 AddItem(_lc
[I_MENU_NO
]);
3052 AddItem(_lc
[I_MENU_YES
]);
3054 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3056 Name
:= 'scTouchOffset';
3058 OnChange
:= ProcChangeTouchSettings
;
3061 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3062 g_GUI_AddWindow(Menu
);
3064 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3065 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3067 Name
:= 'mOptionsPlayersMenu';
3068 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3069 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3071 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3072 g_GUI_AddWindow(Menu
);
3074 CreatePlayerOptionsMenu('P1');
3075 CreatePlayerOptionsMenu('P2');
3077 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3078 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3080 Name
:= 'mOptionsPlayersMIMenu';
3081 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3086 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3091 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3093 Name
:= 'meComment';
3096 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3097 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3100 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3104 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3105 g_GUI_AddWindow(Menu
);
3107 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3108 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3110 Name
:= 'mOptionsLanguageMenu';
3111 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3112 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3115 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3116 g_GUI_AddWindow(Menu
);
3118 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3119 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3120 g_GUI_AddWindow(Menu
);
3122 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3123 Menu
.BackTexture
:= 'INTER';
3124 Menu
.OnClose
:= ProcAuthorsClose
;
3128 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3130 Color
:= _RGB(255, 0, 0);
3131 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3133 _y
:= _y
+GetHeight();
3135 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3137 Color
:= _RGB(255, 0, 0);
3138 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3140 _y
:= _y
+GetHeight()+32;
3142 // ×òî äåëàë: Êòî äåëàë
3143 cx
:= gScreenWidth
div 2 - 320 + 64;
3144 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3146 Color
:= _RGB(255, 0, 0);
3151 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3153 Color
:= _RGB(255, 255, 255);
3158 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3160 Color
:= _RGB(255, 0, 0);
3165 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3167 Color
:= _RGB(255, 255, 255);
3172 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3174 Color
:= _RGB(255, 255, 255);
3179 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3181 Color
:= _RGB(255, 0, 0);
3186 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3188 Color
:= _RGB(255, 255, 255);
3193 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3195 Color
:= _RGB(255, 0, 0);
3200 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3202 Color
:= _RGB(255, 255, 255);
3205 _y
:= gScreenHeight
- 128;
3208 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3210 Color
:= _RGB(255, 0, 0);
3215 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3217 Color
:= _RGB(255, 255, 255);
3220 _y
:= _y
+GetHeight();
3222 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3224 Color
:= _RGB(255, 255, 255);
3227 _y
:= _y
+GetHeight();
3229 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3231 Color
:= _RGB(255, 255, 255);
3234 _y
:= gScreenHeight
- 32;
3236 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3238 Color
:= _RGB(255, 0, 0);
3239 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3242 g_GUI_AddWindow(Menu
);
3244 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3245 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3246 g_GUI_AddWindow(Menu
);
3248 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3249 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3251 Name
:= 'mmGameSingleMenu';
3252 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3253 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3254 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3255 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3256 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3257 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3259 Menu
.DefControl
:= 'mmGameSingleMenu';
3260 Menu
.MainWindow
:= True;
3261 Menu
.OnClose
:= ProcGMClose
;
3262 Menu
.OnShow
:= ProcGMShow
;
3263 g_GUI_AddWindow(Menu
);
3265 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3266 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3267 g_GUI_AddWindow(Menu
);
3269 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3270 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3271 g_GUI_AddWindow(Menu
);
3273 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3274 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3276 Name
:= 'mmGameCustomMenu';
3277 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3278 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3279 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3280 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3281 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3282 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3283 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3285 Menu
.DefControl
:= 'mmGameCustomMenu';
3286 Menu
.MainWindow
:= True;
3287 Menu
.OnClose
:= ProcGMClose
;
3288 Menu
.OnShow
:= ProcGMShow
;
3289 g_GUI_AddWindow(Menu
);
3291 Menu
:= TGUIWindow
.Create('GameServerMenu');
3292 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3294 Name
:= 'mmGameServerMenu';
3295 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3296 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3297 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3298 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3299 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3301 Menu
.DefControl
:= 'mmGameServerMenu';
3302 Menu
.MainWindow
:= True;
3303 Menu
.OnClose
:= ProcGMClose
;
3304 Menu
.OnShow
:= ProcGMShow
;
3305 g_GUI_AddWindow(Menu
);
3307 Menu
:= TGUIWindow
.Create('GameClientMenu');
3308 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3310 Name
:= 'mmGameClientMenu';
3311 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3312 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3313 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3315 Menu
.DefControl
:= 'mmGameClientMenu';
3316 Menu
.MainWindow
:= True;
3317 Menu
.OnClose
:= ProcGMClose
;
3318 Menu
.OnShow
:= ProcGMShow
;
3319 g_GUI_AddWindow(Menu
);
3321 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3322 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3324 Name
:= 'mClientPasswordMenu';
3325 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3333 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3336 Menu
.DefControl
:= 'mClientPasswordMenu';
3337 g_GUI_AddWindow(Menu
);
3339 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3340 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3342 Name
:= 'mGameSetGameMenu';
3343 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3345 Name
:= 'swTeamDamage';
3346 AddItem(_lc
[I_MENU_YES
]);
3347 AddItem(_lc
[I_MENU_NO
]);
3350 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3352 Name
:= 'swTeamHit';
3353 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3354 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3355 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3356 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3359 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3361 Name
:= 'swDeathmatchKeys';
3362 AddItem(_lc
[I_MENU_YES
]);
3363 AddItem(_lc
[I_MENU_NO
]);
3366 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3368 Name
:= 'edTimeLimit';
3373 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3375 Name
:= 'edGoalLimit';
3380 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3382 Name
:= 'edMaxLives';
3387 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3390 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3391 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3392 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3398 Menu
.DefControl
:= 'mGameSetGameMenu';
3399 Menu
.OnClose
:= ProcApplyGameSet
;
3400 g_GUI_AddWindow(Menu
);
3402 Menu
:= TGUIWindow
.Create('TeamMenu');
3403 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3405 Name
:= 'mmTeamMenu';
3406 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3407 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3408 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3409 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3410 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3412 Menu
.DefControl
:= 'mmTeamMenu';
3413 Menu
.OnShow
:= ProcChangePlayers
;
3414 g_GUI_AddWindow(Menu
);
3417 procedure g_Menu_Show_SaveMenu();
3419 if g_Game_IsTestMap
then
3421 if gGameSettings
.GameType
= GT_SINGLE
then
3422 g_GUI_ShowWindow('GameSingleMenu')
3425 if g_Game_IsClient
then
3428 if g_Game_IsNet
then
3431 g_GUI_ShowWindow('GameCustomMenu');
3433 g_GUI_ShowWindow('SaveMenu');
3434 g_Sound_PlayEx('MENU_OPEN');
3437 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3439 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3440 if gGameSettings
.GameType
= GT_SINGLE
then
3442 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3446 if g_Game_IsClient
then exit
;
3447 if g_Game_IsNet
then exit
;
3448 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3450 g_GUI_ShowWindow('LoadMenu');
3451 g_Sound_PlayEx('MENU_OPEN');
3454 procedure g_Menu_Show_GameSetGame();
3456 if gGameSettings
.GameType
= GT_SINGLE
then
3457 g_GUI_ShowWindow('GameSingleMenu')
3460 if g_Game_IsClient
then
3463 if g_Game_IsNet
then
3464 g_GUI_ShowWindow('GameServerMenu')
3466 g_GUI_ShowWindow('GameCustomMenu');
3469 g_GUI_ShowWindow('GameSetGameMenu');
3470 g_Sound_PlayEx('MENU_OPEN');
3473 procedure g_Menu_Show_OptionsVideo();
3475 if gGameSettings
.GameType
= GT_SINGLE
then
3476 g_GUI_ShowWindow('GameSingleMenu')
3479 if g_Game_IsClient
then
3480 g_GUI_ShowWindow('GameClientMenu')
3482 if g_Game_IsNet
then
3483 g_GUI_ShowWindow('GameServerMenu')
3485 g_GUI_ShowWindow('GameCustomMenu');
3488 g_GUI_ShowWindow('OptionsMenu');
3489 g_GUI_ShowWindow('OptionsVideoMenu');
3490 g_Sound_PlayEx('MENU_OPEN');
3493 procedure g_Menu_Show_OptionsSound();
3495 if gGameSettings
.GameType
= GT_SINGLE
then
3496 g_GUI_ShowWindow('GameSingleMenu')
3499 if g_Game_IsClient
then
3500 g_GUI_ShowWindow('GameClientMenu')
3502 if g_Game_IsNet
then
3503 g_GUI_ShowWindow('GameServerMenu')
3505 g_GUI_ShowWindow('GameCustomMenu');
3508 g_GUI_ShowWindow('OptionsMenu');
3509 g_GUI_ShowWindow('OptionsSoundMenu');
3510 g_Sound_PlayEx('MENU_OPEN');
3513 procedure g_Menu_Show_EndGameMenu();
3515 g_GUI_ShowWindow('EndGameMenu');
3516 g_Sound_PlayEx('MENU_OPEN');
3519 procedure g_Menu_Show_QuitGameMenu();
3521 g_GUI_ShowWindow('ExitMenu');
3522 g_Sound_PlayEx('MENU_OPEN');
3525 procedure g_Menu_Init();
3531 procedure g_Menu_Free();
3536 procedure g_Menu_Reset();
3540 g_GUI_SaveMenuPos();
3541 ex
:= g_GUI_Destroy();
3545 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3550 g_Game_SetDebugMode();
3552 g_GUI_LoadMenuPos();