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;
45 {$INCLUDE ../nogl/noGLuses.inc}
46 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
, e_res
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
52 utils
, wadreader
, g_system
;
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();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
128 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
130 g_Sound_SetupAllVolumes(
131 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
132 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
135 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
136 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
137 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
138 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
139 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
141 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
143 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
145 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
146 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
148 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
153 else gGibsCount
:= 48;
156 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
157 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
158 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
159 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
160 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
161 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
162 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
163 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
164 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
165 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
166 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
167 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
169 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
170 g_dbg_scale
:= TempScale
+ 1;
173 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
177 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
178 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
179 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
187 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
236 for i
:= WP_FIRST
to WP_LAST
do
238 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
240 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
245 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
291 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
294 for i
:= WP_FIRST
to WP_LAST
do
296 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
298 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
303 if e_HasJoysticks
then
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
308 for i
:= 0 to e_MaxJoys
- 1 do
309 if e_JoystickAvailable
[i
] then
310 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
314 if g_touch_enabled
then
316 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
317 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
318 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
319 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
320 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
325 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
326 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
327 TEAM_RED
, TEAM_BLUE
);
329 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
331 gPlayer1Settings
.Model
:= Model
.Name
;
332 gPlayer1Settings
.Color
:= Model
.Color
;
335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
337 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
338 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
339 TEAM_RED
, TEAM_BLUE
);
340 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
342 gPlayer2Settings
.Model
:= Model
.Name
;
343 gPlayer2Settings
.Color
:= Model
.Color
;
346 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
347 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
349 if g_Game_IsServer
then
351 if gPlayer1
<> nil then
353 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
354 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
355 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
356 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
358 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
361 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
364 if gPlayer2
<> nil then
366 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
367 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
368 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
369 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
371 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
376 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
378 s
:= e_GetWriteableDir(ConfigDirs
);
380 g_Options_Write(s
+ '/' + CONFIG_FILENAME
);
381 g_Console_WriteGameConfig
;
384 procedure ReadOptions();
389 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
391 with TGUISwitch(menu
.GetControl('swBPP')) do
397 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
398 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swVSync')) do
401 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
404 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
406 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
408 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
409 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
410 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
412 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
413 if gMuteWhenInactive
then
418 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
420 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
421 if gSoundEffectsDF
then
426 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
427 if gUseChatSounds
then
432 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
458 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
461 for i
:= WP_FIRST
to WP_LAST
do
463 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
468 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
494 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
497 for i
:= WP_FIRST
to WP_LAST
do
499 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
504 if e_HasJoysticks
then
506 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
509 for i
:= 0 to e_MaxJoys
- 1 do
510 if e_JoystickAvailable
[i
] then
511 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
515 if g_touch_enabled
then
517 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
518 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
519 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
521 with TGUISwitch(menu
.GetControl('swTouchFire')) do
522 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
523 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
535 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
537 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
538 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
539 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
540 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
541 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
543 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
546 with TGUISwitch(menu
.GetControl('swBloodType')) do
547 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
549 with TGUISwitch(menu
.GetControl('swCorpseType')) do
550 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
552 with TGUISwitch(menu
.GetControl('swGibsType')) do
553 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
555 with TGUISwitch(menu
.GetControl('swGibsCount')) do
564 with TGUISwitch(menu
.GetControl('swBackGround')) do
565 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 with TGUISwitch(menu
.GetControl('swMessages')) do
568 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
571 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
573 with TGUISwitch(menu
.GetControl('swChatBubble')) do
574 ItemIndex
:= gChatBubble
;
576 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
577 ItemIndex
:= gPlayerIndicator
;
579 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
580 ItemIndex
:= gPlayerIndicatorStyle
;
582 TempScale
:= Round(g_dbg_scale
- 1);
583 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
587 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
588 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
590 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
591 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
593 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
594 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
595 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
599 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
600 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
602 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
603 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
605 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
606 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
607 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
609 ProcSelectModel(nil);
612 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
614 // don't turn off monsters in DM
616 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
617 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
618 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
623 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
624 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
625 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
626 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
630 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
632 // don't turn off monsters in DM
634 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
635 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
641 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
642 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
643 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
644 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
648 procedure ProcStartCustomGame();
655 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
657 Map
:= TGUILabel(GetControl('lbMap')).Text;
660 if not isWadPath(Map
) then
663 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
664 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
665 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
666 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
667 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
669 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
670 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
671 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
672 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
675 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
677 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
679 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
681 Options
:= Options
or GAME_OPTION_MONSTERS
;
682 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
684 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
686 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
687 gcBotsVS
:= 'Monsters';
690 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
691 gcBotsVS
:= 'Everybody';
694 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
695 gcBotsVS
:= 'Players';
702 s
:= e_GetWriteableDir(ConfigDirs
);
704 g_Options_Write_Gameplay_Custom(s
+ '/' + CONFIG_FILENAME
);
706 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
707 gcMaxLives
, Options
, gcPlayers
);
711 procedure ProcStartNetGame();
718 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
720 Map
:= TGUILabel(GetControl('lbMap')).Text;
723 if not isWadPath(Map
) then
726 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
727 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
728 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
729 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
730 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
731 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
733 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
734 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
735 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
736 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
739 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
741 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
743 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
745 Options
:= Options
or GAME_OPTION_MONSTERS
;
746 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
748 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
750 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
751 gnBotsVS
:= 'Monsters';
754 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
755 gnBotsVS
:= 'Everybody';
758 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
759 gnBotsVS
:= 'Players';
764 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
765 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
766 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
767 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
768 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
771 s
:= e_GetWriteableDir(ConfigDirs
);
774 g_Options_Write_Net_Server(s
+ '/' + CONFIG_FILENAME
);
775 g_Options_Write_Gameplay_Net(s
+ '/' + CONFIG_FILENAME
)
778 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
779 Options
, gnPlayers
, 0, NetPort
);
782 procedure ProcConnectNetGame();
787 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
789 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
790 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
791 PW
:= TGUIEdit(GetControl('edPW')).Text;
794 s
:= e_GetWriteableDir(ConfigDirs
);
796 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
797 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
800 procedure ProcEnterPassword();
805 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
807 NetClientIP
:= PromptIP
;
808 NetClientPort
:= PromptPort
;
809 PW
:= TGUIEdit(GetControl('edPW')).Text;
812 s
:= e_GetWriteableDir(ConfigDirs
);
814 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
815 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
818 procedure ProcServerlist();
820 if not NetInitDone
then
822 if (not g_Net_Init()) then
824 g_Console_Add('NET: ERROR: Failed to init ENet!');
831 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
833 gState
:= STATE_SLIST
;
834 g_ActiveWindow
:= nil;
836 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
841 slReturnPressed
:= True;
842 if g_Net_Slist_Fetch(slCurrent
) then
844 if slCurrent
= nil then
845 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
848 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
849 g_Serverlist_GenerateTable(slCurrent
, slTable
);
852 procedure ProcStartCampaign();
858 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
860 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
861 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
863 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
869 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
872 procedure ProcSelectMap(Sender
: TGUIControl
);
876 wad
, map
, res
: String;
878 win
:= g_GUI_GetWindow('SelectMapMenu');
879 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
881 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
882 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
884 if (wad
= '') or (map
= '') then
885 begin // Ýòî íå êàðòà
886 TGUILabel(GetControl('lbMapName')).Text := '';
887 TGUILabel(GetControl('lbMapAuthor')).Text := '';
888 TGUILabel(GetControl('lbMapSize')).Text := '';
889 TGUIMemo(GetControl('meMapDescription')).SetText('');
890 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
891 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
897 a
:= g_Map_GetMapInfo(res
);
899 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
900 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
901 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
902 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
903 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
904 TGUILabel(win
.GetControl('lbMapScale')).Text :=
905 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
910 procedure ProcSelectWAD(Sender
: TGUIControl
);
915 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
917 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
919 with TGUIListBox(GetControl('lsMapRes')) do
925 list
:= g_Map_GetMapsList(wad
);
939 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
945 win
:= g_GUI_GetWindow('CampaignMenu');
946 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
948 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
952 TGUILabel(GetControl('lbWADName')).Text := '';
953 TGUILabel(GetControl('lbWADAuthor')).Text := '';
954 TGUIMemo(GetControl('meWADDescription')).SetText('');
957 a
:= g_Game_GetMegaWADInfo(wad
);
959 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
960 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
961 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
963 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
967 fn
:= g_ExtractWadName(a
.pic
);
969 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
971 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
976 procedure ProcChangeColor(Sender
: TGUIControl
);
980 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
981 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
982 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
983 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
984 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
985 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
987 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
988 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
989 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
990 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
991 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
992 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
995 procedure ProcSelectModel(Sender
: TGUIControl
);
1000 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1001 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1002 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1004 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1005 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1006 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1008 ProcChangeColor(nil);
1011 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1023 wad
:= TWADFile
.Create
;
1024 if wad
.ReadFile(GameWAD
) then
1025 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1030 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1032 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1033 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1034 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1035 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1037 if g_Texture_Get('FONT_STD', ID
) then
1038 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1043 if cfglen
<> 0 then FreeMem(cfgdata
);
1046 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1052 cfgdata
, fntdata
: Pointer;
1053 cfglen
, fntlen
: Integer;
1061 wad
:= TWADFile
.Create
;
1062 if wad
.ReadFile(GameWAD
) then
1064 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1065 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1071 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1072 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1073 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1075 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1076 FontID
:= e_CharFont_Create(spc
);
1078 for a
:= 0 to 255 do
1080 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1081 if chrwidth
= 0 then Continue
;
1083 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1085 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1091 if cfglen
<> 0 then FreeMem(cfgdata
);
1092 if fntlen
<> 0 then FreeMem(fntdata
);
1095 procedure MenuLoadData();
1097 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1099 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1100 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1101 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1102 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1103 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1104 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1105 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1106 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1107 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1108 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1109 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1110 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1111 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1112 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1113 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1114 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1115 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1116 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1117 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1118 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1119 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1120 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1121 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1122 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1123 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1125 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1126 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1127 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1128 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1129 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1130 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1131 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1134 procedure MenuFreeData();
1136 e_CharFont_Remove(gMenuFont
);
1137 e_CharFont_Remove(gMenuSmallFont
);
1139 g_Texture_Delete('MAINMENU_LOGO');
1140 g_Texture_Delete('MAINMENU_MARKER1');
1141 g_Texture_Delete('MAINMENU_MARKER2');
1142 g_Texture_Delete('SCROLL_LEFT');
1143 g_Texture_Delete('SCROLL_RIGHT');
1144 g_Texture_Delete('SCROLL_MIDDLE');
1145 g_Texture_Delete('SCROLL_MARKER');
1146 g_Texture_Delete('EDIT_LEFT');
1147 g_Texture_Delete('EDIT_RIGHT');
1148 g_Texture_Delete('EDIT_MIDDLE');
1149 g_Texture_Delete('BOX1');
1150 g_Texture_Delete('BOX2');
1151 g_Texture_Delete('BOX3');
1152 g_Texture_Delete('BOX4');
1153 g_Texture_Delete('BOX5');
1154 g_Texture_Delete('BOX6');
1155 g_Texture_Delete('BOX7');
1156 g_Texture_Delete('BOX8');
1157 g_Texture_Delete('BOX9');
1158 g_Texture_Delete('BSCROLL_UP_A');
1159 g_Texture_Delete('BSCROLL_UP_U');
1160 g_Texture_Delete('BSCROLL_DOWN_A');
1161 g_Texture_Delete('BSCROLL_DOWN_U');
1162 g_Texture_Delete('BSCROLL_MIDDLE');
1163 g_Texture_Delete('NOPIC');
1165 g_Sound_Delete('MENU_SELECT');
1166 g_Sound_Delete('MENU_OPEN');
1167 g_Sound_Delete('MENU_CLOSE');
1168 g_Sound_Delete('MENU_CHANGE');
1169 g_Sound_Delete('SCROLL_ADD');
1170 g_Sound_Delete('SCROLL_SUB');
1171 g_Sound_Delete('SOUND_PLAYER_FALL');
1174 procedure ProcAuthorsMenu();
1176 gMusic
.SetByName('MUSIC_INTERMUS');
1180 procedure ProcExitMenuKeyDown (yes
: Boolean);
1183 snd
: TPlayableSound
;
1188 g_Game_StopAllSounds(True);
1189 case (Random(18)) of
1190 0: s
:= 'SOUND_MONSTER_PAIN';
1191 1: s
:= 'SOUND_MONSTER_DIE_3';
1192 2: s
:= 'SOUND_MONSTER_SLOP';
1193 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1194 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1195 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1196 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1197 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1198 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1199 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1200 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1201 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1202 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1203 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1204 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1205 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1206 else s
:= 'SOUND_PLAYER_FALL';
1208 snd
:= TPlayableSound
.Create();
1209 res
:= snd
.SetByName(s
);
1210 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1214 while snd
.IsPlaying() do begin end;
1222 procedure ProcLoadMenu();
1229 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1230 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1231 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1235 procedure ProcSaveMenu();
1243 name
:= g_GetSaveName(a
, valid
);
1244 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1245 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1249 procedure ProcSaveGame(Sender
: TGUIControl
);
1253 if g_Game_IsNet
then Exit
;
1254 if g_Game_IsTestMap
then Exit
;
1255 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1256 g_Game_PauseAllSounds(True);
1257 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1259 g_ActiveWindow
:= nil;
1260 g_Game_Pause(False);
1263 procedure ProcLoadGame(Sender
: TGUIControl
);
1267 if g_Game_IsNet
then Exit
;
1268 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1269 if g_LoadGame(a
) then
1271 g_Game_PauseAllSounds(False)
1273 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1275 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1276 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1277 //g_ActiveWindow := nil;
1281 procedure ProcSinglePlayer (n
: Integer);
1282 var wad
, map
: AnsiString;
1284 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1285 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1286 if e_FindResource(AllMapDirs
, wad
) then
1288 wad
:= ExpandFileName(wad
);
1289 g_Game_StartSingle(wad
+ ':\' + map
, False, n
);
1293 procedure ProcSingle1Player
;
1298 procedure ProcSingle2Players
;
1303 procedure ProcSelectMapMenu();
1306 wad_lb
: TGUIFileListBox
;
1307 map_lb
: TGUIListBox
;
1310 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1311 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1312 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1314 if wad_lb
.SelectedItem() <> '' then
1315 map
:= map_lb
.SelectedItem()
1319 wad_lb
.UpdateFileList();
1322 if wad_lb
.SelectedItem() <> '' then
1325 map_lb
.SelectItem(map
);
1327 if map_lb
.SelectedItem() <> '' then
1331 g_GUI_ShowWindow('SelectMapMenu');
1334 procedure ProcSelectCampaignMenu();
1337 wad_lb
: TGUIFileListBox
;
1339 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1340 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1342 wad_lb
.UpdateFileList();
1344 if wad_lb
.SelectedItem() <> '' then
1345 ProcSelectCampaignWAD(nil);
1348 procedure ProcSetMap();
1350 wad
, map
, res
: String;
1352 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1354 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1355 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1358 if (wad
= '') or (map
= '') then
1361 wad
:= e_FindWadRel(MapDirs
, WAD
);
1363 res
:= wad
+':\'+map
;
1365 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1366 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1369 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1373 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1375 g_Sound_SetupAllVolumes(
1376 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1377 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1381 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1386 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1388 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1389 g_dbg_scale
:= TempScale
+ 1;
1393 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1397 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1398 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1399 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1400 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1403 procedure ProcOptionsPlayersMIMenu();
1408 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1410 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1412 if a
= '' then Exit
;
1414 b
:= g_PlayerModel_GetInfo(a
);
1416 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1418 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1419 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1420 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1422 if b
.HaveWeapon
then
1423 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1425 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1428 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1431 procedure ProcOptionsPlayersAnim();
1435 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1440 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1443 Model
.GetCurrentAnimation
.Loop
:= True;
1444 Model
.GetCurrentAnimationMask
.Loop
:= True;
1448 procedure ProcOptionsPlayersWeap();
1452 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1457 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1461 procedure ProcOptionsPlayersRot();
1465 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1466 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1468 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1472 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1476 g_Options_SetDefault();
1482 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1484 if yes
then ReadOptions();
1488 procedure ProcAuthorsClose();
1490 gMusic
.SetByName('MUSIC_MENU');
1492 gState
:= STATE_MENU
;
1495 procedure ProcGMClose();
1497 g_Game_InGameMenu(False);
1500 procedure ProcGMShow();
1505 if (gGameSettings
.GameType
= GT_SINGLE
) and
1506 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1507 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1508 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1510 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1511 if g_Game_IsTestMap
then
1512 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1513 TGUIMainMenu(g_ActiveWindow
.GetControl(
1514 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1517 procedure ProcChangePlayers();
1519 TeamGame
, Spectator
, AddTwo
: Boolean;
1520 P1Team
{, P2Team}: Byte;
1521 bP2
: TGUITextButton
;
1523 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1524 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1525 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1526 P1Team
:= TEAM_NONE
;
1527 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1529 //P2Team := TEAM_NONE;
1530 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1532 TGUIMainMenu(g_ActiveWindow
.GetControl(
1533 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1534 TGUIMainMenu(g_ActiveWindow
.GetControl(
1535 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1536 TGUIMainMenu(g_ActiveWindow
.GetControl(
1537 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1539 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1540 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1541 bP2
.Enabled
:= AddTwo
and not Spectator
;
1543 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1545 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1546 if gPlayer2
= nil then
1547 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1549 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1551 TGUIMainMenu(g_ActiveWindow
.GetControl(
1552 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1555 procedure ProcJoinRed();
1557 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1559 if g_Game_IsServer
then
1561 if gPlayer1
= nil then
1562 g_Game_AddPlayer(TEAM_RED
)
1565 if gPlayer1
.Team
<> TEAM_RED
then
1567 gPlayer1
.SwitchTeam
;
1568 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1571 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1576 gPlayer1Settings
.Team
:= TEAM_RED
;
1577 MC_SEND_PlayerSettings
;
1578 if gPlayer1
= nil then
1579 g_Game_AddPlayer(TEAM_RED
);
1581 g_ActiveWindow
:= nil;
1582 g_Game_Pause(False);
1585 procedure ProcJoinBlue();
1587 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1589 if g_Game_IsServer
then
1591 if gPlayer1
= nil then
1592 g_Game_AddPlayer(TEAM_BLUE
)
1595 if gPlayer1
.Team
<> TEAM_BLUE
then
1597 gPlayer1
.SwitchTeam
;
1598 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1601 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1606 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1607 MC_SEND_PlayerSettings
;
1608 if gPlayer1
= nil then
1609 g_Game_AddPlayer(TEAM_BLUE
);
1611 g_ActiveWindow
:= nil;
1612 g_Game_Pause(False);
1615 procedure ProcJoinGame();
1617 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1619 if gPlayer1
= nil then
1621 g_ActiveWindow
:= nil;
1622 g_Game_Pause(False);
1625 procedure ProcSwitchP2();
1627 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1629 if gPlayer1
= nil then
1631 if gPlayer2
= nil then
1634 g_Game_RemovePlayer();
1635 g_ActiveWindow
:= nil;
1636 g_Game_Pause(False);
1639 procedure ProcSpectate();
1641 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1644 g_ActiveWindow
:= nil;
1645 g_Game_Pause(False);
1648 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1650 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1653 procedure ProcEndMenuKeyDown (yes
: Boolean);
1655 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1658 procedure ProcSetRussianLanguage
;
1660 if gLanguage
<> LANGUAGE_RUSSIAN
then
1662 gLanguage
:= LANGUAGE_RUSSIAN
;
1663 gLanguageChange
:= True;
1664 gAskLanguage
:= False;
1669 procedure ProcSetEnglishLanguage
;
1671 if gLanguage
<> LANGUAGE_ENGLISH
then
1673 gLanguage
:= LANGUAGE_ENGLISH
;
1674 gLanguageChange
:= True;
1675 gAskLanguage
:= False;
1680 procedure ReadGameSettings();
1684 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1686 with gGameSettings
do
1688 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1689 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1694 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1695 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1696 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1698 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1699 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1700 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1703 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1708 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1710 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1711 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1712 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1713 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1714 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1715 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1716 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1717 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1721 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1722 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1727 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1728 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1733 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1734 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1739 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1740 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1745 procedure ProcApplyGameSet();
1749 stat
: TPlayerStatArray
;
1751 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1753 if not g_Game_IsServer
then Exit
;
1755 with gGameSettings
do
1757 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1759 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1760 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1762 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1765 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1767 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1773 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1775 TimeLimit
:= Max(n
, b
);
1779 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1781 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1788 if GameMode
= GM_DM
then
1790 stat
:= g_Player_GetStats();
1792 for a
:= 0 to High(stat
) do
1793 if stat
[a
].Frags
> b
then
1797 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1799 GoalLimit
:= Max(n
, b
);
1803 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1805 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1806 if n
< 0 then n
:= 0;
1807 if n
> 255 then n
:= 255;
1813 stat
:= g_Player_GetStats();
1815 for a
:= 0 to High(stat
) do
1816 if stat
[a
].Lives
> b
then
1819 MaxLives
:= Max(n
, b
);
1823 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1825 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1828 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1829 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1833 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1834 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1838 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1839 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1845 if g_Game_IsNet
then MH_SEND_GameSettings
;
1848 procedure ProcVideoOptionsRes();
1853 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1855 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1856 IntToStr(gScreenWidth
) +
1857 ' x ' + IntToStr(gScreenHeight
) +
1858 ', ' + IntToStr(gBPP
) + ' bpp';
1860 with TGUIListBox(menu
.GetControl('lsResolution')) do
1862 list
:= sys_GetDisplayModes(gBPP
);
1866 ItemIndex
:= Length(list
)
1874 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1881 procedure ProcApplyVideoOptions();
1884 Fullscreen
: Boolean;
1885 SWidth
, SHeight
: Integer;
1888 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1890 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1891 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1893 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1895 if (SWidth
<> gScreenWidth
) or
1896 (SHeight
<> gScreenHeight
) or
1897 (Fullscreen
<> gFullscreen
) then
1899 gResolutionChange
:= True;
1900 gRC_Width
:= SWidth
;
1901 gRC_Height
:= SHeight
;
1902 gRC_FullScreen
:= Fullscreen
;
1903 gRC_Maximized
:= gWinMaximized
;
1906 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1910 procedure ProcSetFirstRussianLanguage
;
1912 gLanguage
:= LANGUAGE_RUSSIAN
;
1913 gLanguageChange
:= True;
1914 gAskLanguage
:= False;
1917 procedure ProcSetFirstEnglishLanguage
;
1919 gLanguage
:= LANGUAGE_ENGLISH
;
1920 gLanguageChange
:= True;
1921 gAskLanguage
:= False;
1924 procedure ProcRecallAddress();
1926 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1928 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1929 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1933 procedure CreateFirstLanguageMenu();
1937 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1939 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1941 Name
:= 'mmFirstLanguageMenu';
1942 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1943 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1946 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1947 Menu
.MainWindow
:= True;
1948 g_GUI_AddWindow(Menu
);
1951 procedure g_Menu_AskLanguage();
1953 CreateFirstLanguageMenu();
1954 g_GUI_ShowWindow('FirstLanguageMenu');
1957 procedure CreatePlayerOptionsMenu(s
: String);
1962 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1964 a
:= _lc
[I_MENU_PLAYER_1
]
1966 a
:= _lc
[I_MENU_PLAYER_2
];
1967 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1969 Name
:= 'mOptionsPlayers'+s
+'Menu';
1970 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1972 Name
:= 'ed'+s
+'Name';
1976 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1978 Name
:= 'sw'+s
+'Team';
1979 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1980 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1982 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1984 Name
:= 'ls'+s
+'Model';
1986 Items
:= g_PlayerModel_GetNames();
1987 OnChange
:= ProcSelectModel
;
1989 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1991 Name
:= 'sc'+s
+'Red';
1993 OnChange
:= ProcChangeColor
;
1995 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1997 Name
:= 'sc'+s
+'Green';
1999 OnChange
:= ProcChangeColor
;
2001 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2003 Name
:= 'sc'+s
+'Blue';
2005 OnChange
:= ProcChangeColor
;
2008 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2009 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2010 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2011 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2013 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2015 Name
:= 'mv'+s
+'Model';
2016 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2017 Y
:= GetControl('ls'+s
+'Model').Y
;
2020 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2021 g_GUI_AddWindow(Menu
);
2024 procedure CreateAllMenus();
2028 a
, cx
, _y
, i
: Integer;
2031 Menu
:= TGUIWindow
.Create('MainMenu');
2032 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2034 Name
:= 'mmMainMenu';
2035 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2036 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2037 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2038 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2039 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2040 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2042 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2044 Color
:= _RGB(255, 255, 255);
2045 X
:= gScreenWidth
-GetWidth
-8;
2046 Y
:= gScreenHeight
-GetHeight
-8;
2048 Menu
.DefControl
:= 'mmMainMenu';
2049 Menu
.MainWindow
:= True;
2050 g_GUI_AddWindow(Menu
);
2052 Menu
:= TGUIWindow
.Create('NewGameMenu');
2053 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2055 Name
:= 'mmNewGameMenu';
2056 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2057 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2058 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2059 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2061 Menu
.DefControl
:= 'mmNewGameMenu';
2062 g_GUI_AddWindow(Menu
);
2064 Menu
:= TGUIWindow
.Create('NetGameMenu');
2065 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2067 Name
:= 'mmNetGameMenu';
2068 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2069 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2071 Menu
.DefControl
:= 'mmNetGameMenu';
2072 g_GUI_AddWindow(Menu
);
2074 Menu
:= TGUIWindow
.Create('NetServerMenu');
2075 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2077 Name
:= 'mNetServerMenu';
2078 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2080 Name
:= 'edSrvName';
2081 OnlyDigits
:= False;
2084 Text := NetServerName
;
2086 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2088 Name
:= 'edSrvPassword';
2089 OnlyDigits
:= False;
2092 Text := NetPassword
;
2094 with AddEdit(_lc
[I_NET_PORT
]) do
2100 Text := IntToStr(NetPort
);
2102 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2104 Name
:= 'edMaxPlayers';
2108 Text := IntToStr(NetMaxClients
);
2110 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2112 Name
:= 'swUseMaster';
2113 AddItem(_lc
[I_MENU_YES
]);
2114 AddItem(_lc
[I_MENU_NO
]);
2115 if NetUseMaster
then
2121 with AddLabel(_lc
[I_MENU_MAP
]) do
2126 OnClick
:= @ProcSelectMapMenu
;
2128 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2130 Name
:= 'swGameMode';
2131 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2132 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2133 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2134 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2135 case g_Game_TextToMode(gnGameMode
) of
2137 GM_DM
: ItemIndex
:= 0;
2138 GM_TDM
: ItemIndex
:= 1;
2139 GM_CTF
: ItemIndex
:= 2;
2141 GM_COOP
: ItemIndex
:= 3;
2143 OnChange
:= ProcSwitchMonstersNet
;
2145 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2147 Name
:= 'edTimeLimit';
2151 if gnTimeLimit
> 0 then
2152 Text := IntToStr(gnTimeLimit
);
2154 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2156 Name
:= 'edGoalLimit';
2160 if gnGoalLimit
> 0 then
2161 Text := IntToStr(gnGoalLimit
);
2163 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2165 Name
:= 'edMaxLives';
2169 if gnMaxLives
> 0 then
2170 Text := IntToStr(gnMaxLives
);
2172 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2174 Name
:= 'swPlayers';
2175 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2176 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2177 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2178 ItemIndex
:= gnPlayers
;
2180 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2182 Name
:= 'swTeamDamage';
2183 AddItem(_lc
[I_MENU_YES
]);
2184 AddItem(_lc
[I_MENU_NO
]);
2185 if gnTeamDamage
then
2190 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2192 Name
:= 'swEnableExits';
2193 AddItem(_lc
[I_MENU_YES
]);
2194 AddItem(_lc
[I_MENU_NO
]);
2200 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2202 Name
:= 'swWeaponStay';
2203 AddItem(_lc
[I_MENU_YES
]);
2204 AddItem(_lc
[I_MENU_NO
]);
2205 if gnWeaponStay
then
2210 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2212 Name
:= 'swMonsters';
2213 AddItem(_lc
[I_MENU_YES
]);
2214 AddItem(_lc
[I_MENU_NO
]);
2220 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2223 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2224 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2225 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2227 if gnBotsVS
= 'Players' then
2229 if gnBotsVS
= 'Monsters' then
2233 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2237 Menu
.DefControl
:= 'mNetServerMenu';
2238 g_GUI_AddWindow(Menu
);
2240 Menu
:= TGUIWindow
.Create('NetClientMenu');
2241 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2243 Name
:= 'mNetClientMenu';
2245 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2248 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2254 Text := 'localhost';
2256 with AddEdit(_lc
[I_NET_PORT
]) do
2264 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2267 OnlyDigits
:= False;
2274 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2278 Menu
.DefControl
:= 'mNetClientMenu';
2279 g_GUI_AddWindow(Menu
);
2281 Menu
:= TGUIWindow
.Create('LoadMenu');
2282 Menu
.OnShow
:= ProcLoadMenu
;
2283 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2285 Name
:= 'mmLoadMenu';
2290 Name
:= 'edSlot'+IntToStr(a
);
2293 OnEnter
:= ProcLoadGame
;
2296 Menu
.DefControl
:= 'mmLoadMenu';
2297 g_GUI_AddWindow(Menu
);
2299 Menu
:= TGUIWindow
.Create('SaveMenu');
2300 Menu
.OnShow
:= ProcSaveMenu
;
2301 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2303 Name
:= 'mmSaveMenu';
2308 Name
:= 'edSlot'+IntToStr(a
);
2311 OnChange
:= ProcSaveGame
;
2314 Menu
.DefControl
:= 'mmSaveMenu';
2315 g_GUI_AddWindow(Menu
);
2317 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2318 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2320 Name
:= 'mCustomGameMenu';
2321 with AddLabel(_lc
[I_MENU_MAP
]) do
2326 OnClick
:= @ProcSelectMapMenu
;
2328 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2330 Name
:= 'swGameMode';
2331 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2332 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2333 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2334 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2335 case g_Game_TextToMode(gcGameMode
) of
2337 GM_DM
: ItemIndex
:= 0;
2338 GM_TDM
: ItemIndex
:= 1;
2339 GM_CTF
: ItemIndex
:= 2;
2341 GM_COOP
: ItemIndex
:= 3;
2343 OnChange
:= ProcSwitchMonstersCustom
;
2345 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2347 Name
:= 'edTimeLimit';
2351 if gcTimeLimit
> 0 then
2352 Text := IntToStr(gcTimeLimit
);
2354 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2356 Name
:= 'edGoalLimit';
2360 if gcGoalLimit
> 0 then
2361 Text := IntToStr(gcGoalLimit
);
2363 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2365 Name
:= 'edMaxLives';
2369 if gcMaxLives
> 0 then
2370 Text := IntToStr(gcMaxLives
);
2372 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2374 Name
:= 'swPlayers';
2375 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2376 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2377 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2378 ItemIndex
:= gcPlayers
;
2380 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2382 Name
:= 'swTeamDamage';
2383 AddItem(_lc
[I_MENU_YES
]);
2384 AddItem(_lc
[I_MENU_NO
]);
2385 if gcTeamDamage
then
2390 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2392 Name
:= 'swEnableExits';
2393 AddItem(_lc
[I_MENU_YES
]);
2394 AddItem(_lc
[I_MENU_NO
]);
2400 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2402 Name
:= 'swWeaponStay';
2403 AddItem(_lc
[I_MENU_YES
]);
2404 AddItem(_lc
[I_MENU_NO
]);
2405 if gcWeaponStay
then
2410 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2412 Name
:= 'swMonsters';
2413 AddItem(_lc
[I_MENU_YES
]);
2414 AddItem(_lc
[I_MENU_NO
]);
2420 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2423 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2424 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2425 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2427 if gcBotsVS
= 'Players' then
2429 if gcBotsVS
= 'Monsters' then
2433 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2437 Menu
.DefControl
:= 'mCustomGameMenu';
2438 g_GUI_AddWindow(Menu
);
2440 Menu
:= TGUIWindow
.Create('CampaignMenu');
2441 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2443 Name
:= 'mCampaignMenu';
2452 with AddFileList('', 15, 4) do
2455 OnChange
:= ProcSelectCampaignWAD
;
2459 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2460 SetBase(MegawadDirs
);
2463 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2465 Name
:= 'lbWADName';
2469 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2471 Name
:= 'lbWADAuthor';
2475 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2476 with AddMemo('', 15, 3) do
2478 Name
:= 'meWADDescription';
2479 Color
:= MENU_ITEMSCTRL_COLOR
;
2481 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2483 Name
:= 'swPlayers';
2484 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2485 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2488 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2492 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2494 Name
:= 'mpWADImage';
2495 DefaultRes
:= 'NOPIC';
2496 X
:= GetControl('lsWAD').X
+4;
2497 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2500 Menu
.DefControl
:= 'mCampaignMenu';
2501 g_GUI_AddWindow(Menu
);
2503 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2504 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2506 Name
:= 'mSelectMapMenu';
2507 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2510 OnChange
:= ProcSelectWAD
;
2514 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2517 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2521 OnChange
:= ProcSelectMap
;
2524 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2526 Name
:= 'lbMapName';
2530 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2532 Name
:= 'lbMapAuthor';
2536 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2538 Name
:= 'lbMapSize';
2542 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2544 Name
:= 'meMapDescription';
2549 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2551 Name
:= 'mpMapPreview';
2552 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2553 Y
:= GetControl('lsMapWAD').Y
;
2555 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2557 Name
:= 'lbMapScale';
2560 Color
:= MENU_ITEMSCTRL_COLOR
;
2561 X
:= GetControl('lsMapWAD').X
+
2562 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2563 2 + MAPPREVIEW_WIDTH
*4;
2564 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2567 Menu
.OnClose
:= ProcSetMap
;
2568 Menu
.DefControl
:= 'mSelectMapMenu';
2569 g_GUI_AddWindow(Menu
);
2571 Menu
:= TGUIWindow
.Create('OptionsMenu');
2572 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2574 Name
:= 'mmOptionsMenu';
2575 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2576 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2577 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2578 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2579 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2580 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2582 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2583 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2585 Menu
.OnClose
:= ProcApplyOptions
;
2586 Menu
.DefControl
:= 'mmOptionsMenu';
2587 g_GUI_AddWindow(Menu
);
2589 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2590 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2591 g_GUI_AddWindow(Menu
);
2593 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2594 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2596 Name
:= 'mOptionsVideoMenu';
2597 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2598 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2604 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2607 AddItem(_lc
[I_MENU_YES
]);
2608 AddItem(_lc
[I_MENU_NO
]);
2610 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2612 Name
:= 'swTextureFilter';
2613 AddItem(_lc
[I_MENU_YES
]);
2614 AddItem(_lc
[I_MENU_NO
]);
2616 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2618 Name
:= 'swLegacyNPOT';
2619 AddItem(_lc
[I_MENU_NO
]);
2620 AddItem(_lc
[I_MENU_YES
]);
2623 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2626 Menu
.DefControl
:= 'mOptionsVideoMenu';
2627 g_GUI_AddWindow(Menu
);
2629 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2630 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2632 Name
:= 'mOptionsVideoResMenu';
2633 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2635 Name
:= 'lbCurrentRes';
2639 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2641 Name
:= 'lsResolution';
2644 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2646 Name
:= 'swFullScreen';
2647 AddItem(_lc
[I_MENU_YES
]);
2648 AddItem(_lc
[I_MENU_NO
]);
2651 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2654 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2655 g_GUI_AddWindow(Menu
);
2657 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2658 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2660 Name
:= 'mOptionsSoundMenu';
2661 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2663 Name
:= 'scMusicLevel';
2665 OnChange
:= ProcChangeSoundSettings
;
2667 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2669 Name
:= 'scSoundLevel';
2671 OnChange
:= ProcChangeSoundSettings
;
2673 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2675 Name
:= 'scMaxSimSounds';
2678 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2680 Name
:= 'swAnnouncer';
2681 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2682 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2683 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2684 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2686 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2687 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2689 Name
:= 'swSoundEffects';
2690 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2691 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2693 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2694 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2696 Name
:= 'swChatSpeech';
2697 AddItem(_lc
[I_MENU_YES
]);
2698 AddItem(_lc
[I_MENU_NO
]);
2700 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2702 Name
:= 'swInactiveSounds';
2703 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2704 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2708 Menu
.DefControl
:= 'mOptionsSoundMenu';
2709 g_GUI_AddWindow(Menu
);
2711 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2712 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2714 Name
:= 'mOptionsGameMenu';
2715 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2717 Name
:= 'scParticlesCount';
2720 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2722 Name
:= 'swBloodCount';
2723 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2724 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2725 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2726 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2727 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2729 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2731 Name
:= 'scShellsMax';
2734 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2736 Name
:= 'scGibsMax';
2739 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2741 Name
:= 'scCorpsesMax';
2744 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2746 Name
:= 'swGibsCount';
2747 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2748 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2749 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2750 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2751 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2753 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2755 Name
:= 'swCorpseType';
2756 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2757 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2759 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2761 Name
:= 'swGibsType';
2762 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2763 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2765 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2767 Name
:= 'swBloodType';
2768 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2769 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2771 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2773 Name
:= 'swScreenFlash';
2774 AddItem(_lc
[I_MENU_NO
]);
2775 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2776 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2778 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2780 Name
:= 'swBackground';
2781 AddItem(_lc
[I_MENU_YES
]);
2782 AddItem(_lc
[I_MENU_NO
]);
2784 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2786 Name
:= 'swMessages';
2787 AddItem(_lc
[I_MENU_YES
]);
2788 AddItem(_lc
[I_MENU_NO
]);
2790 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2792 Name
:= 'swRevertPlayers';
2793 AddItem(_lc
[I_MENU_YES
]);
2794 AddItem(_lc
[I_MENU_NO
]);
2796 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2798 Name
:= 'swChatBubble';
2799 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2800 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2801 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2802 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2803 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2805 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2807 Name
:= 'swPlayerIndicator';
2808 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2809 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2810 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2812 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2814 Name
:= 'swPlayerIndicatorStyle';
2815 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2816 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2818 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2820 Name
:= 'scScaleFactor';
2822 OnChange
:= ProcChangeGameSettings
;
2826 Menu
.DefControl
:= 'mOptionsGameMenu';
2827 g_GUI_AddWindow(Menu
);
2829 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2830 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2832 Name
:= 'mOptionsControlsMenu';
2833 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2834 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2835 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2836 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2837 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2839 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2840 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2841 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2842 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2843 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2844 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2845 if e_HasJoysticks
then
2848 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2850 if g_touch_enabled
then
2853 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2856 Menu
.DefControl
:= 'mOptionsControlsMenu';
2857 g_GUI_AddWindow(Menu
);
2859 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2860 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2862 Name
:= 'mOptionsControlsP1Menu';
2863 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2864 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2865 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2866 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2867 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2868 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2869 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2870 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2871 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2874 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2875 g_GUI_AddWindow(Menu
);
2877 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2878 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2880 Name
:= 'mOptionsControlsP1MenuWeapons';
2881 for i
:= WP_FIRST
to WP_LAST
do
2882 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2883 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2885 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2886 g_GUI_AddWindow(Menu
);
2888 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2889 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2891 Name
:= 'mOptionsControlsP2Menu';
2892 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2893 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2894 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2895 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2903 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2909 Name
:= 'mOptionsControlsP2MenuWeapons';
2910 for i
:= WP_FIRST
to WP_LAST
do
2911 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2912 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2914 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2915 g_GUI_AddWindow(Menu
);
2917 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2918 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2920 Name
:= 'mOptionsControlsJoystickMenu';
2921 for i
:= 0 to e_MaxJoys
- 1 do
2922 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2924 Name
:= 'scDeadzone' + IntToStr(i
);
2928 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2929 g_GUI_AddWindow(Menu
);
2931 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2932 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2934 Name
:= 'mOptionsControlsTouchMenu';
2935 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2937 Name
:= 'swTouchAlt';
2938 AddItem(_lc
[I_MENU_NO
]);
2939 AddItem(_lc
[I_MENU_YES
]);
2940 OnChange
:= ProcChangeTouchSettings
;
2942 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2944 Name
:= 'scTouchSize';
2946 OnChange
:= ProcChangeTouchSettings
;
2948 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2950 Name
:= 'swTouchFire';
2951 AddItem(_lc
[I_MENU_NO
]);
2952 AddItem(_lc
[I_MENU_YES
]);
2954 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2956 Name
:= 'scTouchOffset';
2958 OnChange
:= ProcChangeTouchSettings
;
2961 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2962 g_GUI_AddWindow(Menu
);
2964 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2965 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2967 Name
:= 'mOptionsPlayersMenu';
2968 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2969 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2971 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2972 g_GUI_AddWindow(Menu
);
2974 CreatePlayerOptionsMenu('P1');
2975 CreatePlayerOptionsMenu('P2');
2977 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2978 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2980 Name
:= 'mOptionsPlayersMIMenu';
2981 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2986 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2991 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2993 Name
:= 'meComment';
2996 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2997 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3000 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3004 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3005 g_GUI_AddWindow(Menu
);
3007 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3008 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3010 Name
:= 'mOptionsLanguageMenu';
3011 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3012 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3015 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3016 g_GUI_AddWindow(Menu
);
3018 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3019 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3020 g_GUI_AddWindow(Menu
);
3022 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3023 Menu
.BackTexture
:= 'INTER';
3024 Menu
.OnClose
:= ProcAuthorsClose
;
3028 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3030 Color
:= _RGB(255, 0, 0);
3031 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3033 _y
:= _y
+GetHeight();
3035 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3037 Color
:= _RGB(255, 0, 0);
3038 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3040 _y
:= _y
+GetHeight()+32;
3042 // ×òî äåëàë: Êòî äåëàë
3043 cx
:= gScreenWidth
div 2 - 320 + 64;
3044 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3046 Color
:= _RGB(255, 0, 0);
3051 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3053 Color
:= _RGB(255, 255, 255);
3058 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3060 Color
:= _RGB(255, 0, 0);
3065 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3067 Color
:= _RGB(255, 255, 255);
3072 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3074 Color
:= _RGB(255, 255, 255);
3079 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3081 Color
:= _RGB(255, 0, 0);
3086 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3088 Color
:= _RGB(255, 255, 255);
3093 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3095 Color
:= _RGB(255, 0, 0);
3100 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3102 Color
:= _RGB(255, 255, 255);
3105 _y
:= gScreenHeight
- 128;
3108 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3110 Color
:= _RGB(255, 0, 0);
3115 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3117 Color
:= _RGB(255, 255, 255);
3120 _y
:= _y
+GetHeight();
3122 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3124 Color
:= _RGB(255, 255, 255);
3127 _y
:= _y
+GetHeight();
3129 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3131 Color
:= _RGB(255, 255, 255);
3134 _y
:= gScreenHeight
- 32;
3136 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3138 Color
:= _RGB(255, 0, 0);
3139 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3142 g_GUI_AddWindow(Menu
);
3144 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3145 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3146 g_GUI_AddWindow(Menu
);
3148 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3149 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3151 Name
:= 'mmGameSingleMenu';
3152 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3153 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3154 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3155 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3156 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3157 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3159 Menu
.DefControl
:= 'mmGameSingleMenu';
3160 Menu
.MainWindow
:= True;
3161 Menu
.OnClose
:= ProcGMClose
;
3162 Menu
.OnShow
:= ProcGMShow
;
3163 g_GUI_AddWindow(Menu
);
3165 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3166 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3167 g_GUI_AddWindow(Menu
);
3169 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3170 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3171 g_GUI_AddWindow(Menu
);
3173 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3174 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3176 Name
:= 'mmGameCustomMenu';
3177 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3178 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3179 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3180 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3181 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3182 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3183 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3185 Menu
.DefControl
:= 'mmGameCustomMenu';
3186 Menu
.MainWindow
:= True;
3187 Menu
.OnClose
:= ProcGMClose
;
3188 Menu
.OnShow
:= ProcGMShow
;
3189 g_GUI_AddWindow(Menu
);
3191 Menu
:= TGUIWindow
.Create('GameServerMenu');
3192 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3194 Name
:= 'mmGameServerMenu';
3195 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3196 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3197 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3198 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3199 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3201 Menu
.DefControl
:= 'mmGameServerMenu';
3202 Menu
.MainWindow
:= True;
3203 Menu
.OnClose
:= ProcGMClose
;
3204 Menu
.OnShow
:= ProcGMShow
;
3205 g_GUI_AddWindow(Menu
);
3207 Menu
:= TGUIWindow
.Create('GameClientMenu');
3208 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3210 Name
:= 'mmGameClientMenu';
3211 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3212 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3213 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3215 Menu
.DefControl
:= 'mmGameClientMenu';
3216 Menu
.MainWindow
:= True;
3217 Menu
.OnClose
:= ProcGMClose
;
3218 Menu
.OnShow
:= ProcGMShow
;
3219 g_GUI_AddWindow(Menu
);
3221 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3222 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3224 Name
:= 'mClientPasswordMenu';
3225 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3233 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3236 Menu
.DefControl
:= 'mClientPasswordMenu';
3237 g_GUI_AddWindow(Menu
);
3239 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3240 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3242 Name
:= 'mGameSetGameMenu';
3243 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3245 Name
:= 'swTeamDamage';
3246 AddItem(_lc
[I_MENU_YES
]);
3247 AddItem(_lc
[I_MENU_NO
]);
3250 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3252 Name
:= 'edTimeLimit';
3257 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3259 Name
:= 'edGoalLimit';
3264 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3266 Name
:= 'edMaxLives';
3271 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3274 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3275 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3276 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3282 Menu
.DefControl
:= 'mGameSetGameMenu';
3283 Menu
.OnClose
:= ProcApplyGameSet
;
3284 g_GUI_AddWindow(Menu
);
3286 Menu
:= TGUIWindow
.Create('TeamMenu');
3287 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3289 Name
:= 'mmTeamMenu';
3290 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3291 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3292 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3293 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3294 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3296 Menu
.DefControl
:= 'mmTeamMenu';
3297 Menu
.OnShow
:= ProcChangePlayers
;
3298 g_GUI_AddWindow(Menu
);
3301 procedure g_Menu_Show_SaveMenu();
3303 if g_Game_IsTestMap
then
3305 if gGameSettings
.GameType
= GT_SINGLE
then
3306 g_GUI_ShowWindow('GameSingleMenu')
3309 if g_Game_IsClient
then
3312 if g_Game_IsNet
then
3315 g_GUI_ShowWindow('GameCustomMenu');
3317 g_GUI_ShowWindow('SaveMenu');
3318 g_Sound_PlayEx('MENU_OPEN');
3321 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3323 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3324 if gGameSettings
.GameType
= GT_SINGLE
then
3326 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3330 if g_Game_IsClient
then exit
;
3331 if g_Game_IsNet
then exit
;
3332 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3334 g_GUI_ShowWindow('LoadMenu');
3335 g_Sound_PlayEx('MENU_OPEN');
3338 procedure g_Menu_Show_GameSetGame();
3340 if gGameSettings
.GameType
= GT_SINGLE
then
3341 g_GUI_ShowWindow('GameSingleMenu')
3344 if g_Game_IsClient
then
3347 if g_Game_IsNet
then
3348 g_GUI_ShowWindow('GameServerMenu')
3350 g_GUI_ShowWindow('GameCustomMenu');
3353 g_GUI_ShowWindow('GameSetGameMenu');
3354 g_Sound_PlayEx('MENU_OPEN');
3357 procedure g_Menu_Show_OptionsVideo();
3359 if gGameSettings
.GameType
= GT_SINGLE
then
3360 g_GUI_ShowWindow('GameSingleMenu')
3363 if g_Game_IsClient
then
3364 g_GUI_ShowWindow('GameClientMenu')
3366 if g_Game_IsNet
then
3367 g_GUI_ShowWindow('GameServerMenu')
3369 g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('OptionsMenu');
3373 g_GUI_ShowWindow('OptionsVideoMenu');
3374 g_Sound_PlayEx('MENU_OPEN');
3377 procedure g_Menu_Show_OptionsSound();
3379 if gGameSettings
.GameType
= GT_SINGLE
then
3380 g_GUI_ShowWindow('GameSingleMenu')
3383 if g_Game_IsClient
then
3384 g_GUI_ShowWindow('GameClientMenu')
3386 if g_Game_IsNet
then
3387 g_GUI_ShowWindow('GameServerMenu')
3389 g_GUI_ShowWindow('GameCustomMenu');
3392 g_GUI_ShowWindow('OptionsMenu');
3393 g_GUI_ShowWindow('OptionsSoundMenu');
3394 g_Sound_PlayEx('MENU_OPEN');
3397 procedure g_Menu_Show_EndGameMenu();
3399 g_GUI_ShowWindow('EndGameMenu');
3400 g_Sound_PlayEx('MENU_OPEN');
3403 procedure g_Menu_Show_QuitGameMenu();
3405 g_GUI_ShowWindow('ExitMenu');
3406 g_Sound_PlayEx('MENU_OPEN');
3409 procedure g_Menu_Init();
3416 procedure g_Menu_Free();
3420 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3425 procedure g_Menu_Reset();
3429 g_GUI_SaveMenuPos();
3430 ex
:= g_GUI_Destroy();
3434 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3439 g_Game_SetDebugMode();
3441 g_GUI_LoadMenuPos();